<commit_before>package org.openmrs.module.openhmis.commons.api.entity.search;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.openmrs.OpenmrsMetadata;

public class BaseMetadataTemplateSearch<T extends OpenmrsMetadata> extends BaseAuditableTemplateSearch<T> {
	public static final long serialVersionUID = 0L;

	public BaseMetadataTemplateSearch(T template) {
		this(template, StringComparisonType.EQUAL, null);
	}

	public BaseMetadataTemplateSearch(T template, Boolean includeRetired) {
		this(template, StringComparisonType.EQUAL, includeRetired);
	}

	public BaseMetadataTemplateSearch(T template, StringComparisonType nameComparisonType, Boolean includeRetired) {
		super(template);

		this.nameComparisonType = nameComparisonType;
		this.includeRetired = includeRetired;
		this.descriptionComparisonType = StringComparisonType.EQUAL;
		this.retireReasonComparisonType = StringComparisonType.EQUAL;
		this.dateRetiredComparisonType = DateComparisonType.EQUAL;
	}

	private StringComparisonType nameComparisonType;
	private StringComparisonType descriptionComparisonType;
	private StringComparisonType retireReasonComparisonType;
	private DateComparisonType dateRetiredComparisonType;

	private Boolean includeRetired;

	public StringComparisonType getNameComparisonType() {
		return nameComparisonType;
	}

	public void setNameComparisonType(StringComparisonType nameComparisonType) {
		this.nameComparisonType = nameComparisonType;
	}

	public StringComparisonType getDescriptionComparisonType() {
		return descriptionComparisonType;
	}

	public void setDescriptionComparisonType(StringComparisonType descriptionComparisonType) {
		this.descriptionComparisonType = descriptionComparisonType;
	}

	public StringComparisonType getRetireReasonComparisonType() {
		return retireReasonComparisonType;
	}

	public void setRetireReasonComparisonType(StringComparisonType retireReasonComparisonType) {
		this.retireReasonComparisonType = retireReasonComparisonType;
	}

	public DateComparisonType getDateRetiredComparisonType() {
		return dateRetiredComparisonType;
	}

	public void setDateRetiredComparisonType(DateComparisonType dateRetiredComparisonType) {
		this.dateRetiredComparisonType = dateRetiredComparisonType;
	}

	public boolean getIncludeRetired() {
		return includeRetired;
	}

	public void setIncludeRetired(boolean includeRetired) {
		this.includeRetired = includeRetired;
	}

	@Override
	public void updateCriteria(Criteria criteria) {
		super.updateCriteria(criteria);

		T t = getTemplate();
		if (t.getName() != null) {
			criteria.add(createCriterion("name", t.getName(), nameComparisonType));
		}
		if (t.getDescription() != null) {
			criteria.add(createCriterion("description", t.getName(), nameComparisonType));
		}

		if (includeRetired != null) {
			if (!includeRetired) {
				criteria.add(Restrictions.eq("retired", false));
			}
		} else if (t.isRetired() != null) {
			criteria.add(Restrictions.eq("retired", t.isRetired()));
		}

		if (t.getRetiredBy() != null) {
			criteria.add(Restrictions.eq("retiredBy", t.getRetiredBy()));
		}
		if (t.getDateRetired() != null) {
			criteria.add(createCriterion("dateRetired", t.getDateRetired(), dateRetiredComparisonType));
		}
		if (t.getRetireReason() != null) {
			criteria.add(createCriterion("retireReason", t.getRetireReason(), retireReasonComparisonType));
		}
	}
}

<commit_msg>Updated property methods for includeRetired to be consistent with datatype.<commit_after>package org.openmrs.module.openhmis.commons.api.entity.search;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.openmrs.OpenmrsMetadata;

public class BaseMetadataTemplateSearch<T extends OpenmrsMetadata> extends BaseAuditableTemplateSearch<T> {
	public static final long serialVersionUID = 0L;

	public BaseMetadataTemplateSearch(T template) {
		this(template, StringComparisonType.EQUAL, null);
	}

	public BaseMetadataTemplateSearch(T template, Boolean includeRetired) {
		this(template, StringComparisonType.EQUAL, includeRetired);
	}

	public BaseMetadataTemplateSearch(T template, StringComparisonType nameComparisonType, Boolean includeRetired) {
		super(template);

		this.nameComparisonType = nameComparisonType;
		this.includeRetired = includeRetired;
		this.descriptionComparisonType = StringComparisonType.EQUAL;
		this.retireReasonComparisonType = StringComparisonType.EQUAL;
		this.dateRetiredComparisonType = DateComparisonType.EQUAL;
	}

	private StringComparisonType nameComparisonType;
	private StringComparisonType descriptionComparisonType;
	private StringComparisonType retireReasonComparisonType;
	private DateComparisonType dateRetiredComparisonType;

	private Boolean includeRetired;

	public StringComparisonType getNameComparisonType() {
		return nameComparisonType;
	}

	public void setNameComparisonType(StringComparisonType nameComparisonType) {
		this.nameComparisonType = nameComparisonType;
	}

	public StringComparisonType getDescriptionComparisonType() {
		return descriptionComparisonType;
	}

	public void setDescriptionComparisonType(StringComparisonType descriptionComparisonType) {
		this.descriptionComparisonType = descriptionComparisonType;
	}

	public StringComparisonType getRetireReasonComparisonType() {
		return retireReasonComparisonType;
	}

	public void setRetireReasonComparisonType(StringComparisonType retireReasonComparisonType) {
		this.retireReasonComparisonType = retireReasonComparisonType;
	}

	public DateComparisonType getDateRetiredComparisonType() {
		return dateRetiredComparisonType;
	}

	public void setDateRetiredComparisonType(DateComparisonType dateRetiredComparisonType) {
		this.dateRetiredComparisonType = dateRetiredComparisonType;
	}

	public Boolean getIncludeRetired() {
		return includeRetired;
	}

	public void setIncludeRetired(Boolean includeRetired) {
		this.includeRetired = includeRetired;
	}

	@Override
	public void updateCriteria(Criteria criteria) {
		super.updateCriteria(criteria);

		T t = getTemplate();
		if (t.getName() != null) {
			criteria.add(createCriterion("name", t.getName(), nameComparisonType));
		}
		if (t.getDescription() != null) {
			criteria.add(createCriterion("description", t.getName(), nameComparisonType));
		}

		if (includeRetired != null) {
			if (!includeRetired) {
				criteria.add(Restrictions.eq("retired", false));
			}
		} else if (t.isRetired() != null) {
			criteria.add(Restrictions.eq("retired", t.isRetired()));
		}

		if (t.getRetiredBy() != null) {
			criteria.add(Restrictions.eq("retiredBy", t.getRetiredBy()));
		}
		if (t.getDateRetired() != null) {
			criteria.add(createCriterion("dateRetired", t.getDateRetired(), dateRetiredComparisonType));
		}
		if (t.getRetireReason() != null) {
			criteria.add(createCriterion("retireReason", t.getRetireReason(), retireReasonComparisonType));
		}
	}
}


{'fraction_non_alphanumeric': 0.09002042602859645, 'fraction_numerical': 0.0002918004085205719, 'mean_word_length': 6.642140468227424, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7156485', 'n_tokens_mistral': 2033, 'n_tokens_neox': 1885, 'n_words': 357}