Search in sources :

Example 1 with AnyValueType

use of net.opengis.cat.wrs.v_1_0_2.AnyValueType in project ddf by codice.

the class RegistryPackageWebConverterTest method getFirstExtrinsicObject.

private ExtrinsicObjectType getFirstExtrinsicObject() {
    ExtrinsicObjectType extrinsicObject = RIM_FACTORY.createExtrinsicObjectType();
    // set default values
    extrinsicObject.setMimeType(extrinsicObject.getMimeType());
    extrinsicObject.setIsOpaque(extrinsicObject.isIsOpaque());
    extrinsicObject.setId("urn:registry:node");
    extrinsicObject.setObjectType("urn:registry:federation:node");
    extrinsicObject.getSlot().add(stHelper.create("liveDate", "2015-11-01T06:15:30-07:00", "xs:dateTime"));
    extrinsicObject.getSlot().add(stHelper.create("dataStartDate", "2015-11-01T13:15:30Z", "xs:dateTime"));
    extrinsicObject.getSlot().add(stHelper.create("dataEndDate", "2015-12-01T23:01:40Z", "xs:dateTime"));
    extrinsicObject.getSlot().add(stHelper.create("lastUpdated", "2016-01-26T17:16:34.996Z", "xs:dateTime"));
    extrinsicObject.getSlot().add(stHelper.create("links", "https://some/link/to/my/repo", "xs:string"));
    SlotType1 locationSlot = stHelper.create("location", (String) null, "urn:ogc:def:dataType:ISO-19107:2003:GM_Point");
    PointType point = GML_FACTORY.createPointType();
    point.setSrsDimension(BigInteger.valueOf(2));
    point.setSrsName("urn:ogc:def:crs:EPSG::4326");
    DirectPositionType directPosition = GML_FACTORY.createDirectPositionType();
    directPosition.getValue().add(112.267472);
    directPosition.getValue().add(33.467944);
    point.setPos(directPosition);
    ValueListType valueList = WRS_FACTORY.createValueListType();
    AnyValueType anyValue = WRS_FACTORY.createAnyValueType();
    anyValue.getContent().add(GML_FACTORY.createPoint(point));
    valueList.getAnyValue().add(anyValue);
    locationSlot.setValueList(RIM_FACTORY.createValueList(valueList));
    extrinsicObject.getSlot().add(locationSlot);
    SlotType1 boundsSlot = stHelper.create("bounds", (String) null, "urn:ogc:def:dataType:ISO-19107:2003:GM_Envelope");
    EnvelopeType bounds = GML_FACTORY.createEnvelopeType();
    bounds.setSrsName("urn:ogc:def:crs:EPSG::4326");
    directPosition = GML_FACTORY.createDirectPositionType();
    directPosition.getValue().add(112.267472);
    directPosition.getValue().add(33.467944);
    bounds.setUpperCorner(directPosition);
    directPosition = GML_FACTORY.createDirectPositionType();
    directPosition.getValue().add(110.267472);
    directPosition.getValue().add(30.467944);
    bounds.setLowerCorner(directPosition);
    valueList = WRS_FACTORY.createValueListType();
    anyValue = WRS_FACTORY.createAnyValueType();
    anyValue.getContent().add(GML_FACTORY.createEnvelope(bounds));
    valueList.getAnyValue().add(anyValue);
    boundsSlot.setValueList(RIM_FACTORY.createValueList(valueList));
    extrinsicObject.getSlot().add(boundsSlot);
    extrinsicObject.getSlot().add(stHelper.create("region", "USA", "urn:ogc:def:ebRIM-ClassificationScheme:UNSD:GlobalRegions"));
    List<String> values = new ArrayList<>();
    values.add("youtube");
    values.add("myCamera");
    extrinsicObject.getSlot().add(stHelper.create("inputDataSources", values, "xs:string"));
    values = new ArrayList<>();
    values.add("video");
    values.add("sensor");
    extrinsicObject.getSlot().add(stHelper.create("dataTypes", values, "xs:string"));
    extrinsicObject.getSlot().add(stHelper.create("securityLevel", "role=guest", "xs:string"));
    extrinsicObject.setName(istHelper.create("Node Name"));
    extrinsicObject.setDescription(istHelper.create("A little something describing this node in less than 1024 characters"));
    extrinsicObject.setVersionInfo(getVersionInfo("2.9.x"));
    ClassificationType classification = RIM_FACTORY.createClassificationType();
    classification.setId("urn:classification:id0");
    classification.setClassifiedObject("classifiedObjectId");
    extrinsicObject.getClassification().add(classification);
    return extrinsicObject;
}
Also used : EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) SlotType1(oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1) DirectPositionType(net.opengis.gml.v_3_1_1.DirectPositionType) ValueListType(net.opengis.cat.wrs.v_1_0_2.ValueListType) ArrayList(java.util.ArrayList) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) PointType(net.opengis.gml.v_3_1_1.PointType) AnyValueType(net.opengis.cat.wrs.v_1_0_2.AnyValueType) ClassificationType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ClassificationType)

Example 2 with AnyValueType

use of net.opengis.cat.wrs.v_1_0_2.AnyValueType in project ddf by codice.

