Package healthwatcher.model.healthguide

Examples of healthwatcher.model.healthguide.HealthUnit


      if (!repUS.hasNext()) {
        out.println("</select></p></center></div>");
        out.println("<P> There isn't registered health units.</P>");
      } else {
        HealthUnit us;
        do {
          us = (HealthUnit) repUS.next();
         
          //#if relacional
          out.println("<option value=\"" + us.getId() + "\"> "
              + us.getDescription() + " </OPTION>");
          //#endif
         
          //#if norelacional
//@          out.println("<option value=\"" + us.getCode() + "\"> " //Thiago alterou aqui
//@              + us.getDescription() + " </OPTION>");
View Full Code Here


  }

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

        HealthUnit unit;
       
        try {
          if (! request.isAuthorized()) {
                throw new InvalidSessionException();
            }
         
          unit = (HealthUnit) request.get(UpdateHealthUnitSearch.HEALTH_UNIT);                       
           
            String descricao = request.getInput("descricao");           
            unit.setDescription(descricao);
            facade.updateHealthUnit(unit);
         
            out.println(HTMLCode.htmlPageAdministrator("Operation executed", "Health Unit updated"));

        } catch(Exception e){
View Full Code Here

      // O resultado da query � testado para saber
      // da exist�ncia de unidades de sa�de cadastradas.
      // Caso n�o existam uma exce��o � lan�ada.
      if (rs.next()) {
        HealthUnit us = search((new Long(rs.getString("codigo"))).longValue());
        listaUs.add(us);
      } else {
        throw new ObjectNotFoundException(ExceptionMessages.EXC_FALHA_PROCURA);
      }

      // O resultado da query � navegado, e cada
      // c�digo � informado � um m�todo (procura) que
      // monta uma unidade de s�ude a partir do c�digo.
      while (rs.next()) {
        HealthUnit us = new HealthUnit();
        us = search((new Long(rs.getString("codigo"))).longValue());
        listaUs.add(us);
      }
      rs.close();
      stmt.close();
View Full Code Here

      // O resultado da query � testado para saber
      //da exist�ncia de unidades de sa�de cadastradas.
      // Caso n�o existam uma exce��o � lan�ada.
      if (rs.next()) {
        HealthUnit us = partialSearch((new Long(rs.getString("codigo"))).longValue());
        listaUs.add(us);
      } else {
        throw new ObjectNotFoundException(ExceptionMessages.EXC_FALHA_PROCURA);
      }

      //     O resultado da query � navegado, e cada
      // c�digo � informado � um m�todo (procura) que
      // monta uma unidade de s�ude a partir do c�digo.
      while (rs.next()) {
        HealthUnit us = new HealthUnit();
        us = search((new Long(rs.getString("codigo"))).longValue());
        listaUs.add(us);
      }
      rs.close();
      stmt.close();
View Full Code Here

      // O resultado da query � testado para saber
      // da exist�ncia de unidades de sa�de relacionadas.
      // Caso n�o existam uma exce��o � lan�ada.
      if (rs.next()) {
        HealthUnit us = new HealthUnit();
        us = partialSearch((new Long(rs.getString("codigo"))).longValue());
        listaUS.add(us);
      } else {
        throw new ObjectNotFoundException(ExceptionMessages.EXC_FALHA_PROCURA);
      }

      // O resultado da query � navegado, e cada
      // c�digo � informado � um m�todo (procura) que
      // monta uma unidade de s�ude a partir do c�digo.
      while (rs.next()) {
        HealthUnit us = new HealthUnit();
        us = search((new Long(rs.getString("codigo"))).longValue());
        listaUS.add(us);
      }
      rs.close();
      stmt.close();
View Full Code Here

    }
  }

  public HealthUnit search(Long code) throws RepositoryException, ObjectNotFoundException {

    HealthUnit us = null;
    String sql = null;
    try {

      // Query montada para recuperar os relacionamentos de
      // unidades de sa�de com especialidades
      // filtrando pelo identificador da unidade.
      sql = "select * from scbs_unidadeespecialidade where " + "codigounidadesaude = '"
          + code + "'";

      Statement stmt = (Statement) this.mp.getCommunicationChannel();
      resultSet = stmt.executeQuery(sql);
      List specialities = new ArrayList();

      // Iterar nos resultados da query para recuperar as
      // especialidades e inserir em um conjunto
      // (RepositorioEspecialidadeArray)
      while (resultSet.next()) {
        try {
          MedicalSpeciality esp = specialityRep.search((new Long(resultSet
              .getString("codigoespecialidade"))).longValue());
          System.out.println("medicalspeciality: " + esp.getId() + " "
              + esp.getDescricao());
          specialities.add(esp);
        } catch (ObjectNotFoundException ex) {
        }
      }
      resultSet.close();
      stmt.close();

      // Query montada para recuperar a unidade de sa�de
      // usando o identificador da unidade informado como
      // par�metro do m�todo
      sql = "select * from scbs_unidadesaude where " + "codigo = '" + code + "'";

      stmt = (Statement) this.mp.getCommunicationChannel();
      resultSet = stmt.executeQuery(sql);

      if (resultSet.next()) {
        us = new HealthUnit(resultSet.getString("descricao"), specialities);

        //us.setId(resultSet.getLong("ID"));
        us.setId((new Long(resultSet.getString("codigo"))).longValue());

        //preparar para buscar em outra tabela as especialidades desta unidade de saude
        //depois vai chamar deepAccess() de RepositorioEspecialidadeBDR
      } else {
        throw new ObjectNotFoundException(ExceptionMessages.EXC_FALHA_PROCURA);
View Full Code Here

  public void remove(Long codigo) throws RepositoryException, ObjectNotFoundException {
  }

  public HealthUnit partialSearch(Long codigo) throws RepositoryException, ObjectNotFoundException {
    HealthUnit hu = null;
    String sql = null;
    try {
      // Query montada para recuperar a unidade de sa�de
      // usando o identificador da unidade informado como
      // par�metro do m�todo
      sql = "select * from scbs_unidadesaude where " + "codigo = '" + codigo + "'";

      Statement stmt = (Statement) this.mp.getCommunicationChannel();
      resultSet = stmt.executeQuery(sql);

      if (resultSet.next()) {
        hu = new HealthUnit();
        hu.setId((new Long(resultSet.getString("codigo"))).longValue());
        hu.setDescription(resultSet.getString("descricao"));
      } else {
        throw new ObjectNotFoundException(ExceptionMessages.EXC_FALHA_PROCURA);
      }
      resultSet.close();
      stmt.close();
View Full Code Here

    this.vetor[indice] = unit;
    indice++;
  }

  public HealthUnit search(Long code) throws RepositoryException, ObjectNotFoundException {
    HealthUnit response = null;
    int i = getIndex(code);
    if (i == indice) {
      throw new ObjectNotFoundException("Health unit not found");
    } else {
      response = vetor[i];
View Full Code Here

           
            out.println("<P><h3>Medical specialty: " + codigoEsp + "</h3></P>");
            out.println("<h3>Health units:</h3>");

            while (repUS.hasNext()) {
                HealthUnit us = (HealthUnit) repUS.next();
                out.println("<dd><dd>" + us.getDescription());            
            }
            out.println(HTMLCode.closeQueries());

        }catch (ObjectNotFoundException e) {
            out.println("<P> " + e.getMessage() + " </P>");
View Full Code Here

    return lista;
  }

  public HealthUnit searchHealthUnit(Long healthUnitCode) throws ObjectNotFoundException,
      RepositoryException, TransactionException {
    HealthUnit unit = null;
    try {
      getPm().beginTransaction();
      unit = healthUnitRecord.search(healthUnitCode);
      getPm().commitTransaction();
    } catch (TransactionException e) {
View Full Code Here

TOP

Related Classes of healthwatcher.model.healthguide.HealthUnit

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.