Search in sources :

Example 6 with AssociationType1

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

the class RegistryPackageWebConverterTest method getSecondAssociation.

private AssociationType1 getSecondAssociation() {
    AssociationType1 association = RIM_FACTORY.createAssociationType1();
    association.setId("urn:association:2");
    association.setAssociationType("RelatedTo");
    association.setSourceObject("urn:registry:node");
    association.setTargetObject("urn:organization:id0");
    return association;
}
Also used : AssociationType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1)

Example 7 with AssociationType1

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

the class RegistryPackageWebConverterTest method getFifthAssociation.

private AssociationType1 getFifthAssociation() {
    AssociationType1 association = RIM_FACTORY.createAssociationType1();
    association.setId("urn:association:5");
    association.setAssociationType("RelatedTo");
    association.setSourceObject("urn:organization:id1");
    association.setTargetObject("urn:service:id0");
    return association;
}
Also used : AssociationType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1)

Example 8 with AssociationType1

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

the class RegistryPackageWebConverterTest method getSixthAssociation.

private AssociationType1 getSixthAssociation() {
    AssociationType1 association = RIM_FACTORY.createAssociationType1();
    association.setId("urn:association:6");
    association.setAssociationType("RelatedTo");
    association.setSourceObject("urn:organization:id0");
    association.setTargetObject("urn:content:collection:id0");
    return association;
}
Also used : AssociationType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1)

Example 9 with AssociationType1

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

the class AssociationTypeConverterTest method testBuildAssociation.

@Test
public void testBuildAssociation() throws Exception {
    AssociationTypeConverter atBuilder = new AssociationTypeConverter();
    Optional<AssociationType1> optionalAssociation = atBuilder.convert(associationMap);
    assertThat(optionalAssociation, notNullValue());
}
Also used : AssociationTypeConverter(org.codice.ddf.registry.schemabindings.converter.type.AssociationTypeConverter) AssociationType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1) Test(org.junit.Test)

Example 10 with AssociationType1

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1 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)

Aggregations

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