Package org.pathways.openciss.info.hmis.schema._3_0.hud_hmis

Examples of org.pathways.openciss.info.hmis.schema._3_0.hud_hmis.Destination


    if (ssp.getHouseholdID().getIDStr() != null) {
      headOfHouseholdID = getHeadOfHouseholdIDFromHouseholdID(ssp.getHouseholdID().getIDStr());
    } else if (ssp.getHouseholdID().getIDNum() != null) {
      headOfHouseholdID = getHeadOfHouseholdIDFromHouseholdID(ssp.getHouseholdID().getIDNum().toString());
    } else headOfHouseholdID = null;
    Household household = null;
    if (ssp.getHouseholdID().getIDStr() != null) {
      household = getHouseholdFromHouseholdID(ssp.getHouseholdID().getIDStr());
    } else if (ssp.getHouseholdID().getIDNum() != null) {
      household = getHouseholdFromHouseholdID(ssp.getHouseholdID().getIDNum().toString());
    } else {log.info("Couldn't look up household.");}
   
    // calculate FamilySize for this household (HUD HMIS XML doesn't use this; it just lists the members)
    // This is a very simplistic calculation, and doesn't dedup nor search by all elements with same household id
    //"/Sources/Source/Export/Household[HouseholdID/IDNum/text() = \"" + hid + "\"]/Members/Member", doc, XPathConstants.NODESET);
    //"/Sources/Source/Export/Household[HouseholdID/IDStr/text() = \"" + hid + "\"]/Members/Member", doc, XPathConstants.NODESET);
    try {
      log.info("Getting household members for household: " + household.getHouseholdID());
      List<Member> members= household.getMembers().getMember();
      //add all the household members
      int familySize = members.size();
      //add the head of household (there is always 1)
      familySize++;
      String familySizeCSV1= String.valueOf(familySize);
      log.info("Number of members for this household: " + familySizeCSV1);
      csv1Record[18] = familySizeCSV1;
    } catch (NullPointerException e) {
      log.info("Problem getting household members: ");// + e.toString());
      if (household.getHouseholdID().getIDStr() != null) {
        log.info("For family size, no members in household: " + household.getHouseholdID().getIDStr());
      } else if (household.getHouseholdID().getIDNum() != null) {
        log.info("For family size, no members in household: " + household.getHouseholdID().getIDNum());
      }
      log.info("So set family size equal to '1' for the head of household indicated");
      csv1Record[18] = "1";
    }
    //For CSV 1 Household Information, we look inside the siteserviceparticipation's personhistorical, but we should look into unnested personhistoricals as well
