Subversion Repositories Integrator Subversion

Rev

Rev 106 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

package br.com.ec.controller.managedbean;

import java.io.Serializable;

import javax.inject.Inject;
import javax.inject.Named;

import org.springframework.context.annotation.Scope;

import br.com.ec.controller.managedbean.consultademanda.AberturaLojaConsultaPorDemanda;
import br.com.ec.core.consulta.ParametrosConsulta;
import br.com.ec.core.generic.GenericService;
import br.com.ec.core.util.VerificadorUtil;
import br.com.ec.domain.model.AberturaLoja;
import br.com.ec.domain.service.aberturaloja.AberturaLojaService;
import br.com.ec.web.generic.AbstractBean;

@Named
@Scope("view")
public class AberturaLojaBean extends AbstractBean<AberturaLoja> implements Serializable {

        private static final long serialVersionUID = 1L;
       
        private AberturaLojaConsultaPorDemanda lazy;
       
        private AberturaLojaService aberturaLojaService;

        @Inject
        public AberturaLojaBean(AberturaLojaService aberturaLojaService, AberturaLojaConsultaPorDemanda lazy) {
                this.aberturaLojaService = aberturaLojaService;
                this.lazy = lazy;
        }
       
        @Override
        public void preCarregamento() {
                if (VerificadorUtil.estaNulo(parametrosConsulta)) {
                        entidade = new AberturaLoja();
                        parametrosConsulta = new ParametrosConsulta<AberturaLoja>();
                        parametrosConsulta.setEntidade(entidade);
                        prepararConsultaDemanda();
                }
        }
       
        @Override
        public void limparEntidade() {
                AberturaLoja loja = new AberturaLoja();
                setEntidade(loja);
        }

        @Override
        public GenericService<AberturaLoja> getService() {
                return aberturaLojaService;
        }
       
        @Override
        public AberturaLoja getEntidade() {
                return entidade;
        }

        @Override
        public AberturaLoja getId() {
                return getEntidade();
        }
       
        public AberturaLojaConsultaPorDemanda getLazy() {
                return lazy;
        }
        public void setLazy(AberturaLojaConsultaPorDemanda lazy) {
                this.lazy = lazy;
        }
        public void prepararConsultaDemanda() {
                lazy.setarParametrosConsulta(getParametrosConsulta());
        }
       
}