Search in sources :

Example 6 with RegistryObjectListType

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType in project ddf by codice.

the class RegistryPackageTypeHelper method populateLists.

private void populateLists() {
    serviceBindings.clear();
    services.clear();
    extrinsicObjects.clear();
    organizations.clear();
    persons.clear();
    associations.clear();
    if (registryPackageType == null) {
        return;
    }
    if (registryPackageType.isSetRegistryObjectList()) {
        RegistryObjectListType registryObjectList = registryPackageType.getRegistryObjectList();
        for (JAXBElement<? extends IdentifiableType> identifiableType : registryObjectList.getIdentifiable()) {
            RegistryObjectType registryObject = (RegistryObjectType) identifiableType.getValue();
            if (registryObject instanceof ExtrinsicObjectType) {
                extrinsicObjects.add((ExtrinsicObjectType) registryObject);
            } else if (registryObject instanceof ServiceType) {
                ServiceType service = (ServiceType) registryObject;
                services.add(service);
                serviceBindings.addAll(service.getServiceBinding());
            } else if (registryObject instanceof OrganizationType) {
                organizations.add((OrganizationType) registryObject);
            } else if (registryObject instanceof PersonType) {
                persons.add((PersonType) registryObject);
            } else if (registryObject instanceof AssociationType1) {
                associations.add((AssociationType1) registryObject);
            }
        }
    }
}
Also used : RegistryObjectListType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType) ServiceType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType) AssociationType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) PersonType(oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType) OrganizationType(oasis.names.tc.ebxml_regrep.xsd.rim._3.OrganizationType) RegistryObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType)

Example 7 with RegistryObjectListType

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType in project ddf by codice.

the class RegistryPackageConverter method parseRegistryObjectList.

private static void parseRegistryObjectList(RegistryObjectListType registryObjects, MetacardImpl metacard) throws RegistryConversionException {
    Map<String, Set<String>> associations = new HashMap<>();
    Map<String, RegistryObjectType> registryIds = new HashMap<>();
    List<OrganizationType> orgs = new ArrayList<>();
    List<PersonType> contacts = new ArrayList<>();
    String nodeId = "";
    for (JAXBElement identifiable : registryObjects.getIdentifiable()) {
        RegistryObjectType registryObject = (RegistryObjectType) identifiable.getValue();
        registryIds.put(registryObject.getId(), registryObject);
        if (registryObject instanceof ExtrinsicObjectType && RegistryConstants.REGISTRY_NODE_OBJECT_TYPE.equals(registryObject.getObjectType())) {
            nodeId = registryObject.getId();
            parseNodeExtrinsicObject(registryObject, metacard);
        } else if (registryObject instanceof ServiceType && RegistryConstants.REGISTRY_SERVICE_OBJECT_TYPE.equals(registryObject.getObjectType())) {
            parseRegistryService((ServiceType) registryObject, metacard);
        } else if (registryObject instanceof OrganizationType) {
            orgs.add((OrganizationType) registryObject);
        } else if (registryObject instanceof PersonType) {
            contacts.add((PersonType) registryObject);
        } else if (registryObject instanceof AssociationType1) {
            AssociationType1 association = (AssociationType1) registryObject;
            if (associations.containsKey(association.getSourceObject())) {
                associations.get(association.getSourceObject()).add(association.getTargetObject());
            } else {
                associations.put(association.getSourceObject(), new HashSet<>(Collections.singleton(association.getTargetObject())));
            }
        }
    }
    boolean orgFound = false;
    boolean contactFound = false;
    if (associations.get(nodeId) != null) {
        Set<String> nodeAssociations = associations.get(nodeId);
        RegistryObjectType ro;
        for (String id : nodeAssociations) {
            ro = registryIds.get(id);
            if (!orgFound && ro != null && ro instanceof OrganizationType) {
                parseRegistryOrganization((OrganizationType) ro, metacard);
                orgFound = true;
            } else if (!contactFound && ro != null && ro instanceof PersonType) {
                parseRegistryPerson((PersonType) ro, metacard);
                contactFound = true;
            }
        }
    }
    if (!orgFound && !orgs.isEmpty()) {
        parseRegistryOrganization(orgs.get(0), metacard);
    }
    if (!contactFound && !contacts.isEmpty()) {
        parseRegistryPerson(contacts.get(0), metacard);
    }
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AssociationType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) PersonType(oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType) JAXBElement(javax.xml.bind.JAXBElement) OrganizationType(oasis.names.tc.ebxml_regrep.xsd.rim._3.OrganizationType) ServiceType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType) RegistryObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType)

