Search in sources :

Example 21 with SlotType1

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

the class IdentityNodeInitialization method createIdentityNode.

private void createIdentityNode() throws FederationAdminException {
    String registryPackageId = RegistryConstants.GUID_PREFIX + UUID.randomUUID().toString().replaceAll("-", "");
    LOGGER.info("Creating registry identity node: {} {}", SystemInfo.getSiteName(), registryPackageId);
    RegistryPackageType registryPackage = RIM_FACTORY.createRegistryPackageType();
    registryPackage.setId(registryPackageId);
    registryPackage.setObjectType(RegistryConstants.REGISTRY_NODE_OBJECT_TYPE);
    ExtrinsicObjectType extrinsicObject = RIM_FACTORY.createExtrinsicObjectType();
    extrinsicObject.setObjectType(RegistryConstants.REGISTRY_NODE_OBJECT_TYPE);
    String extrinsicObjectId = RegistryConstants.GUID_PREFIX + UUID.randomUUID().toString().replaceAll("-", "");
    extrinsicObject.setId(extrinsicObjectId);
    String siteName = SystemInfo.getSiteName();
    if (StringUtils.isNotBlank(siteName)) {
        extrinsicObject.setName(internationalStringTypeHelper.create(siteName));
    } else {
        extrinsicObject.setName(internationalStringTypeHelper.create(UNKNOWN_SITE_NAME));
    }
    String home = SystemBaseUrl.getBaseUrl();
    extrinsicObject.setHome(home);
    String version = SystemInfo.getVersion();
    if (StringUtils.isNotBlank(version)) {
        VersionInfoType versionInfo = RIM_FACTORY.createVersionInfoType();
        versionInfo.setVersionName(version);
        extrinsicObject.setVersionInfo(versionInfo);
    }
    OffsetDateTime now = OffsetDateTime.now(ZoneId.of(ZoneOffset.UTC.toString()));
    String rightNow = now.toString();
    SlotType1 lastUpdated = slotTypeHelper.create(RegistryConstants.XML_LAST_UPDATED_NAME, rightNow, DATE_TIME);
    extrinsicObject.getSlot().add(lastUpdated);
    SlotType1 liveDate = slotTypeHelper.create(RegistryConstants.XML_LIVE_DATE_NAME, rightNow, DATE_TIME);
    extrinsicObject.getSlot().add(liveDate);
    if (registryPackage.getRegistryObjectList() == null) {
        registryPackage.setRegistryObjectList(RIM_FACTORY.createRegistryObjectListType());
    }
    registryPackage.getRegistryObjectList().getIdentifiable().add(RIM_FACTORY.createIdentifiable(extrinsicObject));
    Metacard identityMetacard = getRegistryMetacardFromRegistryPackage(registryPackage);
    if (identityMetacard != null) {
        identityMetacard.setAttribute(new AttributeImpl(RegistryObjectMetacardType.REGISTRY_IDENTITY_NODE, true));
        identityMetacard.setAttribute(new AttributeImpl(RegistryObjectMetacardType.REGISTRY_LOCAL_NODE, true));
        System.setProperty(RegistryConstants.REGISTRY_ID_PROPERTY, registryPackageId);
        federationAdminService.addRegistryEntry(identityMetacard);
    }
}
Also used : Metacard(ddf.catalog.data.Metacard) SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) OffsetDateTime(java.time.OffsetDateTime) RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) AttributeImpl(ddf.catalog.data.impl.AttributeImpl) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) VersionInfoType(oasis.names.tc.ebxml_regrep.xsd.rim._3.VersionInfoType)

Example 22 with SlotType1

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

the class SlotWebConverter method getSlotGeoMap.

