Search in sources :

Example 1 with IdentifierList

use of net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList in project arctic-sea by 52North.

the class SensorMLEncoderv101 method createIdentification.

/**
 * Creates the valueentification section of the SensorML description.
 *
 * @param identifications
 *            SOS valueentifications
 *
 * @return XML Identification array
 */
protected Identification[] createIdentification(List<SmlIdentifier> identifications) {
    Identification xbIdentification = Identification.Factory.newInstance(getXmlOptions());
    IdentifierList xbIdentifierList = xbIdentification.addNewIdentifierList();
    identifications.forEach(sosSMLIdentifier -> {
        Identifier xbIdentifier = xbIdentifierList.addNewIdentifier();
        if (sosSMLIdentifier.getName() != null) {
            xbIdentifier.setName(sosSMLIdentifier.getName());
        }
        Term xbTerm = xbIdentifier.addNewTerm();
        xbTerm.setDefinition(sosSMLIdentifier.getDefinition());
        xbTerm.setValue(sosSMLIdentifier.getValue());
    });
    return new Identification[] { xbIdentification };
}
Also used : Identifier(net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList.Identifier) SmlIdentifier(org.n52.shetland.ogc.sensorML.elements.SmlIdentifier) Identification(net.opengis.sensorML.x101.IdentificationDocument.Identification) Term(net.opengis.sensorML.x101.TermDocument.Term) IdentifierList(net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList)

Example 2 with IdentifierList

use of net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList in project arctic-sea by 52North.

the class SensorMLEncoderV101Test method should_set_identifier.

@Test
public void should_set_identifier() throws EncodingException {
    final SensorML sensorMl = new SensorML();
    final System system = new System();
    sensorMl.addMember(system);
    system.addIdentifier(new SmlIdentifier(TEST_NAME_1, OGCConstants.URN_UNIQUE_IDENTIFIER, TEST_ID_1));
    final SystemType xbSystem = encodeSystem(sensorMl);
    assertThat(xbSystem.getIdentificationArray().length, is(1));
    final IdentifierList xbIdentifierList = xbSystem.getIdentificationArray()[0].getIdentifierList();
    assertThat(xbIdentifierList.sizeOfIdentifierArray(), is(1));
    final Identifier xbIdentifier = xbIdentifierList.getIdentifierArray(0);
    assertThat(xbIdentifier.getName(), is(TEST_NAME_1));
    assertThat(xbIdentifier.getTerm().getDefinition(), is(OGCConstants.URN_UNIQUE_IDENTIFIER));
    assertThat(xbIdentifier.getTerm().getValue(), is(TEST_ID_1));
}
Also used : SmlIdentifier(org.n52.shetland.ogc.sensorML.elements.SmlIdentifier) Identifier(net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList.Identifier) SystemType(net.opengis.sensorML.x101.SystemType) IdentifierList(net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList) SensorML(org.n52.shetland.ogc.sensorML.SensorML) System(org.n52.shetland.ogc.sensorML.System) SmlIdentifier(org.n52.shetland.ogc.sensorML.elements.SmlIdentifier) Test(org.junit.Test)

Example 3 with IdentifierList

use of net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList 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 4 with IdentifierList

use of net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList 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 5 with IdentifierList

use of net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList in project arctic-sea by 52North.

the class SensorMLDecoderV101Test method addIdentifier.

private void addIdentifier(IdentifierList xbIdentifierList, String name, String definition, String value) {
    Identifier xbIdentifier = xbIdentifierList.addNewIdentifier();
    xbIdentifier.setName(name);
    Term xbTerm = xbIdentifier.addNewTerm();
    xbTerm.setDefinition(definition);
    xbTerm.setValue(value);
}
Also used : Identifier(net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList.Identifier) Term(net.opengis.sensorML.x101.TermDocument.Term)

Aggregations

IdentifierList (net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList)7 SystemType (net.opengis.sensorML.x101.SystemType)6 Test (org.junit.Test)5 SensorMLDocument (net.opengis.sensorML.x101.SensorMLDocument)4 AbstractProcess (org.n52.shetland.ogc.sensorML.AbstractProcess)4 Identifier (net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList.Identifier)3 Term (net.opengis.sensorML.x101.TermDocument.Term)2 SmlIdentifier (org.n52.shetland.ogc.sensorML.elements.SmlIdentifier)2 ComponentList (net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList)1 Component (net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList.Component)1 Identification (net.opengis.sensorML.x101.IdentificationDocument.Identification)1 SensorML (org.n52.shetland.ogc.sensorML.SensorML)1 System (org.n52.shetland.ogc.sensorML.System)1