use of net.opengis.waterml.x20.ObservationProcessType in project arctic-sea by 52North.
the class WmlObservationProcessDecoderv20 method setDescriptionXml.
private void setDescriptionXml(ObservationProcessType opt, ObservationProcess observationProcess) {
ObservationProcessDocument doc = ObservationProcessDocument.Factory.newInstance(getXmlOptions());
doc.setObservationProcess(opt);
observationProcess.setXml(doc.xmlText(getXmlOptions()));
}
use of net.opengis.waterml.x20.ObservationProcessType in project arctic-sea by 52North.
the class AbstractWmlEncoderv20 method createObservationProcess.
/**
* Creates an WaterML 2.0 ObservationProcess XML object from SOS
* ObservationProcess object
*
* @param procedure
* SOS ObservationProcess
* @param context
* Additional values
* @return WaterML 2.0 ObservationProcess XML object
* @throws EncodingException
* If an error occurs
*/
protected ObservationProcessDocument createObservationProcess(ObservationProcess procedure, EncodingContext context) throws EncodingException {
XmlObject encodedObject = null;
try {
if (procedure.isSetXml()) {
encodedObject = XmlObject.Factory.parse(procedure.getXml());
checkAndAddIdentifier(procedure, ((ObservationProcessDocument) encodedObject).getObservationProcess());
} else {
encodedObject = ObservationProcessDocument.Factory.newInstance();
ObservationProcessType observationProcess = ((ObservationProcessDocument) encodedObject).addNewObservationProcess();
if (context.has(XmlBeansEncodingFlags.GMLID)) {
observationProcess.setId(PROCESS_ID_PREFIX + context.get(XmlBeansEncodingFlags.GMLID));
} else {
observationProcess.setId(PROCESS_ID_PREFIX + JavaHelper.generateID(procedure.toString()));
}
if (procedure.isSetIdentifier()) {
observationProcess.addNewIdentifier().set(encodeGML(procedure.getIdentifierCodeWithAuthority()));
}
if (procedure.isSetName()) {
for (final CodeType sosName : procedure.getName()) {
observationProcess.addNewName().set(encodeGML(sosName));
}
}
addProcessType(observationProcess, procedure);
addOriginatingProcess(observationProcess, procedure);
addAggregatingDuration(observationProcess, procedure);
addVerticalDatum(observationProcess, procedure);
addComment(observationProcess, procedure);
addProcessReference(observationProcess, procedure);
addInput(observationProcess, procedure);
addParameter(observationProcess, procedure);
}
} catch (final XmlException xmle) {
throw new EncodingException(xmle);
}
try {
LOGGER.debug("Encoded object {} is valid: {}", encodedObject.schemaType().toString(), XmlHelper.validateDocument(encodedObject));
} catch (DecodingException e) {
throw new EncodingException(e);
}
return (ObservationProcessDocument) encodedObject;
}
Aggregations