Search in sources :

Example 6 with SystemType

use of net.opengis.sensorML.x101.SystemType 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 7 with SystemType

use of net.opengis.sensorML.x101.SystemType 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 8 with SystemType

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

the class SensorMLDecoderV101Test method addChildProcedure.

private void addChildProcedure(ComponentList xbComponentList, String identifier) {
    Component xbComponent = xbComponentList.addNewComponent();
    xbComponent.setName(SensorMLConstants.ELEMENT_NAME_CHILD_PROCEDURES);
    SystemType xbSystem = (SystemType) xbComponent.addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
    IdentifierList xbIdentifierList = xbSystem.addNewIdentification().addNewIdentifierList();
    addIdentifier(xbIdentifierList, "anyname", OGCConstants.URN_UNIQUE_IDENTIFIER, identifier);
}
Also used : SystemType(net.opengis.sensorML.x101.SystemType) Component(net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList.Component) IdentifierList(net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList)

Example 9 with SystemType

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

the class SensorMLDecoderV101Test method should_decode_features_of_interest_from_sml.

@Test
public void should_decode_features_of_interest_from_sml() throws DecodingException {
    SensorMLDocument xbSmlDoc = getSensorMLDoc();
    SystemType xbSystem = (SystemType) xbSmlDoc.getSensorML().addNewMember().addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
    Capabilities xbCapabilities = xbSystem.addNewCapabilities();
    xbCapabilities.setName(SensorMLConstants.ELEMENT_NAME_FEATURES_OF_INTEREST);
    SimpleDataRecordType xbSimpleDataRecord = (SimpleDataRecordType) xbCapabilities.addNewAbstractDataRecord().substitute(SweConstants.QN_SIMPLEDATARECORD_SWE_101, SimpleDataRecordType.type);
    addCapabilitiesInsertionMetadata(xbSimpleDataRecord, TEST_ID_1, TEST_NAME_1);
    addCapabilitiesInsertionMetadata(xbSimpleDataRecord, TEST_ID_2, TEST_NAME_2);
    AbstractProcess absProcess = decodeAbstractProcess(xbSmlDoc);
    // assertThat(absProcess.getFeaturesOfInterest().size(), is(2));
    assertThat(absProcess.getCapabilities().size(), is(1));
// List<String> featuresOfInterest = new ArrayList<String>(absProcess.getFeaturesOfInterest());
// Collections.sort(featuresOfInterest);
// assertThat(featuresOfInterest.get(0), is(TEST_ID_1));
// assertThat(featuresOfInterest.get(1), is(TEST_ID_2));
}
Also used : SensorMLDocument(net.opengis.sensorML.x101.SensorMLDocument) AbstractProcess(org.n52.shetland.ogc.sensorML.AbstractProcess) Capabilities(net.opengis.sensorML.x101.CapabilitiesDocument.Capabilities) SystemType(net.opengis.sensorML.x101.SystemType) SimpleDataRecordType(net.opengis.swe.x101.SimpleDataRecordType) Test(org.junit.Test)

Example 10 with SystemType

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

the class SensorMLDecoderV101 method parseSensorML.

@SuppressFBWarnings("BC_VACUOUS_INSTANCEOF")
private SensorML parseSensorML(final SensorMLDocument xbSensorML) throws DecodingException {
    final SensorML sensorML = new SensorML();
    // get member process
    for (final Member xbMember : xbSensorML.getSensorML().getMemberArray()) {
        if (xbMember.getProcess() != null) {
            if (xbMember.getProcess() instanceof AbstractProcessType) {
                final AbstractProcessType xbAbstractProcess = xbMember.getProcess();
                AbstractProcess abstractProcess = null;
                if (xbAbstractProcess.schemaType() == SystemType.type) {
                    abstractProcess = parseSystem((SystemType) xbAbstractProcess);
                } else if (xbAbstractProcess.schemaType() == ProcessModelType.type) {
                    abstractProcess = parseProcessModel((ProcessModelType) xbAbstractProcess);
                } else if (xbAbstractProcess.schemaType() == ComponentType.type) {
                    abstractProcess = parseComponent((ComponentType) xbAbstractProcess);
                } else {
                    throw unsupportedMemberProcess(xbMember);
                }
                sensorML.addMember(abstractProcess);
            } else {
                throw unsupportedMemberProcess(xbMember);
            }
        } else {
            throw new DecodingException(XmlHelper.getLocalName(xbMember), "The process of a member of the SensorML Document is null (%s)!", xbMember.getProcess());
        }
    }
    sensorML.setXml(xbSensorML.xmlText(getXmlOptions()));
    return sensorML;
}
Also used : AbstractProcessType(net.opengis.sensorML.x101.AbstractProcessType) AbstractComponentType(net.opengis.sensorML.x101.AbstractComponentType) AbstractDerivableComponentType(net.opengis.sensorML.x101.AbstractDerivableComponentType) ComponentType(net.opengis.sensorML.x101.ComponentType) AbstractProcess(org.n52.shetland.ogc.sensorML.AbstractProcess) SystemType(net.opengis.sensorML.x101.SystemType) DecodingException(org.n52.svalbard.decode.exception.DecodingException) SensorML(org.n52.shetland.ogc.sensorML.SensorML) AbstractSensorML(org.n52.shetland.ogc.sensorML.AbstractSensorML) Member(net.opengis.sensorML.x101.SensorMLDocument.SensorML.Member) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

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