use of org.n52.shetland.ogc.sensorML.AbstractProcess in project arctic-sea by 52North.
the class SensorMLEncoderv101 method createSensorMLDescription.
protected SensorMLDocument createSensorMLDescription(final SensorML smlSensorDesc) throws EncodingException {
final SensorMLDocument sensorMLDoc = SensorMLDocument.Factory.newInstance(getXmlOptions());
final net.opengis.sensorML.x101.SensorMLDocument.SensorML xbSensorML = sensorMLDoc.addNewSensorML();
xbSensorML.setVersion(SensorMLConstants.VERSION_V101);
if (smlSensorDesc.isSetMembers()) {
for (final AbstractProcess sml : smlSensorDesc.getMembers()) {
if (sml instanceof System) {
final SystemType xbSystem = (SystemType) xbSensorML.addNewMember().addNewProcess().substitute(new QName(SensorMLConstants.NS_SML, SensorMLConstants.EN_SYSTEM), SystemType.type);
final System smlSystem = (System) sml;
addAbstractProcessValues(xbSystem, smlSystem);
addSystemValues(xbSystem, smlSystem);
} else if (sml instanceof ProcessModel) {
final ProcessModelType xbProcessModel = (ProcessModelType) xbSensorML.addNewMember().addNewProcess().substitute(new QName(SensorMLConstants.NS_SML, SensorMLConstants.EN_PROCESS_MODEL), ProcessModelType.type);
final ProcessModel smlProcessModel = (ProcessModel) sml;
addAbstractProcessValues(xbProcessModel, smlProcessModel);
addProcessModelValues(xbProcessModel, smlProcessModel);
} else if (sml instanceof org.n52.shetland.ogc.sensorML.Component) {
final ComponentType xbCompontent = (ComponentType) xbSensorML.addNewMember().addNewProcess().substitute(new QName(SensorMLConstants.NS_SML, SensorMLConstants.EN_COMPONENT), ComponentType.type);
final org.n52.shetland.ogc.sensorML.Component smlComponent = (org.n52.shetland.ogc.sensorML.Component) sml;
addAbstractProcessValues(xbCompontent, smlComponent);
addComponentValues(xbCompontent, smlComponent);
}
}
}
return sensorMLDoc;
}
use of org.n52.shetland.ogc.sensorML.AbstractProcess in project arctic-sea by 52North.
the class SensorMLEncoderv20 method addAggregateProcessValues.
private void addAggregateProcessValues(AggregateProcessType apt, AggregateProcess abstractProcess) throws EncodingException {
addAbstractProcessValues(apt, abstractProcess);
addDescribedObjectValues(apt, abstractProcess);
// set components
if (abstractProcess.isSetComponents()) {
List<SmlComponent> smlComponents = checkForComponents(abstractProcess);
if (!smlComponents.isEmpty()) {
ComponentListPropertyType clpt = createComponents(smlComponents);
if (clpt != null && clpt.getComponentList() != null && clpt.getComponentList().sizeOfComponentArray() > 0) {
apt.setComponents(clpt);
}
}
}
// set connections
}
use of org.n52.shetland.ogc.sensorML.AbstractProcess 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));
}
use of org.n52.shetland.ogc.sensorML.AbstractProcess 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));
}
use of org.n52.shetland.ogc.sensorML.AbstractProcess in project arctic-sea by 52North.
the class SensorMLDecoderV101Test method decodeAbstractProcess.
private AbstractProcess decodeAbstractProcess(SensorMLDocument xbSmlDoc) throws DecodingException {
// FIXME
// Object decoded = CodingHelper.decodeXmlObject(xbSmlDoc);
Object decoded = sensorMLDecoderV101.decode(xbSmlDoc);
assertThat(decoded, instanceOf(SensorML.class));
SensorML sml = (SensorML) decoded;
assertThat(sml.getMembers().size(), is(1));
return sml.getMembers().get(0);
}
Aggregations