Package Controle

Source Code of Controle.ClassificacaoConverter

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;
    }
   
}
TOP

Related Classes of Controle.ClassificacaoConverter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.