Search in sources :

Example 56 with DecodingException

use of org.n52.svalbard.decode.exception.DecodingException in project arctic-sea by 52North.

the class ReportObligationJSONDecoder method decodeJSON.

@Override
public ReportObligation decodeJSON(JsonNode node, boolean validate) throws DecodingException {
    ReportObligation reportObligation = new ReportObligation();
    reportObligation.setChange(decodeJsonToObject(node.path(AQDJSONConstants.CHANGE), EReportingChange.class));
    reportObligation.setInspireID(decodeJsonToObject(node.path(AQDJSONConstants.INSPIRE_ID), Identifier.class));
    reportObligation.setReportingPeriod(parseReferenceableTime(node.path(AQDJSONConstants.REPORTING_PERIOD)));
    return reportObligation;
}
Also used : Identifier(org.n52.shetland.inspire.base.Identifier) ReportObligation(org.n52.shetland.aqd.ReportObligation) EReportingChange(org.n52.shetland.aqd.EReportingChange)

Example 57 with DecodingException

use of org.n52.svalbard.decode.exception.DecodingException in project arctic-sea by 52North.

the class GetObservationRequestDecoder method decodeRequest.

@Override
public GetObservationRequest decodeRequest(JsonNode node) throws DecodingException {
    GetObservationRequest r = new GetObservationRequest();
    r.setFeatureIdentifiers(parseStringOrStringList(node.path(JSONConstants.FEATURE_OF_INTEREST)));
    r.setObservedProperties(parseStringOrStringList(node.path(JSONConstants.OBSERVED_PROPERTY)));
    r.setOfferings(parseStringOrStringList(node.path(JSONConstants.OFFERING)));
    r.setProcedures(parseStringOrStringList(node.path(JSONConstants.PROCEDURE)));
    r.setResponseFormat(node.path(JSONConstants.RESPONSE_FORMAT).textValue());
    r.setResponseMode(node.path(JSONConstants.RESPONSE_MODE).textValue());
    r.setResultModel(node.path(JSONConstants.RESULT_MODEL).textValue());
    r.setResultFilter(parseComparisonFilter(node.path(JSONConstants.RESULT_FILTER)));
    r.setSpatialFilter(parseSpatialFilter(node.path(JSONConstants.SPATIAL_FILTER)));
    r.setTemporalFilters(parseTemporalFilters(node.path(JSONConstants.TEMPORAL_FILTER)));
    // TODO whats that for?
    r.setRequestString(Json.print(node));
    return r;
}
Also used : GetObservationRequest(org.n52.shetland.ogc.sos.request.GetObservationRequest)

Example 58 with DecodingException

use of org.n52.svalbard.decode.exception.DecodingException in project arctic-sea by 52North.

the class InsertObservationRequestDecoder method decodeRequest.

@Override
public InsertObservationRequest decodeRequest(JsonNode node) throws DecodingException {
    InsertObservationRequest r = new InsertObservationRequest();
    r.setObservation(decodeJsonToObjectList(node.path(JSONConstants.OBSERVATION), OmObservation.class));
    r.setOfferings(parseStringOrStringList(node.path(JSONConstants.OFFERING)));
    return r;
}
Also used : InsertObservationRequest(org.n52.shetland.ogc.sos.request.InsertObservationRequest) OmObservation(org.n52.shetland.ogc.om.OmObservation)

Example 59 with DecodingException

use of org.n52.svalbard.decode.exception.DecodingException in project arctic-sea by 52North.

the class InsertResultTemplateRequestDecoder method parseObservationTemplate.

private OmObservationConstellation parseObservationTemplate(JsonNode node) throws DecodingException {
    OmObservationConstellation oc = observationDecoder.parseObservationConstellation(node.path(JSONConstants.OBSERVATION_TEMPLATE));
    oc.addOffering(node.path(JSONConstants.OFFERING).textValue());
    return oc;
}
Also used : OmObservationConstellation(org.n52.shetland.ogc.om.OmObservationConstellation)

Example 60 with DecodingException

use of org.n52.svalbard.decode.exception.DecodingException in project arctic-sea by 52North.

the class SensorMLDecoderV20 method parseConnections.

private SmlConnection parseConnections(ConnectionListPropertyType connections) throws DecodingException {
    SmlConnection sosSmlConnection = new SmlConnection();
    if (connections.isSetConnectionList() && connections.getConnectionList().getConnectionArray() != null) {
        for (final Connection connection : connections.getConnectionList().getConnectionArray()) {
            if (connection.getLink() != null) {
                LinkType link = connection.getLink();
                sosSmlConnection.addConnection(new SmlLink(link.getDestination().getRef(), link.getSource().getRef()));
            }
        }
    }
    return sosSmlConnection;
}
Also used : SmlConnection(org.n52.shetland.ogc.sensorML.elements.SmlConnection) SmlLink(org.n52.shetland.ogc.sensorML.elements.SmlLink) SmlConnection(org.n52.shetland.ogc.sensorML.elements.SmlConnection) Connection(net.opengis.sensorml.x20.ConnectionListType.Connection) LinkType(net.opengis.sensorml.x20.LinkType)

Aggregations

Test (org.junit.Test)92 DecodingException (org.n52.svalbard.decode.exception.DecodingException)63 XmlObject (org.apache.xmlbeans.XmlObject)52 JsonNode (com.fasterxml.jackson.databind.JsonNode)25 SweField (org.n52.shetland.ogc.swe.SweField)25 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)23 XmlException (org.apache.xmlbeans.XmlException)23 GetObservationRequest (org.n52.shetland.ogc.sos.request.GetObservationRequest)22 UnsupportedDecoderInputException (org.n52.svalbard.decode.exception.UnsupportedDecoderInputException)21 AbstractProcess (org.n52.shetland.ogc.sensorML.AbstractProcess)13 SystemType (net.opengis.sensorML.x101.SystemType)12 TimeInstant (org.n52.shetland.ogc.gml.time.TimeInstant)12 Before (org.junit.Before)11 AbstractFeature (org.n52.shetland.ogc.gml.AbstractFeature)11 SensorMLDocument (net.opengis.sensorML.x101.SensorMLDocument)10 DateTime (org.joda.time.DateTime)10 SweAbstractDataComponent (org.n52.shetland.ogc.swe.SweAbstractDataComponent)10 XmlString (org.apache.xmlbeans.XmlString)9 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)8 Geometry (org.locationtech.jts.geom.Geometry)8