Package healthwatcher.model.complaint

Examples of healthwatcher.model.complaint.Complaint


  public Complaint search(Long code) throws RepositoryException, ObjectNotFoundException {
    // Query montada para obten��o do tipo de queixa referente ao
    // c�digo informado
    String sql = "SELECT tipoqueixa FROM scbs_queixa WHERE codigo = '" + code + "'";
    int tipoQueixa;
    Complaint q = null;

    try {
      Statement stmt = (Statement) this.mp.getCommunicationChannel();
      ResultSet rs = stmt.executeQuery(sql);

      if (rs.next()) {
        tipoQueixa = (new Integer(rs.getString("tipoqueixa"))).intValue();
      } else {
        throw new ObjectNotFoundException(ExceptionMessages.EXC_FALHA_PROCURA + " code: "
            + code);
      }
      rs.close();
      stmt.close();
    } catch (PersistenceMechanismException e) {
      throw new RepositoryException(ExceptionMessages.EXC_FALHA_PROCURA);
    } catch (SQLException e) {
      throw new SQLPersistenceMechanismException(ExceptionMessages.EXC_FALHA_PROCURA,sql);
    }

    // Dependendo do tipo da queixa o acesso aos dados � feito
    // por um m�todo espec�fico
    switch (tipoQueixa) {

    case Complaint.QUEIXA_ALIMENTAR:
      q = accessFood(code);
      break;

    case Complaint.QUEIXA_ANIMAL:
      q = accessAnimal(code);
      break;

    case Complaint.QUEIXA_DIVERSA:
      q = accessSpecial(code);
      break;

    default:
      throw new IllegalArgumentException();
    }
    long timestamp = searchTimestamp("scbs_queixa", q.getCodigo() + "");
    q.setTimestamp(timestamp);
    return q;
  }
View Full Code Here


  public IteratorDsk getComplaintList() throws ObjectNotFoundException, RepositoryException {
    List<Complaint> cList = new ArrayList<Complaint>();
    String sql = "SELECT * FROM scbs_queixa";
    ResultSet rs = null;
    Complaint complaint = null;
    try {
      Statement stmt = (Statement) this.mp.getCommunicationChannel();
      rs = stmt.executeQuery(sql);

      if (!rs.next()) {
View Full Code Here

  public void execute() throws Exception {
    PrintWriter out = response.getWriter();

    String obsQueixa = request.getInput("obsQueixa");
    Complaint q = null;

    try {
      if (! request.isAuthorized()) {
        throw new InvalidSessionException();
      }

      q = (Complaint) request
          .get(UpdateComplaintSearch.QUEIXA);
     
      q.setObservacao(obsQueixa);
      Calendar agora = Calendar.getInstance();
      q.setDataParecer(new lib.util.Date(
          agora.get(Calendar.DAY_OF_MONTH),
          agora.get(Calendar.MONTH), agora.get(Calendar.YEAR)));
      Employee employee = (Employee) request
          .get(Login.EMPLOYEE);
      q.setAtendente(employee);
      q.setSituacao(Situation.QUEIXA_FECHADA);
      facade.updateComplaint(q); //Thiago acrescentou aqui

      out.println(HTMLCode.htmlPageAdministrator("Operation executed",
          "Complaint updated"));
    } catch (Exception e) {
View Full Code Here

    return lista;
  }

  public Complaint searchComplaint(Long code) throws RepositoryException, ObjectNotFoundException,
      TransactionException {
    Complaint q = null;
    try {
      getPm().beginTransaction();
      q = this.complaintRecord.search(code);
      getPm().commitTransaction();
    } catch (RepositoryException e) {
View Full Code Here

TOP

Related Classes of healthwatcher.model.complaint.Complaint

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.