Example #1
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;
    }
    HTMLForm form = document.getForm("form");
    form.clear();
    SolicitacaoServicoDTO solicitacaoServicoDto = (SolicitacaoServicoDTO) document.getBean();
    SolicitacaoServicoService solicitacaoServicoService =
        (SolicitacaoServicoService)
            ServiceLocator.getInstance()
                .getService(SolicitacaoServicoService.class, WebUtil.getUsuarioSistema(request));
    CalendarioService calendarioService =
        (CalendarioService) ServiceLocator.getInstance().getService(CalendarioService.class, null);
    JustificativaSolicitacaoService justificativaService =
        (JustificativaSolicitacaoService)
            ServiceLocator.getInstance().getService(JustificativaSolicitacaoService.class, null);
    solicitacaoServicoDto =
        solicitacaoServicoService.restoreAll(solicitacaoServicoDto.getIdSolicitacaoServico());
    request.setAttribute("dataHoraSolicitacao", solicitacaoServicoDto.getDataHoraSolicitacaoStr());

    HTMLSelect slaACombinar = (HTMLSelect) document.getSelectById("slaACombinar");
    slaACombinar.addOption(
        "S", "-- " + UtilI18N.internacionaliza(request, "citcorpore.comum.acombinar") + " --");
    slaACombinar.addOption(
        "N", UtilI18N.internacionaliza(request, "citcorpore.comum.definirtempo"));

    Collection colJustificativas = justificativaService.listAtivasParaSuspensao();
    document.getSelectById("idJustificativa").removeAllOptions();
    document
        .getSelectById("idJustificativa")
        .addOption("", UtilI18N.internacionaliza(request, "citcorpore.comum.selecione"));
    if (colJustificativas != null) {
      document
          .getSelectById("idJustificativa")
          .addOptions(colJustificativas, "idJustificativa", "descricaoJustificativa", null);
    }

    Collection colCalendarios = calendarioService.list();
    document.getSelectById("idCalendario").removeAllOptions();
    document
        .getSelectById("idCalendario")
        .addOption("", UtilI18N.internacionaliza(request, "citcorpore.comum.selecione"));
    if (colCalendarios != null) {
      document
          .getSelectById("idCalendario")
          .addOptions(colCalendarios, "idCalendario", "descricao", null);
    }
    form.setValues(solicitacaoServicoDto);
    document.executeScript("verificaMudarTipoSLA()");
  }
  public void preencherComboGrupoExecutor(
      DocumentHTML document, HttpServletRequest request, HttpServletResponse response)
      throws ServiceException, Exception {

    HTMLSelect idGrupoAtual = (HTMLSelect) document.getSelectById("idGrupoAtual");
    idGrupoAtual.removeAllOptions();
    idGrupoAtual.addOption("", UtilI18N.internacionaliza(request, "citcorpore.comum.selecione"));
    GrupoService grupoSegurancaService =
        (GrupoService) ServiceLocator.getInstance().getService(GrupoService.class, null);
    Collection<GrupoDTO> colGrupos = grupoSegurancaService.listGruposServiceDesk();
    if (colGrupos != null) idGrupoAtual.addOptions(colGrupos, "idGrupo", "nome", null);
  }
  public void carregaComboQuest(
      DocumentHTML document, HttpServletRequest request, HttpServletResponse response)
      throws Exception {

    final QuestionarioService questionarioService =
        (QuestionarioService)
            ServiceLocator.getInstance().getService(QuestionarioService.class, null);

    final HTMLSelect comboQuestionario = document.getSelectById("idQuestionario");
    @SuppressWarnings("unchecked")
    final ArrayList<QuestionarioDTO> tipos = (ArrayList) questionarioService.list();
    comboQuestionario.removeAllOptions();
    if (tipos != null && tipos.size() > 0) {
      comboQuestionario.addOption(
          "", "-- " + UtilI18N.internacionaliza(request, "alcada.limite.todos") + " --");
      for (final QuestionarioDTO tipo : tipos) {
        comboQuestionario.addOption(
            tipo.getIdQuestionario().toString(),
            StringEscapeUtils.escapeEcmaScript(tipo.getNomeQuestionario()));
      }
    }
  }
  @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);
  }