Search in sources :

Example 1 with TimeObjectPropertyType

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

the class OmDecoderv20 method getPhenomenonTime.

private Time getPhenomenonTime(OMObservationType omObservation) throws DecodingException {
    TimeObjectPropertyType phenomenonTime = omObservation.getPhenomenonTime();
    if (phenomenonTime.isSetHref() && phenomenonTime.getHref().startsWith("#")) {
        TimeInstant timeInstant = new TimeInstant();
        timeInstant.setGmlId(phenomenonTime.getHref());
        return timeInstant;
    } else if (phenomenonTime.isSetNilReason() && phenomenonTime.getNilReason() instanceof String && ((String) phenomenonTime.getNilReason()).equals(IndeterminateValue.TEMPLATE.getValue())) {
        return new TimeInstant(IndeterminateValue.TEMPLATE);
    } else if (phenomenonTime.isSetAbstractTimeObject()) {
        Object decodedObject = decodeXmlObject(phenomenonTime.getAbstractTimeObject());
        if (decodedObject instanceof Time) {
            return (Time) decodedObject;
        }
    // FIXME else
    }
    throw new DecodingException(Sos2Constants.InsertObservationParams.observation, "The requested phenomenonTime type is not supported by this service!");
}
Also used : TimeObjectPropertyType(net.opengis.om.x20.TimeObjectPropertyType) XmlObject(org.apache.xmlbeans.XmlObject) Time(org.n52.shetland.ogc.gml.time.Time) DecodingException(org.n52.svalbard.decode.exception.DecodingException) XmlString(org.apache.xmlbeans.XmlString) TimeInstant(org.n52.shetland.ogc.gml.time.TimeInstant)

Example 2 with TimeObjectPropertyType

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

the class OmEncoderv20 method addNilPhenomenonTime.

private void addNilPhenomenonTime(OMObservationType xbObservationTemplate) {
    TimeObjectPropertyType xbPhenomenonTime = xbObservationTemplate.addNewPhenomenonTime();
    xbPhenomenonTime.setNilReason(NIL_REASON_TEMPLATE);
}
Also used : TimeObjectPropertyType(net.opengis.om.x20.TimeObjectPropertyType)

Aggregations

TimeObjectPropertyType (net.opengis.om.x20.TimeObjectPropertyType)2 XmlObject (org.apache.xmlbeans.XmlObject)1 XmlString (org.apache.xmlbeans.XmlString)1 Time (org.n52.shetland.ogc.gml.time.Time)1 TimeInstant (org.n52.shetland.ogc.gml.time.TimeInstant)1 DecodingException (org.n52.svalbard.decode.exception.DecodingException)1