<commit_before>/*
 * Copyright 2011-2016 B2i Healthcare Pte Ltd, http://b2i.sg
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.b2international.snowowl.datastore.request;

import com.b2international.commons.options.OptionsBuilder;
import com.b2international.snowowl.core.ServiceProvider;
import com.b2international.snowowl.core.events.Request;
import com.b2international.snowowl.core.merge.Merge;
import com.b2international.snowowl.core.merge.MergeCollection;

/**
 * @since 4.6
 */
public class SearchMergeRequestBuilder {

	private final String repositoryId;
	private final OptionsBuilder optionsBuilder = OptionsBuilder.newBuilder();
	
	public SearchMergeRequestBuilder(String repositoryId) {
		this.repositoryId = repositoryId;
	}

	public SearchMergeRequestBuilder withSource(String source) {
		optionsBuilder.put("source", source);
		return this;
	}

	public SearchMergeRequestBuilder withTarget(String target) {
		optionsBuilder.put("target", target);
		return this;
	}

	public SearchMergeRequestBuilder withStatus(Merge.Status status) {
		optionsBuilder.put("status", status);
		return this;
	}

	public Request<ServiceProvider, MergeCollection> build() {
		return RepositoryRequests.wrap(repositoryId, new SearchMergeRequest(optionsBuilder.build()));
	}
}
<commit_msg>WRP-2255 Check empty value before adding search option for merge entries<commit_after>/*
 * Copyright 2011-2016 B2i Healthcare Pte Ltd, http://b2i.sg
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.b2international.snowowl.datastore.request;

import com.b2international.commons.CompareUtils;
import com.b2international.commons.options.OptionsBuilder;
import com.b2international.snowowl.core.ServiceProvider;
import com.b2international.snowowl.core.events.Request;
import com.b2international.snowowl.core.merge.Merge;
import com.b2international.snowowl.core.merge.MergeCollection;

/**
 * @since 4.6
 */
public class SearchMergeRequestBuilder {

	private final String repositoryId;
	private final OptionsBuilder optionsBuilder = OptionsBuilder.newBuilder();
	
	public SearchMergeRequestBuilder(String repositoryId) {
		this.repositoryId = repositoryId;
	}

	public SearchMergeRequestBuilder withSource(String source) {
		if (!CompareUtils.isEmpty(source)) {
			optionsBuilder.put("source", source);
		}
		return this;
	}

	public SearchMergeRequestBuilder withTarget(String target) {
		if (!CompareUtils.isEmpty(target)) {
			optionsBuilder.put("target", target);
		}
		return this;
	}

	public SearchMergeRequestBuilder withStatus(Merge.Status status) {
		if (!CompareUtils.isEmpty(status)) {
			optionsBuilder.put("status", status);
		}
		return this;
	}

	public Request<ServiceProvider, MergeCollection> build() {
		return RepositoryRequests.wrap(repositoryId, new SearchMergeRequest(optionsBuilder.build()));
	}
}

{'fraction_non_alphanumeric': 0.09064935064935065, 'fraction_numerical': 0.012727272727272728, 'mean_word_length': 5.04552590266876, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4160458', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1038, 'n_words': 316}