Search in sources :

Example 1 with SmlIdentifier

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

the class SensorMLDecoderV20 method parseIdentifications.

private void parseIdentifications(DescribedObject describedObject, IdentifierListPropertyType[] identificationArray) {
    for (final IdentifierListPropertyType ilpt : identificationArray) {
        if (ilpt.isSetIdentifierList() && CollectionHelper.isNotNullOrEmpty(ilpt.getIdentifierList().getIdentifier2Array())) {
            for (final Identifier i : ilpt.getIdentifierList().getIdentifier2Array()) {
                if (i.getTerm() != null) {
                    final SmlIdentifier identifier = new SmlIdentifier();
                    parseTerm(i.getTerm(), identifier);
                    describedObject.addIdentifier(identifier);
                    if (isIdentificationProcedureIdentifier(identifier)) {
                        describedObject.setIdentifier(identifier.getValue());
                    }
                }
            }
        }
    }
}
Also used : Identifier(net.opengis.sensorml.x20.IdentifierListType.Identifier) SmlIdentifier(org.n52.shetland.ogc.sensorML.elements.SmlIdentifier) IdentifierListPropertyType(net.opengis.sensorml.x20.IdentifierListPropertyType) SmlIdentifier(org.n52.shetland.ogc.sensorML.elements.SmlIdentifier)

Example 2 with SmlIdentifier

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

the class SensorMLDecoderV101 method parseIdentifications.

/**
 * Parses the identifications and sets the AbstractProcess' identifiers
 *
 * @param abstractProcess The AbstractProcess to which identifiers are added
 * @param identificationArray XML identification
 */
private void parseIdentifications(final AbstractProcess abstractProcess, final Identification[] identificationArray) {
    for (final Identification xbIdentification : identificationArray) {
        if (xbIdentification.getIdentifierList() != null) {
            for (final Identifier xbIdentifier : xbIdentification.getIdentifierList().getIdentifierArray()) {
                if (xbIdentifier.getName() != null && xbIdentifier.getTerm() != null) {
                    final SmlIdentifier identifier = new SmlIdentifier(xbIdentifier.getName(), xbIdentifier.getTerm().getDefinition(), xbIdentifier.getTerm().getValue());
                    abstractProcess.addIdentifier(identifier);
                    if (isIdentificationProcedureIdentifier(identifier)) {
                        abstractProcess.setIdentifier(identifier.getValue());
                    }
                }
            }
        }
    }
}
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) SmlIdentifier(org.n52.shetland.ogc.sensorML.elements.SmlIdentifier)

Example 3 with SmlIdentifier

use of org.n52.shetland.ogc.sensorML.elements.SmlIdentifier 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 4 with SmlIdentifier

use of org.n52.shetland.ogc.sensorML.elements.SmlIdentifier 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)

Aggregations

SmlIdentifier (org.n52.shetland.ogc.sensorML.elements.SmlIdentifier)4 Identifier (net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList.Identifier)3 Identification (net.opengis.sensorML.x101.IdentificationDocument.Identification)2 IdentifierList (net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList)2 SystemType (net.opengis.sensorML.x101.SystemType)1 Term (net.opengis.sensorML.x101.TermDocument.Term)1 IdentifierListPropertyType (net.opengis.sensorml.x20.IdentifierListPropertyType)1 Identifier (net.opengis.sensorml.x20.IdentifierListType.Identifier)1 Test (org.junit.Test)1 SensorML (org.n52.shetland.ogc.sensorML.SensorML)1 System (org.n52.shetland.ogc.sensorML.System)1