public void carregaTodosMetaDados(
      DocumentHTML document, HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    DataBaseMetaDadosService data =
        (DataBaseMetaDadosService)
            ServiceLocator.getInstance().getService(DataBaseMetaDadosService.class, null);
    DataBaseMetaDadosUtil dataBaseMetaDadosUtil = new DataBaseMetaDadosUtil();
    VisaoDao visaoDao = new VisaoDao();
    Connection con = (Connection) visaoDao.getTransactionControler().getTransactionObject();
    String DB_SCHEMA =
        ParametroUtil.getValorParametroCitSmartHashMap(Enumerados.ParametroSistema.DB_SCHEMA, "");
    if (DB_SCHEMA == null || DB_SCHEMA.trim().equalsIgnoreCase("")) {
      DB_SCHEMA = "citsmart";
    }

    // Desabilitando as tabelas para garantir que as que não existam mais não fiquem ativas
    desabilitaTabelas();

    Collection colObsNegocio =
        dataBaseMetaDadosUtil.readTables(con, DB_SCHEMA, DB_SCHEMA, null, true);
    con.close();
    con = null;

    String carregados = "";

    for (Iterator it = colObsNegocio.iterator(); it.hasNext(); ) {
      ObjetoNegocioDTO objetoNegocioDTO = (ObjetoNegocioDTO) it.next();

      System.out.println("-----: Objeto de Negocio: " + objetoNegocioDTO.getNomeTabelaDB());
      carregados += objetoNegocioDTO.getNomeTabelaDB() + "<br>";

      Collection colObjs =
          getObjetoNegocioService().findByNomeTabelaDB(objetoNegocioDTO.getNomeTabelaDB());
      if (colObjs == null || colObjs.size() == 0) {
        System.out.println("----------: Criando....  " + objetoNegocioDTO.getNomeTabelaDB());
        getObjetoNegocioService().create(objetoNegocioDTO);
      } else {
        ObjetoNegocioDTO objetoNegocioAux = (ObjetoNegocioDTO) ((List) colObjs).get(0);
        objetoNegocioDTO.setIdObjetoNegocio(objetoNegocioAux.getIdObjetoNegocio());
        System.out.println(
            "----------: Atualizando....  "
                + objetoNegocioDTO.getNomeTabelaDB()
                + "    Id Interno: "
                + objetoNegocioAux.getIdObjetoNegocio());
        getObjetoNegocioService().update(objetoNegocioDTO);
      }
    }

    data.corrigeTabelaComplexidade();
    data.corrigeTabelaSla();
    data.corrigeTabelaFluxoServico();

    carregados = "<b>Finalizado!</b> <br><b>Tabelas carregadas:</b> <br>" + carregados;
    document.getElementById("divRetorno").setInnerHTML(carregados);
  }
