/** * Lookup the specified type of Contact in the RP metadata. * * @param contactType what type to look up. * @return the {@link ContactPerson} or null. */ @Nullable public ContactPerson getContactPerson(final ContactPersonTypeEnumeration contactType) { if (null == getRPEntityDescriptor()) { return null; } final List<ContactPerson> contacts = getRPEntityDescriptor().getContactPersons(); if (null == contacts || contacts.isEmpty()) { log.trace("No Contacts found at all"); return null; } for (final ContactPerson contact : contacts) { if (contactType == contact.getType()) { return contact; } } log.trace("No matching Contacts found at all"); return null; }
/** {@inheritDoc} */ protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject) throws UnmarshallingException { EntityDescriptor entityDescriptor = (EntityDescriptor) parentSAMLObject; if (childSAMLObject instanceof Extensions) { entityDescriptor.setExtensions((Extensions) childSAMLObject); } else if (childSAMLObject instanceof Signature) { entityDescriptor.setSignature((Signature) childSAMLObject); } else if (childSAMLObject instanceof RoleDescriptor) { entityDescriptor.getRoleDescriptors().add((RoleDescriptor) childSAMLObject); } else if (childSAMLObject instanceof AffiliationDescriptor) { entityDescriptor.setAffiliationDescriptor((AffiliationDescriptor) childSAMLObject); } else if (childSAMLObject instanceof Organization) { entityDescriptor.setOrganization((Organization) childSAMLObject); } else if (childSAMLObject instanceof ContactPerson) { entityDescriptor.getContactPersons().add((ContactPerson) childSAMLObject); } else if (childSAMLObject instanceof AdditionalMetadataLocation) { entityDescriptor.getAdditionalMetadataLocations().add((AdditionalMetadataLocation) childSAMLObject); } else { super.processChildElement(parentSAMLObject, childSAMLObject); } }