use of net.opengis.sensorML.x101.SystemType in project arctic-sea by 52North.
the class SensorMLDecoderV101 method parseSystem.
private System parseSystem(final SystemType xbSystemType, final System system) throws DecodingException {
parseAbstractProcess(xbSystemType, system);
parseAbstractComponent(xbSystemType, system);
parseAbstractDerivableComponent(xbSystemType, system);
if (xbSystemType.isSetComponents() && xbSystemType.getComponents().isSetComponentList()) {
system.addComponents(parseComponents(xbSystemType.getComponents()));
ComponentList componentList = xbSystemType.getComponents().getComponentList();
checkComponentsForRemoval(componentList).forEach(componentList::removeComponent);
checkAndRemoveEmptyComponents(xbSystemType);
}
final String xmlDescription = addSensorMLWrapperForXmlDescription(xbSystemType);
system.setXml(xmlDescription);
return system;
}
use of net.opengis.sensorML.x101.SystemType in project arctic-sea by 52North.
the class SensorMLDecoderV101 method checkAndRemoveEmptyComponents.
private void checkAndRemoveEmptyComponents(final SystemType system) {
boolean removeComponents = false;
final Components components = system.getComponents();
if (components != null) {
if (components.getComponentList() == null) {
removeComponents = true;
} else if (components.getComponentList().getComponentArray() == null || ((components.getComponentList().getComponentArray() != null && components.getComponentList().getComponentArray().length == 0))) {
removeComponents = true;
}
}
if (removeComponents) {
system.unsetComponents();
}
}
use of net.opengis.sensorML.x101.SystemType in project arctic-sea by 52North.
the class SensorMLDecoderV101 method parseComponents.
private List<SmlComponent> parseComponents(final Components components) throws DecodingException {
final List<SmlComponent> sosSmlComponents = Lists.newLinkedList();
if (components.isSetComponentList() && components.getComponentList().getComponentArray() != null) {
for (final Component component : components.getComponentList().getComponentArray()) {
if (component.isSetProcess() || component.isSetHref()) {
final SmlComponent sosSmlcomponent = new SmlComponent(component.getName());
AbstractProcess abstractProcess = null;
if (component.isSetProcess()) {
if (component.getProcess() instanceof SystemType) {
abstractProcess = new System();
parseSystem((SystemType) component.getProcess(), (System) abstractProcess);
} else {
abstractProcess = new AbstractProcess();
parseAbstractProcess(component.getProcess(), abstractProcess);
}
} else {
abstractProcess = new AbstractProcess();
abstractProcess.setIdentifier(component.getHref());
}
sosSmlcomponent.setProcess(abstractProcess);
sosSmlComponents.add(sosSmlcomponent);
}
}
}
return sosSmlComponents;
}
use of net.opengis.sensorML.x101.SystemType in project arctic-sea by 52North.
the class SensorMLEncoderV101Test method should_set_gml_id.
@Test
public void should_set_gml_id() throws EncodingException {
final SensorML sensorMl = new SensorML();
final System system = new System();
sensorMl.addMember(system);
system.setGmlId(TEST_ID_1);
final SystemType xbSystem = encodeSystem(sensorMl);
assertThat(xbSystem.getId(), is(TEST_ID_1));
}
use of net.opengis.sensorML.x101.SystemType in project arctic-sea by 52North.
the class SensorMLEncoderV101Test method encodeSimpleDataRecord.
private SimpleDataRecordType encodeSimpleDataRecord(final SystemType xbSystem, final String capName, final int fields) {
assertThat(xbSystem.getCapabilitiesArray().length, is(1));
final Capabilities xbCapabilities = xbSystem.getCapabilitiesArray()[0];
assertThat(xbCapabilities.getName(), is(capName));
assertThat(xbCapabilities.getAbstractDataRecord(), notNullValue());
assertThat(xbCapabilities.getAbstractDataRecord(), instanceOf(SimpleDataRecordType.class));
final SimpleDataRecordType xbSimpleDataRecord = (SimpleDataRecordType) xbCapabilities.getAbstractDataRecord();
assertThat(xbSimpleDataRecord.getFieldArray().length, is(fields));
return xbSimpleDataRecord;
}
Aggregations