Ejemplo n.º 2
0
  public void updateFromMap(
      final Map map,
      final Collection colCampos,
      final UsuarioDTO usuarioDto,
      final VisaoDao visaoDao,
      final HttpServletRequest request)
      throws Exception {
    final List lstParms = new ArrayList<>();
    final List lstWhere = new ArrayList<>();
    String strFields = "";
    String strWhere = "";
    final String strTable = this.generateFrom(colCampos);
    String sql = "UPDATE " + strTable + " ";
    for (final Iterator it = colCampos.iterator(); it.hasNext(); ) {
      final CamposObjetoNegocioDTO camposObjetoNegocioDTO = (CamposObjetoNegocioDTO) it.next();

      String strVal = "";
      if (camposObjetoNegocioDTO.getFormula() != null
          && !camposObjetoNegocioDTO.getFormula().trim().equalsIgnoreCase("")
          && !camposObjetoNegocioDTO
              .getTipoNegocio()
              .trim()
              .equalsIgnoreCase(MetaUtil.CLASS_AND_METHOD)) {
        strVal =
            this.executeFormula(camposObjetoNegocioDTO.getFormula(), map, camposObjetoNegocioDTO);
      } else {
        strVal = (String) map.get(camposObjetoNegocioDTO.getNomeDB().trim().toUpperCase());
      }
      if (!camposObjetoNegocioDTO.getPk().equalsIgnoreCase("S")) {
        if (strVal != null) {
          if (!strFields.equalsIgnoreCase("")) {
            strFields += ",";
          }
          strFields += "" + camposObjetoNegocioDTO.getNomeDB().trim() + " = ?";
          lstParms.add(
              MetaUtil.convertType(
                  camposObjetoNegocioDTO.getTipoDB().trim(),
                  strVal,
                  camposObjetoNegocioDTO.getPrecisionDB(),
                  request));
        }
      } else {
        if (strVal != null) {
          if (!strWhere.equalsIgnoreCase("")) {
            strWhere += " AND ";
          }
          strWhere += "" + camposObjetoNegocioDTO.getNomeDB() + " = ?";
          lstWhere.add(
              MetaUtil.convertType(
                  camposObjetoNegocioDTO.getTipoDB().trim(),
                  strVal,
                  camposObjetoNegocioDTO.getPrecisionDB(),
                  request));
        }
      }
    }
    sql += " SET " + strFields + " WHERE " + strWhere;

    lstParms.addAll(lstWhere);

    if (strFields != null && !strFields.trim().equalsIgnoreCase("")) {
      visaoDao.execUpdate(sql, lstParms.toArray());
      if (UtilStrings.nullToVazio(
              ParametroUtil.getValorParametroCitSmartHashMap(ParametroSistema.USE_LOG, "false"))
          .equalsIgnoreCase("true")) {
        new Thread(new RegistraLogDinamicView(lstParms.toArray(), "U", sql, usuarioDto, strTable))
            .start();
      }
    }

    if (!map.containsKey("REMOVED")) {
      map.put("REMOVED", "false");
    }
    String removed = (String) map.get("REMOVED");
    if (removed == null) {
      removed = "false";
    }
    if (removed.equalsIgnoreCase("X")) { // A nova arquitetura coloca esta informacao.
      removed = "true";
    }
    String sqlUltAtualizAndLogicDelete = "";
    if (removed.equalsIgnoreCase("true")) {
      sqlUltAtualizAndLogicDelete = "UPDATE " + strTable + " SET DELETED = 'Y' WHERE " + strWhere;
      try {
        visaoDao.execUpdate(sqlUltAtualizAndLogicDelete, lstWhere.toArray());
        if (UtilStrings.nullToVazio(
                ParametroUtil.getValorParametroCitSmartHashMap(ParametroSistema.USE_LOG, "false"))
            .equalsIgnoreCase("true")) {
          new Thread(
                  new RegistraLogDinamicView(
                      lstWhere.toArray(), "D", sqlUltAtualizAndLogicDelete, usuarioDto, strTable))
              .start();
        }
      } catch (final Exception e) {
        LOGGER.debug("SQL executado:" + sqlUltAtualizAndLogicDelete);
        throw new LogicException(
            "Não foi possí­vel realizar a exclusão do registro! Verifique se possui o Campo 'DELETED' do tipo CHAR(1) no Banco de dados!");
      }
    }
  }
