Blame |
Last modification |
View Log
| Download
| RSS feed
package br.gov.al.saude.scs.web.managebean.municipio;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.event.ValueChangeEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import br.gov.al.saude.framework.core.util.VerificadorUtil;
import br.gov.al.saude.scg.model.view.MunicipioView;
import br.gov.al.saude.scg.model.view.UfView;
import br.gov.al.saude.scs.core.application.municipio.MunicipioFacade;
@
Component
@ManagedBean
@Scope
("view")
public class MunicipioBean
implements Serializable {
private static final long serialVersionUID = 1L
;
private List<MunicipioView
> municipios
;
private MunicipioFacade municipioFacade
;
@Autowired
public MunicipioBean
(MunicipioFacade municipioFacade
) {
this.
municipioFacade = municipioFacade
;
}
public void municipioListener
(ValueChangeEvent e
){
UfView uf =
(UfView
) e.
getNewValue();
if(VerificadorUtil.
naoEstaNulo(uf
)) {
municipios = municipioFacade.
listar(uf.
getCodigo());
} else {
municipios =
new ArrayList<MunicipioView
>();
}
}
public void municipioListener1
(UfView uf
){
if(VerificadorUtil.
naoEstaNulo(uf
)) {
municipios = municipioFacade.
listar(uf.
getCodigo());
} else {
municipios =
new ArrayList<MunicipioView
>();
}
}
public List<MunicipioView
> getMunicipios
() {
return municipios
;
}
}