Search in sources :

Example 1 with SpecificationLinkType

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

the class ServiceBindingWebConverter method convert.

/**
     * This method creates a Map<String, Object> representation of the ServiceBindingType provided.
     * The following keys will be added to the map (Taken from EbrimConstants):
     * <p>
     * ACCESS_URI = "accessUri";
     * SERVICE = "service";
     * TARGET_BINDING = "targetBinding";
     * SPECIFICATION_LINK_KEY = "SpecificationLink";
     * <p>
     * This will also try to parse RegistryObjectType values to the map.
     * <p>
     * Uses:
     * SpecificationLinkWebConverter
     *
     * @param binding the ServiceBindingType to be converted into a map, null returns empty Map
     * @return Map<String, Object> representation of the ServiceBindingType provided
     */
public Map<String, Object> convert(ServiceBindingType binding) {
    Map<String, Object> bindingMap = new HashMap<>();
    if (binding == null) {
        return bindingMap;
    }
    webMapHelper.putAllIfNotEmpty(bindingMap, super.convertRegistryObject(binding));
    webMapHelper.putIfNotEmpty(bindingMap, ACCESS_URI, binding.getAccessURI());
    webMapHelper.putIfNotEmpty(bindingMap, SERVICE, binding.getService());
    if (binding.isSetSpecificationLink()) {
        List<Map<String, Object>> specificationLinks = new ArrayList<>();
        SpecificationLinkWebConverter specificationLinkConverter = new SpecificationLinkWebConverter();
        for (SpecificationLinkType specificationLink : binding.getSpecificationLink()) {
            Map<String, Object> specificationLinkMap = specificationLinkConverter.convert(specificationLink);
            if (MapUtils.isNotEmpty(specificationLinkMap)) {
                specificationLinks.add(specificationLinkMap);
            }
        }
        webMapHelper.putIfNotEmpty(bindingMap, SPECIFICATION_LINK_KEY, specificationLinks);
    }
    webMapHelper.putIfNotEmpty(bindingMap, TARGET_BINDING, binding.getTargetBinding());
    return bindingMap;
}
Also used : HashMap(java.util.HashMap) SpecificationLinkType(oasis.names.tc.ebxml_regrep.xsd.rim._3.SpecificationLinkType) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with SpecificationLinkType

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

the class RegistryPackageWebConverterTest method getSecondSpecificationLink.

private SpecificationLinkType getSecondSpecificationLink() {
    SpecificationLinkType specificationLink = RIM_FACTORY.createSpecificationLinkType();
    specificationLink.setId("notARealId");
    specificationLink.setServiceBinding("notARealServiceBinding");
    specificationLink.setSpecificationObject("notARealSpecificationObject");
    specificationLink.setUsageDescription(istHelper.create("This is some usage description"));
    List<String> usageParameters = new ArrayList<>();
    usageParameters.add("someUsageParameter");
    specificationLink.setUsageParameter(usageParameters);
    return specificationLink;
}
Also used : SpecificationLinkType(oasis.names.tc.ebxml_regrep.xsd.rim._3.SpecificationLinkType) ArrayList(java.util.ArrayList)

Example 3 with SpecificationLinkType

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

the class RegistryPackageWebConverterTest method getFirstSpecificationLink.

private SpecificationLinkType getFirstSpecificationLink() {
    SpecificationLinkType specificationLink = RIM_FACTORY.createSpecificationLinkType();
    specificationLink.setId("urn:request:parameters");
    specificationLink.setServiceBinding("urn:registry:federation:method:csw");
    specificationLink.setSpecificationObject("urn:service:params:id0");
    return specificationLink;
}
Also used : SpecificationLinkType(oasis.names.tc.ebxml_regrep.xsd.rim._3.SpecificationLinkType)

Aggregations

SpecificationLinkType (oasis.names.tc.ebxml_regrep.xsd.rim._3.SpecificationLinkType)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1