View Full Code Here


        xmlr13.next();
        if (xmlr13.isStartElement()) {
          if (xmlr13.getLocalName().equals("Household")) {
            xmlr13.require(XMLStreamConstants.START_ELEMENT, null, "Household");
            JAXBElement<Household> householdJAXB = unmarshaller.unmarshal(xmlr13, Household.class);
            Household household = (Household)householdJAXB.getValue();
            if (household.getHouseholdID().getIDStr() != null) {
              if (household.getHouseholdID().getIDStr().equals(householdID)) {
              //Then, use getHeadOfHouseholdSSNFromHousehold() method
                ssn = getHeadOfHouseholdSSNFromHousehold(household);
                break;
              }
            } else if (household.getHouseholdID().getIDNum() != null) {
              if ((household.getHouseholdID().getIDNum().toString()).equals(householdID)) {
              //Then, use getHeadOfHouseholdSSNFromHousehold() method
                ssn = getHeadOfHouseholdSSNFromHousehold(household);
                break;
              }
            }
View Full Code Here

        xmlr14.next();
        if (xmlr14.isStartElement()) {
          if (xmlr14.getLocalName().equals("Household")) {
            xmlr14.require(XMLStreamConstants.START_ELEMENT, null, "Household");
            JAXBElement<Household> householdJAXB = unmarshaller.unmarshal(xmlr14, Household.class);
            Household household = (Household)householdJAXB.getValue();
            if (household.getHouseholdID().getIDStr() != null) {
              if (household.getHouseholdID().getIDStr().equals(householdID)) {
                headOfHouseholdID = household.getHeadOfHouseholdID().getIDNum();
                break;
              }
            } else if (household.getHouseholdID().getIDNum() != null) {
              if ((household.getHouseholdID().getIDNum().toString()).equals(householdID)) {
                headOfHouseholdID = household.getHeadOfHouseholdID().getIDNum();
                break;
              }
            }
          }  
        }
View Full Code Here

    }
    return returnPerson;
  }
 
  Household  getHouseholdFromHouseholdID(String householdID) {
    Household returnHousehold = null;
    log.info("Attempting to get household for household id: " + householdID);
    //Using StAX to get all the household ids for File 2 Household Membership Generation
    JAXBContext jc = null;
    InputStream zis = openXMLStream(hudXMLURL);

    XMLStreamReader xmlr15 = null;
    try {
     
      // set up a StAX reader
      xmlr15 = xmlif.createXMLStreamReader(zis);
    } catch (Exception e) {
      log.info("exception caught creating StAX stream " + e.toString());
      e.printStackTrace();
    }
    try {
      jc = JAXBContext.newInstance(Household.class);
    } catch (JAXBException e) {
      e.toString();
      e.printStackTrace();
    }
    Unmarshaller unmarshaller = null;
    try {
      unmarshaller = jc.createUnmarshaller();
    } catch (JAXBException e) {
      log.info(e.toString());
      e.printStackTrace();
    }
    try {
      while(xmlr15.hasNext()) {
        //Get each household
        xmlr15.next();
        if (xmlr15.isStartElement()) {
          //log.info("name is:" + xmlr15.getLocalName());
          if (xmlr15.getLocalName().equals("Household"&& xmlr15.isStartElement()) {
            xmlr15.require(XMLStreamConstants.START_ELEMENT, null, "Household");
            JAXBElement<Household> householdJAXB = unmarshaller.unmarshal(xmlr15,Household.class);
            Household householdElement = (Household)householdJAXB.getValue();
            if (householdElement.getHouseholdID().getIDStr() != null) {
              if (householdElement.getHouseholdID().getIDStr().equals(householdID)) {
                log.info("found a matching household for household id: " + householdID);
                returnHousehold = householdElement;
                break;
              }
            } else if (householdElement.getHouseholdID().getIDNum() != null) {
              if (householdElement.getHouseholdID().getIDNum().toString().equals(householdID)) {
                log.info("found a matching household for household id: " + householdID);
                returnHousehold = householdElement;
                break;
              }
            } else {log.info("Couldn't find a household match in getHouseholdFromHouseholdID.");}
View Full Code Here

        for (Object item : o) {
          if (item instanceof IncomeSourceCode) {
            // get the effective date and the code
            //Get transaction Date and Time from IncomeAndSource/IncomeSourceCode@date_effective
            ///IncomeSourceCodeID/@dateEffective", incomeAndSource, XPathConstants.NODESET);
            IncomeSourceCode incomeSourceCode = (IncomeSourceCode)item;
            GregorianCalendar incomeSourceCodeDateEffectiveCalendar = incomeSourceCode.getDateEffective().toGregorianCalendar();
            SimpleDateFormat formatOutDate = new SimpleDateFormat("MMddyy");
            SimpleDateFormat formatOutTime = new SimpleDateFormat("HHmmss");
            formatOutDate.setCalendar(incomeSourceCodeDateEffectiveCalendar);
            Date date = incomeSourceCodeDateEffectiveCalendar.getTime();
            transactionDateCSV3 = formatOutDate.format(date);
            transactionTimeCSV3 = formatOutTime.format(date);
            //Get IncomeExpenseTypeCode
            incomeExpenseTypeCodeCSV3 = String.valueOf(incomeSourceCode.getValue());
            //xpath.evaluate("/IncomeSourceCode/text()", incomeAndSource, XPathConstants.NODESET)).item(0).getTextContent();
            //log.info("Problem getting income source code: " + e.toString());
            csv3Record[1] = transactionDateCSV3;
            csv1Record[1] = csv3Record[1];
            csv2Record[1] = csv3Record[1];
View Full Code Here

    if (household.getHouseholdID().getIDStr() != null) {
      log.info("Searching for family members of household with id: " + household.getHouseholdID().getIDStr());
    } else if (household.getHouseholdID().getIDNum() != null) {
      log.info("Searching for family members of household with id: " + household.getHouseholdID().getIDNum());
    }
    Members householdMembers;
    try
      householdMembers = household.getMembers();
      if (householdMembers.getMember().isEmpty()) {
        if (household.getHouseholdID().getIDStr() != null) {
          log.info("No household members found within householdID/IDStr: " + household.getHouseholdID().getIDStr());
        } else if (household.getHouseholdID().getIDNum() != null) {
          log.info("No household members found within householdID/IDNum: " + household.getHouseholdID().getIDNum());
        }
      } else {
        log.info("Number of household members found is: " + householdMembers.getMember().size());
      }
     
      for (Member member : householdMembers.getMember()) {
          csv2Record[5] = String.valueOf(++householdMemberCounterCSV2);

        //Get the family member's relationship to the head of household
        String relationshipCodeCSV2;
        try {
View Full Code Here

    System.out.println("GET client called");
    String client;
    JAXBContext jc;
    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);
          } catch (DatatypeConfigurationException e) {e.printStackTrace();
          dobhc.setUnhashed(ds);
          p.setDateOfBirth(dobhc);
       
        Marshaller marshaller = jc.createMarshaller();
        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
        //NamespacePrefixMapper namespacePrefixMapper = new NamespacePrefixMapper();
        //marshaller.setProperty(  "com.sun.xml.bind.namespacePrefixMapper", namespacePrefixMapper);
View Full Code Here

    Integer clientID = null;
    System.out.println("POST data is: " + incomingXML);
    StringBuffer stringBuffer = new StringBuffer(incomingXML);
    try {
      //JAXBContext jc = JAXBContext.newInstance("info.hmis.schema._3_0.hud_hmis");
      Person person = new Person();
      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);
        }
      }
View Full Code Here

    Integer clientID = null;
    System.out.println("POST data is: " + incomingXML);
    StringBuffer stringBuffer = new StringBuffer(incomingXML);
    try {
      //JAXBContext jc = JAXBContext.newInstance("info.hmis.schema._3_0.hud_hmis");
      Person person = new Person();
      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?");}
View Full Code Here

  ArrayList<SiteServiceParticipation> getSiteServiceParticipationsForPersonIDInHouseholdID(BigInteger personID, String householdID) {
    ArrayList<SiteServiceParticipation> ssps;
    ArrayList<SiteServiceParticipation> returnedSsps = new ArrayList<SiteServiceParticipation>();

    //assumes there is only one Person record for each unique person ID
    Person person = getPersonByID(personID);
    ssps = (ArrayList<SiteServiceParticipation>) person.getSiteServiceParticipation();
    for (SiteServiceParticipation ssp : ssps) {
      String hhid = ssp.getHouseholdID().getIDStr();
      if (hhid != null && !hhid.isEmpty()) {
        if (hhid.equals(householdID)) {
          returnedSsps.add(ssp);
View Full Code Here

TOP

Related Classes of org.pathways.openciss.info.hmis.schema._3_0.hud_hmis.Destination

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.