package com.fp.dto.query;

public enum FilterTypes {

	EQUAL("="), DIFFERENT("!="), MAYOR(">"), GREATERTHAN("<"), LESSOREQUAL(">="), GREATOREQUAL("<=");

	/**
	 * Codigo de criterio.
	 */
	private String criteriacondition;

	/**
	 * Crea una instancia de FilterTypes.
	 * @param criteriacondition Codigo de criterio.
	 */
	private FilterTypes(String criteriacondition) {
		this.criteriacondition = criteriacondition;
	}

	/**
	 * Entraga un objeto FilterTypes dado una condicion.
	 * @param criterio Codigo de criterio.
	 * @return FilterTypes
	 * @throws Exception
	 */
	public static FilterTypes getFilterTypes(String criteriacondition) throws Exception {
		FilterTypes em = null;
		for (FilterTypes obj : FilterTypes.values()) {
			if (obj.criteriacondition.compareTo(criteriacondition) == 0) {
				em = obj;
			}
		}
		return em;
	}

}
