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;
}
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")));
}
}
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;
}
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;
}
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;
}
Aggregations