package de.ivu.elect;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;

import de.ivu.elect.jee.faces.FacesMessageUtil;

public class EmlBestaetigenAuswahlValidator implements Validator {
  @Override
  public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {

    if (value==null || !EmlBestaetigenAuswahl.HASH_CODE_BESTAETIGT.name().equalsIgnoreCase(value.toString())) {
      throw new ValidatorException(
          FacesMessageUtil.createErrorMessage(context, "eml.hash.code.bestaetigen", "eml.hash.code.bestaetigen"));

    }
  }
}
