Esempio n. 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()");
  }
Esempio n. 2
0
  public void restore(
      DocumentHTML document, HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    RegraEscalonamentoDTO regraEscalonamentoDTO = (RegraEscalonamentoDTO) document.getBean();
    RegraEscalonamentoService service =
        (RegraEscalonamentoService)
            ServiceLocator.getInstance()
                .getService(RegraEscalonamentoService.class, WebUtil.getUsuarioSistema(request));
    regraEscalonamentoDTO = (RegraEscalonamentoDTO) service.restore(regraEscalonamentoDTO);

    if ((regraEscalonamentoDTO != null)
        && (regraEscalonamentoDTO.getIdRegraEscalonamento() != null)) {

      EmpregadoService empregadoService =
          (EmpregadoService)
              ServiceLocator.getInstance()
                  .getService(EmpregadoService.class, WebUtil.getUsuarioSistema(request));
      if (regraEscalonamentoDTO.getIdSolicitante() != null) {
        EmpregadoDTO empregadoDTO =
            empregadoService.restoreByIdEmpregado(regraEscalonamentoDTO.getIdSolicitante());
        regraEscalonamentoDTO.setNomeSolicitante(
            ((empregadoDTO == null) || (empregadoDTO.getNome() == null))
                ? ""
                : empregadoDTO.getNome());
      }
      ServicoService servicoService =
          (ServicoService)
              ServiceLocator.getInstance()
                  .getService(ServicoService.class, WebUtil.getUsuarioSistema(request));
      if (regraEscalonamentoDTO.getIdServico() != null) {
        ServicoDTO servicoDTO = servicoService.findById(regraEscalonamentoDTO.getIdServico());
        regraEscalonamentoDTO.setServico(
            ((servicoDTO == null) || (servicoDTO.getNomeServico() == null))
                ? ""
                : servicoDTO.getNomeServico());
      }

      if (regraEscalonamentoDTO.getIdGrupo() != null) {
        GrupoService grupoService =
            (GrupoService)
                ServiceLocator.getInstance()
                    .getService(GrupoService.class, WebUtil.getUsuarioSistema(request));
        GrupoDTO grupoDTO = grupoService.listGrupoById(regraEscalonamentoDTO.getIdGrupo());
        regraEscalonamentoDTO.setGrupo(
            ((grupoDTO == null) || (grupoDTO.getDescricao() == null))
                ? ""
                : grupoDTO.getDescricao());
      }
    }
    atualizaTblGrupoExecutor(document, request, response, regraEscalonamentoDTO);
    HTMLForm form = document.getForm("form");
    form.clear();
    if (regraEscalonamentoDTO != null) {
      form.setValues(regraEscalonamentoDTO);
    }
  }
  public void save(DocumentHTML document, HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    if (document.getBean() == null) {
      document.alert(UtilI18N.internacionaliza(request, "MSG05"));
    } else {
      document.alert(UtilI18N.internacionaliza(request, "MSG06"));
    }

    final HTMLForm form = document.getForm("form");
    form.clear();
  }
Esempio n. 4
0
  public void save(DocumentHTML document, HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    FluxoDTO fluxoDto = (FluxoDTO) document.getBean();

    if (fluxoDto.getIdFluxo() == null || fluxoDto.getIdFluxo().intValue() == 0) {
      getFluxoService().create(fluxoDto);
    } else {
      getFluxoService().update(fluxoDto);
    }

    document.alert("Registro gravado com sucesso!");

    HTMLForm form = document.getForm("form");
    form.clear();
  }
Esempio n. 5
0
 public void excluir(
     DocumentHTML document, HttpServletRequest request, HttpServletResponse response)
     throws Exception {
   RegraEscalonamentoDTO regraEscalonamentoDTO = (RegraEscalonamentoDTO) document.getBean();
   RegraEscalonamentoService service =
       (RegraEscalonamentoService)
           ServiceLocator.getInstance().getService(RegraEscalonamentoService.class, null);
   if (regraEscalonamentoDTO.getIdRegraEscalonamento() != null) {
     service.delete(regraEscalonamentoDTO);
     document.alert(UtilI18N.internacionaliza(request, "regraEscalonamento.excluida"));
   }
   HTMLForm form = document.getForm("form");
   form.clear();
   document.setBean(new RegraEscalonamentoDTO());
   HTMLTable tblGrupoExecutor = document.getTableById("tblGrupoExecutor");
   tblGrupoExecutor.deleteAllRows();
 }
