Search in sources :

Example 6 with NamedValue

use of org.n52.shetland.ogc.om.NamedValue in project arctic-sea by 52North.

the class WmlObservationProcessDecoderv20Test method getTextNamedValue.

private NamedValue<String> getTextNamedValue() {
    NamedValue<String> nv = new NamedValue<String>();
    nv.setName(getNameValueOfferingName());
    nv.setValue(new TextValue(TEXT_OFFERING));
    return nv;
}
Also used : TextValue(org.n52.shetland.ogc.om.values.TextValue) NamedValue(org.n52.shetland.ogc.om.NamedValue)

Example 7 with NamedValue

use of org.n52.shetland.ogc.om.NamedValue in project arctic-sea by 52North.

the class WmlObservationProcessDecoderv20Test method getReferencedNamedValue.

private NamedValue<ReferenceType> getReferencedNamedValue() {
    NamedValue<ReferenceType> nv = new NamedValue<ReferenceType>();
    nv.setName(getNameValueOfferingName());
    nv.setValue(new ReferenceValue(new ReferenceType(REF_OFFERING)));
    return nv;
}
Also used : ReferenceValue(org.n52.shetland.ogc.om.values.ReferenceValue) NamedValue(org.n52.shetland.ogc.om.NamedValue) ReferenceType(org.n52.shetland.ogc.gml.ReferenceType)

Example 8 with NamedValue

use of org.n52.shetland.ogc.om.NamedValue in project arctic-sea by 52North.

the class AbstractOmV20XmlStreamWriter method writeMetadata.

/**
 * Write extension information
 *
 * @param map
 *            Map with values
 * @param element
 *            element name
 * @throws XMLStreamException
 *             If an error occurs when writing to stream
 * @throws EncodingException
 *             If an error occurs when creating elements to be written
 */
protected void writeMetadata(Map<String, NamedValue<?>> map, QName element) throws XMLStreamException, EncodingException {
    for (Entry<String, NamedValue<?>> entry : map.entrySet()) {
        Object o = getEncoder(OmConstants.NS_OM_2, entry.getValue()).encode(entry.getValue(), EncodingContext.of(XmlBeansEncodingFlags.DOCUMENT));
        if (o != null && o instanceof XmlObject) {
            start(GetDataAvailabilityConstants.GDA_EXTENSION);
            attr("name", entry.getKey());
            rawText(((XmlObject) o).xmlText(getXmlOptions()));
            end(GetDataAvailabilityConstants.GDA_EXTENSION);
        }
    }
}
Also used : NamedValue(org.n52.shetland.ogc.om.NamedValue) XmlObject(org.apache.xmlbeans.XmlObject) XmlObject(org.apache.xmlbeans.XmlObject)

Example 9 with NamedValue

use of org.n52.shetland.ogc.om.NamedValue in project arctic-sea by 52North.

the class AbstractOmV20XmlStreamWriter method writeParameter.

/**
 * Write om:parameter to stream
 *
 * @throws XMLStreamException
 *             If an error occurs when writing to stream
 * @throws EncodingException
 *             If an error occurs when creating elements to be written
 */
protected void writeParameter() throws XMLStreamException, EncodingException {
    XmlEncoderKey key = new XmlEncoderKey(OmConstants.NS_OM_2, NamedValue.class);
    Encoder<XmlObject, NamedValue<?>> encoder = getEncoder(key);
    if (encoder != null) {
        for (NamedValue<?> namedValue : getElement().getParameter()) {
            start(OmConstants.QN_OM_20_PARAMETER);
            writeXmlObject(encoder.encode(namedValue), OmConstants.QN_OM_20_NAMED_VALUE);
            end(OmConstants.QN_OM_20_PARAMETER);
        }
    }
}
Also used : XmlEncoderKey(org.n52.svalbard.encode.XmlEncoderKey) XmlObject(org.apache.xmlbeans.XmlObject) NamedValue(org.n52.shetland.ogc.om.NamedValue)

Example 10 with NamedValue

use of org.n52.shetland.ogc.om.NamedValue in project arctic-sea by 52North.

the class ObservationDecoder method parseNamedValue.

private NamedValue<?> parseNamedValue(JsonNode parameter) throws DecodingException {
    JsonNode namedValue = parameter.path(JSONConstants.NAMED_VALUE);
    NamedValue<?> nv = parseNamedValueValue(namedValue.path(JSONConstants.VALUE));
    ReferenceType referenceType = new ReferenceType(namedValue.path(JSONConstants.NAME).asText());
    nv.setName(referenceType);
    return nv;
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) ReferenceType(org.n52.shetland.ogc.gml.ReferenceType)

Aggregations

NamedValue (org.n52.shetland.ogc.om.NamedValue)10 XmlObject (org.apache.xmlbeans.XmlObject)5 ReferenceType (org.n52.shetland.ogc.gml.ReferenceType)4 GeometryValue (org.n52.shetland.ogc.om.values.GeometryValue)4 Geometry (org.locationtech.jts.geom.Geometry)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 BigDecimal (java.math.BigDecimal)2 NamedValueType (net.opengis.om.x20.NamedValueType)2 BooleanValue (org.n52.shetland.ogc.om.values.BooleanValue)2 CountValue (org.n52.shetland.ogc.om.values.CountValue)2 HrefAttributeValue (org.n52.shetland.ogc.om.values.HrefAttributeValue)2 ReferenceValue (org.n52.shetland.ogc.om.values.ReferenceValue)2 TextValue (org.n52.shetland.ogc.om.values.TextValue)2 W3CHrefAttribute (org.n52.shetland.w3c.xlink.W3CHrefAttribute)2 UnsupportedDecoderInputException (org.n52.svalbard.decode.exception.UnsupportedDecoderInputException)2 ReferenceType (net.opengis.gml.x32.ReferenceType)1 NamedValueDocument (net.opengis.om.x20.NamedValueDocument)1 NamedValuePropertyType (net.opengis.om.x20.NamedValuePropertyType)1 XmlBoolean (org.apache.xmlbeans.XmlBoolean)1 XmlDouble (org.apache.xmlbeans.XmlDouble)1