public JustificativaSolicitacaoDao() {
   super(Constantes.getValue("DATABASE_ALIAS"), null);
 }
 public ControleQuestionariosDao() {
   super(Constantes.getValue("DATABASE_ALIAS"), null);
 }
 public CategoriaServicoDao() {
   super(Constantes.getValue("DATABASE_ALIAS"), null);
 }
Esempio n. 4
0
  public void preencherComboContrato(
      DocumentHTML document, HttpServletRequest request, HttpServletResponse response)
      throws ServiceException, Exception {
    RegraEscalonamentoDTO regraEscalonamentoDTO = (RegraEscalonamentoDTO) document.getBean();

    ContratoService contratoService =
        (ContratoService) ServiceLocator.getInstance().getService(ContratoService.class, null);
    ClienteService clienteService =
        (ClienteService) ServiceLocator.getInstance().getService(ClienteService.class, null);
    FornecedorService fornecedorService =
        (FornecedorService) ServiceLocator.getInstance().getService(FornecedorService.class, null);
    ContratosGruposService contratosGruposService =
        (ContratosGruposService)
            ServiceLocator.getInstance().getService(ContratosGruposService.class, null);
    Collection colContratos = contratoService.list();
    ContratoDTO contratoDtoAux = new ContratoDTO();

    UsuarioDTO usuario = WebUtil.getUsuario(request);
    if (usuario == null) {
      document.alert(UtilI18N.internacionaliza(request, "citcorpore.comum.sessaoExpirada"));
      document.executeScript(
          "window.location = '"
              + Constantes.getValue("SERVER_ADDRESS")
              + request.getContextPath()
              + "'");
      return;
    }

    String COLABORADORES_VINC_CONTRATOS =
        ParametroUtil.getValorParametroCitSmartHashMap(
            br.com.centralit.citcorpore.util.Enumerados.ParametroSistema
                .COLABORADORES_VINC_CONTRATOS,
            "N");
    if (COLABORADORES_VINC_CONTRATOS == null) {
      COLABORADORES_VINC_CONTRATOS = "N";
    }
    Collection colContratosColab = null;
    if (COLABORADORES_VINC_CONTRATOS.equalsIgnoreCase("S")) {
      colContratosColab = contratosGruposService.findByIdEmpregado(usuario.getIdEmpregado());
    }
    Collection<ContratoDTO> listaContratos = new ArrayList<ContratoDTO>();
    ((HTMLSelect) document.getSelectById("idContrato")).removeAllOptions();
    if (colContratos != null) {
      if (colContratos.size() > 1) {
        ((HTMLSelect) document.getSelectById("idContrato"))
            .addOption("", UtilI18N.internacionaliza(request, "citcorpore.comum.selecione"));
      }

      for (Iterator it = colContratos.iterator(); it.hasNext(); ) {
        ContratoDTO contratoDto = (ContratoDTO) it.next();
        if (contratoDto.getDeleted() == null || !contratoDto.getDeleted().equalsIgnoreCase("y")) {
          if (COLABORADORES_VINC_CONTRATOS.equalsIgnoreCase(
              "S")) { // Se parametro de colaboradores por contrato ativo, entao filtra.
            if (colContratosColab == null) {
              continue;
            }
            if (!isContratoInList(contratoDto.getIdContrato(), colContratosColab)) {
              continue;
            }
          }

          if (regraEscalonamentoDTO != null
              && regraEscalonamentoDTO.getIdRegraEscalonamento() != null) {
            this.restore(document, request, response);
          }

          String nomeCliente = "";
          String nomeForn = "";
          ClienteDTO clienteDto = new ClienteDTO();
          clienteDto.setIdCliente(contratoDto.getIdCliente());
          clienteDto = (ClienteDTO) clienteService.restore(clienteDto);
          if (clienteDto != null) {
            nomeCliente = clienteDto.getNomeRazaoSocial();
          }
          FornecedorDTO fornecedorDto = new FornecedorDTO();
          fornecedorDto.setIdFornecedor(contratoDto.getIdFornecedor());
          fornecedorDto = (FornecedorDTO) fornecedorService.restore(fornecedorDto);
          if (fornecedorDto != null) {
            nomeForn = fornecedorDto.getRazaoSocial();
          }
          contratoDtoAux.setIdContrato(contratoDto.getIdContrato());
          if (contratoDto.getSituacao().equalsIgnoreCase("A")) {
            String nomeContrato =
                ""
                    + contratoDto.getNumero()
                    + " de "
                    + UtilDatas.convertDateToString(
                        TipoDate.DATE_DEFAULT,
                        contratoDto.getDataContrato(),
                        WebUtil.getLanguage(request))
                    + " ("
                    + nomeCliente
                    + " - "
                    + nomeForn
                    + ")";
            ((HTMLSelect) document.getSelectById("idContrato"))
                .addOption("" + contratoDto.getIdContrato(), nomeContrato);
            contratoDto.setNome(nomeContrato);
            listaContratos.add(contratoDto);
          }
        }
      }
    }
  }
 public AtitudeCandidatoDao() {
   super(Constantes.getValue("DATABASE_ALIAS"), null);
 }
 public IncidentesRelacionadosDAO() {
   super(Constantes.getValue("DATABASE_ALIAS"), null);
 }
