Search in sources :

Example 6 with SosProcedureDescription

use of org.n52.shetland.ogc.sos.SosProcedureDescription in project arctic-sea by 52North.

the class InsertSensorRequestEncoderTest method createProcedureDescription.

private SosProcedureDescription<PhysicalSystem> createProcedureDescription() {
    PhysicalSystem description = new PhysicalSystem();
    description.setIdentifier("test-identifier");
    return new SosProcedureDescription<>(description);
}
Also used : PhysicalSystem(org.n52.shetland.ogc.sensorML.v20.PhysicalSystem) SosProcedureDescription(org.n52.shetland.ogc.sos.SosProcedureDescription)

Example 7 with SosProcedureDescription

use of org.n52.shetland.ogc.sos.SosProcedureDescription in project arctic-sea by 52North.

the class SensorMLDecoderV101Test method should_decode_child_procedure_from_sml.

@Test
public void should_decode_child_procedure_from_sml() throws DecodingException {
    SensorMLDocument xbSmlDoc = getSensorMLDoc();
    SystemType xbSystem = (SystemType) xbSmlDoc.getSensorML().addNewMember().addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
    IdentifierList xbIdentifierList = xbSystem.addNewIdentification().addNewIdentifierList();
    addIdentifier(xbIdentifierList, "anyname", OGCConstants.URN_UNIQUE_IDENTIFIER, TEST_ID_1);
    ComponentList xbComponentList = xbSystem.addNewComponents().addNewComponentList();
    addChildProcedure(xbComponentList, TEST_ID_2);
    AbstractProcess absProcess = decodeAbstractProcess(xbSmlDoc);
    assertThat(absProcess.getIdentifier(), is(TEST_ID_1));
// assertThat(absProcess.getChildProcedures().size(), is(1));
// SosProcedureDescription childProcedure = absProcess.getChildProcedures().iterator().next();
// assertThat(childProcedure, instanceOf(System.class));
// assertThat(childProcedure.getIdentifier(), is(TEST_ID_2));
}
Also used : SensorMLDocument(net.opengis.sensorML.x101.SensorMLDocument) AbstractProcess(org.n52.shetland.ogc.sensorML.AbstractProcess) SystemType(net.opengis.sensorML.x101.SystemType) ComponentList(net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList) IdentifierList(net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList) Test(org.junit.Test)

Example 8 with SosProcedureDescription

use of org.n52.shetland.ogc.sos.SosProcedureDescription in project arctic-sea by 52North.

the class SensorMLEncoderv101 method encode.

@Override
public XmlObject encode(final Object response, final EncodingContext additionalValues) throws EncodingException {
    XmlObject encodedObject = null;
    if (response instanceof AbstractSensorML) {
        encodedObject = createSensorDescription((AbstractSensorML) response);
    // }
    // FIXME workaround? if of type UnknowProcedureType try to parse the
    // description string, UNIT is missing "NOT_DEFINED"?!
    // else if (response instanceof SosProcedureDescriptionUnknownType)
    // {
    // final String procDescXMLString = ((SosProcedureDescription)
    // response).getXml();
    // final AbstractSensorML sensorDesc = new AbstractSensorML();
    // sensorDesc.setXml(procDescXMLString);
    // encodedObject = createSensorDescriptionFromString(sensorDesc);
    } else {
        throw new UnsupportedEncoderInputException(this, response);
    }
    // check if all gml:id are unique
    XmlHelper.makeGmlIdsUnique(encodedObject.getDomNode());
    XmlHelper.validateDocument(encodedObject, EncodingException::new);
    return encodedObject;
}
Also used : AbstractSensorML(org.n52.shetland.ogc.sensorML.AbstractSensorML) EncodingException(org.n52.svalbard.encode.exception.EncodingException) XmlObject(org.apache.xmlbeans.XmlObject) UnsupportedEncoderInputException(org.n52.svalbard.encode.exception.UnsupportedEncoderInputException)

Aggregations

XmlObject (org.apache.xmlbeans.XmlObject)6 SosProcedureDescription (org.n52.shetland.ogc.sos.SosProcedureDescription)6 AbstractFeature (org.n52.shetland.ogc.gml.AbstractFeature)5 XmlException (org.apache.xmlbeans.XmlException)4 DecodingException (org.n52.svalbard.decode.exception.DecodingException)4 OwsServiceCommunicationObject (org.n52.shetland.ogc.ows.service.OwsServiceCommunicationObject)2 UnsupportedEncoderInputException (org.n52.svalbard.encode.exception.UnsupportedEncoderInputException)2 NamedValueDocument (net.opengis.om.x20.NamedValueDocument)1 NamedValuePropertyType (net.opengis.om.x20.NamedValuePropertyType)1 NamedValueType (net.opengis.om.x20.NamedValueType)1 ComponentList (net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList)1 IdentifierList (net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList)1 SensorMLDocument (net.opengis.sensorML.x101.SensorMLDocument)1 SystemType (net.opengis.sensorML.x101.SystemType)1 InsertSensorType (net.opengis.swes.x20.InsertSensorType)1 SensorDescriptionType (net.opengis.swes.x20.SensorDescriptionType)1 UpdateSensorDescriptionType (net.opengis.swes.x20.UpdateSensorDescriptionType)1 Description (net.opengis.swes.x20.UpdateSensorDescriptionType.Description)1 Test (org.junit.Test)1 NamedValue (org.n52.shetland.ogc.om.NamedValue)1