Package lib.exceptions

Examples of lib.exceptions.RepositoryException


        stmt.executeUpdate(sql);
        stmt.close();
      } catch (SQLException sqlException) {
        throw new SQLPersistenceMechanismException(ExceptionMessages.EXC_FALHA_BD,sql);
      } catch (PersistenceMechanismException mpException) {
        throw new RepositoryException(ExceptionMessages.EXC_FALHA_ATUALIZACAO);
      }finally {
                try {
                    mp.releaseCommunicationChannel();
                } catch (PersistenceMechanismException e) {
                    throw new RepositoryException(e.getMessage());
                }
            }
    } else {
      throw new ObjectNotValidException(ExceptionMessages.EXC_NULO);
    }
View Full Code Here


            resultSet  = stmt.executeQuery(sql);
            response = resultSet.next();
            resultSet.close();
            stmt.close();           
        } catch (PersistenceMechanismException e) {
            throw new RepositoryException(e.getMessage());
        } catch (SQLException e) {
            throw new SQLPersistenceMechanismException(e.getMessage(),sql);
        }
        return response;
    }
View Full Code Here

      }
      resultSet.close();
      stmt.close();
    } catch (PersistenceMechanismException e) {
      e.printStackTrace();
      throw new RepositoryException(ExceptionMessages.EXC_FALHA_BD);
    } catch (java.sql.SQLException e) {
      throw new SQLPersistenceMechanismException(ExceptionMessages.EXC_FALHA_BD,sql);
    }
    return complaint;
  }
View Full Code Here

        throw new ObjectNotFoundException(ExceptionMessages.EXC_FALHA_PROCURA);
      }
      resultSet.close();
      stmt.close();
    } catch (PersistenceMechanismException e) {
      throw new RepositoryException(ExceptionMessages.EXC_FALHA_BD);
    } catch (SQLException e) {
      throw new SQLPersistenceMechanismException(ExceptionMessages.EXC_FALHA_BD, sql);
    }
    return complaint;
  }
View Full Code Here

      // System.out.println("endereco solicitante" + codEndereco);
      Address endSol = addressRep.search(codEndereco);
      complaint.setEnderecoSolicitante(endSol);

    } catch (RepositoryException e) {
      throw new RepositoryException(ExceptionMessages.EXC_FALHA_BD);
    } catch (ObjectNotFoundException e) {
      throw new RepositoryException(ExceptionMessages.EXC_FALHA_BD);
    } catch (SQLException e) {
      throw new PersistenceMechanismException(ExceptionMessages.EXC_FALHA_BD);
    }

  }
View Full Code Here

      }
      resultSet.close();
      stmt.close();
    } catch (PersistenceMechanismException e) {
      e.printStackTrace();
      throw new RepositoryException(ExceptionMessages.EXC_FALHA_BD);
    } catch (SQLException e) {
      throw new SQLPersistenceMechanismException(ExceptionMessages.EXC_FALHA_BD,sql);
    }
    return complaint;
  }
View Full Code Here

                + complaint.getCodigo() + "'";
            ResultSet resultSet = stmt.executeQuery(sql);
            if (resultSet.next()) {
              timestamp = (new Long(resultSet.getString("ts"))).longValue();
              if (timestamp != complaint.getTimestamp()) {
                throw new RepositoryException(
                    ExceptionMessages.EXC_FALHA_ATUALIZACAO_COPIA);
              } else {
                complaint.incTimestamp();
              }
            } else {
              throw new ObjectNotFoundException(
                  ExceptionMessages.EXC_FALHA_ATUALIZACAO);
            }
            resultSet.close();
            stmt.close();
            stmt = (Statement) this.mp.getCommunicationChannel();
            sql = "update scbs_queixa set " + "observacao='"
                + complaint.getObservacao() + "', " + "situacao= '"
                + complaint.getSituacao() + "', ts= '"
                + complaint.getTimestamp() + "'";

            if (complaint.getAtendente() != null) {
              sql += ", funcionario= '" + complaint.getAtendente().getLogin() + "'";
            }
            if (complaint.getDataParecer() != null) {
              sql += ", dataparecer= '" + complaint.getDataParecer() + "'";
            }
            sql += " where codigo = '" + complaint.getCodigo() + "'";

            int response = stmt.executeUpdate(sql);
            if (response == 0) {
              throw new ObjectNotFoundException(
                  ExceptionMessages.EXC_FALHA_ATUALIZACAO);
            }
            stmt.close();
          } catch (SQLException e) {
            System.out.println(sql);
            throw new RepositoryException(ExceptionMessages.EXC_FALHA_BD);
          }
        } else {
          throw new ObjectNotValidException(ExceptionMessages.EXC_NULO);
        }
      } catch (PersistenceMechanismException e) {
        throw new RepositoryException(ExceptionMessages.EXC_FALHA_ATUALIZACAO);
      }
      updateTimestamp(complaint.getTimestamp() + "", "scbs_queixa", complaint.getCodigo()
          + "");
    }
  }
View Full Code Here

      Statement stmt = (Statement) this.mp.getCommunicationChannel();
      stmt.executeUpdate(sql);
      stmt.close();
    } catch (PersistenceMechanismException e) {
      throw new RepositoryException(ExceptionMessages.EXC_FALHA_BD);
    } catch (SQLException e) {
      throw new SQLPersistenceMechanismException(ExceptionMessages.EXC_FALHA_BD,sql);
    }
  }
View Full Code Here

      response = resultSet.next();

      resultSet.close();
      stmt.close();
    } catch (PersistenceMechanismException e) {
      throw new RepositoryException(e.getMessage());
    } catch (SQLException e) {
        throw new SQLPersistenceMechanismException(e.getMessage(),consulta);
    }
    return response;
  }
View Full Code Here

      } else {
        throw new ObjectNotValidException(ExceptionMessages.EXC_NULO);
      }
    } catch (PersistenceMechanismException e) {
      e.printStackTrace();
      throw new RepositoryException(ExceptionMessages.EXC_FALHA_INCLUSAO);
    } catch (SQLException e) {
      e.printStackTrace();
      throw new SQLPersistenceMechanismException(ExceptionMessages.EXC_FALHA_INCLUSAO,consulta);
     
    }
View Full Code Here

TOP

Related Classes of lib.exceptions.RepositoryException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.