Esempio n. 7
0
  private String generateAvailSLATime(
      DocumentHTML document,
      HttpServletRequest request,
      AcordoNivelServicoDTO acordoNivelServicoDTO,
      Integer idAcordoNivelServico,
      UsuarioDTO usuarioDto)
      throws IOException, ParseException {
    SlaAvaliacaoDTO slaAvaliacaoDto = (SlaAvaliacaoDTO) document.getBean();
    ControleGenerateSLAPorAcordoNivelServico controleGenerateSLAPorAcordoNivelServico =
        new ControleGenerateSLAPorAcordoNivelServico();
    ControleGenerateSLAPorAcordoNivelServicoEmAndamento
        controleGenerateSLAPorAcordoNivelServicoEmAndamento =
            new ControleGenerateSLAPorAcordoNivelServicoEmAndamento();
    List lst =
        controleGenerateSLAPorAcordoNivelServico.execute(
            idAcordoNivelServico, slaAvaliacaoDto.getDataInicio(), slaAvaliacaoDto.getDataFim());
    double qtdeDentroPrazo = 0;
    double qtdeForaPrazo = 0;
    if (lst != null && lst.size() > 0) {
      for (Iterator itSLA = lst.iterator(); itSLA.hasNext(); ) {
        Object[] objs = (Object[]) itSLA.next();
        if (((String) objs[0]).indexOf("Fora") > -1 || ((String) objs[0]).indexOf("Out") > -1) {
          qtdeForaPrazo = (Double) objs[2];
        } else {
          qtdeDentroPrazo = (Double) objs[2];
        }
      }
    }
    double qtdeDentroPrazoPerc = (qtdeDentroPrazo / (qtdeDentroPrazo + qtdeForaPrazo)) * 100;
    double qtdeForaPrazoPerc = (qtdeForaPrazo / (qtdeDentroPrazo + qtdeForaPrazo)) * 100;

    final DefaultValueDataset dataset = new DefaultValueDataset(new Double(qtdeDentroPrazoPerc));

    // create the chart...
    final ThermometerPlot plot = new ThermometerPlot(dataset);
    final JFreeChart chart =
        new JFreeChart(
            UtilI18N.internacionaliza(request, "sla.avaliacao.avaliacaogeral"), // chart title
            JFreeChart.DEFAULT_TITLE_FONT,
            plot, // plot
            false); // include legend

    plot.setSubrangeInfo(ThermometerPlot.NORMAL, 90.000001, 100);
    plot.setSubrangeInfo(ThermometerPlot.WARNING, 80.000001, 90);
    plot.setSubrangeInfo(ThermometerPlot.CRITICAL, 0, 80);

    plot.setThermometerStroke(new BasicStroke(2.0f));
    plot.setThermometerPaint(Color.lightGray);

    String nomeImgAval =
        CITCorporeUtil.caminho_real_app
            + "/tempFiles/"
            + usuarioDto.getIdUsuario()
            + "/avalSLA_"
            + acordoNivelServicoDTO.getIdAcordoNivelServico()
            + ".png";
    String nomeImgAvalRel =
        br.com.citframework.util.Constantes.getValue("SERVER_ADDRESS")
            + br.com.citframework.util.Constantes.getValue("CONTEXTO_APLICACAO")
            + "/tempFiles/"
            + usuarioDto.getIdUsuario()
            + "/avalSLA_"
            + acordoNivelServicoDTO.getIdAcordoNivelServico()
            + ".png";
    File arquivo = new File(nomeImgAval);

    if (arquivo.exists()) {
      arquivo.delete();
    } else {
      String nomeDir =
          CITCorporeUtil.caminho_real_app + "/tempFiles/" + usuarioDto.getIdUsuario() + "/";
      File dirTemp = new File(nomeDir);
      dirTemp.mkdirs();
      arquivo.createNewFile();
    }

    ChartUtilities.saveChartAsPNG(arquivo, chart, 500, 200);

    List lst2 = controleGenerateSLAPorAcordoNivelServicoEmAndamento.execute(idAcordoNivelServico);
    qtdeDentroPrazo = 0;
    qtdeForaPrazo = 0;
    if (lst2 != null && lst2.size() > 0) {
      for (Iterator itSLA = lst2.iterator(); itSLA.hasNext(); ) {
        Object[] objs = (Object[]) itSLA.next();
        if (((String) objs[0]).indexOf("Fora") > -1 || ((String) objs[0]).indexOf("Out") > -1) {
          qtdeForaPrazo = (Double) objs[2];
        } else {
          qtdeDentroPrazo = (Double) objs[2];
        }
      }
    }
    qtdeDentroPrazoPerc = (qtdeDentroPrazo / (qtdeDentroPrazo + qtdeForaPrazo)) * 100;
    qtdeForaPrazoPerc = (qtdeForaPrazo / (qtdeDentroPrazo + qtdeForaPrazo)) * 100;

    DefaultPieDataset datasetPie = new DefaultPieDataset();
    datasetPie.setValue(
        UtilI18N.internacionaliza(request, "sla.avaliacao.noprazo")
            + " ("
            + UtilFormatacao.formatDouble(qtdeDentroPrazo, 0)
            + ")",
        new Double(qtdeDentroPrazoPerc));
    datasetPie.setValue(
        UtilI18N.internacionaliza(request, "sla.avaliacao.foraprazo")
            + " ("
            + UtilFormatacao.formatDouble(qtdeForaPrazo, 0)
            + ")",
        new Double(qtdeForaPrazoPerc));

    JFreeChart chartX =
        ChartFactory.createPieChart(
            UtilI18N.internacionaliza(request, "sla.avaliacao.emandamento"), // chart title
            datasetPie, // data
            true, // include legend
            true,
            false);

    PiePlot plotPie = (PiePlot) chartX.getPlot();
    plotPie.setLabelFont(new Font("SansSerif", Font.PLAIN, 6));
    plotPie.setNoDataMessage(UtilI18N.internacionaliza(request, "sla.avaliacao.naohadados"));
    plotPie.setCircular(true);
    plotPie.setLabelGap(0);

    String nomeImgAval2 =
        CITCorporeUtil.caminho_real_app
            + "/tempFiles/"
            + usuarioDto.getIdUsuario()
            + "/avalSLA2_"
            + idAcordoNivelServico
            + ".png";
    String nomeImgAvalRel2 =
        br.com.citframework.util.Constantes.getValue("SERVER_ADDRESS")
            + br.com.citframework.util.Constantes.getValue("CONTEXTO_APLICACAO")
            + "/tempFiles/"
            + usuarioDto.getIdUsuario()
            + "/avalSLA2_"
            + idAcordoNivelServico
            + ".png";
    File arquivo2 = new File(nomeImgAval2);
    if (arquivo2.exists()) {
      arquivo2.delete();
    }
    ChartUtilities.saveChartAsPNG(arquivo2, chartX, 200, 200);

    String table = "";
    table += "<tr>";
    table += "<td style='border:1px solid black; vertical-align:middle;'>";
    // table +=
    // UtilHTML.encodeHTML(UtilStrings.retiraApostrofe(acordoNivelServicoDTO.getTituloSLA()));
    table +=
        "<br>"
            + geraTabelaMeses(
                acordoNivelServicoDTO.getTituloSLA(), idAcordoNivelServico, request, usuarioDto);
    table += "</td>";
    table += "<td style='border:1px solid black; vertical-align:middle;'>";
    if (acordoNivelServicoDTO.getTipo() != null
        && acordoNivelServicoDTO.getTipo().equalsIgnoreCase("T")) {
      table +=
          "<img src='"
              + br.com.citframework.util.Constantes.getValue("SERVER_ADDRESS")
              + br.com.citframework.util.Constantes.getValue("CONTEXTO_APLICACAO")
              + "/imagens/relogio.png' border='0'  title='"
              + UtilI18N.internacionaliza(request, "sla.avaliacao.tempo")
              + "'/>";
      table += UtilI18N.internacionaliza(request, "sla.avaliacao.tempo");
    } else if (acordoNivelServicoDTO.getTipo() != null
        && acordoNivelServicoDTO.getTipo().equalsIgnoreCase("D")) {
      table +=
          "<img src='"
              + br.com.citframework.util.Constantes.getValue("SERVER_ADDRESS")
              + br.com.citframework.util.Constantes.getValue("CONTEXTO_APLICACAO")
              + "/imagens/disponibilidade.png' border='0'  title='"
              + UtilI18N.internacionaliza(request, "sla.avaliacao.disponibilidade")
              + "'/>";
      table += UtilI18N.internacionaliza(request, "sla.avaliacao.disponibilidade");
    } else if (acordoNivelServicoDTO.getTipo() != null
        && acordoNivelServicoDTO.getTipo().equalsIgnoreCase("V")) {
      table +=
          "<img src='"
              + br.com.citframework.util.Constantes.getValue("SERVER_ADDRESS")
              + br.com.citframework.util.Constantes.getValue("CONTEXTO_APLICACAO")
              + "/imagens/outrasfontes.png' border='0'  title='"
              + UtilI18N.internacionaliza(request, "sla.avaliacao.outrasfontes")
              + "'/>";
      table += UtilI18N.internacionaliza(request, "sla.avaliacao.outrasfontes");
    }
    table += "</td>";
    table += "<td style='border:1px solid black; vertical-align:middle;'>";
    if (acordoNivelServicoDTO.getDataFim() != null
        && acordoNivelServicoDTO.getDataFim().before(UtilDatas.getDataAtual())) {
      table +=
          "<img src='"
              + br.com.citframework.util.Constantes.getValue("SERVER_ADDRESS")
              + br.com.citframework.util.Constantes.getValue("CONTEXTO_APLICACAO")
              + "/imagens/bolavermelha.png' border='0'  title='"
              + UtilI18N.internacionaliza(request, "sla.avaliacao.inativo")
              + "'/>";
      table += UtilI18N.internacionaliza(request, "sla.avaliacao.inativo");
    } else {
      table +=
          "<img src='"
              + br.com.citframework.util.Constantes.getValue("SERVER_ADDRESS")
              + br.com.citframework.util.Constantes.getValue("CONTEXTO_APLICACAO")
              + "/imagens/bolaverde.png' border='0'  title='"
              + UtilI18N.internacionaliza(request, "sla.avaliacao.ativo")
              + "'/>";
      table += UtilI18N.internacionaliza(request, "sla.avaliacao.ativo");
    }
    table += "</td>";
    table += "<td style='border:1px solid black'>";
    table += "<img src='" + nomeImgAvalRel + "' border='0'/>";
    table += "</td>";
    table += "<td style='border:1px solid black'>";
    table += "<img src='" + nomeImgAvalRel2 + "' border='0'/>";
    table += "</td>";
    table += "</tr>";

    return table;
  }
 public CriterioItemCotacaoDao() {
   super(Constantes.getValue("DATABASE_ALIAS"), null);
 }
 public TemplateSolicitacaoServicoDao() {
   super(Constantes.getValue("DATABASE_ALIAS"), null);
 }
 private File getDiretorioAnexosIncidentes() {
   if (diretorioAnexosIncidentes == null) {
     diretorioAnexosIncidentes = new File(Constantes.getValue("DIRETORIO_ANEXOS_INCIDENTES"));
   }
   return diretorioAnexosIncidentes;
 }
 public PerfilAcessoMenuDao() {
   super(Constantes.getValue("DATABASE_ALIAS"), null);
 }
  public void verificaImpactos(
      Integer idItemCfg,
      DocumentHTML document,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    UsuarioDTO usrDto = (UsuarioDTO) br.com.centralit.citcorpore.util.WebUtil.getUsuario(request);
    if (usrDto == null) {
      return;
    }
    HashMap map = new HashMap<>();
    HashMap map2 = new HashMap<>();
    ImagemItemConfiguracaoService imagemItemConfiguracaoService =
        (ImagemItemConfiguracaoService)
            ServiceLocator.getInstance().getService(ImagemItemConfiguracaoService.class, null);
    Collection colHierarq =
        imagemItemConfiguracaoService.findItensRelacionadosHierarquia(idItemCfg);
    String strTables =
        "<b><u>"
            + UtilI18N.internacionaliza(request, "pesquisaItemConfiguracao.iCsVinculados")
            + "</u></b>";
    strTables += "<table>";
    if (colHierarq != null && colHierarq.size() > 0) {
      for (Iterator it = colHierarq.iterator(); it.hasNext(); ) {
        ItemConfiguracaoDTO itemConfiguracaoAux = (ItemConfiguracaoDTO) it.next();
        ItemConfiguracaoDTO itemConfiguracaoAux2 =
            (ItemConfiguracaoDTO) map.get("" + itemConfiguracaoAux.getIdItemConfiguracao());
        if (itemConfiguracaoAux2 != null) {
          continue;
        }
        map.put("" + itemConfiguracaoAux.getIdItemConfiguracao(), itemConfiguracaoAux);
        strTables += "<tr>";
        strTables += "<td>";
        if (itemConfiguracaoAux.getTipoVinculo().equalsIgnoreCase("FILHO")) {
          strTables +=
              "<img src='"
                  + Constantes.getValue("SERVER_ADDRESS")
                  + Constantes.getValue("CONTEXTO_APLICACAO")
                  + "/pages/gerenciaConfiguracaoTree/images/item_relation.png' border='0'/>";
        } else {
          strTables +=
              "<img src='"
                  + Constantes.getValue("SERVER_ADDRESS")
                  + Constantes.getValue("CONTEXTO_APLICACAO")
                  + "/pages/gerenciaConfiguracaoTree/images/item_menu_relation.png' border='0'/>";
        }
        strTables += "</td>";
        strTables += "<td>";
        strTables += "" + itemConfiguracaoAux.getIdentificacao();
        strTables += "</td>";
        strTables += "</tr>";
      }
    } else {
      strTables += "<tr>";
      strTables += "<td>";
      strTables += "" + UtilI18N.internacionaliza(request, "MSG04") + "";
      strTables += "</td>";
      strTables += "</tr>";
    }
    strTables += "</table>";

    strTables +=
        "<b><u>"
            + UtilI18N.internacionaliza(request, "pesquisaItemConfiguracao.servicosVinculados")
            + "</u></b>";
    strTables += "<table>";
    colHierarq = imagemItemConfiguracaoService.findServicosRelacionadosHierarquia(idItemCfg);
    if (colHierarq != null && colHierarq.size() > 0) {
      for (Iterator it = colHierarq.iterator(); it.hasNext(); ) {
        ServicoDTO servicoDTO = (ServicoDTO) it.next();
        ServicoDTO servicoAux2 = (ServicoDTO) map2.get("" + servicoDTO.getIdServico());
        if (servicoAux2 != null) {
          continue;
        }
        map2.put("" + servicoDTO.getIdServico(), servicoDTO);
        strTables += "<tr>";
        strTables += "<td>";
        strTables +=
            "<img src='"
                + Constantes.getValue("SERVER_ADDRESS")
                + Constantes.getValue("CONTEXTO_APLICACAO")
                + "/pages/gerenciaConfiguracaoTree/images/item_relation.png' border='0'/>";
        strTables += "</td>";
        strTables += "<td>";
        strTables += "" + servicoDTO.getNomeServico();
        strTables += "</td>";
        strTables += "</tr>";
      }
    } else {
      strTables += "<tr>";
      strTables += "<td>";
      strTables += "" + UtilI18N.internacionaliza(request, "MSG04") + "";
      strTables += "</td>";
      strTables += "</tr>";
    }
    strTables += "</table>";

    document.getElementById("divImpactos").setInnerHTML(strTables);
  }