Esempio n. 6
0
 public void load(DocumentHTML document, HttpServletRequest request, HttpServletResponse response)
     throws Exception {
   String idSolicitacaoServicoStr = request.getParameter("idSolicitacao");
   if (idSolicitacaoServicoStr != null && idSolicitacaoServicoStr != "") {
     int idSolicitacaoServico = Integer.parseInt(idSolicitacaoServicoStr);
     OpiniaoService opiniaoService =
         (OpiniaoService) ServiceLocator.getInstance().getService(OpiniaoService.class, null);
     OpiniaoDTO opiniaoDto = new OpiniaoDTO();
     opiniaoDto = opiniaoService.findByIdSolicitacao(idSolicitacaoServico);
     if (opiniaoDto != null) {
       HTMLForm form = document.getForm("form");
       form.clear();
       form.setValues(opiniaoDto);
       form.lockForm();
       document.executeScript("$('#btnGravar').addClass('disabledButtons')");
       document.executeScript("$('#btnLimpar').addClass('disabledButtons')");
     }
   }
 }
Esempio n. 7
0
  /**
   * Inclui Novo Pesfil Acesso e AcessoMenu.
   *
   * @param document
   * @param request
   * @param response
   * @throws Exception
   * @author thays.araujo
   */
  public void save(DocumentHTML document, HttpServletRequest request, HttpServletResponse response)
      throws Exception {

    this.setPerfilAcessoBean((PerfilAcessoDTO) document.getBean());

    String[] acessoMenuSerializados =
        this.getPerfilAcessoBean().getAcessoMenuSerializados().split(";");
    Collection<PerfilAcessoMenuDTO> colPerfilAcessoMenuDTO = new ArrayList<PerfilAcessoMenuDTO>();
    for (String menus : acessoMenuSerializados) {
      String[] aux = menus.split("@");
      PerfilAcessoMenuDTO perfilAcessoMenu = new PerfilAcessoMenuDTO();
      perfilAcessoMenu.setIdMenu(new Integer(aux[0].trim()));
      String[] tiposAcesso = aux[1].split("-");
      perfilAcessoMenu.setGrava(tiposAcesso[1]);
      perfilAcessoMenu.setPesquisa(tiposAcesso[0]);
      perfilAcessoMenu.setDeleta(tiposAcesso[2]);
      colPerfilAcessoMenuDTO.add(perfilAcessoMenu);
      this.getPerfilAcessoBean().setAcessoMenus(colPerfilAcessoMenuDTO);
    }

    if (this.getPerfilAcessoBean().getIdPerfilAcesso() == null) {
      if (this.getPerfilAcessoService().verificarSePerfilAcessoExiste(this.getPerfilAcessoBean())) {
        document.alert(UtilI18N.internacionaliza(request, "citcorpore.comum.registroJaCadastrado"));
      } else {
        this.getPerfilAcessoService().create(this.getPerfilAcessoBean());
        document.alert(UtilI18N.internacionaliza(request, "MSG05"));
      }
    } else {
      if (this.getPerfilAcessoService().verificarSePerfilAcessoExiste(this.getPerfilAcessoBean())) {
        document.alert(UtilI18N.internacionaliza(request, "citcorpore.comum.registroJaCadastrado"));
      } else {
        this.getPerfilAcessoService().update(this.getPerfilAcessoBean());
        document.alert(UtilI18N.internacionaliza(request, "MSG06"));
      }
    }
    HTMLForm form = document.getForm("form");
    form.clear();

    document.executeScript("limpar_LOOKUP_PERFILACESSO()");
  }
Esempio n. 8
0
 public void save(DocumentHTML document, HttpServletRequest request, HttpServletResponse response)
     throws Exception {
   RegraEscalonamentoDTO regraEscalonamentoDTO = (RegraEscalonamentoDTO) document.getBean();
   RegraEscalonamentoService service =
       (RegraEscalonamentoService)
           ServiceLocator.getInstance().getService(RegraEscalonamentoService.class, null);
   Collection<EscalonamentoDTO> grupos_serialize =
       br.com.citframework.util.WebUtil.deserializeCollectionFromRequest(
           EscalonamentoDTO.class, "grupos_serialize", request);
   if (grupos_serialize != null) {
     regraEscalonamentoDTO.setColEscalonamentoDTOs(grupos_serialize);
   }
   if (regraEscalonamentoDTO != null && service != null) {
     regraEscalonamentoDTO.setCriaProblema(
         regraEscalonamentoDTO.getCriaProblema() == null
             ? "N"
             : regraEscalonamentoDTO.getCriaProblema());
     regraEscalonamentoDTO.setEnviarEmail(
         regraEscalonamentoDTO.getEnviarEmail() == null
             ? "N"
             : regraEscalonamentoDTO.getEnviarEmail());
     if (regraEscalonamentoDTO.getIdRegraEscalonamento() == null) {
       service.create(regraEscalonamentoDTO);
       document.alert(UtilI18N.internacionaliza(request, "MSG05"));
     } else {
       service.update(regraEscalonamentoDTO);
       document.alert(UtilI18N.internacionaliza(request, "MSG06"));
     }
     HTMLForm form = document.getForm("form");
     form.clear();
     document.setBean(new RegraEscalonamentoDTO());
     HTMLTable tblGrupoExecutor = document.getTableById("tblGrupoExecutor");
     tblGrupoExecutor.deleteAllRows();
     load(document, request, response);
   }
 }
