Search in sources :

Example 1 with ServiceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ServiceType 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 2 with ServiceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ServiceType in project ddf by codice.

the class RegistryPackageWebConverterTest method getService.

private ServiceType getService() {
    ServiceType service = RIM_FACTORY.createServiceType();
    service.setId("urn:service:id0");
    service.setObjectType("registry:federation:service");
    service.getServiceBinding().add(getFirstServiceBinding());
    service.getServiceBinding().add(getSecondServiceBinding());
    return service;
}
Also used : ServiceType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType)

Example 3 with ServiceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ServiceType 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 4 with ServiceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ServiceType in project ddf by codice.

the class RegistryPackageConverter method getRegistryObjectMetacard.

public static Metacard getRegistryObjectMetacard(RegistryObjectType registryObject, MetacardType metacardType) throws RegistryConversionException {
    MetacardImpl metacard = null;
    if (registryObject == null) {
        return metacard;
    }
    validateIdentifiable(registryObject);
    metacard = new MetacardImpl(metacardType);
    parseTopLevel(registryObject, metacard);
    if (registryObject instanceof RegistryPackageType) {
        parseRegistryPackage((RegistryPackageType) registryObject, metacard);
    } else if (registryObject instanceof ExtrinsicObjectType) {
        parseNodeExtrinsicObject(registryObject, metacard);
    } else if (registryObject instanceof ServiceType) {
        parseRegistryService((ServiceType) registryObject, metacard);
    } else if (registryObject instanceof OrganizationType) {
        parseRegistryOrganization((OrganizationType) registryObject, metacard);
    } else if (registryObject instanceof PersonType) {
        parseRegistryPerson((PersonType) registryObject, metacard);
    } else {
        LOGGER.debug("Unexpected object found: {}", registryObject);
    }
    return metacard;
}
Also used : RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) ServiceType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType) 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) MetacardImpl(ddf.catalog.data.impl.MetacardImpl)

Example 5 with ServiceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ServiceType in project ddf by codice.

the class RegistryObjectListWebConverter method convert.

/**
     * This method creates a Map<String, Object> representation of the RegistryObjectListType provided.
     * The following keys will be added to the map (Taken from EbrimConstants):
     * <p>
     * ASSOCIATION_KEY = "Association";
     * EXTRINSIC_OBJECT_KEY = "ExtrinsicObject";
     * ORGANIZATION_KEY = "Organization";
     * PERSON_KEY = "Person";
     * SERVICE_KEY = "Service";
     * <p>
     * <p>
     * Uses:
     * AssociationWebConverter
     * ExtrinsicObjectWebConverter
     * OrganizationWebConverter
     * PersonWebConverter
     * ServiceWebConverter
     *
     * @param registryObjectList the RegistryObjectListType to be converted into a map, null returns empty Map
     * @return Map<String, Object> representation of the RegistryObjectListType provided
     */
