package Controle;
import DAO.ClassificacaoRmpDao;
import Entidade.ClassificacaoRmp;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
/**
*
* @author Kleysson
*/
@FacesConverter(forClass = ClassificacaoRmp.class, value = "classificacaoConverter")
public class ClassificacaoConverter implements Converter {
@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
if (value != null && !"".equals(value)) {
//return new UnidadeDao().consultarPorId(Integer.parseInt(value));
ClassificacaoRmp classificacao = new ClassificacaoRmpDao().consultarPorId(Integer.parseInt(value));
if (classificacao != null){
return classificacao;
}
}
return null;
}
@Override
public String getAsString(FacesContext context, UIComponent component, Object value) {
if (value != null ) {
return value.toString();
}
return null;
}
}