package gcom.gui.relatorio.cadastro.imovel;
import gcom.relatorio.ExibidorProcessamentoTarefaRelatorio;
import gcom.relatorio.cadastro.imovel.FiltrarRelatorioImoveisAtivosNaoMedidosHelper;
import gcom.relatorio.cadastro.imovel.RelatorioImoveisAtivosNaoMedidos;
import gcom.tarefa.TarefaRelatorio;
import gcom.util.ConstantesSistema;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
/**
* [UC00728] Gerar Relat�rio de Im�veis Ativos e N�o Medidos
*
* @author Rafael Pinto
* @date 02/01/2008
*/
public class GerarRelatorioImoveisAtivosNaoMedidosAction extends ExibidorProcessamentoTarefaRelatorio {
public ActionForward execute(ActionMapping actionMapping,
ActionForm actionForm, HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) {
// Seta o mapeamento de retorno
ActionForward retorno = actionMapping.findForward("exibirGerarRelatorioImoveisAtivosNaoMedidosAction");
// Form
GerarRelatorioImoveisAtivosNaoMedidosActionForm form =
(GerarRelatorioImoveisAtivosNaoMedidosActionForm) actionForm;
FiltrarRelatorioImoveisAtivosNaoMedidosHelper filtro =
new FiltrarRelatorioImoveisAtivosNaoMedidosHelper();
// Ger�ncia Regional
if (form.getGerenciaRegional() != null &&
!form.getGerenciaRegional().equals(""+ConstantesSistema.NUMERO_NAO_INFORMADO) ) {
filtro.setGerenciaRegional(new Integer(form.getGerenciaRegional()));
}
// Unidade de Negocio
if (form.getUnidadeNegocio() != null &&
!form.getUnidadeNegocio().equals(""+ConstantesSistema.NUMERO_NAO_INFORMADO) ) {
filtro.setUnidadeNegocio(new Integer(form.getUnidadeNegocio()));
}
// Localidade Inicial
if (form.getLocalidadeInicial() != null &&
!form.getLocalidadeInicial().equals("") ) {
filtro.setLocalidadeInicial(new Integer(form.getLocalidadeInicial()));
}
// Setor Comercial Inicial
if (form.getSetorComercialInicial() != null &&
!form.getSetorComercialInicial().equals("") ) {
filtro.setSetorComercialInicial(new Integer(form.getSetorComercialInicial()));
}
// Rota Inicial
if (form.getRotaInicial() != null &&
!form.getRotaInicial().equals("") ) {
filtro.setRotaInicial(new Integer(form.getRotaInicial()));
}
// Sequencial Rota Inicial
if (form.getSequencialRotaInicial() != null &&
!form.getSequencialRotaInicial().equals("") ) {
filtro.setSequencialRotalInicial(new Integer(form.getSequencialRotaInicial()));
}
// Localidade Final
if (form.getLocalidadeFinal() != null &&
!form.getLocalidadeFinal().equals("") ) {
filtro.setLocalidadeFinal(new Integer(form.getLocalidadeFinal()));
}
// Setor Comercial Final
if (form.getSetorComercialFinal() != null &&
!form.getSetorComercialFinal().equals("") ) {
filtro.setSetorComercialFinal(new Integer(form.getSetorComercialFinal()));
}
// Rota Final
if (form.getRotaFinal() != null &&
!form.getRotaFinal().equals("") ) {
filtro.setRotaFinal(new Integer(form.getRotaFinal()));
}
// Sequencial Rota Final
if (form.getSequencialRotaFinal() != null &&
!form.getSequencialRotaFinal().equals("") ) {
filtro.setSequencialRotalFinal(new Integer(form.getSequencialRotaFinal()));
}
String tipoRelatorio = httpServletRequest.getParameter("tipoRelatorio");
RelatorioImoveisAtivosNaoMedidos relatorio =
new RelatorioImoveisAtivosNaoMedidos(this.getUsuarioLogado(httpServletRequest));
relatorio.addParametro("filtrarRelatorioImoveisAtivosNaoMedidosHelper", filtro);
if (tipoRelatorio == null) {
tipoRelatorio = TarefaRelatorio.TIPO_PDF + "";
}
relatorio.addParametro("tipoFormatoRelatorio",Integer.parseInt(tipoRelatorio));
retorno =
processarExibicaoRelatorio(relatorio, tipoRelatorio, httpServletRequest,
httpServletResponse, actionMapping);
return retorno;
}
}