Esempio n. 13
0
  @SuppressWarnings({"rawtypes", "unchecked"})
  public List processLookup(LookupDTO lookupObject) throws LogicException, Exception {
    StringBuilder sql = new StringBuilder();
    String camposDesejados = "";
    String where = "";

    LookupFieldUtil lookUpField = new LookupFieldUtil();
    Collection colCamposRet = lookUpField.getCamposRetorno(lookupObject.getNomeLookup());
    Iterator itRet = colCamposRet.iterator();
    Campo cp;

    // Os valores que podem ser consultados sao os referentes a:
    // itemConfiguracao, tipoItemConfiguracao, caracteristica e valor.
    while (itRet.hasNext()) {
      cp = (Campo) itRet.next();
      if (!camposDesejados.equalsIgnoreCase("")) {
        camposDesejados = camposDesejados + ",";
      }
      camposDesejados = camposDesejados + cp.getNomeFisico();
    }

    // Montando sql de busca
    sql.append("SELECT " + camposDesejados + " ");
    sql.append("FROM " + lookUpField.getTabela(lookupObject.getNomeLookup()) + " ");
    sql.append(
        "INNER JOIN tipoitemconfiguracao tipo ON item.idtipoitemconfiguracao = tipo.idtipoitemconfiguracao ");
    sql.append(
        "INNER JOIN tipoitemcfgcaracteristica tipocaracteristica ON tipo.idtipoitemconfiguracao = tipocaracteristica.idtipoitemconfiguracao ");
    sql.append(
        "INNER JOIN caracteristica caracteristica ON tipocaracteristica.idcaracteristica = caracteristica.idcaracteristica ");
    sql.append(
        "INNER JOIN valor valor ON caracteristica.idcaracteristica = valor.idcaracteristica AND valor.iditemconfiguracao = item.iditemconfiguracao ");
    sql.append(
        "INNER JOIN itemconfiguracao itempai ON itempai.iditemconfiguracao = item.iditemconfiguracaopai ");

    Collection colCamposPesq = lookUpField.getCamposPesquisa(lookupObject.getNomeLookup());
    Iterator itPesq = colCamposPesq.iterator();
    String obj = null;
    int count = 1;
    while (itPesq.hasNext()) {
      cp = (Campo) itPesq.next();
      obj = null;
      obj = this.getValueParmLookup(lookupObject, count);
      if (obj != null) {
        String[] trataGetNomeFisico = cp.getNomeFisico().split("\\.");
        String nomeFisico = cp.getNomeFisico();
        if (trataGetNomeFisico.length > 1) {
          cp.setNomeFisico(trataGetNomeFisico[1]);
          nomeFisico = trataGetNomeFisico[0] + "." + trataGetNomeFisico[1];
        }
        if (!obj.equalsIgnoreCase("")) {
          if (!where.equalsIgnoreCase("")) {
            where = where + " AND ";
          }
          if (cp.getType().equalsIgnoreCase(Constantes.getValue("FIELDTYPE_TEXT").trim())
              || cp.getType().equalsIgnoreCase(Constantes.getValue("FIELDTYPE_TEXTAREA").trim())) {
            String func = Constantes.getValue("FUNCAO_CONVERTE_MAIUSCULO");
            if (func != null && !func.trim().equalsIgnoreCase("")) {
              // Se for IP, USUARIO ou MAQUINA devera' ser verificado no mesmo campo do itempai.
              if (nomeFisico.equalsIgnoreCase("IP")
                  || nomeFisico.equalsIgnoreCase("USUARIO")
                  || nomeFisico.equalsIgnoreCase("MAQUINA")) {
                where = where + func + "(itempai.identificacao)";
              } else if (nomeFisico.equalsIgnoreCase("CARACTERISTICA")) {
                where = where + func + "(caracteristica.nomecaracteristica)";
              } else if (nomeFisico.equalsIgnoreCase("ITEM")) {
                where = where + func + "(item.identificacao)";
              } else if (nomeFisico.equalsIgnoreCase("UNIDADE")) {
                where = where + func + "(item.idunidade)";
              } else if (nomeFisico.equalsIgnoreCase("TIPO")) {
                where = where + func + "(tipo.nometipoitemconfiguracao)";
              } else {
                where = where + func + "(" + nomeFisico + ")";
              }
            } else {
              where = where + cp.getNomeFisico();
            }
            where = where + " LIKE '%";
          } else {
            if (cp.getType().equalsIgnoreCase(Constantes.getValue("FIELDTYPE_COMBO").trim())) {
              where = where + cp.getNomeFisico();
              where = where + " IN (";
            } else if (cp.getType().equalsIgnoreCase("DATE")) {
              where = where + cp.getNomeFisico();
              where = where + " = '";
            } else {
              where = where + cp.getNomeFisico();
              where = where + " = ";
            }
          }

          if (StringUtils.contains(obj, "'")) {
            obj = StringUtils.replace(obj, "'", "\\'");
          }

          where = where + obj;
          if (cp.getType().equalsIgnoreCase(Constantes.getValue("FIELDTYPE_TEXT").trim())
              || cp.getType().equalsIgnoreCase(Constantes.getValue("FIELDTYPE_TEXTAREA").trim())) {
            where = where + "%'";
          } else if (cp.getType().equalsIgnoreCase("DATE")) {
            where = where + "'";
          } else if (cp.getType().equalsIgnoreCase(Constantes.getValue("FIELDTYPE_COMBO").trim())) {
            where = where + ")";
          }
        }
      }
      count++;
    }

    String strAux;
    if (!where.equalsIgnoreCase("")) {
      sql.append(" WHERE " + where);
      strAux = lookUpField.getWhere(lookupObject.getNomeLookup());
      if (!strAux.equalsIgnoreCase("")) {
        sql.append(" AND ");
        sql.append(strAux);
      }
    } else {
      strAux = lookUpField.getWhere(lookupObject.getNomeLookup());
      if (!strAux.equalsIgnoreCase("")) {
        sql.append(" WHERE " + strAux);
      }
    }

    Collection colCamposOrd = lookUpField.getCamposOrdenacao(lookupObject.getNomeLookup());
    Iterator itOrd = colCamposOrd.iterator();
    String ordem = "";
    while (itOrd.hasNext()) {
      cp = (Campo) itOrd.next();
      if (!ordem.equalsIgnoreCase("")) {
        ordem = ordem + ",";
      }
      ordem = ordem + cp.getNomeFisico();
    }

    if (!ordem.equalsIgnoreCase("")) {
      sql.append(" ORDER BY " + ordem);
    }

    sql.append(" LIMIT 0,400");

    String sqlFinal = sql.toString().toUpperCase();

    List lista = execSQL(sqlFinal, null);
    if (lista == null || lista.size() == 0) {
      TransactionControler tc = this.getTransactionControler();
      if (tc != null) {
        tc.close();
      }

      return null;
    }

    // Processa o resultado.
    List result = new ArrayList<>();
    if (lista == null || lista.size() == 0) {
      TransactionControler tc = this.getTransactionControler();
      if (tc != null) {
        tc.close();
      }

      return result;
    }
    if (lista.size() > 400) {
      TransactionControler tc = this.getTransactionControler();
      if (tc != null) {
        tc.close();
      }

      throw new LogicException(
          "A consulta retornou mais de 400 registros, por favor, especifique melhor a consulta!");
    }
    Iterator it = lista.iterator();
    Campo campoAux;
    int i;
    Collection colAux;
    Object auxObj;
    while (it.hasNext()) {
      Object[] row = (Object[]) it.next();
      itRet = colCamposRet.iterator();
      i = 0;
      campoAux = null;
      colAux = new ArrayList<>();
      while (itRet.hasNext()) {
        cp = (Campo) itRet.next();
        campoAux =
            new Campo(
                cp.getNomeFisico(),
                cp.getDescricao(),
                cp.isObrigatorio(),
                cp.getType(),
                cp.getTamanho());
        if (cp.getType().equalsIgnoreCase(Constantes.getValue("FIELDTYPE_TEXT").trim())
            || cp.getType().equalsIgnoreCase(Constantes.getValue("FIELDTYPE_TEXTAREA").trim())) {
          if (row[i] == null) {
            auxObj = new String("");
          } else {
            String str = new String(row[i].toString());
            auxObj = str.replaceAll("\"", "&quot;").replaceAll("'", "&#180;");
          }
          campoAux.setObjValue(auxObj);
        } else if (cp.getType().equalsIgnoreCase(Constantes.getValue("FIELDTYPE_DATE").trim())) {
          if (row[i] == null) {
            campoAux.setObjValue(null);
          } else {
            auxObj = row[i];
            if ((auxObj instanceof java.sql.Date)) {
              campoAux.setObjValue(UtilDatas.dateToSTR((java.sql.Date) auxObj));
            } else if ((auxObj instanceof java.sql.Timestamp)) {
              campoAux.setObjValue(UtilDatas.dateToSTR((java.sql.Timestamp) auxObj));
            } else {
              campoAux.setObjValue(auxObj.toString());
            }
          }
        } else if (cp.getType().equalsIgnoreCase(Constantes.getValue("FIELDTYPE_MOEDA").trim())) {
          if (row[i] == null) {
            campoAux.setObjValue(null);
          } else {
            auxObj = row[i];
            String valorTransf = null;
            if ((auxObj instanceof Double)) {
              valorTransf =
                  UtilFormatacao.formatBigDecimal(
                      new BigDecimal(((Double) auxObj).doubleValue()), 2);
            } else if ((auxObj instanceof BigDecimal)) {
              valorTransf = UtilFormatacao.formatBigDecimal(((BigDecimal) auxObj), 2);
            } else {
              valorTransf = auxObj.toString();
            }
            campoAux.setObjValue(valorTransf);
          }
        }
        colAux.add(campoAux);
        i++;
      }
      result.add(colAux);
    }

    TransactionControler tc = this.getTransactionControler();
    if (tc != null) {
      tc.close();
    }

    return result;
  }
