Search in sources :

Example 6 with AbstractProcess

use of org.n52.shetland.ogc.sensorML.AbstractProcess in project arctic-sea by 52North.

the class SensorMLEncoderv101 method createSensorMLDescription.

protected SensorMLDocument createSensorMLDescription(final SensorML smlSensorDesc) throws EncodingException {
    final SensorMLDocument sensorMLDoc = SensorMLDocument.Factory.newInstance(getXmlOptions());
    final net.opengis.sensorML.x101.SensorMLDocument.SensorML xbSensorML = sensorMLDoc.addNewSensorML();
    xbSensorML.setVersion(SensorMLConstants.VERSION_V101);
    if (smlSensorDesc.isSetMembers()) {
        for (final AbstractProcess sml : smlSensorDesc.getMembers()) {
            if (sml instanceof System) {
                final SystemType xbSystem = (SystemType) xbSensorML.addNewMember().addNewProcess().substitute(new QName(SensorMLConstants.NS_SML, SensorMLConstants.EN_SYSTEM), SystemType.type);
                final System smlSystem = (System) sml;
                addAbstractProcessValues(xbSystem, smlSystem);
                addSystemValues(xbSystem, smlSystem);
            } else if (sml instanceof ProcessModel) {
                final ProcessModelType xbProcessModel = (ProcessModelType) xbSensorML.addNewMember().addNewProcess().substitute(new QName(SensorMLConstants.NS_SML, SensorMLConstants.EN_PROCESS_MODEL), ProcessModelType.type);
                final ProcessModel smlProcessModel = (ProcessModel) sml;
                addAbstractProcessValues(xbProcessModel, smlProcessModel);
                addProcessModelValues(xbProcessModel, smlProcessModel);
            } else if (sml instanceof org.n52.shetland.ogc.sensorML.Component) {
                final ComponentType xbCompontent = (ComponentType) xbSensorML.addNewMember().addNewProcess().substitute(new QName(SensorMLConstants.NS_SML, SensorMLConstants.EN_COMPONENT), ComponentType.type);
                final org.n52.shetland.ogc.sensorML.Component smlComponent = (org.n52.shetland.ogc.sensorML.Component) sml;
                addAbstractProcessValues(xbCompontent, smlComponent);
                addComponentValues(xbCompontent, smlComponent);
            }
        }
    }
    return sensorMLDoc;
}
Also used : ProcessModel(org.n52.shetland.ogc.sensorML.ProcessModel) ComponentType(net.opengis.sensorML.x101.ComponentType) AbstractDataComponentType(net.opengis.swe.x101.AbstractDataComponentType) AbstractProcess(org.n52.shetland.ogc.sensorML.AbstractProcess) QName(javax.xml.namespace.QName) SystemType(net.opengis.sensorML.x101.SystemType) System(org.n52.shetland.ogc.sensorML.System) SensorMLDocument(net.opengis.sensorML.x101.SensorMLDocument) SmlComponent(org.n52.shetland.ogc.sensorML.elements.SmlComponent) Component(net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList.Component) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent) ProcessModelType(net.opengis.sensorML.x101.ProcessModelType)

Example 7 with AbstractProcess

use of org.n52.shetland.ogc.sensorML.AbstractProcess in project arctic-sea by 52North.

the class SensorMLEncoderv20 method addAggregateProcessValues.

private void addAggregateProcessValues(AggregateProcessType apt, AggregateProcess abstractProcess) throws EncodingException {
    addAbstractProcessValues(apt, abstractProcess);
    addDescribedObjectValues(apt, abstractProcess);
    // set components
    if (abstractProcess.isSetComponents()) {
        List<SmlComponent> smlComponents = checkForComponents(abstractProcess);
        if (!smlComponents.isEmpty()) {
            ComponentListPropertyType clpt = createComponents(smlComponents);
            if (clpt != null && clpt.getComponentList() != null && clpt.getComponentList().sizeOfComponentArray() > 0) {
                apt.setComponents(clpt);
            }
        }
    }
// set connections
}
Also used : ComponentListPropertyType(net.opengis.sensorml.x20.ComponentListPropertyType) SmlComponent(org.n52.shetland.ogc.sensorML.elements.SmlComponent)

