Пример #1
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();
  }
Пример #2
0
  public void restore(
      DocumentHTML document, HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    FluxoDTO fluxoDto = (FluxoDTO) document.getBean();
    fluxoDto = (FluxoDTO) getFluxoService().restore(fluxoDto);
    if (fluxoDto.getDataFim() != null)
      fluxoDto = getFluxoService().findByTipoFluxo(fluxoDto.getIdTipoFluxo());

    if (fluxoDto != null) {
      TipoFluxoDTO tipoFluxo = new TipoFluxoDTO();
      tipoFluxo.setIdTipoFluxo(fluxoDto.getIdTipoFluxo());
      tipoFluxo = (TipoFluxoDTO) getTipoFluxoService().restore(tipoFluxo);

      document.getElementById("nomeTipo").setValue(tipoFluxo.getNomeFluxo());
      HTMLForm form = document.getForm("form");
      form.setValues(fluxoDto);
    }
  }