Esempio n. 14
0
 public RegiaoDao() {
   super(Constantes.getValue("DATABASE_ALIAS"), null);
 }
Esempio n. 15
0
  private String geraTabelaMeses(
      String tituloSLA,
      Integer idAcordoNivelServico,
      HttpServletRequest request,
      UsuarioDTO usuarioDto)
      throws ParseException, IOException {
    ControleGenerateSLAPorAcordoNivelServicoByMesAno
        controleGenerateSLAPorAcordoNivelServicoByMesAno =
            new ControleGenerateSLAPorAcordoNivelServicoByMesAno();
    int m = UtilDatas.getMonth(UtilDatas.getDataAtual());
    int y = UtilDatas.getYear(UtilDatas.getDataAtual());
    int mPesq = (m + 1); // Faz este incremento de 1, pois logo que entrar no laço, faz um -1
    String strTable = "<table width='100%' border='1'>";
    String strHeader = "";
    String strDados = "";
    strHeader += "<tr>";
    strDados += "<tr>";

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    for (int i = 0; i < 6; i++) {
      mPesq = (mPesq - 1);
      if (mPesq <= 0) {
        mPesq = 12;
        y = y - 1;
      }
      strHeader = strHeader + "<td colspan='2' style='border:1px solid black; text-align:center'>";
      strHeader = strHeader + (mPesq + "/" + y);
      strHeader = strHeader + "</td>";

      List lst =
          controleGenerateSLAPorAcordoNivelServicoByMesAno.execute(idAcordoNivelServico, y, mPesq);
      double qtdeDentroPrazo = 0;
      double qtdeForaPrazo = 0;
      if (lst != null && lst.size() > 0) {
        for (Iterator itSLA = lst.iterator(); itSLA.hasNext(); ) {
          Object[] objs = (Object[]) itSLA.next();
          if (((String) objs[0]).indexOf("Fora") > -1 || ((String) objs[0]).indexOf("Out") > -1) {
            qtdeForaPrazo = (Double) objs[2];
          } else {
            qtdeDentroPrazo = (Double) objs[2];
          }
        }
      }
      double qtdeDentroPrazoPerc = 0;
      if ((qtdeDentroPrazo + qtdeForaPrazo) > 0) {
        qtdeDentroPrazoPerc = (qtdeDentroPrazo / (qtdeDentroPrazo + qtdeForaPrazo)) * 100;
      }
      double qtdeForaPrazoPerc = 0;
      if ((qtdeDentroPrazo + qtdeForaPrazo) > 0) {
        qtdeForaPrazoPerc = (qtdeForaPrazo / (qtdeDentroPrazo + qtdeForaPrazo)) * 100;
      }
      strDados = strDados + "<td style='border:1px solid black'>";
      strDados = strDados + UtilFormatacao.formatDouble(qtdeDentroPrazoPerc, 2) + "%";
      strDados = strDados + "</td>";
      strDados = strDados + "<td style='border:1px solid black'>";
      strDados = strDados + UtilFormatacao.formatDouble(qtdeForaPrazoPerc, 2) + "%";
      strDados = strDados + "</td>";

      dataset.setValue(
          new Double(qtdeDentroPrazoPerc),
          UtilI18N.internacionaliza(request, "sla.avaliacao.noprazo"),
          "" + (mPesq + "/" + y));
      dataset.setValue(
          new Double(qtdeForaPrazoPerc),
          UtilI18N.internacionaliza(request, "sla.avaliacao.foraprazo"),
          "" + (mPesq + "/" + y));
    }
    strHeader += "</tr>";
    strDados += "</tr>";

    // create the chart...
    JFreeChart chart =
        ChartFactory.createBarChart(
            tituloSLA, // chart title
            UtilI18N.internacionaliza(request, "sla.avaliacao.indicadores"), // domain axis label
            UtilI18N.internacionaliza(request, "sla.avaliacao.resultado"), // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
            );

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation...
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.white);

    // set the range axis to display integers only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // disable bar outlines...
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);

    // set up gradient paints for series...
    GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64));
    GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(0, 64, 0));

    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);

    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(
        CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));

    String nomeImgAval =
        CITCorporeUtil.caminho_real_app
            + "/tempFiles/"
            + usuarioDto.getIdUsuario()
            + "/avalSLAXX_"
            + idAcordoNivelServico
            + ".png";
    String nomeImgAvalRel =
        br.com.citframework.util.Constantes.getValue("SERVER_ADDRESS")
            + br.com.citframework.util.Constantes.getValue("CONTEXTO_APLICACAO")
            + "/tempFiles/"
            + usuarioDto.getIdUsuario()
            + "/avalSLAXX_"
            + idAcordoNivelServico
            + ".png";
    File arquivo2 = new File(nomeImgAval);
    if (arquivo2.exists()) {
      arquivo2.delete();
    }
    ChartUtilities.saveChartAsPNG(arquivo2, chart, 500, 200);
    strTable += "<tr>";
    strTable += "<td colspan='12'>";
    strTable += "<img src='" + nomeImgAvalRel + "' border='0'/>";
    strTable += "</td>";
    strTable += "</tr>";

    strTable += strHeader;
    strTable += strDados;

    strTable += "</table>";
    return strTable;
  }