Esempio n. 9
0
  /**
   * Exclui Perfil Acesso atribuindo sua data fim em Grupo.
   *
   * @param document
   * @param request
   * @param response
   * @throws Exception
   */
  public void delete(
      DocumentHTML document, HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    this.setPerfilAcessoBean((PerfilAcessoDTO) document.getBean());

    PerfilAcessoService perfilAcessoService =
        (PerfilAcessoService)
            ServiceLocator.getInstance().getService(PerfilAcessoService.class, null);

    if (this.getPerfilAcessoBean().getIdPerfilAcesso() != null) {

      if (perfilAcessoService.excluirPerfilDeAcesso(this.getPerfilAcessoBean())) {
        document.alert(UtilI18N.internacionaliza(request, "MSG07"));
      } else {
        document.alert(
            UtilI18N.internacionaliza(request, "citcorpore.comum.registroNaoPodeSerExcluido"));
      }
    }

    HTMLForm form = document.getForm("form");
    form.clear();

    document.executeScript("limpar_LOOKUP_PERFILACESSO()");
  }
 /**
  * Metodo colocar status Inativo quando for solicitado a exclusão do usuario.
  *
  * @param document
  * @param request
  * @param response
  * @throws Exception
  */
 public void delete(
     DocumentHTML document, HttpServletRequest request, HttpServletResponse response)
     throws Exception {
   final HTMLForm form = document.getForm("form");
   form.clear();
 }
Esempio n. 11
0
  public void restore(
      DocumentHTML document, HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    this.setPerfilAcessoBean((PerfilAcessoDTO) document.getBean());
    this.setPerfilAcessoBean(this.getPerfilAcessoService().restore(getPerfilAcessoBean()));
    HTMLForm form = document.getForm("form");
    form.clear();
    form.setValues(this.getPerfilAcessoBean());

    PerfilAcessoSituacaoOSService perfilAcessoSituacaoOSService =
        (PerfilAcessoSituacaoOSService)
            ServiceLocator.getInstance().getService(PerfilAcessoSituacaoOSService.class, null);
    PerfilAcessoSituacaoFaturaService perfilAcessoSituacaoFaturaService =
        (PerfilAcessoSituacaoFaturaService)
            ServiceLocator.getInstance().getService(PerfilAcessoSituacaoFaturaService.class, null);

    Collection colSituacoesOSPerfil =
        perfilAcessoSituacaoOSService.findByIdPerfil(
            this.getPerfilAcessoBean().getIdPerfilAcesso());
    Collection colSituacoesFaturaPerfil =
        perfilAcessoSituacaoFaturaService.findByIdPerfil(
            this.getPerfilAcessoBean().getIdPerfilAcesso());

    String[] valuesOs = null;
    if (colSituacoesOSPerfil != null && colSituacoesOSPerfil.size() > 0) {
      valuesOs = new String[colSituacoesOSPerfil.size()];
      int i = 0;
      for (Iterator it = colSituacoesOSPerfil.iterator(); it.hasNext(); ) {
        PerfilAcessoSituacaoOSDTO perfilAcessoSituacaoOSDTO = (PerfilAcessoSituacaoOSDTO) it.next();
        valuesOs[i] = "" + perfilAcessoSituacaoOSDTO.getSituacaoOs();
        if (valuesOs[i] != null) {
          document
              .getCheckboxById("situacaoos" + valuesOs[i].toString() + "")
              .setValue(valuesOs[i]);
        }
        i++;
      }
    }
    /*
     * if (valuesOs != null) { document.getCheckboxById("situacaoos").setValue(valuesOs); }
     */
    String[] valuesFatura = null;
    if (colSituacoesFaturaPerfil != null && colSituacoesFaturaPerfil.size() > 0) {
      valuesFatura = new String[colSituacoesFaturaPerfil.size()];
      int i = 0;
      for (Iterator it = colSituacoesFaturaPerfil.iterator(); it.hasNext(); ) {
        PerfilAcessoSituacaoFaturaDTO perfilAcessoSituacaoFaturaDTO =
            (PerfilAcessoSituacaoFaturaDTO) it.next();
        valuesFatura[i] = "" + perfilAcessoSituacaoFaturaDTO.getSituacaoFatura();
        if (valuesFatura[i] != null) {
          document
              .getCheckboxById("situacaoFatura" + valuesFatura[i].toString() + "")
              .setValue(valuesFatura[i]);
        }

        i++;
      }
    }
    /*
     * if (valuesFatura != null) { document.getCheckboxById("situacaoFatura").setValue(valuesFatura); }
     */

    this.montarArvoreDeMenus(document, request, response);
    document.executeScript("JANELA_AGUARDE_MENU.hide();");
  }