the class RegistryPackageConverter method setSlotGeoAttribute.

private static void setSlotGeoAttribute(SlotType1 slot, String metacardAttributeName, MetacardImpl metacard) throws RegistryConversionException {
    if (slot.isSetValueList()) {
        net.opengis.cat.wrs.v_1_0_2.ValueListType valueList = (net.opengis.cat.wrs.v_1_0_2.ValueListType) slot.getValueList().getValue();
        List<AnyValueType> anyValues = valueList.getAnyValue();
        for (AnyValueType anyValue : anyValues) {
            if (anyValue.isSetContent()) {
                for (Object content : anyValue.getContent()) {
                    if (content instanceof JAXBElement) {
                        JAXBElement jaxbElement = (JAXBElement) content;
                        AbstractGeometryType geometry = (AbstractGeometryType) jaxbElement.getValue();
                        String convertedGeometry = getWKTFromGeometry(geometry, jaxbElement);
                        if (StringUtils.isNotBlank(convertedGeometry)) {
                            metacard.setAttribute(metacardAttributeName, convertedGeometry);
                        }
                    }
                }
            }
        }
    }
}
Also used : AbstractGeometryType(net.opengis.gml.v_3_1_1.AbstractGeometryType) JAXBElement(javax.xml.bind.JAXBElement) AnyValueType(net.opengis.cat.wrs.v_1_0_2.AnyValueType)

Example 3 with AnyValueType

use of net.opengis.cat.wrs.v_1_0_2.AnyValueType 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 4 with AnyValueType

use of net.opengis.cat.wrs.v_1_0_2.AnyValueType in project ddf by codice.

the class SlotTypeConverter method getWrsValueList.

private Optional<net.opengis.cat.wrs.v_1_0_2.ValueListType> getWrsValueList(Map<String, Object> map) {
    Optional<net.opengis.cat.wrs.v_1_0_2.ValueListType> optionalValueList = Optional.empty();
    if (MapUtils.isEmpty(map) || !map.containsKey(VALUE)) {
        return optionalValueList;
    }
    Map<String, Object> valueMap = (Map<String, Object>) map.get(VALUE);
    if (valueMap.containsKey(POINT_KEY)) {
        Optional<PointType> optionalPoint = getPoint((Map<String, Object>) valueMap.get(POINT_KEY));
        if (optionalPoint.isPresent()) {
            AnyValueType anyValue = WRS_FACTORY.createAnyValueType();
            anyValue.getContent().add(GML_FACTORY.createPoint(optionalPoint.get()));
            net.opengis.cat.wrs.v_1_0_2.ValueListType valueList = WRS_FACTORY.createValueListType();
            valueList.getAnyValue().add(anyValue);
            if (!optionalValueList.isPresent()) {
                optionalValueList = Optional.of(WRS_FACTORY.createValueListType());
            }
            optionalValueList.get().getAnyValue().add(anyValue);
        }
    } else if (valueMap.containsKey(ENVELOPE_KEY)) {
        Optional<EnvelopeType> optionalEnvelope = getEnvelope((Map<String, Object>) valueMap.get(ENVELOPE_KEY));
        if (optionalEnvelope.isPresent()) {
            AnyValueType anyValue = WRS_FACTORY.createAnyValueType();
            anyValue.getContent().add(GML_FACTORY.createEnvelope(optionalEnvelope.get()));
            net.opengis.cat.wrs.v_1_0_2.ValueListType valueList = WRS_FACTORY.createValueListType();
            valueList.getAnyValue().add(anyValue);
            if (!optionalValueList.isPresent()) {
                optionalValueList = Optional.of(WRS_FACTORY.createValueListType());
            }
            optionalValueList.get().getAnyValue().add(anyValue);
        }
    }
    return optionalValueList;
}
Also used : Optional(java.util.Optional) ValueListType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ValueListType) PointType(net.opengis.gml.v_3_1_1.PointType) AnyValueType(net.opengis.cat.wrs.v_1_0_2.AnyValueType) Map(java.util.Map)

Example 5 with AnyValueType

use of net.opengis.cat.wrs.v_1_0_2.AnyValueType 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

AnyValueType (net.opengis.cat.wrs.v_1_0_2.AnyValueType)5 PointType (net.opengis.gml.v_3_1_1.PointType)4 ArrayList (java.util.ArrayList)3 Map (java.util.Map)3 JAXBElement (javax.xml.bind.JAXBElement)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 SlotType1 (oasis.names.tc.ebxml_regrep.xsd.rim._3.SlotType1)3 HashMap (java.util.HashMap)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 MapUtils (org.apache.commons.collections.MapUtils)2 StringUtils (org.apache.commons.lang.StringUtils)2 RegistryConstants (org.codice.ddf.registry.common.RegistryConstants)2 SlotTypeHelper (org.codice.ddf.registry.schemabindings.helper.SlotTypeHelper)2 WebMapHelper (org.codice.ddf.registry.schemabindings.helper.WebMapHelper)2 Optional (java.util.Optional)1 AbstractGeometryType (net.opengis.gml.v_3_1_1.AbstractGeometryType)1 ClassificationType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ClassificationType)1