Ejemplo n.º 3
0
  public Map createFromMap(
      final Map map,
      final Collection colCampos,
      final UsuarioDTO usuarioDto,
      final VisaoDao visaoDao,
      final HttpServletRequest request)
      throws Exception {
    final List lstParms = new ArrayList<>();
    String strValues = "";
    String strFields = "";

    if (colCampos == null) {
      LOGGER.debug("DinamicViewsServiceEjb - colCampos é null ");
    }

    final String strTable = this.generateFrom(colCampos);
    String sql = "INSERT INTO " + strTable.toLowerCase() + " ";
    if (colCampos != null) {
      for (final Iterator it = colCampos.iterator(); it.hasNext(); ) {
        final CamposObjetoNegocioDTO camposObjetoNegocioDTO = (CamposObjetoNegocioDTO) it.next();

        String strVal = "";
        if (camposObjetoNegocioDTO != null
            && camposObjetoNegocioDTO.getFormula() != null
            && !camposObjetoNegocioDTO.getFormula().trim().equalsIgnoreCase("")
            && !camposObjetoNegocioDTO
                .getTipoNegocio()
                .trim()
                .equalsIgnoreCase(MetaUtil.CLASS_AND_METHOD)) {
          strVal =
              this.executeFormula(camposObjetoNegocioDTO.getFormula(), map, camposObjetoNegocioDTO);
        } else {
          if (camposObjetoNegocioDTO != null) {
            strVal = (String) map.get(camposObjetoNegocioDTO.getNomeDB().trim());
          }
        }

        if (camposObjetoNegocioDTO != null
            && camposObjetoNegocioDTO.getSequence().equalsIgnoreCase("S")) {
          final int val =
              PersistenceEngine.getNextKey(
                  this.getDao().getAliasDB(),
                  strTable.toLowerCase(),
                  camposObjetoNegocioDTO.getNomeDB().trim().toLowerCase());

          if (!strValues.equalsIgnoreCase("")) {
            strValues += ",";
          }
          strValues += "?";

          if (!strFields.equalsIgnoreCase("")) {
            strFields += ",";
          }
          strFields += "" + camposObjetoNegocioDTO.getNomeDB().trim();

          map.put(camposObjetoNegocioDTO.getNomeDB().trim().toUpperCase(), "" + val);

          lstParms.add(val);
        } else {
          // Se o campo for obrigatório e o valor for null ou vazio, não pode continuar.
          if (camposObjetoNegocioDTO != null
              && camposObjetoNegocioDTO.getObrigatorio() != null
              && camposObjetoNegocioDTO.getObrigatorio().equalsIgnoreCase("S")) {
            if (strVal == null || strVal.trim().equals("")) {
              return map;
            }
          } else {
            /*
             * Desenvolvedor: euler.ramos e thiago.oliveira Data: 08/11/2013 Horário: 16h00min ID Citsmart: 123627 Motivo/Comentário: As telas
             * dinamic view não estavam
             * listando os registros que estavam com o campo deleted igual a null
             */
            if (camposObjetoNegocioDTO != null
                && camposObjetoNegocioDTO.getNome().equalsIgnoreCase("deleted")) {
              if (strVal == null || strVal.equals("")) {
                strVal = "n";
              }
            }
            // Se o campo não for obrigatório mas o valor for null, recebe vazio para garantir que
            // não de erro de sql (para campos tipo not null)
            if (strVal == null) {
              strVal = UtilStrings.nullToVazio(strVal);
            }
          }

          if (!strValues.equalsIgnoreCase("")) {
            strValues += ",";
          }
          strValues += "?";

          if (!strFields.equalsIgnoreCase("")) {
            strFields += ",";
          }
          if (camposObjetoNegocioDTO != null) {
            strFields += "" + camposObjetoNegocioDTO.getNomeDB().trim();
            lstParms.add(
                MetaUtil.convertType(
                    camposObjetoNegocioDTO.getTipoDB().trim(),
                    strVal,
                    camposObjetoNegocioDTO.getPrecisionDB(),
                    request));
          }
        }
      }
    }
    sql += "(" + strFields + ") VALUES (" + strValues + ")";
    visaoDao.execUpdate(sql, lstParms.toArray());

    if (UtilStrings.nullToVazio(
            ParametroUtil.getValorParametroCitSmartHashMap(ParametroSistema.USE_LOG, "false"))
        .equalsIgnoreCase("true")) {
      new Thread(new RegistraLogDinamicView(lstParms.toArray(), "I", sql, usuarioDto, strTable))
          .start();
    }

    return map;
  }
