Package ecar.pojo

Examples of ecar.pojo.DemAtributoDema


    lAtributos =  new SisGrupoAtributoDao(request).getGruposAtributosCadastro("D");
        Iterator it = lAtributos.iterator();
        while (it.hasNext()) {
            SisGrupoAtributoSga grupoAtributo = (SisGrupoAtributoSga) it.next();          
            if (!"".equals(Pagina.getParamStr(request, "a" + grupoAtributo.getCodSga().toString())) || !"".equals(Pagina.getParamStr(request, "hidden_a" + grupoAtributo.getCodSga().toString()))) {
                DemAtributoDema demandaAtributo = new DemAtributoDema();
                demandaAtributo.setRegDemandaRegd(regDemanda);
                /*
                 * Caso o tipo de campo seja texto considera-se que o Grupo de
                 * Atributos possuir� apenas 1 atributo que o representa.
                 */
                if (SisTipoExibicGrupoDao.TEXT.equals(grupoAtributo.getSisTipoExibicGrupoSteg().getCodSteg().toString())
                     || SisTipoExibicGrupoDao.VALIDACAO.equals(grupoAtributo.getSisTipoExibicGrupoSteg().getCodSteg().toString())
                     || SisTipoExibicGrupoDao.TEXTAREA.equals(grupoAtributo.getSisTipoExibicGrupoSteg().getCodSteg().toString())
                  || SisTipoExibicGrupoDao.IMAGEM.equals(grupoAtributo.getSisTipoExibicGrupoSteg().getCodSteg().toString())) {
                    if (grupoAtributo.getSisAtributoSatbs() != null && grupoAtributo.getSisAtributoSatbs().size() > 0) {
                      if(Pagina.getParamStr(request,"a" + grupoAtributo.getCodSga().toString()) ==null || "".equals(Pagina.getParamStr(request,"a" + grupoAtributo.getCodSga().toString()))){
                        demandaAtributo.setInformacao(Pagina.getParamStr(request,"hidden_a" + grupoAtributo.getCodSga().toString()));
                      } else{
                        demandaAtributo.setInformacao(Pagina.getParamStr(request,"a" + grupoAtributo.getCodSga().toString()));
                      }
                      demandaAtributo.setSisAtributoSatb((SisAtributoSatb) grupoAtributo.getSisAtributoSatbs().iterator().next());
                      demandaAtributo.setDataInclusao(Data.getDataAtual());
                        if (regDemanda.getDemAtributoDemas() == null)
                          regDemanda.setDemAtributoDemas(new HashSet());
                        if (regDemanda.getDemAtributoDemas()!=null && !regDemanda.getDemAtributoDemas().contains(demandaAtributo)) {
                            regDemanda.getDemAtributoDemas().add(demandaAtributo);                         
                        }

                        String pathRaiz = request.getContextPath();
                       
                        // tratamento imagem
              String caminhoAuxiliarImagem = Pagina.getParamStr(request, "hidImagem" + "a"
                  + grupoAtributo.getCodSga().toString());
              if (caminhoAuxiliarImagem!=null && caminhoAuxiliarImagem.length()>0) {
               
                String chave = demandaAtributo.getInformacao();
                chave = chave.substring(chave.indexOf("RemoteFile=")+ "RemoteFile=".length());
                            UsuarioUsu usuario = ((ecar.login.SegurancaECAR)request.getSession().getAttribute("seguranca")).getUsuario();
                            if(usuario.getMapArquivosAtuaisUsuarios().containsKey(chave)){
//                              demandaAtributo.setInformacao(usuario.getMapArquivosAtuaisUsuarios().get(chave));
                             
                              caminhoAuxiliarImagem = usuario.getMapArquivosAtuaisUsuarios().get(chave);
                              caminhoAuxiliarImagem = pathRaiz +"/DownloadFile?RemoteFile=" + caminhoAuxiliarImagem;
                            }                             
//                            else{
                           
                  // salvar a imagem fisicamente que tem o caminho real no campo "a" + codigo de grupo de atributo
                  try {                 
                    String nomeArquivoNovo = FileUpload.salvarArquivoSessaoFisicamente(request, "a" + grupoAtributo.getCodSga().toString(), caminhoAuxiliarImagem);
                    if(nomeArquivoNovo != null && !nomeArquivoNovo.equals(""))
                      demandaAtributo.setInformacao(nomeArquivoNovo);
                  } catch (FileNotFoundException e) {
                    throw new ECARException("erro.arquivoUrl",e, new String[]{caminhoAuxiliarImagem});
                  } catch (Exception e) {
                    throw new ECARException("erro.upload",e, new String[]{caminhoAuxiliarImagem});
                  }
//                            }
              }

                    }
                } else {

                    String[] atributos = request.getParameterValues("a"
                            + grupoAtributo.getCodSga().toString());
                   
                    if(atributos == null || atributos.length == 0){
                      atributos = request.getParameterValues("hidden_a"
                                + grupoAtributo.getCodSga().toString());
                    }
                     
                    for (int i = 0; i < atributos.length; i++) {
                        /*
                         * Tenho que criar novamente o usu�rio atributo sen�o
                         * ele n�o � adicionado no set no final deste la�o
                         */
                      if(!"".equals(atributos[i])){
                        demandaAtributo = new DemAtributoDema();
                        demandaAtributo.setRegDemandaRegd(regDemanda);
                        demandaAtributo.setSisAtributoSatb((SisAtributoSatb) super.buscar(SisAtributoSatb.class, Long.valueOf(atributos[i])));
                        demandaAtributo.setDataInclusao(Data.getDataAtual());
                          if (regDemanda.getDemAtributoDemas() == null)
                            regDemanda.setDemAtributoDemas(new HashSet());
                          if (regDemanda.getDemAtributoDemas()!=null && !regDemanda.getDemAtributoDemas().contains(demandaAtributo)) {
                              regDemanda.getDemAtributoDemas().add(demandaAtributo);                         
                          }
                      }
                    }
                }
            }
            /* Foi necess�rio alterar o nome dos campos dos elementos multitexto, adicionando "-codSatb"
             * Assim, ficamos com o nome do campo no seguinte padr�o: "a + codSteg + _ + codSatb" (ex.: a12_38)
             * Isto foi feito visto a diferen�a existente entre um grupo com suporte a 1 campo texto
             * e este, que suporta v�rios campos texto.
             */
            else{
                if (SisTipoExibicGrupoDao.MULTITEXTO.equals(grupoAtributo.getSisTipoExibicGrupoSteg().getCodSteg().toString()))
                {
                  Enumeration lAtrib = request.getParameterNames();
                  while(lAtrib.hasMoreElements())
                  {
                    String atrib = (String)lAtrib.nextElement();
                    if (atrib.lastIndexOf('_') > 0)
                    {
                      String nomeAtrib = atrib.substring(0,atrib.lastIndexOf('_'));
                      String nomeCampo = atrib.substring(atrib.lastIndexOf('_')+1);
                      if ( (nomeAtrib.equals("a"+grupoAtributo.getCodSga().toString())
                             && !"".equals(Pagina.getParamStr(request, atrib))) || (nomeAtrib.equals("hidden_a"+grupoAtributo.getCodSga().toString())
                                     && !"".equals(Pagina.getParamStr(request, atrib))))
                      {
                        DemAtributoDema demandaAtributo = new DemAtributoDema();
                        demandaAtributo.setRegDemandaRegd(regDemanda);
                        demandaAtributo.setInformacao(Pagina.getParamStr(request, atrib));
                        demandaAtributo.setSisAtributoSatb((SisAtributoSatb) super.buscar(SisAtributoSatb.class, Long.valueOf(nomeCampo)));
                        demandaAtributo.setDataInclusao(Data.getDataAtual());
                                if (regDemanda.getDemAtributoDemas() == null)
                                  regDemanda.setDemAtributoDemas(new HashSet());
                                if (regDemanda.getDemAtributoDemas()!=null && !regDemanda.getDemAtributoDemas().contains(demandaAtributo)) {
                                    regDemanda.getDemAtributoDemas().add(demandaAtributo);                         
                                }
View Full Code Here


      tx = session.beginTransaction();
     
      if (regDemanda.getDemAtributoDemas() != null) {
        Iterator itAtt = regDemanda.getDemAtributoDemas().iterator();
        while (itAtt.hasNext()) {
          DemAtributoDema demandaAtributo = (DemAtributoDema) itAtt.next();
          Iterator itAtributosLivresVisao = atributosLivresVisao.iterator();
          boolean achouAtributoLivre = false;
          while (itAtributosLivresVisao.hasNext()){
            AtributoDemandaAtbdem atributoDemandaAtbdem = (AtributoDemandaAtbdem) itAtributosLivresVisao.next();
            if (atributoDemandaAtbdem.getSisGrupoAtributoSga() != null){
              if (atributoDemandaAtbdem.getSisGrupoAtributoSga().equals(demandaAtributo.getSisAtributoSatb().getSisGrupoAtributoSga())){
                achouAtributoLivre = true;
                break;
              }
            }
          }
          if (!achouAtributoLivre){
            demandaAtributoNaoConfiguradosVisao.add(demandaAtributo);
          }
         
                    if(demandaAtributo.getSisAtributoSatb().getSisGrupoAtributoSga().getSisTipoExibicGrupoSteg().getCodSteg() == Input.IMAGEM){
                     
                      String nomeCampo = request.getParameter("a" + demandaAtributo.getSisAtributoSatb().getSisGrupoAtributoSga().getCodSga().toString());
                     
                      if (nomeCampo != null && nomeCampo.equals("")){
                       
                  String fullFile = demandaAtributo.getInformacao();
                 
                  if (fullFile.lastIndexOf("=") != -1)    
                    fullFile = fullFile.substring(fullFile.lastIndexOf("=") + 1);
               
                  File f = new File(fullFile);
View Full Code Here

                            .getCodSteg().equals(new Long(Input.VALIDACAO))){
                         
                          //Busca o valor da demanda1
                          Iterator itRegDem1 =  demanda1.getDemAtributoDemas().iterator();
                          String informacaoDemanda1Atbdem = "";
                          DemAtributoDema demAtributoDemanda1Dema = null;
                      while (itRegDem1.hasNext()) {
                        demAtributoDemanda1Dema = (DemAtributoDema) itRegDem1.next();                         
                        if (demAtributoDemanda1Dema.getSisAtributoSatb().getSisGrupoAtributoSga().equals(atributoDemanda.iGetGrupoAtributosLivres())){
                            informacaoDemanda1Atbdem = demAtributoDemanda1Dema.getInformacao();
                            break;
                        }
                        demAtributoDemanda1Dema = null;
                      }

                          //Busca o valor da demanda2
                          Iterator itRegDem2 =  demanda2.getDemAtributoDemas().iterator();
                          String informacaoDemanda2Atbdem = "";
                          DemAtributoDema demAtributoDemanda2Dema = null;
                      while (itRegDem2.hasNext()) {
                        demAtributoDemanda2Dema = (DemAtributoDema) itRegDem2.next();                         
                        if (demAtributoDemanda2Dema.getSisAtributoSatb().getSisGrupoAtributoSga().equals(atributoDemanda.iGetGrupoAtributosLivres())){                            
                            informacaoDemanda2Atbdem = demAtributoDemanda2Dema.getInformacao();
                            break;
                        }
                        demAtributoDemanda2Dema = null;
                      }
                     
                      //Come�a o processo de compara��o da ordena��o
                      if(demAtributoDemanda1Dema==null && demAtributoDemanda2Dema==null){
                        retorno = 0;
                      }                     
                      else if(demAtributoDemanda1Dema!=null && demAtributoDemanda2Dema==null){
                        retorno = 1;
                      }                     
                      else if(demAtributoDemanda1Dema==null && demAtributoDemanda2Dema!=null){
                        retorno = -1;
                      }                     
                      else{
                        if(demAtributoDemanda1Dema.getSisAtributoSatb().getAtribInfCompSatb().equals("dataScript")){
                             
                          //Data no formato dd/mm/aaaa
                              String dataDem1 = informacaoDemanda1Atbdem;
                              int diaDem1 , mesDem1, anoDem1;
                              diaDem1 = Integer.parseInt(dataDem1.trim().substring(0, 2));
                              mesDem1 = Integer.parseInt(dataDem1.trim().substring(3, 5));
                              anoDem1 = Integer.parseInt(dataDem1.trim().substring(6, 10))
                         
                              String dataDem2 = informacaoDemanda2Atbdem;
                              int diaDem2, mesDem2, anoDem2;
                              diaDem2 = Integer.parseInt(dataDem2.trim().substring(0, 2));
                              mesDem2 = Integer.parseInt(dataDem2.trim().substring(3, 5));
                              anoDem2 = Integer.parseInt(dataDem2.trim().substring(6, 10))
                             
                              GregorianCalendar valorDataDemanda1 = new GregorianCalendar(anoDem1, mesDem1, diaDem1);
                              GregorianCalendar valorDataDemanda2 = new GregorianCalendar(anoDem2, mesDem2, diaDem2);
                             
                              retorno = valorDataDemanda1.compareTo(valorDataDemanda2);
                             
                        }
                       
                        else if(demAtributoDemanda1Dema.getSisAtributoSatb().getAtribInfCompSatb().equals("numeroInteiroScript")){
                         
                              Integer valorInteiroDemanda1 = new Integer(Integer.parseInt(informacaoDemanda1Atbdem)) ;
                              Integer valorInteiroDemanda2 = new Integer(Integer.parseInt(informacaoDemanda2Atbdem));
                              retorno = valorInteiroDemanda1.compareTo(valorInteiroDemanda2);
                             
                        }
                       
                        else if(demAtributoDemanda1Dema.getSisAtributoSatb().getAtribInfCompSatb().equals("numeroRealScript")
                            || demAtributoDemanda1Dema.getSisAtributoSatb().getAtribInfCompSatb().equals("valorMonetarioScript")){

                          DecimalFormat dff = (DecimalFormat) DecimalFormat.getInstance();                         
                          Double valorRealDemanda1 = new Double(dff.parse(informacaoDemanda1Atbdem).doubleValue()) ;
                          Double valorRealDemanda2 = new Double(dff.parse(informacaoDemanda2Atbdem).doubleValue());
                              retorno = valorRealDemanda1.compareTo(valorRealDemanda2);
                         
                        }
                                               
                        else{
                          retorno = informacaoDemanda1Atbdem.compareToIgnoreCase(informacaoDemanda2Atbdem);
                        }
                      }
                     
                        }

                        //Caso seja atributo livre diferente de valida��o
                        else if(atributoDemanda.iGetGrupoAtributosLivres() != null){
                     
                          //Busca o valor da demanda1
                          Iterator itRegDem1 =  demanda1.getDemAtributoDemas().iterator();
                          String informacaoDemanda1Atbdem = "";
                      while (itRegDem1.hasNext()) {
                        DemAtributoDema demAtributoDema = (DemAtributoDema) itRegDem1.next();
                       
                        if (demAtributoDema.getSisAtributoSatb().getSisGrupoAtributoSga().equals(atributoDemanda.iGetGrupoAtributosLivres())){
                          if (atributoDemanda.iGetGrupoAtributosLivres().getSisTipoExibicGrupoSteg().getCodSteg().equals(new Long(Input.TEXT)) ||
                            atributoDemanda.iGetGrupoAtributosLivres().getSisTipoExibicGrupoSteg().getCodSteg().equals(new Long(Input.TEXTAREA)) ||
                            atributoDemanda.iGetGrupoAtributosLivres().getSisTipoExibicGrupoSteg().getCodSteg().equals(new Long(Input.MULTITEXTO)) ) {
                          
                            informacaoDemanda1Atbdem = informacaoDemanda1Atbdem + demAtributoDema.getInformacao() "; ";
                         
                          } else if (!atributoDemanda.iGetGrupoAtributosLivres().getSisTipoExibicGrupoSteg().getCodSteg().equals(new Long(Input.IMAGEM))) {
                            //se for do tipo imagem n�o faz nada, deixa em branco.
                            informacaoDemanda1Atbdem = informacaoDemanda1Atbdem + demAtributoDema.getSisAtributoSatb().getDescricaoSatb() "; ";
                          }
                        }
                      }
                      if (informacaoDemanda1Atbdem.length() > 0){
                        informacaoDemanda1Atbdem = informacaoDemanda1Atbdem.substring(0, informacaoDemanda1Atbdem.length() - 2);
                      }                           

                          //Busca o valor da demanda2
                          Iterator itRegDem2 =  demanda2.getDemAtributoDemas().iterator();
                          String informacaoDemanda2Atbdem = "";
                      while (itRegDem2.hasNext()) {
                        DemAtributoDema demAtributoDema = (DemAtributoDema) itRegDem2.next();
                       
                        if (demAtributoDema.getSisAtributoSatb().getSisGrupoAtributoSga().equals(atributoDemanda.iGetGrupoAtributosLivres())){
                          if (atributoDemanda.iGetGrupoAtributosLivres().getSisTipoExibicGrupoSteg().getCodSteg().equals(new Long(Input.TEXT)) ||
                            atributoDemanda.iGetGrupoAtributosLivres().getSisTipoExibicGrupoSteg().getCodSteg().equals(new Long(Input.TEXTAREA)) ||
                            atributoDemanda.iGetGrupoAtributosLivres().getSisTipoExibicGrupoSteg().getCodSteg().equals(new Long(Input.MULTITEXTO)) ) {
                          
                            informacaoDemanda2Atbdem = informacaoDemanda2Atbdem + demAtributoDema.getInformacao() "; ";
                         
                          } else if (!atributoDemanda.iGetGrupoAtributosLivres().getSisTipoExibicGrupoSteg().getCodSteg().equals(new Long(Input.IMAGEM))) {
                            //se for do tipo imagem n�o faz nada, deixa em branco.
                            informacaoDemanda2Atbdem = informacaoDemanda2Atbdem + demAtributoDema.getSisAtributoSatb().getDescricaoSatb() "; ";
                          }
                        }
                      }
                      if (informacaoDemanda2Atbdem.length() > 0){
                        informacaoDemanda2Atbdem = informacaoDemanda2Atbdem.substring(0, informacaoDemanda2Atbdem.length() - 2);
View Full Code Here

                }
               
                if (regDemanda.getDemAtributoDemas() != null) {
                    Iterator itAtb = regDemanda.getDemAtributoDemas().iterator();
                    while (itAtb.hasNext()) {
                      DemAtributoDema demAtrib = (DemAtributoDema) itAtb.next();
                      exclusao.add(demAtrib);
                    }
                }
               
                exclusao.add(regDemanda);
View Full Code Here

        Set result = regDemanda.getDemAtributoDemas();
        if (result != null) {
            if (result.size() > 0) {
                Iterator it = result.iterator();
                while (it.hasNext()) {
                  DemAtributoDema demandaAtributo = (DemAtributoDema) it.next();
                  if (demandaAtributo.getSisAtributoSatb().getSisGrupoAtributoSga().equals(grupo))
                    retorno.add(demandaAtributo);
                }

            }
        }
View Full Code Here

                      }
                     
                      Iterator itAtributosTextTextArea = atributosTextTextArea.iterator();

                      while (itAtributosTextTextArea.hasNext() && filtrarAtributoLivre){
                        DemAtributoDema demAtributoDema = (DemAtributoDema) itAtributosTextTextArea.next();
                        if (!demAtributoDema.getInformacao().toUpperCase().trim().contains((Pagina.trocaNull(valores[0])).toUpperCase().trim())){

                          itRegDemandas.remove();
                                filtrarAtributoLivre = false;
                                retorno = true;
                                break;
                        }
                       
                      } 
                 }
               }
             //Se for MULTITEXTO
             } else if (tipoCampo.equals(SisTipoExibicGrupoDao.MULTITEXTO)) {
                                                       
             List lAtrib = new ArrayList();
             if(parametrosFiltroDemanda.get("listaNomesAtributosRequest") != null)
               lAtrib = (ArrayList) parametrosFiltroDemanda.get("listaNomesAtributosRequest");
             Iterator lAtribIt = lAtrib.iterator();
            
             while (lAtribIt.hasNext() && filtrarAtributoLivre) {
               nomeCampo = Pagina.trocaNull(lAtribIt.next());
               if (nomeCampo.startsWith("a" + grupoAtributo.getCodSga().toString())){
                 String[] valores = null;
                 if (parametrosFiltroDemanda.get(nomeCampo) instanceof String) {
                   valores = new String[1];
                   valores[0] = (String)parametrosFiltroDemanda.get(nomeCampo);
                 } else {
                   valores = (String[])parametrosFiltroDemanda.get(nomeCampo);
                 }
                 if(parametrosFiltroDemanda.get(nomeCampo) != null && valores[0]!=null &&
                     !"".equals(Pagina.trocaNull(valores[0]))){
                   String codSisAtrib = nomeCampo.substring(nomeCampo.lastIndexOf("_") + 1);
                   SisAtributoSatb sisAtributoSatb = (SisAtributoSatb) this.buscar(SisAtributoSatb.class, Long.valueOf(codSisAtrib));
                   List atributosMultiText = getRegDemandaSisAtributoRegdSatbsRegd(regDemandaRegd, grupoAtributo.getCodSga());
                   if (atributosMultiText.size() == 0 || !getSisAtributosRegDem(regDemandaRegd, grupoAtributo.getCodSga()).contains(sisAtributoSatb)){

                     itRegDemandas.remove();
                               filtrarAtributoLivre = false;
                               retorno = true;
                               break;
                   }
                   Iterator itAtributosMultiTexto = atributosMultiText.iterator();
                  
                       while (itAtributosMultiTexto.hasNext() && filtrarAtributoLivre){
                         DemAtributoDema demAtributoDema = (DemAtributoDema) itAtributosMultiTexto.next();
                         if (demAtributoDema.getSisAtributoSatb().getCodSatb().toString().equals(codSisAtrib)){
                           if (!demAtributoDema.getInformacao().toUpperCase().trim().contains((Pagina.trocaNull(parametrosFiltroDemanda.get(nomeCampo))).toUpperCase().trim())){

                               itRegDemandas.remove();
                                       filtrarAtributoLivre = false;
                                       retorno = true;
                                       break;
                             }
                         }
                       }
                 }
               }
             }                                        
           //Se for VALIDACAO
           } else if (tipoCampo.equals(SisTipoExibicGrupoDao.VALIDACAO)) {

             nomeCampo = "a" + grupoAtributo.getCodSga() + "_Inicio";
             String filtroParametro = Pagina.trocaNull(parametrosFiltroDemanda.get(nomeCampo));
             if(parametrosFiltroDemanda.get(nomeCampo) != null &&
                 !"".equals(Pagina.trocaNull(parametrosFiltroDemanda.get(nomeCampo)))){
              
               List atributosValidacao = getRegDemandaSisAtributoRegdSatbsRegd(regDemandaRegd, grupoAtributo.getCodSga());
              
               if (atributosValidacao.size() == 0){

                 itRegDemandas.remove();
                         filtrarAtributoLivre = false;
                         retorno = true;
                         break;
               }
              
                 Iterator itAtributosValidacao = atributosValidacao.iterator();
                
                 while (itAtributosValidacao.hasNext() && filtrarAtributoLivre){
                   DemAtributoDema demAtributoDema = (DemAtributoDema) itAtributosValidacao.next();
                  
                   if (demAtributoDema.getSisAtributoSatb().getAtribInfCompSatb().equals("dataScript")){
                    
                     //Modifica as ordens de dia e m�s na data, para ficar no formato MM/DD/YYYY
                     filtroParametro =
                       filtroParametro.substring(3, filtroParametro.lastIndexOf("/")+1) +
                       filtroParametro.substring(0, filtroParametro.indexOf("/")+1) +
                       filtroParametro.substring(filtroParametro.lastIndexOf("/")+1);
                                    
                       Date dataFiltro = new Date(filtroParametro);
                      
                       String valorAtribLivre = demAtributoDema.getInformacao();
                    
                       //Modifica as ordens de dia e m�s na data, para ficar no formato MM/DD/YYYY
                       valorAtribLivre =
                         valorAtribLivre.substring(3, valorAtribLivre.lastIndexOf("/")+1) +
                         valorAtribLivre.substring(0, valorAtribLivre.indexOf("/")+1) +
                         valorAtribLivre.substring(valorAtribLivre.lastIndexOf("/")+1);
                                    
                       Date dataAtribLivre = new Date(valorAtribLivre);
                       //Remove da lista se a data estiver estiver fora do intervalo especificado no filtro                       
                       if (dataAtribLivre.compareTo(dataFiltro) < 0){
//                         itensRemovidos.add(regDemandaRegd.getCodRegd());
                         itRegDemandas.remove();
                               filtrarAtributoLivre = false;
                               retorno = true;
                               break;
                             }
                    
                    
                   } else if (demAtributoDema.getSisAtributoSatb().getAtribInfCompSatb().equals("numeroInteiroScript") ||
                       demAtributoDema.getSisAtributoSatb().getAtribInfCompSatb().equals("numeroRealScript") ||
                       demAtributoDema.getSisAtributoSatb().getAtribInfCompSatb().equals("valorMonetarioScript") ){
                      
                     filtroParametro = filtroParametro.replace(".", "");
                     filtroParametro = filtroParametro.replace(",", ".");
                    
                     BigDecimal valorFiltro = new BigDecimal(filtroParametro);
                                
                       BigDecimal valorAtribLivre = new BigDecimal(demAtributoDema.getInformacao().replace(".", "").replace(",", "."));
                                                  
                     //Remove da lista se a data estiver estiver fora do intervalo especificado no filtro
                       if (valorAtribLivre.doubleValue() < valorFiltro.doubleValue()){
//                         itensRemovidos.add(regDemandaRegd.getCodRegd());
                         itRegDemandas.remove();
                               filtrarAtributoLivre = false;
                               retorno = true;
                               break;
                             }
                     }
                 }
             }
            
             nomeCampo = "a" + grupoAtributo.getCodSga().toString() + "_Fim";
             filtroParametro = Pagina.trocaNull(parametrosFiltroDemanda.get(nomeCampo));
             if(parametrosFiltroDemanda.get(nomeCampo) != null &&
                 !"".equals(Pagina.trocaNull(parametrosFiltroDemanda.get(nomeCampo)))){
              
               List atributosValidacao = getRegDemandaSisAtributoRegdSatbsRegd(regDemandaRegd, grupoAtributo.getCodSga());
              
               if (atributosValidacao.size() == 0){

                 itRegDemandas.remove();
                         filtrarAtributoLivre = false;
                         retorno = true;
                         break;
               }
              
                 Iterator itAtributosValidacao = atributosValidacao.iterator();
                
                 while (itAtributosValidacao.hasNext() && filtrarAtributoLivre){
                   DemAtributoDema demAtributoDema = (DemAtributoDema) itAtributosValidacao.next();
                  
                   if (demAtributoDema.getSisAtributoSatb().getAtribInfCompSatb().equals("dataScript")){
                    
                     //Modifica as ordens de dia e m�s na data, para ficar no formato MM/DD/YYYY
                     filtroParametro =
                       filtroParametro.substring(3, filtroParametro.lastIndexOf("/")+1) +
                       filtroParametro.substring(0, filtroParametro.indexOf("/")+1) +
                       filtroParametro.substring(filtroParametro.lastIndexOf("/")+1);
                                    
                       Date dataFiltro = new Date(filtroParametro);
                      
                       String valorAtribLivre = demAtributoDema.getInformacao();
                    
                       //Modifica as ordens de dia e m�s na data, para ficar no formato MM/DD/YYYY
                       valorAtribLivre =
                         valorAtribLivre.substring(3, valorAtribLivre.lastIndexOf("/")+1) +
                         valorAtribLivre.substring(0, valorAtribLivre.indexOf("/")+1) +
                         valorAtribLivre.substring(valorAtribLivre.lastIndexOf("/")+1);
                                    
                       Date dataAtribLivre = new Date(valorAtribLivre);
                       //Remove da lista se a data estiver estiver fora do intervalo especificado no filtro                       
                       if (dataAtribLivre.compareTo(dataFiltro) > 0){
//                         itensRemovidos.add(regDemandaRegd.getCodRegd());
                         itRegDemandas.remove();
                               filtrarAtributoLivre = false;
                               retorno = true;
                               break;
                             }
                      
                   } else if (demAtributoDema.getSisAtributoSatb().getAtribInfCompSatb().equals("numeroInteiroScript") ||
                       demAtributoDema.getSisAtributoSatb().getAtribInfCompSatb().equals("numeroRealScript") ||
                       demAtributoDema.getSisAtributoSatb().getAtribInfCompSatb().equals("valorMonetarioScript") ){
                      
                     filtroParametro = filtroParametro.replace(".", "");
                     filtroParametro = filtroParametro.replace(",", ".");
                    
                     BigDecimal valorFiltro = new BigDecimal(filtroParametro);
                    
                       BigDecimal valorAtribLivre = new BigDecimal(demAtributoDema.getInformacao().replace(".", "").replace(",", "."));
                                                  
                     //Remove da lista se a data estiver estiver fora do intervalo especificado no filtro
                       if (valorAtribLivre.doubleValue() > valorFiltro.doubleValue()){
//                         itensRemovidos.add(regDemandaRegd.getCodRegd());
                         itRegDemandas.remove();
                               filtrarAtributoLivre = false;
                               retorno = true;
                               break;
                             }
                     }
                  
                 }
             }
            
               nomeCampo ="a" + grupoAtributo.getCodSga();
             String[] atributos = (String[]) parametrosFiltroDemanda.get(nomeCampo);
             if(parametrosFiltroDemanda.get(nomeCampo) != null){
                 String[] valores = (String[])parametrosFiltroDemanda.get(nomeCampo);
                 if (valores[0]!=null && !"".equals(Pagina.trocaNull(valores[0]))) {
                   List atributosValidacao = getRegDemandaSisAtributoRegdSatbsRegd(regDemandaRegd, grupoAtributo.getCodSga());
              
                   if (atributosValidacao.size() == 0){
                     itRegDemandas.remove();
                     filtrarAtributoLivre = false;
                     retorno = true;
                     break;
                   }
              
                   Iterator itAtributosValidacao = atributosValidacao.iterator();
                
                   while (itAtributosValidacao.hasNext() && filtrarAtributoLivre){
                     DemAtributoDema demAtributoDema = (DemAtributoDema) itAtributosValidacao.next();
                          if (!demAtributoDema.getInformacao().toUpperCase().contains(atributos[0].toUpperCase())){
                            itRegDemandas.remove();
                            filtrarAtributoLivre = false;
                            retorno = true;
                            break;
                          }                      
View Full Code Here

    public List getSisAtributosRegDem(RegDemandaRegd regDemandaRegd, Long codSisGrupoAtributo){
      List listaRetorno = new ArrayList();
      if (regDemandaRegd.getDemAtributoDemas() != null){
        Iterator it = regDemandaRegd.getDemAtributoDemas().iterator();
        while (it.hasNext()){
          DemAtributoDema demAtributoDema = (DemAtributoDema) it.next();
          if (demAtributoDema.getSisAtributoSatb().getSisGrupoAtributoSga().getCodSga().equals(codSisGrupoAtributo)){
            listaRetorno.add(demAtributoDema.getSisAtributoSatb());
          }
        }
      }
     
      return listaRetorno;
View Full Code Here

    public List getRegDemandaSisAtributoRegdSatbsRegd(RegDemandaRegd regDemanda, Long codSisGrupoAtributo){
      List listaRetorno = new ArrayList();
      if (regDemanda.getDemAtributoDemas() != null){
        Iterator it = regDemanda.getDemAtributoDemas().iterator();
        while (it.hasNext()){
          DemAtributoDema demAtributoDema = (DemAtributoDema) it.next();
          if (demAtributoDema.getSisAtributoSatb().getSisGrupoAtributoSga().getCodSga().equals(codSisGrupoAtributo)){
            listaRetorno.add(demAtributoDema);
          }
        }
      }
     
View Full Code Here

                  Iterator<DemAtributoDema> itAtribLivres = pRegDemanda.getDemAtributoDemas().iterator();
                 
                  //Para cada atributo livre da demanda, verifica-se se este corresponde
                  //ao atributo que esta sendo tratado
                  while(itAtribLivres.hasNext()){
                    DemAtributoDema atributoDema = (DemAtributoDema) itAtribLivres.next();
                    //Iterador com os atributos livres associados ao atributo em quest�o
                    Iterator<SisAtributoSatb> sisAtributosSatbIt = atributo.iGetGrupoAtributosLivres().getSisAtributoSatbs().iterator();
                   
                    while (sisAtributosSatbIt.hasNext()) {
                      SisAtributoSatb sisAtributo = (SisAtributoSatb) sisAtributosSatbIt.next();
                      if( (sisAtributo).equals(atributoDema.getSisAtributoSatb()) ) {
                        //Caso seja um atributo tipo texto
                        if(atributoDema.getInformacao() != null) {
                         
                          String conteudoAtributoDemanda = atributoDema.getInformacao().replaceAll("\n", " ").replaceAll("\r"," ");
                         
                          if (sisAtributo.getSisGrupoAtributoSga().getSisTipoExibicGrupoSteg().getCodSteg().intValue() == Input.IMAGEM){
                            if (conteudoAtributoDemanda.indexOf("/") != -1){
                              conteudoAtributoDemanda = conteudoAtributoDemanda.substring(conteudoAtributoDemanda.lastIndexOf("/")+1);
                              if (conteudoAtributoDemanda.indexOf("--") != -1){
                                conteudoAtributoDemanda = conteudoAtributoDemanda.substring(conteudoAtributoDemanda.lastIndexOf("--")+3);
                              }
                            }
                          }
                         
                          linhaRetorno += separadorParaCamposMulti + conteudoAtributoDemanda;
                          separadorParaCamposMulti = this.separadorMultivalor;
                         

                         
                        //Caso seja atributo tipo check, radio ou select
                        } else if(atributoDema.getSisAtributoSatb().getDescricaoSatb() != null) {
                          linhaRetorno += separadorParaCamposCheck + (atributoDema.getSisAtributoSatb().getDescricaoSatb()).replaceAll("\n", " ").replaceAll("\r"," ");
                          separadorParaCamposCheck = this.separadorMultivalor;
                        //Caso n�o tenha valor associado ao atributo
                        } else {
                          linhaRetorno += "";
                        }
View Full Code Here

            List aributosLivresSelecionados = new ArrayList();
           
            if(regDemanda.getDemAtributoDemas() != null){
              Iterator itAtribLivres = regDemanda.getDemAtributoDemas().iterator();
              while(itAtribLivres.hasNext()){
                DemAtributoDema atributo = (DemAtributoDema) itAtribLivres.next();
                AtributoLivre atributoLivre = new AtributoLivre();
                atributoLivre.setInformacao(atributo.getInformacao());
                atributoLivre.setSisAtributoSatb(atributo.getSisAtributoSatb());
                aributosLivresSelecionados.add(atributoLivre);
              }
            }
           
            input.setSelecionados(aributosLivresSelecionados);
            input.setSisAtributo((SisAtributoSatb)grupoAtributo.getSisAtributoSatbs().iterator().next());
            if(atributo.iGetDica(Long.valueOf(codigoVisao)) != null) {
              input.setDica(atributo.iGetDica(Long.valueOf(codigoVisao)));
            }
           
           
            input.setTransformarComboBoxListaChecks(transformarComboBoxListaChecks.booleanValue());
           
            input.doStartTag();
           
            Options options = new Options(writer);
           
            options.setTransformarComboBoxListaChecks(transformarComboBoxListaChecks.booleanValue());
            options.setTransformarRadioListaChecks(transformarRadioListaChecks.booleanValue());
           
          List opcoes = new ArrayList();
          String selectedCodSapadrao = "";
          if(grupoAtributo.getCodSga() != null && grupoAtributo.getCodSga().longValue() != 1){
            if(grupoAtributo.getSisTipoOrdenacaoSto() != null){
              opcoes = new SisGrupoAtributoDao(null).getAtributosOrdenados(grupoAtributo);
              if (!opcoes.isEmpty()){
                Iterator itOpcoes = opcoes.iterator();
                while (itOpcoes.hasNext()){
                  if (((SisAtributoSatb) itOpcoes.next()).getIndAtivoSatb().equals("N")){
                    itOpcoes.remove();
                  }
                }
              }
            }
          }
         
           
          if(!opcoes.isEmpty()) {
              options.setOptions(opcoes);
              options.setValor("codSatb");
              options.setLabel("descricaoSatb");
              options.setDica(atributo.iGetDica(Long.valueOf(codigoVisao)));
              options.setNome("a" + grupoAtributo.getCodSga().toString());
              options.setContexto(this.getContextPath());
              //options.setImagem(getContextPath() + "/images/relAcomp/");
              options.setParent(input);             
              options.doStartTag();
View Full Code Here

TOP

Related Classes of ecar.pojo.DemAtributoDema

Copyright © 2018 www.massapicom. 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.