Search in sources :

Example 11 with ServiceType

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

Example 12 with ServiceType

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

the class SlotTypeHelperTest method getNameSlotMapDuplicateSlotNamesAllowed.

@Test
public void getNameSlotMapDuplicateSlotNamesAllowed() throws Exception {
    RegistryObjectType rot = getRegistryObjectFromResource("/registry-package-slots-only-with-dup.xml");
    List<SlotType1> slots = rot.getSlot();
    String duplicateSlotCase = "serviceType";
    int expectedSize = 1;
    int expectedServiceTypeSize = 2;
    Map<String, List<SlotType1>> slotMap = stHelper.getNameSlotMapDuplicateSlotNamesAllowed(slots);
    for (SlotType1 slot : slots) {
        String slotName = slot.getName();
        // duplicate slotCase
        if (duplicateSlotCase.equals(slotName)) {
            continue;
        }
        assertThat(slotMap, hasKey(slotName));
        assertThat(slotMap.get(slotName), hasSize(expectedSize));
        SlotType1 mappedSlot = slotMap.get(slotName).get(0);
        assertThat(mappedSlot, is(equalTo(slot)));
    }
    // ServiceType slot is repeated in the test xml
    // Testing that both slots(SOAP & REST) are stored
    List<SlotType1> serviceTypes = slotMap.get(duplicateSlotCase);
    assertThat(serviceTypes, notNullValue());
    assertThat(serviceTypes, hasSize(expectedServiceTypeSize));
    for (SlotType1 serviceTypeSlot : serviceTypes) {
        String value = stHelper.getStringValues(serviceTypeSlot).get(0);
        assertThat(value, anyOf(equalTo("SOAP"), equalTo("REST")));
    }
}
Also used : SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) ArrayList(java.util.ArrayList) List(java.util.List) RegistryObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType) Test(org.junit.Test)

Example 13 with ServiceType

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType in project midpoint by Evolveum.

the class RService method toJAXB.

@Override
public ServiceType toJAXB(PrismContext prismContext, Collection<SelectorOptions<GetOperationOptions>> options) throws DtoTranslationException {
    ServiceType object = new ServiceType();
    RService.copyToJAXB(this, object, prismContext, options);
    RUtil.revive(object, prismContext);
    return object;
}
Also used : ServiceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ServiceType)

Example 14 with ServiceType

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

the class ServiceWebConverter method convert.

/**
     * This method creates a Map<String, Object> representation of the ServiceType provided.
     * The following keys will be added to the map (Taken from EbrimConstants):
     * <p>
     * SERVICE_BINDING_KEY = "ServiceBinding";
     * <p>
     * This will also try to parse RegistryObjectType values to the map.
     * <p>
     * Uses:
     * ServiceBindingWebConverter
     *
     * @param service the ServiceType to be converted into a map, null returns empty Map
     * @return Map<String, Object> representation of the ServiceType provided
     */
public Map<String, Object> convert(ServiceType service) {
    Map<String, Object> serviceMap = new HashMap<>();
    if (service == null) {
        return serviceMap;
    }
    webMapHelper.putAllIfNotEmpty(serviceMap, super.convertRegistryObject(service));
    if (service.isSetServiceBinding()) {
        List<Map<String, Object>> bindings = new ArrayList<>();
        ServiceBindingWebConverter bindingConverter = new ServiceBindingWebConverter();
        for (ServiceBindingType binding : service.getServiceBinding()) {
            Map<String, Object> bindingMap = bindingConverter.convert(binding);
            if (MapUtils.isNotEmpty(bindingMap)) {
                bindings.add(bindingMap);
            }
        }
        webMapHelper.putIfNotEmpty(serviceMap, SERVICE_BINDING_KEY, bindings);
    }
    return serviceMap;
}
Also used : ServiceBindingType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceBindingType) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap)

Example 15 with ServiceType

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

the class RegistryPackageWebConverterTest method getSecondServiceBinding.

private ServiceBindingType getSecondServiceBinding() {
    ServiceBindingType binding = RIM_FACTORY.createServiceBindingType();
    binding.setId("urn:registry:federation:method:soap13");
    binding.setService("urn:service:id0");
    binding.setAccessURI("some:access:URI:any:URI");
    binding.setTargetBinding("some:target:binding:reference:URI");
    binding.getSlot().add(stHelper.create("queryAddress", "https://some/address/here", "xs:anyURI"));
    binding.getSlot().add(stHelper.create("ingestAddress", "https://some/address/here", "xs:anyURI"));
    binding.getSlot().add(stHelper.create("eventAddress", "https://some/address/here", "xs:anyURI"));
    binding.getSlot().add(stHelper.create("bindingType", "soap13", "xs:string"));
    binding.getSlot().add(stHelper.create("serviceType", "SOAP", "xs:string"));
    binding.getSlot().add(stHelper.create("endpointDocumentation", "https://some/path/to/docs.html", "xs:anyURI"));
    binding.setName(istHelper.create("Soap Federation Method"));
    binding.setDescription(istHelper.create("This is the Soap federation method."));
    binding.setVersionInfo(getVersionInfo("1.3"));
    binding.getSpecificationLink().add(getSecondSpecificationLink());
    return binding;
}
Also used : ServiceBindingType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceBindingType)

Aggregations

ArrayList (java.util.ArrayList)8 ServiceType (eu.europa.ec.fisheries.schema.exchange.service.v1.ServiceType)7 Test (org.junit.Test)7 Service (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.Service)5 RegistryObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType)5 ServiceBindingType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceBindingType)5 ServiceType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceType)5 ExtrinsicObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType)4 OrganizationType (oasis.names.tc.ebxml_regrep.xsd.rim._3.OrganizationType)4 PersonType (oasis.names.tc.ebxml_regrep.xsd.rim._3.PersonType)4 CapabilityListType (eu.europa.ec.fisheries.schema.exchange.service.v1.CapabilityListType)3 SettingListType (eu.europa.ec.fisheries.schema.exchange.service.v1.SettingListType)3 ServiceCapability (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceCapability)3 ServiceSetting (eu.europa.ec.fisheries.uvms.exchange.entity.serviceregistry.ServiceSetting)3 HashMap (java.util.HashMap)3 List (java.util.List)3 AssociationType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.AssociationType1)3 SlotType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1)3 Map (java.util.Map)2 ServiceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ServiceType)1