Search in sources :

Example 1 with NamedValueDocument

use of net.opengis.om.x20.NamedValueDocument in project arctic-sea by 52North.

the class AbstractOmEncoderv20 method encode.

@Override
public XmlObject encode(Object element, EncodingContext additionalValues) throws EncodingException {
    XmlObject encodedObject = null;
    if (element instanceof OmObservation) {
        encodedObject = encodeOmObservation((OmObservation) element, additionalValues);
    } else if (element instanceof NamedValue) {
        NamedValueType nvt = createNamedValue((NamedValue<?>) element);
        if (additionalValues.has(XmlBeansEncodingFlags.DOCUMENT)) {
            NamedValueDocument nvd = NamedValueDocument.Factory.newInstance();
            nvd.setNamedValue(nvt);
            encodedObject = nvd;
        } else if (additionalValues.has(XmlBeansEncodingFlags.PROPERTY_TYPE)) {
            NamedValuePropertyType nvpt = NamedValuePropertyType.Factory.newInstance();
            nvpt.setNamedValue(nvt);
            encodedObject = nvpt;
        } else {
            encodedObject = nvt;
        }
    } else if (element instanceof AbstractFeature) {
        encodedObject = encodeFeatureOfInterest((AbstractFeature) element);
    } else if (element instanceof SosProcedureDescription) {
        encodedObject = encodeProcedureDescription((SosProcedureDescription<?>) element);
    } else {
        throw new UnsupportedEncoderInputException(this, element);
    }
    // XmlHelper.validateDocument(encodedObject));
    return encodedObject;
}
Also used : NamedValueDocument(net.opengis.om.x20.NamedValueDocument) NamedValueType(net.opengis.om.x20.NamedValueType) OmObservation(org.n52.shetland.ogc.om.OmObservation) SosProcedureDescription(org.n52.shetland.ogc.sos.SosProcedureDescription) AbstractFeature(org.n52.shetland.ogc.gml.AbstractFeature) XmlObject(org.apache.xmlbeans.XmlObject) NamedValue(org.n52.shetland.ogc.om.NamedValue) NamedValuePropertyType(net.opengis.om.x20.NamedValuePropertyType) UnsupportedEncoderInputException(org.n52.svalbard.encode.exception.UnsupportedEncoderInputException)

Aggregations

NamedValueDocument (net.opengis.om.x20.NamedValueDocument)1 NamedValuePropertyType (net.opengis.om.x20.NamedValuePropertyType)1 NamedValueType (net.opengis.om.x20.NamedValueType)1 XmlObject (org.apache.xmlbeans.XmlObject)1 AbstractFeature (org.n52.shetland.ogc.gml.AbstractFeature)1 NamedValue (org.n52.shetland.ogc.om.NamedValue)1 OmObservation (org.n52.shetland.ogc.om.OmObservation)1 SosProcedureDescription (org.n52.shetland.ogc.sos.SosProcedureDescription)1 UnsupportedEncoderInputException (org.n52.svalbard.encode.exception.UnsupportedEncoderInputException)1