}
@SuppressWarnings("unchecked")
private PartyBean parseParty(SOAPEnvelope respEnvelope) {
PartyBean pb = new PartyBean();
pb.setFromRm(true);
// System.out.println("=== party envelope: " + respEnvelope);
OMElement partyRegistryObjectsElement = respEnvelope.getBody().getFirstElement();
OMElement registryObject = partyRegistryObjectsElement.getFirstElement();
//System.out.println("====> registryObject: " + registryObject);
// get the party group
OMAttribute groupAtt = registryObject.getAttribute(new QName("group"));
pb.setGroupName(groupAtt.getAttributeValue());
// set the party key
Iterator<OMElement> keyit = registryObject.getChildrenWithName(new QName(DEFAULT_RESPONSE_NAMESPACE, "key"));
if (keyit.hasNext()) {
OMElement keyElement = keyit.next();
String key = keyElement.getText();
pb.setPartyKey(key);
}
// originating source
Iterator<OMElement> origit = registryObject.getChildrenWithName(new QName(DEFAULT_RESPONSE_NAMESPACE, "originatingSource"));
if (origit.hasNext()) {
OMElement orig = origit.next();
OMAttribute typeAtt = orig.getAttribute(new QName("type"));
String origvalue = orig.getText();
// set originating source type
pb.setOriginateSourceType(typeAtt.getAttributeValue());
// set originating source type value
pb.setOriginateSourceValue(origvalue);
}
// originating source
Iterator<OMElement> partyIt = registryObject.getChildrenWithName(new QName(DEFAULT_RESPONSE_NAMESPACE, "party"));
if (partyIt.hasNext()) {
OMElement partyElement = partyIt.next();
// identifier
Iterator<OMElement> identifierIt = partyElement.getChildrenWithName(new QName(DEFAULT_RESPONSE_NAMESPACE, "identifier"));
if (identifierIt.hasNext()) {
OMElement identifierEle = identifierIt.next();
OMAttribute typeAtt = identifierEle.getAttribute(new QName("type"));
// set the identifier
pb.setIdentifierType(typeAtt.getAttributeValue());
pb.setIdentifierValue(identifierEle.getText());
}
// person name and name part
Iterator<OMElement> pNameIt = partyElement.getChildrenWithName(new QName(DEFAULT_RESPONSE_NAMESPACE, "name"));
if (pNameIt.hasNext()) {
OMElement pNameElement = pNameIt.next();
Iterator<OMElement> pNamePartIt = pNameElement.getChildrenWithName(new QName(DEFAULT_RESPONSE_NAMESPACE, "namePart"));
while (pNamePartIt.hasNext()) {
OMElement pnamePartElement = pNamePartIt.next();
OMAttribute typeAtt = pnamePartElement.getAttribute(new QName("type"));
String typeValue = typeAtt.getAttributeValue();
if (typeValue.equals("title")) {
// set the person title
pb.setPersonTitle(pnamePartElement.getText());
}
if (typeValue.equals("given")) {
// set the person givenname
pb.setPersonGivenName(pnamePartElement.getText());
}
if (typeValue.equals("family")) {
// set the person family name
pb.setPersonFamilyName(pnamePartElement.getText());
}
}
}
// location
Iterator<OMElement> locationIt = partyElement.getChildrenWithName(new QName(DEFAULT_RESPONSE_NAMESPACE, "location"));
if (locationIt.hasNext()) {
OMElement locElement = locationIt.next();
Iterator<OMElement> addressIt = locElement.getChildrenWithName(new QName(DEFAULT_RESPONSE_NAMESPACE, "address"));
if (addressIt.hasNext()) {
OMElement addressElement = addressIt.next();
Iterator<OMElement> electronicaddIt = addressElement.getChildrenWithName(new QName(DEFAULT_RESPONSE_NAMESPACE, "electronic"));
while (electronicaddIt.hasNext()) {
OMElement electronicElement = electronicaddIt.next();
OMAttribute typeAtt = electronicElement.getAttribute(new QName("type"));
OMElement valueElement = electronicElement.getFirstElement();
String typeValue = typeAtt.getAttributeValue();
if (typeValue.equals("url")) {
// set url
pb.setUrl(valueElement.getText());
}
if (typeValue.equals("email")) {
// set email
pb.setEmail(valueElement.getText());
}
}
}
}
}
pb.setRifcsContent(normalizerifcs(registryObject.toString()));
// System.out.println("=====> party rifcs content: " + pb.getRifcsContent());
return pb;
}