Subversion Repositories Integrator Subversion

Rev

Blame | Last modification | View Log | Download | RSS feed

package br.com.ec.controller;

import java.io.Serializable;

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

import org.springframework.context.annotation.Scope;

import br.com.ec.core.exception.NegocioException;
import br.com.ec.core.generic.GenericService;
import br.com.ec.core.util.VerificadorUtil;
import br.com.ec.domain.dto.ExtratoEntregasDTO;
import br.com.ec.domain.service.PedidoService;
import br.com.ec.web.exception.VerificadorLancamentoException;
import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean;
import br.com.ec.web.generic.AbstractBean;

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

        private static final long serialVersionUID = 1L;
       
        private PedidoService pedidoService;
       
        @Inject
        public ExtratoEntregasBean(PedidoService pedidoService) {
                this.pedidoService = pedidoService;
        }

        @Override
        public GenericService<ExtratoEntregasDTO> getService() {
                return null;
        }

        @Override
        public ExtratoEntregasDTO getId() {
                return null;
        }
       
        @Override
        public void preCarregamento() {
                limparEntidade();
        }

        @Override
        public void limparEntidade() {
                setEntidade(new ExtratoEntregasDTO());
        }
       
        /*******************************************/

        public void consultarExtratoEntregas() {
                new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() {
                        public void execute() {
                                if (VerificadorUtil.estaNulo(getEntidade().getVigenciaDTO())) {
                                        throw new NegocioException("SELECIONE A VIGÊNCIA");
                                }
                                setEntidade(pedidoService.consultarExtratoEntregas(getEntidade()));
                        }
                });
        }
       
}