use of net.opengis.sensorML.x101.ProcessModelType 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 net.opengis.sensorML.x101.ProcessModelType in project arctic-sea by 52North.
the class SensorMLDecoderV101 method parseSensorML.
@SuppressFBWarnings("BC_VACUOUS_INSTANCEOF")
private SensorML parseSensorML(final SensorMLDocument xbSensorML) throws DecodingException {
final SensorML sensorML = new SensorML();
// get member process
for (final Member xbMember : xbSensorML.getSensorML().getMemberArray()) {
if (xbMember.getProcess() != null) {
if (xbMember.getProcess() instanceof AbstractProcessType) {
final AbstractProcessType xbAbstractProcess = xbMember.getProcess();
AbstractProcess abstractProcess = null;
if (xbAbstractProcess.schemaType() == SystemType.type) {
abstractProcess = parseSystem((SystemType) xbAbstractProcess);
} else if (xbAbstractProcess.schemaType() == ProcessModelType.type) {
abstractProcess = parseProcessModel((ProcessModelType) xbAbstractProcess);
} else if (xbAbstractProcess.schemaType() == ComponentType.type) {
abstractProcess = parseComponent((ComponentType) xbAbstractProcess);
} else {
throw unsupportedMemberProcess(xbMember);
}
sensorML.addMember(abstractProcess);
} else {
throw unsupportedMemberProcess(xbMember);
}
} else {
throw new DecodingException(XmlHelper.getLocalName(xbMember), "The process of a member of the SensorML Document is null (%s)!", xbMember.getProcess());
}
}
sensorML.setXml(xbSensorML.xmlText(getXmlOptions()));
return sensorML;
}
use of net.opengis.sensorML.x101.ProcessModelType in project arctic-sea by 52North.
the class SensorMLEncoderv101 method createProcessDescription.
private XmlObject createProcessDescription(final AbstractProcess sensorDesc) throws EncodingException {
// TODO Review: System -> return doc; ProcessModel -> return type
if (sensorDesc instanceof System) {
System system = (System) sensorDesc;
SystemDocument xbSystemDoc = SystemDocument.Factory.newInstance(getXmlOptions());
SystemType xbSystem = xbSystemDoc.addNewSystem();
addAbstractProcessValues(xbSystem, system);
addSystemValues(xbSystem, system);
return xbSystem;
} else if (sensorDesc instanceof ProcessModel) {
// TODO: set values
ProcessModel processModel = (ProcessModel) sensorDesc;
ProcessModelDocument xbProcessModelDoc = ProcessModelDocument.Factory.newInstance(getXmlOptions());
ProcessModelType xbProcessModel = xbProcessModelDoc.addNewProcessModel();
addAbstractProcessValues(xbProcessModel, processModel);
addProcessModelValues(xbProcessModel, processModel);
return xbProcessModel;
} else if (sensorDesc instanceof org.n52.shetland.ogc.sensorML.Component) {
org.n52.shetland.ogc.sensorML.Component component = (org.n52.shetland.ogc.sensorML.Component) sensorDesc;
ComponentDocument cd = ComponentDocument.Factory.newInstance(getXmlOptions());
ComponentType ct = cd.addNewComponent();
addAbstractProcessValues(ct, component);
return ct;
} else {
throw unsupportedDescriptionType();
}
}
Aggregations