Examples of PathClient


Examples of org.pathways.openciss.model.PathClient

public class PathClientService {
  public static EntityManager em;
 
  public PathClient getPathClient(int client_key) {
    PathClient result = null;
    em =EMF.get().createEntityManager();
    try {
      result = em.find(PathClient.class, client_key);
    }
    finally {em.close();}
View Full Code Here

Examples of org.pathways.openciss.model.PathClient

    em =EMF.get().createEntityManager();
    try{
       em.getTransaction().begin();
       //extract the client id
       int clientKey = pc.getClientKey();
       PathClient pcx = em.find(PathClient.class, clientKey);
       //need to make it check for nulls before updating
       if (pc.getNameFirst() !=null) {
         pcx.setNameFirst(pc.getNameFirst());
       }
       if (pc.getNameFirstAlias() !=null) {
         pcx.setNameFirstAlias(pc.getNameFirstAlias());
       }
       if (pc.getNameLast() !=null) {
         pcx.setNameLast(pc.getNameLast());
       }
       if (pc.getNameLastAlias() !=null) {
         pcx.setNameLastAlias(pc.getNameLastAlias());
       }
      
       if (pc.getNameMiddle() !=null) {
         pcx.setNameMiddle(pc.getNameMiddle());
       }
      
       if (pc.getDateOfBirth() !=null) {
         pcx.setDateOfBirth(pc.getDateOfBirth());
       }
       if (pc.getGenderCode() !=null) {
         pcx.setGenderCode(pc.getGenderCode());
       }
       if (pc.getSsn() != 0) {
         pcx.setSsn(pc.getSsn());
       }
       if (pc.getSsnQuality() != 0) {
         pcx.setSsnQuality(pc.getSsnQuality());
       }      
       if (pc.getInactive() != null) {
         Integer inactive = pc.getInactive();
         pcx.setInactive(inactive);
       }
      
       em.getTransaction().commit();
       result = true;
     }
View Full Code Here

Examples of org.pathways.openciss.model.PathClient

  public String deleteClient(@QueryParam("id") int clientID) {
    System.out.println("DELETE client called");
    //Person p = new Person();
    boolean b;
    PathClientService pcs = new PathClientService();
    PathClient pc = pcs.getPathClient(clientID);
    if (pc  != null) { // matching record found
      try {
        //b = (Boolean) pc.getInactive();
        b = (pc.getInactive())!=0;

        if (!b) { // that is, if active
          //byte by = (byte) (1);
          pc.setInactive(1); //make it inactive
          pcs.updatePathClient(pc);
        } // otherwise, it's already inactive, so leave it alone
        return "200";
      }
      catch (Exception e){e.printStackTrace();}
View Full Code Here

Examples of org.pathways.openciss.model.PathClient

    try {
      //jc = JAXBContext.newInstance("info.hmis.schema._3_0.hud_hmis");
      Person p = new Person();
      jc = JAXBContext.newInstance(p.getClass());
      PathClientService pcs = new PathClientService();
      PathClient pc = pcs.getPathClient(clientID);
      if (pc  != null) {
       
        HashingChoiceStamped hcs_fn = new HashingChoiceStamped();
        String50 s50_fn = (new String50());
        s50_fn.setValue(pc.getNameFirst());
        hcs_fn.setUnhashed(s50_fn);
        p.setLegalFirstName(hcs_fn)
       
        HashingChoiceStamped hcs_ln = new HashingChoiceStamped();
        String50 s50_ln = (new String50());
        s50_ln.setValue(pc.getNameLast());
        hcs_ln.setUnhashed(s50_ln);; 
        p.setLegalLastName(hcs_ln)
       
        String50 s50_mn = new String50();
        HashingChoiceStamped hcs_mn = new HashingChoiceStamped();
        s50_mn.setValue(pc.getNameMiddle());
        hcs_mn.setUnhashed(s50_mn);
        p.setLegalMiddleName(hcs_mn);
       
        int eth = pc.getEthnicityCode().intValue();
        if (Integer.valueOf(eth) != null ) {
          FourValDKRefusedHashingChoice fourVal_hc = new FourValDKRefusedHashingChoice();
          FourValDKRefusedStatic fourVal_Static = new FourValDKRefusedStatic();
          eth = EthnicityMap.map(eth);
          if (eth != -1) {
            fourVal_Static.setValue((long)eth);
            fourVal_hc.setUnhashed(fourVal_Static);
            p.setEthnicity(fourVal_hc);
          }
        }
       
        int gen = pc.getGenderCode().intValue();
        if (Integer.valueOf(gen) != null ) {
          SevenValDKRefusedHashingChoice sevenValDKRef_hc = new SevenValDKRefusedHashingChoice();
          SevenValDKRefused sevenValDKRef = new SevenValDKRefused();
          gen = GenderMap.map(gen);
          if (gen != -1) {
            sevenValDKRef.setValue((long)gen);
            sevenValDKRef_hc.setUnhashed(sevenValDKRef);
            p.setGender(sevenValDKRef_hc);
          }
        }
       
        try {
          int race = pc.getRaceCode().intValue();
          if (Integer.valueOf(race) != null ) {
            SevenValDKRefused2HashingChoiceStatic sevenValDKRef_hcs = new SevenValDKRefused2HashingChoiceStatic();
            SevenValDKRefused2Static sevenValDKRef2S = new SevenValDKRefused2Static();
            race = RaceMap.map(race);
            if (race != -1) {
              sevenValDKRef2S.setValue((long)race);
              sevenValDKRef_hcs.setUnhashed(sevenValDKRef2S);
              p.getRace().add(sevenValDKRef_hcs);
            }
          }
        } catch (Exception e){e.printStackTrace();}
        if (pc.getDateOfBirth() !=null) {
          DOBHashingChoice dobhc = new DOBHashingChoice();
          DateStatic ds = new DateStatic();
          GregorianCalendar c = new GregorianCalendar();
          c.setTime(pc.getDateOfBirth());
          try {
            XMLGregorianCalendar gc = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
            gc.setTimezone(DatatypeConstants.FIELD_UNDEFINED)
            gc.setTime(DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED)
            ds.setValue(gc);
View Full Code Here

Examples of org.pathways.openciss.model.PathClient

      JAXBContext jc = JAXBContext.newInstance(person.getClass());
      Unmarshaller unmarshaller = jc.createUnmarshaller();
      JAXBElement<?> p = unmarshaller.unmarshal(new StreamSource(new StringReader(stringBuffer.toString())), Person.class);
      Person pt = (Person)p.getValue();
      PathClientService pcs = new PathClientService();
      PathClient pc = new PathClient();
     
      try {
        String lfn = pt.getLegalFirstName().getUnhashed().getValue();
        if (lfn  != null) {
          pc.setNameFirst(lfn);
        }
      }
      catch(Exception e){log.info("Couldn't get LegalFirstName.  This is okay.");}
       
      try {
        String lln = pt.getLegalLastName().getUnhashed().getValue();
        if (lln  != null) {
          pc.setNameLast(lln);
        }
      }
      catch(Exception e){log.info("Couldn't get LegalLastName.  This is okay.");}
       
      try {
        String lmn = pt.getLegalMiddleName().getUnhashed().getValue();
        if (lmn  != null) {
          pc.setNameMiddle(lmn);
        }
      }
      catch(Exception e){log.info("Couldn't get LegalMiddleName.  This is okay.");}
       
      try {
        BigDecimal gender = new BigDecimal(pt.getGender().getUnhashed().getValue());
        if (gender  != null) {
          pc.setGenderCode(gender);
        }
      }
      catch(Exception e){log.info("Couldn't get Gender.  This is okay.");}
       
      try {       
        BigDecimal ethnicity = new BigDecimal(pt.getEthnicity().getUnhashed().getValue());
        if (ethnicity  != null) {
          pc.setEthnicityCode(ethnicity);
        }
      }
      catch(Exception e){log.info("Couldn't get Ethnicity.  This is okay.");}       
       
      try {       
        Date dob = pt.getDateOfBirth().getUnhashed().getValue().toGregorianCalendar().getTime();
        if (dob  != null) {
          pc.setDateOfBirth(dob);
        }
      }
      catch(Exception e){log.info("Couldn't get DoB.  This is okay.");}
     
      try {
        Integer ssn = Integer.valueOf(pt.getSocialSecurityNumber().getUnhashed().getValue());
        if (ssn  != null) {
          pc.setSsn(ssn);
        }
      }
      catch(Exception e){log.info("Couldn't get SSN.  This is okay.");}
     
      try {
        Integer ssnQualityCode = (int) pt.getSocialSecurityNumber().getSocialSecNumberQualityCode().getValue();
        if (ssnQualityCode  != null) {
          pc.setSsnQuality(ssnQualityCode);
        }
      }
      catch(Exception e){log.info("Couldn't get SSN Quality Code.  This is okay.");}
           
      //we only use int ids, not strings in openciss
      try {
        clientID = pt.getPersonID().getIDNum().intValue();
        if (clientID != 0) {
          pc.setClientKey(clientID);
        }
      }
      catch(Exception e){log.info("could not get person ID Number as an integer.  Maybe they sent strings or it is a client/add call?");}
     
      try {
        // assuming newly added clients aren't immediately inactivated
        if (pt.getPersonID().getDelete() == 1L) {
          pc.setInactive(1);
        } else {
          pc.setInactive(0);
        }
      }
      catch(Exception e){log.info("Could not set inactive to false");}
     
     
View Full Code Here

Examples of org.pathways.openciss.model.PathClient

      JAXBContext jc = JAXBContext.newInstance(person.getClass());
      Unmarshaller unmarshaller = jc.createUnmarshaller();
      JAXBElement<?> p = unmarshaller.unmarshal(new StreamSource(new StringReader(stringBuffer.toString())), Person.class);
      Person pt = (Person)p.getValue();
      PathClientService pcs = new PathClientService();
      PathClient pc = new PathClient();
     
      try {
        String lfn = pt.getLegalFirstName().getUnhashed().getValue();
        if (lfn  != null) {
          pc.setNameFirst(lfn);
        }
      }
      catch(Exception e){log.info("Couldn't get LegalFirstName.  This is okay.");}
       
      try {
        String lln = pt.getLegalLastName().getUnhashed().getValue();
        if (lln  != null) {
          pc.setNameLast(lln);
        }
      }
      catch(Exception e){log.info("Couldn't get LegalLastName.  This is okay.");}
       
      try {
        String lmn = pt.getLegalMiddleName().getUnhashed().getValue();
        if (lmn  != null) {
          pc.setNameMiddle(lmn);
        }
      }
      catch(Exception e){log.info("Couldn't get LegalMiddleName.  This is okay.");}
       
      try {
        BigDecimal gender = new BigDecimal(pt.getGender().getUnhashed().getValue());
        if (gender  != null) {
          pc.setGenderCode(gender);
        }
      }
      catch(Exception e){log.info("Couldn't get Gender.  This is okay.");}
       
      try {       
        BigDecimal ethnicity = new BigDecimal(pt.getEthnicity().getUnhashed().getValue());
        if (ethnicity  != null) {
          pc.setEthnicityCode(ethnicity);
        }
      }
      catch(Exception e){log.info("Couldn't get Ethnicity.  This is okay.");}       
       
      try {       
        Date dob = pt.getDateOfBirth().getUnhashed().getValue().toGregorianCalendar().getTime();
        if (dob  != null) {
          pc.setDateOfBirth(dob);
        }
      }
      catch(Exception e){log.info("Couldn't get DoB.  This is okay.");}
     
      try {
        Integer ssn = Integer.valueOf(pt.getSocialSecurityNumber().getUnhashed().getValue());
        if (ssn  != null) {
          pc.setSsn(ssn);
        }
      }
      catch(Exception e){log.info("Couldn't get SSN.  This is okay.");}
     
      try {
        Integer ssnQualityCode = (int) pt.getSocialSecurityNumber().getSocialSecNumberQualityCode().getValue();
        if (ssnQualityCode  != null) {
          pc.setSsnQuality(ssnQualityCode);
        }
      }
      catch(Exception e){log.info("Couldn't get SSN Quality Code.  This is okay.");}
     
      //we only use int ids, not strings in openciss
      try {
        clientID = pt.getPersonID().getIDNum().intValue();
        if (clientID != 0) {
          pc.setClientKey(clientID);
        }
      }
      catch(Exception e){log.info("could not get person ID Number as an integer.  Maybe they sent id strings?");}
     
      try {
        // assuming newly added clients aren't immediately inactivated
        pc.setInactive(0);
      }
      catch(Exception e){log.info("Could not set inactive to false");}
     
        //clientID = pcs.createPathClient(pc);
      //client_id  is -1 if not successful, a positive client id number if successful
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.