Package healthwatcher.model.healthguide

Examples of healthwatcher.model.healthguide.HealthUnit


  }

  public void execute() throws Exception {
    PrintWriter out = response.getWriter();
   
    HealthUnit hu = null;
      
        try {
          if (! request.isAuthorized()) {
                throw new InvalidSessionException();
            }           

            //Complaint Normal
      String code = request.getInput("code");
      String description = request.getInput("description");     
     
      hu = new HealthUnit(description, null);
     
      //#if relacional
      hu.setId(Long.parseLong(code));
      //#endif
     
      //#if norelacional
//@      hu.setCode(Integer.parseInt(code)); //Thiago alterou aqui
      //#endif
View Full Code Here


              if (repTP==null||!repTP.hasNext()) {
                  out.println("</select></p></center></div>");
                  out.println("<p><font color=\"red\"><b> There isn't any health units.</b></font></p>");
              } else {
                  HealthUnit tp;
                  do {
                      tp = (HealthUnit) repTP.next();
                      out.println("<option value=\""      +
                                  tp.getId() + "\"> " +
                                  tp.getDescription()           +
                                  " </OPTION>");
                  } while (repTP.hasNext());
                  repTP.close();
                 
                  out.println("</select></p></center></div>");
View Full Code Here

  public void update(HealthUnit us) throws RepositoryException, ObjectNotFoundException,
  ObjectNotValidException {
    PersistenceManager pm = (PersistenceManager) this.mp.getCommunicationChannel();
    try {
      HealthUnit e = pm.getObjectById(HealthUnit.class, us.getId());
      e.setDescription(us.getDescription());
    } finally {
      pm.close();
    }
  }
View Full Code Here

      List<Long> ids = (List<Long>) q.execute();
      // 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 (!ids.isEmpty()) {
        HealthUnit us = search(ids.get(0));
        listaUs.add(us);
        try {
          ids.remove(0);
        } catch (UnsupportedOperationException uoe) {
          ids = new ArrayList<Long>(ids);
          ids.remove(0);
        }
      } 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 (!ids.isEmpty()) {
        HealthUnit us = new HealthUnit();
        us = search(ids.get(0));
        listaUs.add(us);
        ids.remove(0);
      }
      pm.close();
View Full Code Here

      List<Long> ids = (List<Long>) q.execute();
      // 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 (!ids.isEmpty()) {
        HealthUnit us = search(ids.get(0));
        listaUs.add(us);
        try {
          ids.remove(0);
        } catch (UnsupportedOperationException uoe) {
          ids = new ArrayList<Long>(ids);
          ids.remove(0);
        }
      } 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 (!ids.isEmpty()) {
        HealthUnit us = new HealthUnit();
        us = search(ids.get(0));
        listaUs.add(us);
        ids.remove(0);
      }
      pm.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 (!ids.isEmpty()) {
        Long n = Long.valueOf(ids.get(0).getId());
        HealthUnit us = search(n);
        listaUs.add(us);
        try {
          ids.remove(0);
        } catch (UnsupportedOperationException uoe) {
          ids = new ArrayList<HealthUnit>(ids);
          ids.remove(0);
        }
      } 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 (!ids.isEmpty()) {
        HealthUnit us = new HealthUnit();
        Long n = Long.valueOf(ids.get(0).getId());

        us = search(n);
        listaUs.add(us);
        ids.remove(0);
View Full Code Here

    }
  }

  public HealthUnit search(Long code) throws RepositoryException, ObjectNotFoundException {
    PersistenceManager pm = (PersistenceManager) mp.getCommunicationChannel();
    HealthUnit us = null;

    try{
      String query = ("select from "+HealthUnit.class.getName()+" where id == "+code+"");
      List<HealthUnit> unidade = (List<HealthUnit>)pm.newQuery(query).execute();
View Full Code Here

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

  public HealthUnit partialSearch(Long codigo) throws RepositoryException, ObjectNotFoundException {
    HealthUnit us = null;
    long asdf = codigo;
    int hehe = (int)asdf;
    try{
      PersistenceManager pm = (PersistenceManager) mp.getCommunicationChannel();

      String query = ("select from "+MedicalSpeciality.class.getName()+" where teste == "+hehe+"");
      List<MedicalSpeciality> listEsp = (List<MedicalSpeciality>)pm.newQuery(query).execute();
      List<MedicalSpeciality> specialities = new ArrayList<MedicalSpeciality>();
     
      if (!listEsp.isEmpty()) {
        MedicalSpeciality esp = specialityRep.search(listEsp.get(0).getId());
        specialities.add(esp);
        try {
          listEsp.remove(0);
        } catch (UnsupportedOperationException uoe) {
          listEsp = new ArrayList<MedicalSpeciality>(listEsp);
          listEsp.remove(0);
        }
      } else {
        //throw new ObjectNotFoundException(ExceptionMessages.EXC_FALHA_PROCURA);
      }

      while(!listEsp.isEmpty()){
        MedicalSpeciality ms = specialityRep.search(listEsp.get(0).getId());
        specialities.add(ms);
        listEsp.remove(0);
      }
     
      pm.close();
     
      pm = (PersistenceManager) mp.getCommunicationChannel();
      String queryUS = ("select from "+HealthUnit.class.getName()+" where teste == "+hehe+"");
      List<HealthUnit> listUs = (List<HealthUnit>)pm.newQuery(queryUS).execute();
     
      us = new HealthUnit(listUs.get(0).getDescription(), specialities);
     
    }catch(Exception e){
      e.printStackTrace();
    }
    return us;
View Full Code Here

                throw new InvalidSessionException();
            }       
       
            Long numUS = (new Long(request.getInput("numUS"))).longValue();
           
            HealthUnit unit = facade.searchHealthUnit(numUS);
            //#if relacional
            unit.addObserver(facade); //thiago alterou aqui
            //#endif
           
            request.put(UpdateHealthUnitSearch.HEALTH_UNIT, unit);
           
            out.println("Update Health Unit");
            out.println("<script language=\"javascript\">");
            out.println("function submeterDados(modulo)");
            out.println("{");
   
            String a1 = "\"";
            String a2 = "\"";
   
            out.println("   var f = document.formAlterarUnidade2;");
            out.println("   if(f.descricao.value ==" + a1 + a2 + ")");
            out.println("   {");
            out.println("           alert(\"Digite a nova descri��o da unidade!\");");
            out.println("           f.descricao.select();");
            out.println("           return;");
            out.println("   }");
            out.println("   f.submit();");
            out.println("}");
            out.println("//--></script>");
            out.println("<body><h1>Update Health unit:</h1>");
 
            out.println("<form method=\"POST\" name=\"formAlterarUnidade2\" action=\""+Constants.SYSTEM_ACTION+"?operation=UpdateHealthUnitData\">");
            out.println("<div align=\"center\"><center><h4>Unit: " + numUS + "</h4></center></div>");                     
            out.println("<div align=\"center\"><center><p><strong>Name:</strong><br><input type=\"text\" name=\"descricao\" value=\"" + unit.getDescription() + "\" size=\"60\"></p></center></div>");
            out.println("<div align=\"center\"><center><h4><input type=\"button\" value=\"Update\" name=\"bt1\" onClick=\"javascript:submeterDados();\"><input type=\"reset\" value=\"Clear\" name=\"bt2\"></h4></center></div></form>");
           
            out.println(HTMLCode.closeAdministrator());
       
    } catch (CommunicationException e) {
View Full Code Here

      } else if (subject instanceof Employee) {
        Employee employee = (Employee) subject;
        updateEmployee(employee);
       
      } else if (subject instanceof HealthUnit) {
        HealthUnit healthUnit = (HealthUnit) subject;
        updateHealthUnit(healthUnit);
       
      } else if (subject instanceof MedicalSpeciality) {
        updateMedicalSpeciality((MedicalSpeciality) subject);
       
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.