Search in sources :

Example 61 with DecodingException

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

the class SensorMLDecoderV20 method parseSimpleProcess.

private DescribedObject parseSimpleProcess(SimpleProcessType describedObject) throws DecodingException {
    SimpleProcess sp = new SimpleProcess();
    parseAbstractProcess(describedObject, sp);
    parseDescribedObject(describedObject, sp);
    return sp;
}
Also used : SimpleProcess(org.n52.shetland.ogc.sensorML.v20.SimpleProcess)

Example 62 with DecodingException

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

the class SensorMLDecoderV20 method parseOutput.

@SuppressWarnings({ "rawtypes" })
private SmlIo parseOutput(Output xbOutput) throws DecodingException {
    final SmlIo sosIo = new SmlIo();
    sosIo.setIoName(xbOutput.getName());
    if (xbOutput.isSetHref()) {
        parseReference(xbOutput, sosIo);
    } else {
        sosIo.setIoValue(parseDataComponentOrObservablePropertyType(xbOutput));
    }
    return sosIo;
}
Also used : SmlIo(org.n52.shetland.ogc.sensorML.elements.SmlIo)

Example 63 with DecodingException

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

the class SensorMLDecoderV20 method parseDataInterfaceType.

protected SmlDataInterface parseDataInterfaceType(DataInterfaceType xbDataInterface) throws DecodingException {
    SmlDataInterface dataInterface = new SmlDataInterface();
    // TODO implement- no funding at the moment available
    // When starting implementation: Do not forget to activate the already
    // available unit tests
    Object data = decodeXmlElement(xbDataInterface.getData());
    if (data instanceof SweDataStream) {
        dataInterface.setData((SweDataStream) data);
    }
    if (xbDataInterface.isSetInterfaceParameters()) {
        Object parameter = decodeXmlElement(xbDataInterface.getInterfaceParameters());
        if (parameter instanceof SweDataRecord) {
            dataInterface.setInputParameters((SweDataRecord) parameter);
        }
    // TODO throw exception if not instance of SweDataRecord
    }
    return dataInterface;
}
Also used : SweDataStream(org.n52.shetland.ogc.swe.SweDataStream) SweDataRecord(org.n52.shetland.ogc.swe.SweDataRecord) DescribedObject(org.n52.shetland.ogc.sensorML.v20.DescribedObject) XmlObject(org.apache.xmlbeans.XmlObject) SmlDataInterface(org.n52.shetland.ogc.sensorML.v20.SmlDataInterface)

Example 64 with DecodingException

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

the class SensorMLDecoderV20 method parsePhysicalSystem.

private DescribedObject parsePhysicalSystem(PhysicalSystemType describedObject) throws DecodingException {
    PhysicalSystem ps = new PhysicalSystem();
    parseAbstractPhysicalProcess(describedObject, ps);
    parseAbstractProcess(describedObject, ps);
    parseDescribedObject(describedObject, ps);
    if (describedObject.isSetComponents()) {
        ps.addComponents(parseComponents(describedObject.getComponents()));
        final List<Integer> compsToRemove = checkComponentsForRemoval(describedObject.getComponents().getComponentList());
        compsToRemove.forEach(describedObject.getComponents().getComponentList()::removeComponent);
        if (removeEmptyComponents(describedObject.getComponents())) {
            describedObject.unsetComponents();
        }
    }
    return ps;
}
Also used : PhysicalSystem(org.n52.shetland.ogc.sensorML.v20.PhysicalSystem)

Example 65 with DecodingException

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

the class SensorMLDecoderV20 method parseAggregateProcess.

private DescribedObject parseAggregateProcess(AggregateProcessType describedObject) throws DecodingException {
    AggregateProcess ap = new AggregateProcess();
    parseAbstractProcess(describedObject, ap);
    parseDescribedObject(describedObject, ap);
    if (describedObject.isSetComponents()) {
        ap.addComponents(parseComponents(describedObject.getComponents()));
        List<Integer> compsToRemove = checkComponentsForRemoval(describedObject.getComponents().getComponentList());
        compsToRemove.forEach(describedObject.getComponents().getComponentList()::removeComponent);
        if (removeEmptyComponents(describedObject.getComponents())) {
            describedObject.unsetComponents();
        }
    }
    if (describedObject.isSetConnections()) {
        ap.setConnections(parseConnections(describedObject.getConnections()));
    }
    return ap;
}
Also used : AggregateProcess(org.n52.shetland.ogc.sensorML.v20.AggregateProcess)

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