Esempio n. 1
0
  /**
   * Verifica depois exclui recurso
   *
   * @param recurso
   * @throws ECARException
   */
  public void excluir(RecursoRec recurso) throws ECARException {
    try {
      boolean excluir = true;
      if (contar(recurso.getEfItemEstContaEfiecs()) > 0) {
        List list = new ArrayList(recurso.getEfItemEstContaEfiecs());
        EfItemEstContaEfiec ocorrencia = (EfItemEstContaEfiec) list.get(0);

        excluir = false;
        throw new ECARException(
            "recurso.exclusao.erro.efItemEstContaEfiecs",
            null,
            new String[] {ocorrencia.getContaSistemaOrcEfiec()});
      }
      if (contar(recurso.getEfItemEstPrevisaoEfieps()) > 0) {
        List list = new ArrayList(recurso.getEfItemEstPrevisaoEfieps());
        EfItemEstPrevisaoEfiep ocorrencia = (EfItemEstPrevisaoEfiep) list.get(0);

        String iett =
            (ocorrencia.getItemEstruturaIett() != null)
                ? ocorrencia.getItemEstruturaIett().getSiglaIett()
                    + ": "
                    + ocorrencia.getItemEstruturaIett().getNomeIett()
                : "";
        String exercicio =
            (ocorrencia.getExercicioExe() != null)
                ? ocorrencia.getExercicioExe().getDescricaoExe()
                : "";
        String fonteRecurso =
            (ocorrencia.getFonteRecursoFonr() != null)
                ? ocorrencia.getFonteRecursoFonr().getNomeFonr()
                : "";

        excluir = false;
        throw new ECARException(
            "recurso.exclusao.erro.efItemEstPrevisaoEfieps",
            null,
            new String[] {iett, exercicio, fonteRecurso});
      }
      /*
       FIXME : Historico : Valida a existência no histórico antes de excluir.
      if(contar(recurso.getEfItemEstPrevhistEfiephs()) > 0){
      	List list = new ArrayList(recurso.getEfItemEstPrevhistEfiephs());
      	EfItemEstPrevhistEfieph ocorrencia = (EfItemEstPrevhistEfieph) list.get(0);

      	String iett = (ocorrencia.getItemEstruturaIett() != null) ? ocorrencia.getItemEstruturaIett().getSiglaIett() + ": " + ocorrencia.getItemEstruturaIett().getNomeIett() : "";
      	String exercicio = (ocorrencia.getExercicioExe() != null) ? ocorrencia.getExercicioExe().getDescricaoExe() : "";
      	String fonteRecurso = (ocorrencia.getFonteRecursoFonr() != null) ? ocorrencia.getFonteRecursoFonr().getNomeFonr() : "";

          excluir = false;
       throw new ECARException(
       		"recurso.exclusao.erro.efItemEstPrevhistEfiephs", null, new String[] {iett, exercicio, fonteRecurso});
      }
      */
      if (excluir) super.excluir(recurso);

    } catch (ECARException e) {
      this.logger.error(e);
      throw e;
    }
  }
Esempio n. 2
0
  /**
   * Verifica depois exclui
   *
   * @param sitDemanda
   * @throws ECARException
   */
  public void excluir(SitDemandaSitd sitDemanda) throws ECARException {
    try {
      boolean excluir = true;
      if (contar(sitDemanda.getRegDemandaRegds()) > 0) {
        excluir = false;
        throw new ECARException("sitDemanda.exclusao.erro.regDemandaRegds");
      }

      if (contar(sitDemanda.getVisaoSituacaoDemandas()) > 0) {
        excluir = false;
        throw new ECARException("sitDemanda.exclusao.erro.visoes");
      }
      // (SitDemandaSitd) VisaoDao.buscar(SitDemandaSitd.class,
      // Long.valueOf(Pagina.getParam(request, "codigo")))

      if (excluir) super.excluir(sitDemanda);
    } catch (ECARException e) {
      this.logger.error(e);
      throw e;
    }
  }