public Map<String, Object> convert(RegistryObjectListType registryObjectList) {
    Map<String, Object> registryObjectListMap = new HashMap<>();
    if (registryObjectList == null) {
        return registryObjectListMap;
    }
    List<Map<String, Object>> associations = new ArrayList<>();
    List<Map<String, Object>> extrinsicObjects = new ArrayList<>();
    List<Map<String, Object>> organizations = new ArrayList<>();
    List<Map<String, Object>> people = new ArrayList<>();
    List<Map<String, Object>> services = new ArrayList<>();
    AssociationWebConverter associationConverter = new AssociationWebConverter();
    ExtrinsicObjectWebConverter extrinsicObjectConverter = new ExtrinsicObjectWebConverter();
    OrganizationWebConverter organizationConverter = new OrganizationWebConverter();
    PersonWebConverter personConverter = new PersonWebConverter();
    ServiceWebConverter serviceConverter = new ServiceWebConverter();
    for (JAXBElement<? extends IdentifiableType> identifiable : registryObjectList.getIdentifiable()) {
        RegistryObjectType registryObject = (RegistryObjectType) identifiable.getValue();
        Map<String, Object> identifiableMap;
        if (registryObject instanceof ExtrinsicObjectType) {
            identifiableMap = extrinsicObjectConverter.convert((ExtrinsicObjectType) registryObject);
            if (MapUtils.isNotEmpty(identifiableMap)) {
                extrinsicObjects.add(identifiableMap);
            }
        } else if (registryObject instanceof ServiceType) {
            identifiableMap = serviceConverter.convert((ServiceType) registryObject);
            if (MapUtils.isNotEmpty(identifiableMap)) {
                services.add(identifiableMap);
            }
        } else if (registryObject instanceof OrganizationType) {
            identifiableMap = organizationConverter.convert((OrganizationType) registryObject);
            if (MapUtils.isNotEmpty(identifiableMap)) {
                organizations.add(identifiableMap);
            }
        } else if (registryObject instanceof PersonType) {
            identifiableMap = personConverter.convert((PersonType) registryObject);
            if (MapUtils.isNotEmpty(identifiableMap)) {
                people.add(identifiableMap);
            }
        } else if (registryObject instanceof AssociationType1) {
            identifiableMap = associationConverter.convert((AssociationType1) registryObject);
            if (MapUtils.isNotEmpty(identifiableMap)) {
                associations.add(identifiableMap);
            }
        }
    }
    webMapHelper.putIfNotEmpty(registryObjectListMap, ASSOCIATION_KEY, associations);
    webMapHelper.putIfNotEmpty(registryObjectListMap, EXTRINSIC_OBJECT_KEY, extrinsicObjects);
    webMapHelper.putIfNotEmpty(registryObjectListMap, ORGANIZATION_KEY, organizations);
    webMapHelper.putIfNotEmpty(registryObjectListMap, PERSON_KEY, people);
    webMapHelper.putIfNotEmpty(registryObjectListMap, SERVICE_KEY, services);
    return registryObjectListMap;
}
Also used : 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) OrganizationType(oasis.names.tc.ebxml_regrep.xsd.rim._3.OrganizationType) ServiceType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType) HashMap(java.util.HashMap) Map(java.util.Map) RegistryObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType)

Aggregations

ServiceType (eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceType)7 com.evolveum.midpoint.prism (com.evolveum.midpoint.prism)6 T_OBJECT_REFERENCE (com.evolveum.midpoint.prism.PrismConstants.T_OBJECT_REFERENCE)6 T_PARENT (com.evolveum.midpoint.prism.PrismConstants.T_PARENT)6 ItemName (com.evolveum.midpoint.prism.path.ItemName)6 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)6 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)6 XmlTypeConverter.createXMLGregorianCalendar (com.evolveum.midpoint.prism.xml.XmlTypeConverter.createXMLGregorianCalendar)6 RepositoryService (com.evolveum.midpoint.repo.api.RepositoryService)6 SqaleRepoBaseTest (com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)6 QFocus (com.evolveum.midpoint.repo.sqale.qmodel.focus.QFocus)6 MObject (com.evolveum.midpoint.repo.sqale.qmodel.object.MObject)6 MObjectType (com.evolveum.midpoint.repo.sqale.qmodel.object.MObjectType)6 QAssignmentHolder (com.evolveum.midpoint.repo.sqale.qmodel.object.QAssignmentHolder)6 QObject (com.evolveum.midpoint.repo.sqale.qmodel.object.QObject)6 PolyStringItemFilterProcessor (com.evolveum.midpoint.repo.sqlbase.filtering.item.PolyStringItemFilterProcessor)6 SchemaService (com.evolveum.midpoint.schema.SchemaService)6 SearchResultList (com.evolveum.midpoint.schema.SearchResultList)6 SchemaConstants (com.evolveum.midpoint.schema.constants.SchemaConstants)6 ORG_DEFAULT (com.evolveum.midpoint.schema.constants.SchemaConstants.ORG_DEFAULT)6