Search in sources :

Example 1 with PersonType

use of org.talend.types.demos.library.common._1.PersonType in project ddf by codice.

the class RegistryPackageWebConverterTest method getFirstPerson.

private PersonType getFirstPerson() {
    PersonType person = RIM_FACTORY.createPersonType();
    person.setId("urn:contact:id0");
    person.setPersonName(getPersonName("john", "doe", "middleName"));
    person.getTelephoneNumber().add(getPhoneNumber("111", "country", "1234", "111-1111", "cell phone"));
    person.getEmailAddress().add(getEmailAddress("emailaddress@something.com", null));
    person.getAddress().add(getAddress("Phoenix", "USA", "85037", "AZ", "1234 Some Street", "1234"));
    return person;
}
Also used : PersonType(oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType)

Example 2 with PersonType

use of org.talend.types.demos.library.common._1.PersonType 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 3 with PersonType

use of org.talend.types.demos.library.common._1.PersonType in project ddf by codice.

the class RegistryPackageWebConverterTest method getSecondPerson.

private PersonType getSecondPerson() {
    PersonType person = RIM_FACTORY.createPersonType();
    person.setId("urn:contact:id1");
    person.setPersonName(getPersonName("john1", "doe1", null));
    person.getTelephoneNumber().add(getPhoneNumber("111", null, "1234", "111-1111", null));
    person.getEmailAddress().add(getEmailAddress("emailaddress@something.com", null));
    return person;
}
Also used : PersonType(oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType)

Example 4 with PersonType

use of org.talend.types.demos.library.common._1.PersonType in project ddf by codice.

the class RegistryPackageWebConverterTest method getThirdPerson.

private PersonType getThirdPerson() {
    PersonType person = RIM_FACTORY.createPersonType();
    person.setId("urn:contact:id2");
    person.setPersonName(getPersonName("john2", "doe2", null));
    person.getTelephoneNumber().add(getPhoneNumber("111", null, "1234", "111-1111", null));
    person.getEmailAddress().add(getEmailAddress("emailaddress@something.com", null));
    return person;
}
Also used : PersonType(oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType)

Example 5 with PersonType

use of org.talend.types.demos.library.common._1.PersonType 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

PersonType (oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType)10 Calendar (java.util.Calendar)8 GregorianCalendar (java.util.GregorianCalendar)8 OrganizationType (oasis.names.tc.ebxml_regrep.xsd.rim._3.OrganizationType)5 SeekBookError (org.talend.services.test.library._1_0.SeekBookError)5 BookType (org.talend.types.test.library.common._1.BookType)5 ListOfBooks (org.talend.types.test.library.common._1.ListOfBooks)5 PersonType (org.talend.types.test.library.common._1.PersonType)5 ExtrinsicObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType)4 ServiceType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType)4 BookType (org.talend.types.demos.library.common._1.BookType)4 PersonType (org.talend.types.demos.library.common._1.PersonType)4 AssociationType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1)3 RegistryObjectListType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType)3 RegistryObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType)3 RegistryPackageType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Test (org.junit.Test)2 SeekBookError (org.talend.services.demos.library._1_0.SeekBookError)2