Example 8 with AbstractProcess

use of org.n52.shetland.ogc.sensorML.AbstractProcess in project arctic-sea by 52North.

the class SensorMLDecoderV101Test method should_set_identifier_by_identifier_definition.

@Test
public void should_set_identifier_by_identifier_definition() 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, "any name", OGCConstants.URN_UNIQUE_IDENTIFIER, TEST_ID_1);
    addIdentifier(xbIdentifierList, "any other name", null, TEST_ID_2);
    AbstractProcess absProcess = decodeAbstractProcess(xbSmlDoc);
    assertThat(absProcess.getIdentifier(), is(TEST_ID_1));
    assertThat(absProcess.getIdentifications().size(), is(2));
}
Also used : SensorMLDocument(net.opengis.sensorML.x101.SensorMLDocument) AbstractProcess(org.n52.shetland.ogc.sensorML.AbstractProcess) SystemType(net.opengis.sensorML.x101.SystemType) IdentifierList(net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList) Test(org.junit.Test)

Example 9 with AbstractProcess

use of org.n52.shetland.ogc.sensorML.AbstractProcess in project arctic-sea by 52North.

the class SensorMLDecoderV101Test method should_set_gml_id.

@Test
public void should_set_gml_id() throws DecodingException {
    SensorMLDocument xbSmlDoc = getSensorMLDoc();
    SystemType xbSystem = (SystemType) xbSmlDoc.getSensorML().addNewMember().addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
    xbSystem.setId(TEST_ID_1);
    AbstractProcess absProcess = decodeAbstractProcess(xbSmlDoc);
    assertThat(absProcess.getGmlId(), is(TEST_ID_1));
}
Also used : SensorMLDocument(net.opengis.sensorML.x101.SensorMLDocument) AbstractProcess(org.n52.shetland.ogc.sensorML.AbstractProcess) SystemType(net.opengis.sensorML.x101.SystemType) Test(org.junit.Test)

Example 10 with AbstractProcess

use of org.n52.shetland.ogc.sensorML.AbstractProcess in project arctic-sea by 52North.

the class SensorMLDecoderV101Test method decodeAbstractProcess.

private AbstractProcess decodeAbstractProcess(SensorMLDocument xbSmlDoc) throws DecodingException {
    // FIXME
    // Object decoded = CodingHelper.decodeXmlObject(xbSmlDoc);
    Object decoded = sensorMLDecoderV101.decode(xbSmlDoc);
    assertThat(decoded, instanceOf(SensorML.class));
    SensorML sml = (SensorML) decoded;
    assertThat(sml.getMembers().size(), is(1));
    return sml.getMembers().get(0);
}
Also used : SensorML(org.n52.shetland.ogc.sensorML.SensorML)

Aggregations

AbstractProcess (org.n52.shetland.ogc.sensorML.AbstractProcess)15 SystemType (net.opengis.sensorML.x101.SystemType)14 SensorMLDocument (net.opengis.sensorML.x101.SensorMLDocument)12 Test (org.junit.Test)10 XmlObject (org.apache.xmlbeans.XmlObject)6 SmlComponent (org.n52.shetland.ogc.sensorML.elements.SmlComponent)6 SweAbstractDataComponent (org.n52.shetland.ogc.swe.SweAbstractDataComponent)6 Capabilities (net.opengis.sensorML.x101.CapabilitiesDocument.Capabilities)5 Component (net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList.Component)4 IdentifierList (net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList)4 SimpleDataRecordType (net.opengis.swe.x101.SimpleDataRecordType)4 ComponentType (net.opengis.sensorML.x101.ComponentType)3 AbstractSensorML (org.n52.shetland.ogc.sensorML.AbstractSensorML)3 SensorML (org.n52.shetland.ogc.sensorML.SensorML)3 System (org.n52.shetland.ogc.sensorML.System)3 DecodingException (org.n52.svalbard.decode.exception.DecodingException)3 AbstractProcessType (net.opengis.sensorML.x101.AbstractProcessType)2 ComponentList (net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList)2 ContactList (net.opengis.sensorML.x101.ContactListDocument.ContactList)2 ProcessModelType (net.opengis.sensorML.x101.ProcessModelType)2