Ejemplo n.º 4
0
  /**
   * Este metodo trata do motor do sistema dinamico de gravacao de dados de visoes (montadas
   * dinamicamente)
   */
  @Override
  public void save(
      final UsuarioDTO usuarioDto,
      final DinamicViewsDTO dinamicViewDto,
      final Map map,
      final HttpServletRequest request)
      throws Exception {
    final VisaoRelacionadaDao visaoRelacionadaDao = new VisaoRelacionadaDao();
    final GrupoVisaoDao grupoVisaoDao = new GrupoVisaoDao();
    final GrupoVisaoCamposNegocioDao grupoVisaoCamposNegocioDao = new GrupoVisaoCamposNegocioDao();
    final CamposObjetoNegocioDao camposObjetoNegocioDao = new CamposObjetoNegocioDao();
    final VinculoVisaoDao vinculoVisaoDao = new VinculoVisaoDao();
    final ScriptsVisaoDao scriptsVisaoDao = new ScriptsVisaoDao();
    final MatrizVisaoDao matrizVisaoDao = new MatrizVisaoDao();
    final VisaoDao visaoDao = this.getDao();
    final TransactionControler tc = this.getDao().getTransactionControler();

    visaoRelacionadaDao.setTransactionControler(tc);
    grupoVisaoDao.setTransactionControler(tc);
    grupoVisaoCamposNegocioDao.setTransactionControler(tc);
    camposObjetoNegocioDao.setTransactionControler(tc);
    vinculoVisaoDao.setTransactionControler(tc);
    scriptsVisaoDao.setTransactionControler(tc);
    matrizVisaoDao.setTransactionControler(tc);

    final Integer idVisao = dinamicViewDto.getDinamicViewsIdVisao();
    final Collection colScripts = scriptsVisaoDao.findByIdVisao(idVisao);
    final HashMap mapScritps = new HashMap<>();
    if (colScripts != null) {
      for (final Iterator it = colScripts.iterator(); it.hasNext(); ) {
        final ScriptsVisaoDTO scriptsVisaoDTO = (ScriptsVisaoDTO) it.next();
        mapScritps.put(
            scriptsVisaoDTO.getTypeExecute() + "#" + scriptsVisaoDTO.getScryptType().trim(),
            scriptsVisaoDTO.getScript());
      }
    }

    final Collection colCamposPKPrincipal = new ArrayList<>();
    final Collection colCamposTodosPrincipal = new ArrayList<>();
    Collection colCamposTodosVinc = null;
    CamposObjetoNegocioDTO camposObjetoNegocioChaveMatriz = new CamposObjetoNegocioDTO();

    this.setInfoSave(idVisao, colCamposPKPrincipal, colCamposTodosPrincipal);

    final Collection colVisoesRelacionadas = visaoRelacionadaDao.findByIdVisaoPaiAtivos(idVisao);

    try {
      tc.start();

      if (this.isPKExists(colCamposPKPrincipal, map)) {
        String strScript =
            (String)
                mapScritps.get(
                    ScriptsVisaoDTO.SCRIPT_EXECUTE_SERVER
                        + "#"
                        + ScriptsVisaoDTO.SCRIPT_ONUPDATE.getName());
        if (strScript != null && !strScript.trim().equalsIgnoreCase("")) {
          final ScriptRhinoJSExecute scriptExecute = new ScriptRhinoJSExecute();
          final RuntimeScript runtimeScript = new RuntimeScript();
          final Context cx = Context.enter();
          final Scriptable scope = cx.initStandardObjects();
          scope.put("mapFields", scope, map);
          final String action = "UPDATE";
          scope.put("ACTION", scope, action);
          scope.put("userLogged", scope, usuarioDto);
          scope.put("transactionControler", scope, tc);
          scope.put("dinamicViewDto", scope, dinamicViewDto);
          scope.put("RuntimeScript", scope, runtimeScript);
          scope.put("language", scope, WebUtil.getLanguage(request));
          scriptExecute.processScript(
              cx,
              scope,
              strScript,
              VisaoServiceEjb.class.getName() + "_" + ScriptsVisaoDTO.SCRIPT_ONUPDATE.getName());
        }
        if (!dinamicViewDto.isAbortFuncaoPrincipal()) {
          this.updateFromMap(map, colCamposTodosPrincipal, usuarioDto, visaoDao, request);
          strScript =
              (String)
                  mapScritps.get(
                      ScriptsVisaoDTO.SCRIPT_EXECUTE_SERVER
                          + "#"
                          + ScriptsVisaoDTO.SCRIPT_AFTERUPDATE.getName());
          if (strScript != null && !strScript.trim().equalsIgnoreCase("")) {
            final ScriptRhinoJSExecute scriptExecute = new ScriptRhinoJSExecute();
            final RuntimeScript runtimeScript = new RuntimeScript();
            final Context cx = Context.enter();
            final Scriptable scope = cx.initStandardObjects();
            scope.put("mapFields", scope, map);
            final String action = "UPDATE";
            scope.put("ACTION", scope, action);
            scope.put("userLogged", scope, usuarioDto);
            scope.put("transactionControler", scope, tc);
            scope.put("dinamicViewDto", scope, dinamicViewDto);
            scope.put("RuntimeScript", scope, runtimeScript);
            scope.put("language", scope, WebUtil.getLanguage(request));
            scriptExecute.processScript(
                cx,
                scope,
                strScript,
                VisaoServiceEjb.class.getName()
                    + "_"
                    + ScriptsVisaoDTO.SCRIPT_AFTERUPDATE.getName());
          }
        }
      } else {
        String strScript =
            (String)
                mapScritps.get(
                    ScriptsVisaoDTO.SCRIPT_EXECUTE_SERVER
                        + "#"
                        + ScriptsVisaoDTO.SCRIPT_ONCREATE.getName());
        if (strScript != null && !strScript.trim().equalsIgnoreCase("")) {
          final ScriptRhinoJSExecute scriptExecute = new ScriptRhinoJSExecute();
          final RuntimeScript runtimeScript = new RuntimeScript();
          final Context cx = Context.enter();
          final Scriptable scope = cx.initStandardObjects();
          scope.put("mapFields", scope, map);
          final String action = "CREATE";
          scope.put("ACTION", scope, action);
          scope.put("userLogged", scope, usuarioDto);
          scope.put("transactionControler", scope, tc);
          scope.put("dinamicViewDto", scope, dinamicViewDto);
          scope.put("RuntimeScript", scope, runtimeScript);
          scope.put("language", scope, WebUtil.getLanguage(request));
          scriptExecute.processScript(
              cx,
              scope,
              strScript,
              VisaoServiceEjb.class.getName() + "_" + ScriptsVisaoDTO.SCRIPT_ONCREATE.getName());
        }
        if (!dinamicViewDto.isAbortFuncaoPrincipal()) {
          this.createFromMap(map, colCamposTodosPrincipal, usuarioDto, visaoDao, request);
          strScript =
              (String)
                  mapScritps.get(
                      ScriptsVisaoDTO.SCRIPT_EXECUTE_SERVER
                          + "#"
                          + ScriptsVisaoDTO.SCRIPT_AFTERCREATE.getName());
          if (strScript != null && !strScript.trim().equalsIgnoreCase("")) {
            final ScriptRhinoJSExecute scriptExecute = new ScriptRhinoJSExecute();
            final RuntimeScript runtimeScript = new RuntimeScript();
            final Context cx = Context.enter();
            final Scriptable scope = cx.initStandardObjects();
            scope.put("mapFields", scope, map);
            final String action = "CREATE";
            scope.put("ACTION", scope, action);
            scope.put("userLogged", scope, usuarioDto);
            scope.put("transactionControler", scope, tc);
            scope.put("dinamicViewDto", scope, dinamicViewDto);
            scope.put("RuntimeScript", scope, runtimeScript);
            scope.put("language", scope, WebUtil.getLanguage(request));
            scriptExecute.processScript(
                cx,
                scope,
                strScript,
                VisaoServiceEjb.class.getName()
                    + "_"
                    + ScriptsVisaoDTO.SCRIPT_AFTERCREATE.getName());
          }
        }
      }
      if (colVisoesRelacionadas != null) {
        for (final Iterator it = colVisoesRelacionadas.iterator(); it.hasNext(); ) {
          final VisaoRelacionadaDTO visaoRelacionadaDto = (VisaoRelacionadaDTO) it.next();
          final Collection colVinculos =
              vinculoVisaoDao.findByIdVisaoRelacionada(visaoRelacionadaDto.getIdVisaoRelacionada());

          final Object objFromHash =
              map.get(
                  VisaoRelacionadaDTO.PREFIXO_SISTEMA_TABELA_VINCULADA
                      + visaoRelacionadaDto.getIdVisaoFilha());
          VisaoDTO visaoDtoAux = new VisaoDTO();
          visaoDtoAux.setIdVisao(visaoRelacionadaDto.getIdVisaoFilha());
          visaoDtoAux = (VisaoDTO) visaoDao.restore(visaoDtoAux);
          MatrizVisaoDTO matrizVisaoDTO = new MatrizVisaoDTO();
          boolean ehMatriz = false;
          if (visaoDtoAux != null) {
            if (visaoDtoAux.getTipoVisao().equalsIgnoreCase(VisaoDTO.MATRIZ)) {
              ehMatriz = true;
              matrizVisaoDTO.setIdVisao(visaoDtoAux.getIdVisao());
              final Collection colMatriz = matrizVisaoDao.findByIdVisao(visaoDtoAux.getIdVisao());
              if (colMatriz != null && colMatriz.size() > 0) {
                matrizVisaoDTO = (MatrizVisaoDTO) colMatriz.iterator().next();
                camposObjetoNegocioChaveMatriz.setIdCamposObjetoNegocio(
                    matrizVisaoDTO.getIdCamposObjetoNegocio1());
                camposObjetoNegocioChaveMatriz.setIdObjetoNegocio(
                    matrizVisaoDTO.getIdObjetoNegocio());
                camposObjetoNegocioChaveMatriz =
                    (CamposObjetoNegocioDTO)
                        camposObjetoNegocioDao.restore(camposObjetoNegocioChaveMatriz);
              }
            }
          }

          if (HashMap.class.isInstance(objFromHash)) {
            final HashMap mapVinc = (HashMap) objFromHash;
            if (mapVinc != null) { // Se existir dados recebidos.
              final Collection colCamposPKVinc = new ArrayList<>();
              colCamposTodosVinc = new ArrayList<>();
              this.setInfoSave(
                  visaoRelacionadaDto.getIdVisaoFilha(), colCamposPKVinc, colCamposTodosVinc);
              // Grava os dados de informacoes vinculadas.
              if (this.isPKExists(colCamposPKVinc, mapVinc)) {
                this.updateFromMap(mapVinc, colCamposTodosVinc, usuarioDto, visaoDao, request);
              } else {
                this.createFromMap(mapVinc, colCamposTodosVinc, usuarioDto, visaoDao, request);
              }
            }
          } else if (Collection.class.isInstance(objFromHash)) {
            final Collection colVinc = (Collection) objFromHash;
            if (colVinc != null) {
              for (final Iterator it2 = colVinc.iterator(); it2.hasNext(); ) {
                Map mapVinc = (Map) it2.next();
                if (mapVinc != null) { // Se existir dados recebidos.
                  final Collection colCamposPKVinc = new ArrayList<>();
                  colCamposTodosVinc = new ArrayList<>();
                  this.setInfoSave(
                      visaoRelacionadaDto.getIdVisaoFilha(),
                      colCamposPKVinc,
                      colCamposTodosVinc); // *****
                  String tipoVinc = "";
                  if (colVinculos != null && colVinculos.size() > 0) {
                    final VinculoVisaoDTO vinculoVisaoDTO =
                        (VinculoVisaoDTO) ((List) colVinculos).get(0);
                    tipoVinc = vinculoVisaoDTO.getTipoVinculo();
                  }
                  if (ehMatriz) {
                    if (camposObjetoNegocioChaveMatriz != null) {
                      mapVinc.put(camposObjetoNegocioChaveMatriz.getNomeDB(), mapVinc.get("FLD_0"));
                    }
                    CamposObjetoNegocioDTO camposObjetoNegocioDTO = null;
                    if (colCamposPKVinc != null && colCamposPKVinc.size() > 0) {
                      for (final Iterator itVinc = colCamposPKVinc.iterator(); itVinc.hasNext(); ) {
                        camposObjetoNegocioDTO = (CamposObjetoNegocioDTO) itVinc.next();
                        if (!camposObjetoNegocioDTO
                            .getNomeDB()
                            .trim()
                            .equalsIgnoreCase(camposObjetoNegocioChaveMatriz.getNomeDB().trim())) {
                          mapVinc.put(
                              camposObjetoNegocioDTO.getNomeDB(),
                              map.get(camposObjetoNegocioDTO.getNomeDB()));
                        }
                      }
                    }
                    if (tipoVinc == null || tipoVinc.equalsIgnoreCase("")) {
                      tipoVinc = VinculoVisaoDTO.VINCULO_1_TO_N;
                    }
                  }
                  if (tipoVinc.equalsIgnoreCase(VinculoVisaoDTO.VINCULO_N_TO_N)) {
                    // Grava os dados de informacoes vinculadas.
                    if (this.isPKExists(colCamposPKVinc, mapVinc)) {
                      this.updateFromMap(
                          mapVinc, colCamposTodosVinc, usuarioDto, visaoDao, request);
                    } else {
                      this.createFromMap(
                          mapVinc, colCamposTodosVinc, usuarioDto, visaoDao, request);
                    }
                    this.processCreateVinc(
                        visaoRelacionadaDto, colVinculos, map, mapVinc, usuarioDto, request);
                  }
                  if (tipoVinc.equalsIgnoreCase(VinculoVisaoDTO.VINCULO_1_TO_N)) {
                    mapVinc = this.createUniqueMap(map, mapVinc); // ******
                    // Grava os dados de informacoes vinculadas.
                    if (this.isPKExists(colCamposPKVinc, mapVinc)) {
                      this.updateFromMap(
                          mapVinc, colCamposTodosVinc, usuarioDto, visaoDao, request);
                    } else {
                      this.createFromMap(
                          mapVinc, colCamposTodosVinc, usuarioDto, visaoDao, request);
                    }
                  }
                }
              }
            }
          }
        }
      }

      if (dinamicViewDto.getIdFluxo() != null || dinamicViewDto.getIdTarefa() != null) {
        new ExecucaoSolicitacaoServiceEjb()
            .executa(
                usuarioDto,
                tc,
                dinamicViewDto.getIdFluxo(),
                dinamicViewDto.getIdTarefa(),
                dinamicViewDto.getAcaoFluxo(),
                map,
                colCamposTodosPrincipal,
                colCamposTodosVinc);
      }

      tc.commit();
      tc.close();
    } catch (final Exception e) {
      this.rollbackTransaction(tc, e);
    }
  }