use of net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList.Identifier 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());
}
}
}
}
}
}
use of net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList.Identifier 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 };
}
use of net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList.Identifier 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));
}
use of net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList.Identifier 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);
}
use of net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList.Identifier 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);
}
Aggregations