Search in sources :

Example 11 with OmObservation

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

the class OmDecoderv20 method parseOmObservation.

private OmObservation parseOmObservation(OMObservationType omObservation) throws DecodingException {
    Map<String, AbstractFeature> featureMap = Maps.newHashMap();
    OmObservation sosObservation = new OmObservation();
    // parse identifier, description
    parseAbstractFeatureType(omObservation, sosObservation);
    OmObservationConstellation observationConstallation = getObservationConstellation(omObservation, featureMap);
    sosObservation.setObservationConstellation(observationConstallation);
    sosObservation.setResultTime(getResultTime(omObservation));
    sosObservation.setValidTime(getValidTime(omObservation));
    if (omObservation.getParameterArray() != null) {
        sosObservation.setParameter(parseNamedValueTypeArray(omObservation.getParameterArray()));
    }
    sosObservation.setValue(getObservationValue(omObservation));
    return sosObservation;
}
Also used : OmObservation(org.n52.shetland.ogc.om.OmObservation) AbstractFeature(org.n52.shetland.ogc.gml.AbstractFeature) XmlString(org.apache.xmlbeans.XmlString) OmObservationConstellation(org.n52.shetland.ogc.om.OmObservationConstellation)

Example 12 with OmObservation

use of org.n52.shetland.ogc.om.OmObservation 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)

Example 13 with OmObservation

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

the class AbstractOmEncoderv20 method setValidTime.

private void setValidTime(OmObservation observation, OMObservationType xb) throws EncodingException {
    Time validTime = observation.getValidTime();
    if (validTime == null) {
        return;
    }
    if (validTime.getGmlId() == null) {
        validTime.setGmlId(OmConstants.VALID_TIME_NAME + "_" + observation.getObservationID());
    }
    xb.addNewValidTime().addNewTimePeriod().set(encodeGML(validTime));
}
Also used : Time(org.n52.shetland.ogc.gml.time.Time)

Example 14 with OmObservation

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

the class AbstractOmEncoderv20 method setFeatureOfInterest.

private void setFeatureOfInterest(OmObservation observation, OMObservationType xb) throws EncodingException {
    AbstractFeature foi = observation.getObservationConstellation().getFeatureOfInterest();
    XmlObject xbFoi = encodeFeatureOfInterest(foi);
    xb.addNewFeatureOfInterest().set(xbFoi);
}
Also used : AbstractFeature(org.n52.shetland.ogc.gml.AbstractFeature) XmlObject(org.apache.xmlbeans.XmlObject)

Example 15 with OmObservation

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

the class AbstractOmEncoderv20 method setMetaDataProperty.

private void setMetaDataProperty(OmObservation sosObservation, OMObservationType xbObservation) throws EncodingException {
    if (sosObservation.isSetMetaDataProperty()) {
        for (AbstractMetaData abstractMetaData : sosObservation.getMetaDataProperty()) {
            XmlObject encodeObject = encodeGML(abstractMetaData);
            XmlObject substituteElement = XmlHelper.substituteElement(xbObservation.addNewMetaDataProperty().addNewAbstractMetaData(), encodeObject);
            substituteElement.set(encodeObject);
        }
    }
}
Also used : XmlObject(org.apache.xmlbeans.XmlObject) AbstractMetaData(org.n52.shetland.ogc.gml.AbstractMetaData)

Aggregations

OmObservation (org.n52.shetland.ogc.om.OmObservation)32 XmlObject (org.apache.xmlbeans.XmlObject)17 TimeInstant (org.n52.shetland.ogc.gml.time.TimeInstant)16 Time (org.n52.shetland.ogc.gml.time.Time)15 EncodingException (org.n52.svalbard.encode.exception.EncodingException)14 DateTime (org.joda.time.DateTime)13 TimePeriod (org.n52.shetland.ogc.gml.time.TimePeriod)11 OmObservableProperty (org.n52.shetland.ogc.om.OmObservableProperty)11 OwsExceptionReport (org.n52.shetland.ogc.ows.exception.OwsExceptionReport)10 XmlString (org.apache.xmlbeans.XmlString)9 AbstractFeature (org.n52.shetland.ogc.gml.AbstractFeature)9 CodeWithAuthority (org.n52.shetland.ogc.gml.CodeWithAuthority)9 MultiObservationValues (org.n52.shetland.ogc.om.MultiObservationValues)7 ObservationStream (org.n52.shetland.ogc.om.ObservationStream)7 SingleObservationValue (org.n52.shetland.ogc.om.SingleObservationValue)7 OmObservationConstellation (org.n52.shetland.ogc.om.OmObservationConstellation)6 SweDataArray (org.n52.shetland.ogc.swe.SweDataArray)6 List (java.util.List)5 SamplingFeature (org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature)5 QuantityValue (org.n52.shetland.ogc.om.values.QuantityValue)5