Esempio n. 16
0
  @Override
  public void onEndPage(final PdfWriter writer, final Document document) {
    try {
      /* Adicionado o header */
      final Rectangle page = document.getPageSize();
      final PdfPTable header = new PdfPTable(1);
      header.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin());
      header.setLockedWidth(true);
      header.getDefaultCell().setFixedHeight(55);
      header.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);

      final PdfPCell cellC = new PdfPCell();
      cellC.setBorder(1);

      final PdfPTable tableContent = new PdfPTable(3);

      /* Adicionando a LogoMarca */
      URL url = null;
      String caminho = "";
      String urlInicial = "";
      Image image = null;
      caminho =
          ParametroUtil.getValorParametroCitSmartHashMap(
              Enumerados.ParametroSistema.URL_LOGO_PADRAO_RELATORIO, "");

      if ("".equals(caminho.trim()) || !UtilImagem.verificaSeImagemExiste(caminho)) {
        urlInicial =
            ParametroUtil.getValorParametroCitSmartHashMap(
                Enumerados.ParametroSistema.URL_Sistema, "");
        caminho = urlInicial + "/imagens/logo/logo.png";
      }

      try {
        url = new URL(caminho);
        final URLConnection conn = url.openConnection();
        conn.connect();
      } catch (final MalformedURLException e) {
        // the URL is not in a valid form
        e.printStackTrace();
        url = null;
      } catch (final IOException e) {
        e.printStackTrace();
        url = null;
      }

      if (url == null) {
        if (Constantes.getValue("CAMINHO_LOGO_CITGERENCIAL") != null) {
          try {
            url = new URL(Constantes.getValue("CAMINHO_LOGO_CITGERENCIAL"));
          } catch (final Exception e) {
            e.printStackTrace();
          }
        }
      }

      if (url == null) {
        caminho =
            Constantes.getValue("SERVER_ADDRESS")
                + Constantes.getValue("CONTEXTO_APLICACAO")
                + "/imagens/logoPadraoRelatorio.png";
        try {
          url = new URL(caminho);
        } catch (final Exception e) {
          e.printStackTrace();
        }
      }

      if (url != null) {
        try {
          image = Image.getInstance(url);
        } catch (final BadElementException e) {
          e.printStackTrace();
        }
      }

      if (image != null) {
        image.scaleAbsolute(150, 50);
        image.setAlignment(Image.RIGHT);
        final Chunk ck = new Chunk(image, -3, -25);
        final PdfPCell cell = new PdfPCell();
        cell.addElement(ck);
        cell.setBorderWidth(0);
        cell.setRowspan(2);
        tableContent.addCell(cell);
      } else {
        tableContent.addCell("Citsmart");
      }

      final String strCab = Constantes.getValue("TEXTO_1a_LINHA_CABECALHO_CITGERENCIAL");
      if (strCab != null && !strCab.equalsIgnoreCase("")) {
        final PdfPCell cAux =
            new PdfPCell(
                new Phrase(strCab, new Font(Font.HELVETICA, 12, Font.BOLD, new Color(0, 0, 0))));
        cAux.setColspan(2);
        cAux.setBorderWidth(1);
        cAux.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        tableContent.addCell(cAux);
      }

      /* Adicionado o Titulo do relatório */
      final PdfPCell titulo =
          new PdfPCell(
              new Phrase(titleReport, new Font(Font.HELVETICA, 14, Font.BOLD, new Color(0, 0, 0))));
      titulo.setColspan(2);
      titulo.setRowspan(1);
      titulo.setBorderWidth(0);
      titulo.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
      tableContent.addCell(titulo);

      /* Adicionado o filtro */
      String strFiltro =
          this.trataParameters(hshParameters, colParmsUtilizadosNoSQL, colDefinicaoParametros);
      if (strFiltro == null) {
        strFiltro = "";
      }
      final PdfPCell cFiltro =
          new PdfPCell(
              new Phrase(strFiltro, new Font(Font.HELVETICA, 8, Font.NORMAL, new Color(0, 0, 0))));
      cFiltro.setBorderWidth(0);
      cFiltro.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
      cFiltro.setColspan(2);
      tableContent.addCell(cFiltro);
      cellC.addElement(tableContent);
      header.addCell(tableContent);

      // Fim - Trata parametros
      if (!existeAgrupador) {
        if (listRetorno != null && listRetorno.size() > 0) {
          final Object[] row = (Object[]) listRetorno.get(0);
          this.geraCabecalhoPDF(row.length, gerencialItemDto, header, writer, document, page);
        }
      }

      if (page.getWidth() > 600) {
        if (!existeAgrupador) {
          header.writeSelectedRows(0, -1, 20, 565, writer.getDirectContent());
        } else {
          header.writeSelectedRows(0, -1, 20, 585, writer.getDirectContent());
        }
      } else {
        if (!existeAgrupador) {
          header.writeSelectedRows(
              0,
              -1,
              20,
              page.getHeight() - document.topMargin() + header.getTotalHeight(),
              writer.getDirectContent());
        } else {
          header.writeSelectedRows(0, -1, 20, 805, writer.getDirectContent());
        }
      }

      /* Adicionado o footer */
      final PdfPTable footer = new PdfPTable(2);
      final String emissao = (String) hshParameters.get("citcorpore.comum.emissao");
      final String pagina = (String) hshParameters.get("citcorpore.comum.pagina");

      PdfPCell cAuxPageNumber =
          new PdfPCell(
              new Phrase(
                  emissao
                      + ": "
                      + UtilDatas.convertDateToString(
                          TipoDate.DATE_DEFAULT,
                          UtilDatas.getDataAtual(),
                          WebUtil.getLanguage(request))
                      + " "
                      + UtilDatas.formatHoraFormatadaStr(UtilDatas.getHoraAtual()),
                  new Font(Font.HELVETICA, 8, Font.NORMAL, new Color(0, 0, 0))));
      cAuxPageNumber.setBorder(0);
      footer.addCell(cAuxPageNumber);

      cAuxPageNumber =
          new PdfPCell(
              new Phrase(
                  pagina + ": " + writer.getPageNumber(),
                  new Font(Font.HELVETICA, 8, Font.NORMAL, new Color(0, 0, 0))));
      cAuxPageNumber.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
      cAuxPageNumber.setBorder(0);
      footer.addCell(cAuxPageNumber);
      footer.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin());
      footer.writeSelectedRows(
          0, -1, document.leftMargin(), document.bottomMargin(), writer.getDirectContent());
    } catch (final Exception e) {
      throw new ExceptionConverter(e);
    }
  }
