private String addSensorMLWrapperForXmlDescription(final AbstractProcessType xbProcessType) { final SensorMLDocument xbSensorMLDoc = SensorMLDocument.Factory.newInstance(XmlOptionsHelper.getInstance().getXmlOptions()); final net.opengis.sensorML.x101.SensorMLDocument.SensorML xbSensorML = xbSensorMLDoc.addNewSensorML(); xbSensorML.setVersion(SensorMLConstants.VERSION_V101); final Member member = xbSensorML.addNewMember(); final AbstractProcessType xbAbstractProcessType = (AbstractProcessType) member .addNewProcess() .substitute( getQnameForType(xbProcessType.schemaType()), xbProcessType.schemaType()); xbAbstractProcessType.set(xbProcessType); return xbSensorMLDoc.xmlText(XmlOptionsHelper.getInstance().getXmlOptions()); }
private SensorML parseSensorML(final SensorMLDocument xbSensorML) throws OwsExceptionReport { 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 new InvalidParameterValueException() .at(XmlHelper.getLocalName(xbMember)) .withMessage( "The process of a member of the SensorML Document (%s) is not supported!", xbMember.getProcess().getDomNode().getNodeName()); } sensorML.addMember(abstractProcess); } else { throw new InvalidParameterValueException() .at(XmlHelper.getLocalName(xbMember)) .withMessage( "The process of a member of the SensorML Document (%s) is not supported!", xbMember.getProcess().getDomNode().getNodeName()); } } else { throw new InvalidParameterValueException() .at(XmlHelper.getLocalName(xbMember)) .withMessage( "The process of a member of the SensorML Document is null (%s)!", xbMember.getProcess()); } } sensorML.setSensorDescriptionXmlString( xbSensorML.xmlText(XmlOptionsHelper.getInstance().getXmlOptions())); return sensorML; }