Example 8 with RegistryObjectListType

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType in project ddf by codice.

the class RegistryPackageTypeHelperTest method testGetExtrinsicObjectTypesFromRegistryObjectList.

@Test
public void testGetExtrinsicObjectTypesFromRegistryObjectList() throws Exception {
    RegistryObjectListType registryObjectList = ((RegistryPackageType) registryObject).getRegistryObjectList();
    List<ExtrinsicObjectType> extrinsicObjects = rptHelper.getExtrinsicObjects(registryObjectList);
    assertExtrinsicObjects(extrinsicObjects);
}
Also used : RegistryObjectListType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType) RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) Test(org.junit.Test)

Example 9 with RegistryObjectListType

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType in project ddf by codice.

the class RegistryPackageTypeHelperTest method testGetObjectsAssociatedToServiceFromRegistryObjectList.

@Test
public void testGetObjectsAssociatedToServiceFromRegistryObjectList() throws Exception {
    String testServiceId = "urn:service:id0";
    RegistryObjectListType registryObjectList = ((RegistryPackageType) registryObject).getRegistryObjectList();
    List<OrganizationType> organizations = rptHelper.getAssociatedObjects(registryObjectList, testServiceId, OrganizationType.class);
    assertThat(organizations, hasSize(1));
    assertThat(organizations.get(0).getId(), is(equalTo("urn:organization:id0")));
    List<PersonType> contacts = rptHelper.getAssociatedObjects(testServiceId, PersonType.class);
    assertThat(contacts, hasSize(1));
    assertThat(contacts.get(0).getId(), is(equalTo("urn:contact:id1")));
}
Also used : RegistryObjectListType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType) RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) PersonType(oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType) OrganizationType(oasis.names.tc.ebxml_regrep.xsd.rim._3.OrganizationType) Test(org.junit.Test)

Example 10 with RegistryObjectListType

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType in project nhin-d by DirectProject.

the class DefaultXdmXdsTransformer method getDocName.

protected String getDocName(SubmitObjectsRequest submitObjectRequest) {
    if (submitObjectRequest == null) {
        throw new IllegalArgumentException("SubmitObjectRequest must not be null.");
    }
    String ret = null;
    RegistryObjectListType rol = submitObjectRequest.getRegistryObjectList();
    List<JAXBElement<? extends IdentifiableType>> extensible = rol.getIdentifiable();
    for (JAXBElement<? extends IdentifiableType> elem : extensible) {
        String type = elem.getDeclaredType().getName();
        Object value = elem.getValue();
        if (StringUtils.equals(type, "oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType")) {
            String obId = ((ExtrinsicObjectType) value).getId();
            String mimeType = ((ExtrinsicObjectType) value).getMimeType();
            String suffix = "xml";
            if (mimeType.indexOf("xml") >= 0) {
                suffix = "xml";
            } else if (mimeType.indexOf("pdf") >= 0) {
                suffix = "pdf";
            }
            ret = obId + "." + suffix;
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace(type + " " + value.toString());
            }
        }
    }
    return ret;
}
Also used : RegistryObjectListType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType) IdentifiableType(oasis.names.tc.ebxml_regrep.xsd.rim._3.IdentifiableType) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) JAXBElement(javax.xml.bind.JAXBElement)

Aggregations

RegistryObjectListType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType)13 RegistryPackageType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType)10 ExtrinsicObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType)9 JAXBElement (javax.xml.bind.JAXBElement)6 AssociationType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1)6 Test (org.junit.Test)6 IdentifiableType (oasis.names.tc.ebxml_regrep.xsd.rim._3.IdentifiableType)5 OrganizationType (oasis.names.tc.ebxml_regrep.xsd.rim._3.OrganizationType)5 PersonType (oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType)5 ArrayList (java.util.ArrayList)3 RegistryObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType)3 ServiceType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType)3 HashMap (java.util.HashMap)2 QName (javax.xml.namespace.QName)2 SubmitObjectsRequest (oasis.names.tc.ebxml_regrep.xsd.lcm._3.SubmitObjectsRequest)2 ClassificationType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ClassificationType)2 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Set (java.util.Set)1 ExternalIdentifierType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ExternalIdentifierType)1