Exemplo n.º 1
0
 @Override
 @Transactional(readOnly = false)
 public boolean exist(final int id, final String nome) {
   LOGGER.debug(
       "::: "
           + this.getClass().getPackage().getName()
           + "."
           + this.getClass().getName()
           + ".exist() - Start :::::: ");
   boolean resultado = false;
   try {
     MapSqlParameterSource mapSqlParameterSource = new MapSqlParameterSource();
     mapSqlParameterSource.addValue("id", id, Types.INTEGER);
     mapSqlParameterSource.addValue("nome", nome, Types.VARCHAR);
     String queryStatement = this.getQueryStatement("acao", "exist");
     MotivoAcao acao =
         this.namedParameterJdbcTemplate.queryForObject(
             queryStatement, mapSqlParameterSource, new AcaoMapper());
     if (acao.getId() > 0) {
       resultado = true;
     }
   } catch (final org.springframework.dao.EmptyResultDataAccessException e) {
     LOGGER.debug(
         "::: "
             + this.getClass().getPackage().getName()
             + "."
             + this.getClass().getName()
             + ".exist() - EmptyResultDataAccessException :::::: ",
         e);
   } catch (final DataAccessException e) {
     LOGGER.debug(
         "::: "
             + this.getClass().getPackage().getName()
             + "."
             + this.getClass().getName()
             + ".exist() - DataAccessException :::::: ",
         e);
   } catch (final Exception e) {
     LOGGER.error(
         "::: "
             + this.getClass().getPackage().getName()
             + "."
             + this.getClass().getName()
             + ".exist() - Exception :::::: ",
         e);
   }
   LOGGER.debug(
       "::: "
           + this.getClass().getPackage().getName()
           + "."
           + this.getClass().getName()
           + ".exist() - End :::::: ");
   return resultado;
 }
Exemplo n.º 2
0
 @Override
 @Transactional(readOnly = false)
 public void update(MotivoAcao motivoAcao) {
   LOGGER.debug(
       "::: "
           + this.getClass().getPackage().getName()
           + "."
           + this.getClass().getName()
           + ".update() - Start :::::: ");
   try {
     MapSqlParameterSource mapSqlParameterSource = new MapSqlParameterSource();
     mapSqlParameterSource.addValue("id", motivoAcao.getId(), Types.INTEGER);
     mapSqlParameterSource.addValue("nome", motivoAcao.getNome().toUpperCase(), Types.VARCHAR);
     mapSqlParameterSource.addValue("statusId", motivoAcao.getStatus_id(), Types.INTEGER);
     String queryStatement = this.getQueryStatement("acao", "update");
     this.namedParameterJdbcTemplate.update(queryStatement, mapSqlParameterSource);
   } catch (final org.springframework.dao.EmptyResultDataAccessException e) {
     LOGGER.debug(
         "::: "
             + this.getClass().getPackage().getName()
             + "."
             + this.getClass().getName()
             + ".update() - EmptyResultDataAccessException :::::: ",
         e);
   } catch (final DataAccessException e) {
     LOGGER.debug(
         "::: "
             + this.getClass().getPackage().getName()
             + "."
             + this.getClass().getName()
             + ".update() - DataAccessException :::::: ",
         e);
   } catch (final Exception e) {
     LOGGER.error(
         "::: "
             + this.getClass().getPackage().getName()
             + "."
             + this.getClass().getName()
             + ".update() - Exception :::::: ",
         e);
   }
   LOGGER.debug(
       "::: "
           + this.getClass().getPackage().getName()
           + "."
           + this.getClass().getName()
           + ".update() - End :::::: ");
 }