Search in sources :

Example 11 with SlotType1

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

the class SlotTypeHelperTest method createMultiValue.

@Test
public void createMultiValue() throws Exception {
    String slotName = "slotName";
    String slotValue1 = "slotValue1";
    String slotValue2 = "slotValue2";
    String slotType = "slotType";
    List<String> values = new ArrayList<>();
    values.add(slotValue1);
    values.add(slotValue2);
    SlotType1 slot = stHelper.create(slotName, values, slotType);
    assertThat(slot, notNullValue());
    assertThat(slot.getName(), is(equalTo(slotName)));
    assertThat(slot.getSlotType(), is(equalTo(slotType)));
    values = stHelper.getStringValues(slot);
    assertThat(values, hasSize(2));
    assertThat(values, contains(slotValue1, slotValue2));
}
Also used : SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 12 with SlotType1

use of oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1 in project nhin-d by DirectProject.

the class DirectDocumentUtils method makeSlot.

public static SlotType1 makeSlot(SlotType1Enum slotTypeEnum, String value) {
    SlotType1 slot = new SlotType1();
    ValueListType valueListType = new ValueListType();
    List<String> vals = valueListType.getValue();
    slot.setName(slotTypeEnum.getName());
    slot.setValueList(valueListType);
    vals.add(value);
    return slot;
}
Also used : SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) ValueListType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ValueListType)

Example 13 with SlotType1

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

the class FederationAdmin method updateDateFields.

private void updateDateFields(RegistryPackageType rpt) {
    ExtrinsicObjectType nodeInfo = null;
    for (JAXBElement identifiable : rpt.getRegistryObjectList().getIdentifiable()) {
        RegistryObjectType registryObject = (RegistryObjectType) identifiable.getValue();
        if (registryObject instanceof ExtrinsicObjectType && RegistryConstants.REGISTRY_NODE_OBJECT_TYPE.equals(registryObject.getObjectType())) {
            nodeInfo = (ExtrinsicObjectType) registryObject;
            break;
        }
    }
    if (nodeInfo != null) {
        boolean liveDateFound = false;
        boolean lastUpdatedFound = false;
        OffsetDateTime now = OffsetDateTime.now(ZoneId.of(ZoneOffset.UTC.toString()));
        String rightNow = now.toString();
        for (SlotType1 slot : nodeInfo.getSlot()) {
            if (slot.getName().equals(RegistryConstants.XML_LIVE_DATE_NAME)) {
                liveDateFound = true;
            } else if (slot.getName().equals(RegistryConstants.XML_LAST_UPDATED_NAME)) {
                ValueListType valueList = EbrimConstants.RIM_FACTORY.createValueListType();
                valueList.getValue().add(rightNow);
                slot.setValueList(EbrimConstants.RIM_FACTORY.createValueList(valueList));
                lastUpdatedFound = true;
            }
        }
        if (!liveDateFound) {
            SlotType1 liveDate = slotHelper.create(RegistryConstants.XML_LIVE_DATE_NAME, rightNow, DATE_TIME);
            nodeInfo.getSlot().add(liveDate);
        }
        if (!lastUpdatedFound) {
            SlotType1 lastUpdated = slotHelper.create(RegistryConstants.XML_LAST_UPDATED_NAME, rightNow, DATE_TIME);
            nodeInfo.getSlot().add(lastUpdated);
        }
    }
}
Also used : SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) OffsetDateTime(java.time.OffsetDateTime) ValueListType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ValueListType) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) JAXBElement(javax.xml.bind.JAXBElement) RegistryObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType)

Example 14 with SlotType1

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

the class RegistryPackageConverter method setAttributeFromMap.

private static void setAttributeFromMap(String metacardAttributeName, Map<String, SlotType1> map, MetacardImpl metacard) throws RegistryConversionException {
    String xmlAttributeName = METACARD_XML_NAME_MAP.get(metacardAttributeName);
    if (map.containsKey(xmlAttributeName)) {
        SlotType1 slot = map.get(xmlAttributeName);
        String slotType = slot.getSlotType();
        if (slotType.contains(RegistryConstants.XML_DATE_TIME_TYPE)) {
            setSlotDateAttribute(slot, metacardAttributeName, metacard);
        } else if (slotType.contains(RegistryConstants.XML_GEO_TYPE)) {
            setSlotGeoAttribute(slot, metacardAttributeName, metacard);
        } else {
            // default to string
            setSlotStringAttribute(slot, metacardAttributeName, metacard);
        }
    }
}
Also used : SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1)

Example 15 with SlotType1

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

the class RegistryPackageConverter method parseRegistryService.

private static void parseRegistryService(ServiceType service, MetacardImpl metacard) throws RegistryConversionException {
    validateIdentifiable(service);
    String xmlServiceBindingsTypesAttributeName = METACARD_XML_NAME_MAP.get(RegistryObjectMetacardType.SERVICE_BINDING_TYPES);
    String xmlServiceBindingsAttributeName = METACARD_XML_NAME_MAP.get(RegistryObjectMetacardType.SERVICE_BINDINGS);
    List<String> serviceBindings = new ArrayList<>();
    List<String> serviceBindingTypes = new ArrayList<>();
    List<String> bindings = new ArrayList<>();
    List<String> bindingTypes = new ArrayList<>();
    for (ServiceBindingType binding : service.getServiceBinding()) {
        bindings.clear();
        bindingTypes.clear();
        Map<String, List<SlotType1>> slotMap = SLOT_TYPE_HELPER.getNameSlotMapDuplicateSlotNamesAllowed(binding.getSlot());
        if (slotMap.containsKey(xmlServiceBindingsTypesAttributeName)) {
            List<SlotType1> slots = slotMap.get(xmlServiceBindingsTypesAttributeName);
            for (SlotType1 slot : slots) {
                bindingTypes.addAll(SLOT_TYPE_HELPER.getStringValues(slot));
            }
        }
        if (slotMap.containsKey(xmlServiceBindingsAttributeName)) {
            List<SlotType1> slots = slotMap.get(xmlServiceBindingsAttributeName);
            for (SlotType1 slot : slots) {
                bindings.addAll(SLOT_TYPE_HELPER.getStringValues(slot));
            }
        }
        serviceBindingTypes.addAll(bindingTypes);
        serviceBindings.addAll(bindings);
    }
    metacard.setAttribute(RegistryObjectMetacardType.SERVICE_BINDING_TYPES, (Serializable) serviceBindingTypes);
    metacard.setAttribute(RegistryObjectMetacardType.SERVICE_BINDINGS, (Serializable) serviceBindings);
}
Also used : ServiceBindingType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceBindingType) SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

SlotType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1)23 ArrayList (java.util.ArrayList)8 Test (org.junit.Test)7 List (java.util.List)6 HashMap (java.util.HashMap)5 ExtrinsicObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType)5 ValueListType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ValueListType)5 JAXBElement (javax.xml.bind.JAXBElement)4 Map (java.util.Map)3 AnyValueType (net.opengis.cat.wrs.v_1_0_2.AnyValueType)3 ValueListType (net.opengis.cat.wrs.v_1_0_2.ValueListType)3 DirectPositionType (net.opengis.gml.v_3_1_1.DirectPositionType)3 EnvelopeType (net.opengis.gml.v_3_1_1.EnvelopeType)3 PointType (net.opengis.gml.v_3_1_1.PointType)3 ClassificationType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ClassificationType)3 RegistryObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectType)3 OffsetDateTime (java.time.OffsetDateTime)2 Collectors (java.util.stream.Collectors)2 RegistryPackageType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType)2 ServiceBindingType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ServiceBindingType)2