Esempio n. 17
0
  public void avalia(
      DocumentHTML document, HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    UsuarioDTO usuarioDto = WebUtil.getUsuario(request);
    if (usuarioDto == null) {
      document.alert(UtilI18N.internacionaliza(request, "citcorpore.comum.sessaoExpirada"));
      document.executeScript(
          "window.location = '"
              + Constantes.getValue("SERVER_ADDRESS")
              + request.getContextPath()
              + "'");
      return;
    }
    AcordoNivelServicoService acordoNivelServicoService =
        (AcordoNivelServicoService)
            ServiceLocator.getInstance().getService(AcordoNivelServicoService.class, null);
    RequisitoSLAService requisitoSLAService =
        (RequisitoSLAService)
            ServiceLocator.getInstance().getService(RequisitoSLAService.class, null);
    Collection colAcordos = acordoNivelServicoService.findAcordosSemVinculacaoDireta();
    Collection colReqs = requisitoSLAService.list();

    ControleGenerateSLAPorRequisitoSLA controleGenerateSLAPorRequisitoSLA =
        new ControleGenerateSLAPorRequisitoSLA();
    ControleGenerateSLAPorRequisitoSLAEmAndamento controleGenerateSLAPorRequisitoSLAEmAndamento =
        new ControleGenerateSLAPorRequisitoSLAEmAndamento();
    String table = "<table border='1'>";
    if (colAcordos != null && colAcordos.size() > 0) {
      table += "<tr>";
      table += "<td>";
      table += "<b>" + UtilI18N.internacionaliza(request, "sla.avaliacao.acordo") + "</b>";
      table += "</td>";
      table += "</tr>";
      table += "<tr>";
      table += "<td>";
      table += "&nbsp;";
      table += "</td>";
      table += "</tr>";
      for (Iterator it = colAcordos.iterator(); it.hasNext(); ) {
        AcordoNivelServicoDTO acordoNivelServicoDTO = (AcordoNivelServicoDTO) it.next();
        table += "<tr>";
        table += "<td colspan='5' style='background-color:gray'>";
        table +=
            UtilI18N.internacionaliza(request, "citcorpore.comum.acordo")
                + ": <b>"
                + acordoNivelServicoDTO.getTituloSLA()
                + "</b>";
        table += "</td>";
        table += "</tr>";
        if (acordoNivelServicoDTO.getTipo().equalsIgnoreCase("T")) {
          table +=
              generateSLATime(
                  document,
                  request,
                  acordoNivelServicoDTO,
                  acordoNivelServicoDTO.getIdAcordoNivelServico(),
                  usuarioDto);
          table +=
              generateAvailSLATime(
                  document,
                  request,
                  acordoNivelServicoDTO,
                  acordoNivelServicoDTO.getIdAcordoNivelServico(),
                  usuarioDto);
        } else if (acordoNivelServicoDTO.getTipo().equalsIgnoreCase("D")) {
          table +=
              generateAvailSLAAvailability(
                  document,
                  request,
                  response,
                  acordoNivelServicoDTO,
                  acordoNivelServicoDTO.getIdAcordoNivelServico(),
                  usuarioDto);
        }
      }
    }
    if (colReqs != null && colReqs.size() > 0) {
      table += "<tr>";
      table += "<td>";
      table += "&nbsp;";
      table += "</td>";
      table += "</tr>";
      table += "<tr>";
      table += "<td>";
      table += "<b>" + UtilI18N.internacionaliza(request, "sla.avaliacao.requisito") + "</b>";
      table += "</td>";
      table += "</tr>";
      for (Iterator it = colReqs.iterator(); it.hasNext(); ) {
        RequisitoSLADTO requisitoSLADTO = (RequisitoSLADTO) it.next();
        List lst = controleGenerateSLAPorRequisitoSLA.execute(requisitoSLADTO.getIdRequisitoSLA());
        double qtdeDentroPrazo = 0;
        double qtdeForaPrazo = 0;
        if (lst != null && lst.size() > 0) {
          for (Iterator itSLA = lst.iterator(); itSLA.hasNext(); ) {
            Object[] objs = (Object[]) itSLA.next();
            if (((String) objs[0]).indexOf("Fora") > -1 || ((String) objs[0]).indexOf("Out") > -1) {
              qtdeForaPrazo = (Double) objs[2];
            } else {
              qtdeDentroPrazo = (Double) objs[2];
            }
          }
        }
        double qtdeDentroPrazoPerc = (qtdeDentroPrazo / (qtdeDentroPrazo + qtdeForaPrazo)) * 100;
        double qtdeForaPrazoPerc = (qtdeForaPrazo / (qtdeDentroPrazo + qtdeForaPrazo)) * 100;

        final DefaultValueDataset dataset =
            new DefaultValueDataset(new Double(qtdeDentroPrazoPerc));

        // create the chart...
        final ThermometerPlot plot = new ThermometerPlot(dataset);
        final JFreeChart chart =
            new JFreeChart(
                UtilI18N.internacionaliza(request, "sla.avaliacao.avaliacaogeral"), // chart title
                JFreeChart.DEFAULT_TITLE_FONT,
                plot, // plot
                false); // include legend

        plot.setSubrangeInfo(ThermometerPlot.NORMAL, 90.000001, 100);
        plot.setSubrangeInfo(ThermometerPlot.WARNING, 80.000001, 90);
        plot.setSubrangeInfo(ThermometerPlot.CRITICAL, 0, 80);

        plot.setThermometerStroke(new BasicStroke(2.0f));
        plot.setThermometerPaint(Color.lightGray);

        String nomeImgAval =
            CITCorporeUtil.caminho_real_app
                + "/tempFiles/"
                + usuarioDto.getIdUsuario()
                + "/avalREQSLA_"
                + requisitoSLADTO.getIdRequisitoSLA()
                + ".png";
        String nomeImgAvalRel =
            br.com.citframework.util.Constantes.getValue("SERVER_ADDRESS")
                + br.com.citframework.util.Constantes.getValue("CONTEXTO_APLICACAO")
                + "/tempFiles/"
                + usuarioDto.getIdUsuario()
                + "/avalREQSLA_"
                + requisitoSLADTO.getIdRequisitoSLA()
                + ".png";
        File arquivo = new File(nomeImgAval);

        if (arquivo.exists()) {
          arquivo.delete();
        } else {
          String nomeDir =
              CITCorporeUtil.caminho_real_app + "/tempFiles/" + usuarioDto.getIdUsuario() + "/";
          File dirTemp = new File(nomeDir);
          dirTemp.mkdirs();
          arquivo.createNewFile();
        }

        ChartUtilities.saveChartAsPNG(arquivo, chart, 500, 200);

        List lst2 =
            controleGenerateSLAPorRequisitoSLAEmAndamento.execute(
                requisitoSLADTO.getIdRequisitoSLA());
        qtdeDentroPrazo = 0;
        qtdeForaPrazo = 0;
        if (lst2 != null && lst2.size() > 0) {
          for (Iterator itSLA = lst2.iterator(); itSLA.hasNext(); ) {
            Object[] objs = (Object[]) itSLA.next();
            if (((String) objs[0]).indexOf("Fora") > -1 || ((String) objs[0]).indexOf("Out") > -1) {
              qtdeForaPrazo = (Double) objs[2];
            } else {
              qtdeDentroPrazo = (Double) objs[2];
            }
          }
        }
        qtdeDentroPrazoPerc = (qtdeDentroPrazo / (qtdeDentroPrazo + qtdeForaPrazo)) * 100;
        qtdeForaPrazoPerc = (qtdeForaPrazo / (qtdeDentroPrazo + qtdeForaPrazo)) * 100;

        DefaultPieDataset datasetPie = new DefaultPieDataset();
        datasetPie.setValue(
            UtilI18N.internacionaliza(request, "sla.avaliacao.noprazo")
                + " ("
                + UtilFormatacao.formatDouble(qtdeDentroPrazo, 0)
                + ")",
            new Double(qtdeDentroPrazoPerc));
        datasetPie.setValue(
            UtilI18N.internacionaliza(request, "sla.avaliacao.foraprazo")
                + " ("
                + UtilFormatacao.formatDouble(qtdeForaPrazo, 0)
                + ")",
            new Double(qtdeForaPrazoPerc));

        JFreeChart chartX =
            ChartFactory.createPieChart(
                UtilI18N.internacionaliza(request, "sla.avaliacao.emandamento"), // chart title
                datasetPie, // data
                true, // include legend
                false,
                false);

        PiePlot plotPie = (PiePlot) chartX.getPlot();
        plotPie.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
        plotPie.setNoDataMessage(UtilI18N.internacionaliza(request, "sla.avaliacao.naohadados"));
        plotPie.setCircular(false);
        plotPie.setLabelGap(0.02);

        String nomeImgAval2 =
            CITCorporeUtil.caminho_real_app
                + "/tempFiles/"
                + usuarioDto.getIdUsuario()
                + "/avalREQSLA2_"
                + requisitoSLADTO.getIdRequisitoSLA()
                + ".png";
        String nomeImgAvalRel2 =
            br.com.citframework.util.Constantes.getValue("SERVER_ADDRESS")
                + br.com.citframework.util.Constantes.getValue("CONTEXTO_APLICACAO")
                + "/tempFiles/"
                + usuarioDto.getIdUsuario()
                + "/avalREQSLA2_"
                + requisitoSLADTO.getIdRequisitoSLA()
                + ".png";
        File arquivo2 = new File(nomeImgAval2);
        if (arquivo2.exists()) {
          arquivo2.delete();
        }
        ChartUtilities.saveChartAsPNG(arquivo2, chartX, 200, 200);

        table += "<tr>";
        table += "<td style='border:1px solid black; vertical-align:middle;'>";
        table += UtilHTML.encodeHTML(UtilStrings.retiraApostrofe(requisitoSLADTO.getAssunto()));
        table += "</td>";
        table += "<td style='border:1px solid black; vertical-align:middle;'>";
        if (requisitoSLADTO.getSituacao() != null
            && requisitoSLADTO.getSituacao().equalsIgnoreCase("A")) {
          table +=
              "<img src='"
                  + br.com.citframework.util.Constantes.getValue("SERVER_ADDRESS")
                  + br.com.citframework.util.Constantes.getValue("CONTEXTO_APLICACAO")
                  + "/imagens/bolaverde.png' border='0'  title='"
                  + UtilI18N.internacionaliza(request, "requisitosla.ativo")
                  + "'/>";
          table += UtilI18N.internacionaliza(request, "requisitosla.ativo");
        } else if (requisitoSLADTO.getSituacao() != null
            && requisitoSLADTO.getSituacao().equalsIgnoreCase("P")) {
          table +=
              "<img src='"
                  + br.com.citframework.util.Constantes.getValue("SERVER_ADDRESS")
                  + br.com.citframework.util.Constantes.getValue("CONTEXTO_APLICACAO")
                  + "/imagens/bolavermelha.png' border='0'  title='"
                  + UtilI18N.internacionaliza(request, "requisitosla.planejamento")
                  + "'/>";
          table += UtilI18N.internacionaliza(request, "requisitosla.planejamento");
        } else if (requisitoSLADTO.getSituacao() != null
            && requisitoSLADTO.getSituacao().equalsIgnoreCase("R")) {
          table +=
              "<img src='"
                  + br.com.citframework.util.Constantes.getValue("SERVER_ADDRESS")
                  + br.com.citframework.util.Constantes.getValue("CONTEXTO_APLICACAO")
                  + "/imagens/bolavermelha.png' border='0'  title='"
                  + UtilI18N.internacionaliza(request, "requisitosla.emrevisao")
                  + "'/>";
          table += UtilI18N.internacionaliza(request, "requisitosla.emrevisao");
        } else {
          table +=
              "<img src='"
                  + br.com.citframework.util.Constantes.getValue("SERVER_ADDRESS")
                  + br.com.citframework.util.Constantes.getValue("CONTEXTO_APLICACAO")
                  + "/imagens/bolavermelha.png' border='0'  title='"
                  + UtilI18N.internacionaliza(request, "requisitosla.inativo")
                  + "'/>";
          table += UtilI18N.internacionaliza(request, "requisitosla.inativo");
        }
        table += "</td>";
        table += "<td style='border:1px solid black'>";
        table += "<img src='" + nomeImgAvalRel + "' border='0'/>";
        table += "</td>";
        table += "<td style='border:1px solid black'>";
        table += "<img src='" + nomeImgAvalRel2 + "' border='0'/>";
        table += "</td>";
        table += "</tr>";
      }
    }
    table += "</table>";
    document.getElementById("divInfo").setInnerHTML(table);
  }
 public AprovacaoMudancaDao() {
   super(Constantes.getValue("DATABASE_ALIAS"), null);
   // TODO Auto-generated constructor stub
 }
 public CriterioAvaliacaoFornecedorDao() {
   super(Constantes.getValue("DATABASE_ALIAS"), null);
 }
 public LigacaoRequisicaoMudancaItemConfiguracaoDao() {
   super(Constantes.getValue("DATABASE_ALIAS"), null);
 }
 public FornecedorProdutoDao() {
   super(Constantes.getValue("DATABASE_ALIAS"), null);
 }