private Map<String, Object> getSlotGeoMap(SlotType1 slot) {
    Map<String, Object> map = new HashMap<>();
    if (!slot.isSetValueList()) {
        return map;
    }
    ValueListType valueList = (ValueListType) slot.getValueList().getValue();
    for (AnyValueType anyValue : valueList.getAnyValue()) {
        anyValue.getContent().stream().filter(content -> content instanceof JAXBElement).forEach(content -> {
            JAXBElement jaxbElement = (JAXBElement) content;
            if (jaxbElement.getValue() instanceof PointType) {
                Map<String, Object> pointMap = getPointMapFromPointType((PointType) jaxbElement.getValue());
                if (MapUtils.isNotEmpty(pointMap)) {
                    Map<String, Object> valueMap = new HashMap<>();
                    valueMap.put(POINT_KEY, pointMap);
                    map.put(VALUE, valueMap);
                }
            }
        });
    }
    return map;
}
Also used : DirectPositionType(net.opengis.gml.v_3_1_1.DirectPositionType) StringUtils(org.apache.commons.lang.StringUtils) WebMapHelper(org.codice.ddf.registry.schemabindings.helper.WebMapHelper) MapUtils(org.apache.commons.collections.MapUtils) AnyValueType(net.opengis.cat.wrs.v_1_0_2.AnyValueType) JAXBElement(javax.xml.bind.JAXBElement) HashMap(java.util.HashMap) Collectors(java.util.stream.Collectors) EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) ArrayList(java.util.ArrayList) List(java.util.List) SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) Map(java.util.Map) ValueListType(net.opengis.cat.wrs.v_1_0_2.ValueListType) PointType(net.opengis.gml.v_3_1_1.PointType) SlotTypeHelper(org.codice.ddf.registry.schemabindings.helper.SlotTypeHelper) RegistryConstants(org.codice.ddf.registry.common.RegistryConstants) HashMap(java.util.HashMap) ValueListType(net.opengis.cat.wrs.v_1_0_2.ValueListType) PointType(net.opengis.gml.v_3_1_1.PointType) AnyValueType(net.opengis.cat.wrs.v_1_0_2.AnyValueType) JAXBElement(javax.xml.bind.JAXBElement)

Example 23 with SlotType1

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

the class SlotTypeHelper method create.

/**
     * This is a convenience method to create a SlotType1 object with the List of values
     *
     * @param slotName   the name of the slot, empty SlotType1 if null
     * @param slotValues the value to set
     * @param slotType   the slot type of the slot
     * @return
     */
public SlotType1 create(String slotName, List<String> slotValues, String slotType) {
    SlotType1 slot = RIM_FACTORY.createSlotType1();
    if (StringUtils.isNotBlank(slotName)) {
        ValueListType valueList = RIM_FACTORY.createValueListType();
        valueList.getValue().addAll(slotValues);
        slot.setValueList(RIM_FACTORY.createValueList(valueList));
        slot.setSlotType(slotType);
        slot.setName(slotName);
    }
    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 24 with SlotType1

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

the class SlotWebConverter method getSlotBoundsMap.

private Map<String, Object> getSlotBoundsMap(SlotType1 slot) {
    Map<String, Object> map = new HashMap<>();
    if (!slot.isSetValueList()) {
        return map;
    }
    ValueListType valueList = (ValueListType) slot.getValueList().getValue();
    for (AnyValueType anyValue : valueList.getAnyValue()) {
        anyValue.getContent().stream().filter(content -> content instanceof JAXBElement).forEach(content -> {
            JAXBElement jaxbElement = (JAXBElement) content;
            if (jaxbElement.getValue() instanceof EnvelopeType) {
                Map<String, Object> boundsMap = getBoundsMapFromEnvelopeType((EnvelopeType) jaxbElement.getValue());
                if (MapUtils.isNotEmpty(boundsMap)) {
                    Map<String, Object> valueMap = new HashMap<>();
                    valueMap.put(ENVELOPE_KEY, boundsMap);
                    map.put(VALUE, valueMap);
                }
            }
        });
    }
    return map;
}
Also used : DirectPositionType(net.opengis.gml.v_3_1_1.DirectPositionType) StringUtils(org.apache.commons.lang.StringUtils) WebMapHelper(org.codice.ddf.registry.schemabindings.helper.WebMapHelper) MapUtils(org.apache.commons.collections.MapUtils) AnyValueType(net.opengis.cat.wrs.v_1_0_2.AnyValueType) JAXBElement(javax.xml.bind.JAXBElement) HashMap(java.util.HashMap) Collectors(java.util.stream.Collectors) EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) ArrayList(java.util.ArrayList) List(java.util.List) SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) Map(java.util.Map) ValueListType(net.opengis.cat.wrs.v_1_0_2.ValueListType) PointType(net.opengis.gml.v_3_1_1.PointType) SlotTypeHelper(org.codice.ddf.registry.schemabindings.helper.SlotTypeHelper) RegistryConstants(org.codice.ddf.registry.common.RegistryConstants) EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) HashMap(java.util.HashMap) ValueListType(net.opengis.cat.wrs.v_1_0_2.ValueListType) AnyValueType(net.opengis.cat.wrs.v_1_0_2.AnyValueType) JAXBElement(javax.xml.bind.JAXBElement)

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