Search in sources :

Example 11 with SystemType

use of net.opengis.sensorML.x101.SystemType in project arctic-sea by 52North.

the class SensorMLDecoderV101 method parseSystem.

private System parseSystem(final SystemType xbSystemType, final System system) throws DecodingException {
    parseAbstractProcess(xbSystemType, system);
    parseAbstractComponent(xbSystemType, system);
    parseAbstractDerivableComponent(xbSystemType, system);
    if (xbSystemType.isSetComponents() && xbSystemType.getComponents().isSetComponentList()) {
        system.addComponents(parseComponents(xbSystemType.getComponents()));
        ComponentList componentList = xbSystemType.getComponents().getComponentList();
        checkComponentsForRemoval(componentList).forEach(componentList::removeComponent);
        checkAndRemoveEmptyComponents(xbSystemType);
    }
    final String xmlDescription = addSensorMLWrapperForXmlDescription(xbSystemType);
    system.setXml(xmlDescription);
    return system;
}
Also used : ComponentList(net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList)

Example 12 with SystemType

use of net.opengis.sensorML.x101.SystemType in project arctic-sea by 52North.

the class SensorMLDecoderV101 method checkAndRemoveEmptyComponents.

private void checkAndRemoveEmptyComponents(final SystemType system) {
    boolean removeComponents = false;
    final Components components = system.getComponents();
    if (components != null) {
        if (components.getComponentList() == null) {
            removeComponents = true;
        } else if (components.getComponentList().getComponentArray() == null || ((components.getComponentList().getComponentArray() != null && components.getComponentList().getComponentArray().length == 0))) {
            removeComponents = true;
        }
    }
    if (removeComponents) {
        system.unsetComponents();
    }
}
Also used : Components(net.opengis.sensorML.x101.ComponentsDocument.Components)

Example 13 with SystemType

use of net.opengis.sensorML.x101.SystemType in project arctic-sea by 52North.

the class SensorMLDecoderV101 method parseComponents.

private List<SmlComponent> parseComponents(final Components components) throws DecodingException {
    final List<SmlComponent> sosSmlComponents = Lists.newLinkedList();
    if (components.isSetComponentList() && components.getComponentList().getComponentArray() != null) {
        for (final Component component : components.getComponentList().getComponentArray()) {
            if (component.isSetProcess() || component.isSetHref()) {
                final SmlComponent sosSmlcomponent = new SmlComponent(component.getName());
                AbstractProcess abstractProcess = null;
                if (component.isSetProcess()) {
                    if (component.getProcess() instanceof SystemType) {
                        abstractProcess = new System();
                        parseSystem((SystemType) component.getProcess(), (System) abstractProcess);
                    } else {
                        abstractProcess = new AbstractProcess();
                        parseAbstractProcess(component.getProcess(), abstractProcess);
                    }
                } else {
                    abstractProcess = new AbstractProcess();
                    abstractProcess.setIdentifier(component.getHref());
                }
                sosSmlcomponent.setProcess(abstractProcess);
                sosSmlComponents.add(sosSmlcomponent);
            }
        }
    }
    return sosSmlComponents;
}
Also used : AbstractProcess(org.n52.shetland.ogc.sensorML.AbstractProcess) SystemType(net.opengis.sensorML.x101.SystemType) SmlComponent(org.n52.shetland.ogc.sensorML.elements.SmlComponent) AbstractComponent(org.n52.shetland.ogc.sensorML.AbstractComponent) Component(net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList.Component) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent) SmlComponent(org.n52.shetland.ogc.sensorML.elements.SmlComponent) System(org.n52.shetland.ogc.sensorML.System)

Example 14 with SystemType

use of net.opengis.sensorML.x101.SystemType in project arctic-sea by 52North.

the class SensorMLEncoderV101Test method should_set_gml_id.

@Test
public void should_set_gml_id() throws EncodingException {
    final SensorML sensorMl = new SensorML();
    final System system = new System();
    sensorMl.addMember(system);
    system.setGmlId(TEST_ID_1);
    final SystemType xbSystem = encodeSystem(sensorMl);
    assertThat(xbSystem.getId(), is(TEST_ID_1));
}
Also used : SystemType(net.opengis.sensorML.x101.SystemType) SensorML(org.n52.shetland.ogc.sensorML.SensorML) System(org.n52.shetland.ogc.sensorML.System) Test(org.junit.Test)

Example 15 with SystemType

use of net.opengis.sensorML.x101.SystemType in project arctic-sea by 52North.

the class SensorMLEncoderV101Test method encodeSimpleDataRecord.

private SimpleDataRecordType encodeSimpleDataRecord(final SystemType xbSystem, final String capName, final int fields) {
    assertThat(xbSystem.getCapabilitiesArray().length, is(1));
    final Capabilities xbCapabilities = xbSystem.getCapabilitiesArray()[0];
    assertThat(xbCapabilities.getName(), is(capName));
    assertThat(xbCapabilities.getAbstractDataRecord(), notNullValue());
    assertThat(xbCapabilities.getAbstractDataRecord(), instanceOf(SimpleDataRecordType.class));
    final SimpleDataRecordType xbSimpleDataRecord = (SimpleDataRecordType) xbCapabilities.getAbstractDataRecord();
    assertThat(xbSimpleDataRecord.getFieldArray().length, is(fields));
    return xbSimpleDataRecord;
}
Also used : Capabilities(net.opengis.sensorML.x101.CapabilitiesDocument.Capabilities) SimpleDataRecordType(net.opengis.swe.x101.SimpleDataRecordType)

Aggregations

SystemType (net.opengis.sensorML.x101.SystemType)24 Test (org.junit.Test)18 SensorMLDocument (net.opengis.sensorML.x101.SensorMLDocument)15 AbstractProcess (org.n52.shetland.ogc.sensorML.AbstractProcess)13 System (org.n52.shetland.ogc.sensorML.System)11 SensorML (org.n52.shetland.ogc.sensorML.SensorML)9 IdentifierList (net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList)6 SimpleDataRecordType (net.opengis.swe.x101.SimpleDataRecordType)5 SmlPerson (org.n52.shetland.ogc.sensorML.SmlPerson)5 Capabilities (net.opengis.sensorML.x101.CapabilitiesDocument.Capabilities)4 Component (net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList.Component)4 ResponsibleParty (net.opengis.sensorML.x101.ResponsiblePartyDocument.ResponsibleParty)4 XmlObject (org.apache.xmlbeans.XmlObject)4 SmlResponsibleParty (org.n52.shetland.ogc.sensorML.SmlResponsibleParty)4 ComponentType (net.opengis.sensorML.x101.ComponentType)3 ContactList (net.opengis.sensorML.x101.ContactListDocument.ContactList)3 Person (net.opengis.sensorML.x101.PersonDocument.Person)3 SmlComponent (org.n52.shetland.ogc.sensorML.elements.SmlComponent)3 SweAbstractDataComponent (org.n52.shetland.ogc.swe.SweAbstractDataComponent)3 ComponentList (net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList)2