Esempio n. 22
0
 public EventoGrupoDao() {
   super(Constantes.getValue("DATABASE_ALIAS"), null);
 }
 public CopyOfFornecedorDao() {
   super(Constantes.getValue("DATABASE_ALIAS"), null);
 }
Esempio n. 24
0
 public StartDAO() {
   super(Constantes.getValue("DATABASE_ALIAS"), null);
 }
 public TipoDemandaServicoDao() {
   super(Constantes.getValue("DATABASE_ALIAS"), null);
 }
Esempio n. 26
0
  @Override
  public void load(DocumentHTML document, HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    UsuarioDTO usuario = WebUtil.getUsuario(request);
    if (usuario == null) {
      document.alert(UtilI18N.internacionaliza(request, "citcorpore.comum.sessaoExpirada"));
      document.executeScript(
          "window.location = '"
              + Constantes.getValue("SERVER_ADDRESS")
              + request.getContextPath()
              + "'");
      return;
    }

    HTMLSelect idTipoGerenciamento = (HTMLSelect) document.getSelectById("idTipoGerenciamento");
    idTipoGerenciamento.removeAllOptions();
    idTipoGerenciamento.addOption(
        "1", UtilI18N.internacionaliza(request, "citcorpore.comum.solicitacao"));
    idTipoGerenciamento.addOption("2", UtilI18N.internacionaliza(request, "problema.problema"));
    idTipoGerenciamento.addOption(
        "3", UtilI18N.internacionaliza(request, "menu.relatorio.gerMudanca"));

    HTMLSelect tipoDataEscalonamento = (HTMLSelect) document.getSelectById("tipoDataEscalonamento");
    tipoDataEscalonamento.removeAllOptions();
    tipoDataEscalonamento.addOption(
        "1", UtilI18N.internacionaliza(request, "citcorpore.comum.dataCriacao"));
    tipoDataEscalonamento.addOption(
        "2", UtilI18N.internacionaliza(request, "citcorpore.comum.dataUltimaOcorrencia"));

    preencherComboGrupoExecutor(document, request, response);

    HTMLSelect idTipoDemandaServico = (HTMLSelect) document.getSelectById("idTipoDemandaServico");
    idTipoDemandaServico.removeAllOptions();
    ArrayList<TipoDemandaServicoDTO> listaTipoDemandaServico;
    TipoDemandaServicoDao tipoDemandaServicoDao = new TipoDemandaServicoDao();
    listaTipoDemandaServico =
        (ArrayList<TipoDemandaServicoDTO>) tipoDemandaServicoDao.findByClassificacao("'R','I'");
    idTipoDemandaServico.addOption(
        "", UtilI18N.internacionaliza(request, "citcorpore.comum.selecione"));
    for (TipoDemandaServicoDTO tipoDemandaServicoDTO : listaTipoDemandaServico) {
      idTipoDemandaServico.addOption(
          String.valueOf(tipoDemandaServicoDTO.getIdTipoDemandaServico()),
          tipoDemandaServicoDTO.getNomeTipoDemandaServico());
    }

    HTMLSelect idPrioridade = (HTMLSelect) document.getSelectById("idPrioridade");
    idPrioridade.removeAllOptions();
    ArrayList<PrioridadeDTO> listaPrioridades;
    PrioridadeDao prioridadeDao = new PrioridadeDao();
    listaPrioridades = (ArrayList<PrioridadeDTO>) prioridadeDao.list();
    idPrioridade.addOption("", UtilI18N.internacionaliza(request, "citcorpore.comum.selecione"));
    for (PrioridadeDTO prioridadeDTO : listaPrioridades) {
      idPrioridade.addOption(
          String.valueOf(prioridadeDTO.getIdPrioridade()),
          Util.tratarAspasSimples(Util.retiraBarraInvertida(prioridadeDTO.getNomePrioridade())));
    }

    HTMLSelect urgencia = (HTMLSelect) document.getSelectById("urgencia");
    urgencia.removeAllOptions();
    urgencia.addOption("", UtilI18N.internacionaliza(request, "citcorpore.comum.selecione"));
    urgencia.addOption("B", UtilI18N.internacionaliza(request, "citcorpore.comum.baixa"));
    urgencia.addOption("M", UtilI18N.internacionaliza(request, "citcorpore.comum.media"));
    urgencia.addOption("A", UtilI18N.internacionaliza(request, "citcorpore.comum.alta"));

    HTMLSelect impacto = (HTMLSelect) document.getSelectById("impacto");
    impacto.removeAllOptions();
    impacto.addOption("", UtilI18N.internacionaliza(request, "citcorpore.comum.selecione"));
    impacto.addOption("B", UtilI18N.internacionaliza(request, "citcorpore.comum.baixa"));
    impacto.addOption("M", UtilI18N.internacionaliza(request, "citcorpore.comum.media"));
    impacto.addOption("A", UtilI18N.internacionaliza(request, "citcorpore.comum.alta"));

    HTMLSelect intervaloNotificacao = (HTMLSelect) document.getSelectById("intervaloNotificacao");
    intervaloNotificacao.removeAllOptions();
    // intervaloNotificacao.addOption("", UtilI18N.internacionaliza(request,
    // "citcorpore.comum.selecione")); Retirado o critério de obrigatório da tela, mas o banco
    // necessita de informação
    intervaloNotificacao.addOption("15", "15");
    intervaloNotificacao.addOption("30", "30");
    intervaloNotificacao.addOption("45", "45");
    intervaloNotificacao.addOption("60", "60   (1:00h)");
    intervaloNotificacao.addOption("75", "75   (1:15h)");
    intervaloNotificacao.addOption("90", "90   (1:30h)");
    intervaloNotificacao.addOption("105", "105 (1:45h)");
    intervaloNotificacao.addOption("120", "120 (2:00h)");
    intervaloNotificacao.addOption("135", "135 (2:15h)");
    intervaloNotificacao.addOption("150", "150 (2:30h)");
    intervaloNotificacao.addOption("165", "165 (2:45h)");
    intervaloNotificacao.addOption("180", "180 (3:00h)");
    intervaloNotificacao.addOption("195", "195 (3:15h)");
    intervaloNotificacao.addOption("210", "210 (3:30h)");
    intervaloNotificacao.addOption("225", "225 (3:45h)");
    intervaloNotificacao.addOption("240", "240 (4:00h)");
    intervaloNotificacao.addOption("255", "255 (4:15h)");
    intervaloNotificacao.addOption("270", "270 (4:30h)");
    intervaloNotificacao.addOption("285", "285 (4:45h)");
    intervaloNotificacao.addOption("300", "300 (5:00h)");
    intervaloNotificacao.addOption("315", "315 (5:15h)");
    intervaloNotificacao.addOption("330", "330 (5:30h)");
    intervaloNotificacao.addOption("345", "345 (5:45h)");
    intervaloNotificacao.addOption("360", "360 (6:00h)");

    HTMLSelect prazoExecucao = (HTMLSelect) document.getSelectById("prazoExecucao");
    prazoExecucao.removeAllOptions();
    prazoExecucao.addOption("", UtilI18N.internacionaliza(request, "citcorpore.comum.selecione"));
    prazoExecucao.addOption("15", "15");
    prazoExecucao.addOption("30", "30");
    prazoExecucao.addOption("45", "45");
    prazoExecucao.addOption("60", "60   (1:00h)");
    prazoExecucao.addOption("75", "75   (1:15h)");
    prazoExecucao.addOption("90", "90   (1:30h)");
    prazoExecucao.addOption("105", "105 (1:45h)");
    prazoExecucao.addOption("120", "120 (2:00h)");
    prazoExecucao.addOption("135", "135 (2:15h)");
    prazoExecucao.addOption("150", "150 (2:30h)");
    prazoExecucao.addOption("165", "165 (2:45h)");
    prazoExecucao.addOption("180", "180 (3:00h)");
    prazoExecucao.addOption("195", "195 (3:15h)");
    prazoExecucao.addOption("210", "210 (3:30h)");
    prazoExecucao.addOption("225", "225 (3:45h)");
    prazoExecucao.addOption("240", "240 (4:00h)");
    prazoExecucao.addOption("255", "255 (4:15h)");
    prazoExecucao.addOption("270", "270 (4:30h)");
    prazoExecucao.addOption("285", "285 (4:45h)");
    prazoExecucao.addOption("300", "300 (5:00h)");
    prazoExecucao.addOption("315", "315 (5:15h)");
    prazoExecucao.addOption("330", "330 (5:30h)");
    prazoExecucao.addOption("345", "345 (5:45h)");
    prazoExecucao.addOption("360", "360 (6:00h)");

    HTMLSelect prazoCriarProblema = (HTMLSelect) document.getSelectById("prazoCriarProblema");
    prazoCriarProblema.removeAllOptions();
    // prazoCriarProblema.addOption("", UtilI18N.internacionaliza(request,
    // "citcorpore.comum.selecione"));
    prazoCriarProblema.addOption("15", "15");
    prazoCriarProblema.addOption("30", "30");
    prazoCriarProblema.addOption("45", "45");
    prazoCriarProblema.addOption("60", "60   (1:00h)");
    prazoCriarProblema.addOption("75", "75   (1:15h)");
    prazoCriarProblema.addOption("90", "90   (1:30h)");
    prazoCriarProblema.addOption("105", "105 (1:45h)");
    prazoCriarProblema.addOption("120", "120 (2:00h)");
    prazoCriarProblema.addOption("135", "135 (2:15h)");
    prazoCriarProblema.addOption("150", "150 (2:30h)");
    prazoCriarProblema.addOption("165", "165 (2:45h)");
    prazoCriarProblema.addOption("180", "180 (3:00h)");
    prazoCriarProblema.addOption("195", "195 (3:15h)");
    prazoCriarProblema.addOption("210", "210 (3:30h)");
    prazoCriarProblema.addOption("225", "225 (3:45h)");
    prazoCriarProblema.addOption("240", "240 (4:00h)");
    prazoCriarProblema.addOption("255", "255 (4:15h)");
    prazoCriarProblema.addOption("270", "270 (4:30h)");
    prazoCriarProblema.addOption("285", "285 (4:45h)");
    prazoCriarProblema.addOption("300", "300 (5:00h)");
    prazoCriarProblema.addOption("315", "315 (5:15h)");
    prazoCriarProblema.addOption("330", "330 (5:30h)");
    prazoCriarProblema.addOption("345", "345 (5:45h)");
    prazoCriarProblema.addOption("360", "360 (6:00h)");

    preencherComboContrato(document, request, response);
  }
 public ReaberturaMudancaDao() {
   super(Constantes.getValue("DATABASE_ALIAS"), null);
 }