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