package de.ivu.elect.business.konfiguration.control;

import java.io.Serializable;

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

import org.apache.commons.lang3.StringUtils;

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

public class VerzeichnisKonfiguriertValidator implements Validator, Serializable {

  private static final long serialVersionUID = 1L;

  @Override
  public void validate(FacesContext facesContext, UIComponent component, Object o) throws ValidatorException {

    if (o == null || StringUtils.isBlank(o.toString())) {
      throw new ValidatorException(FacesMessageUtil
          .createErrorMessage(facesContext, "verzeichnis.validation.failed.muss.vorhanden.sein",
              "verzeichnis.validation.failed.muss.vorhanden.sein"));

    }

  }
}
