use of org.n52.shetland.ogc.om.OmObservation in project arctic-sea by 52North.
the class OmDecoderv20 method parseOmObservation.
private OmObservation parseOmObservation(OMObservationType omObservation) throws DecodingException {
Map<String, AbstractFeature> featureMap = Maps.newHashMap();
OmObservation sosObservation = new OmObservation();
// parse identifier, description
parseAbstractFeatureType(omObservation, sosObservation);
OmObservationConstellation observationConstallation = getObservationConstellation(omObservation, featureMap);
sosObservation.setObservationConstellation(observationConstallation);
sosObservation.setResultTime(getResultTime(omObservation));
sosObservation.setValidTime(getValidTime(omObservation));
if (omObservation.getParameterArray() != null) {
sosObservation.setParameter(parseNamedValueTypeArray(omObservation.getParameterArray()));
}
sosObservation.setValue(getObservationValue(omObservation));
return sosObservation;
}
use of org.n52.shetland.ogc.om.OmObservation in project arctic-sea by 52North.
the class AbstractOmEncoderv20 method encode.
@Override
public XmlObject encode(Object element, EncodingContext additionalValues) throws EncodingException {
XmlObject encodedObject = null;
if (element instanceof OmObservation) {
encodedObject = encodeOmObservation((OmObservation) element, additionalValues);
} else if (element instanceof NamedValue) {
NamedValueType nvt = createNamedValue((NamedValue<?>) element);
if (additionalValues.has(XmlBeansEncodingFlags.DOCUMENT)) {
NamedValueDocument nvd = NamedValueDocument.Factory.newInstance();
nvd.setNamedValue(nvt);
encodedObject = nvd;
} else if (additionalValues.has(XmlBeansEncodingFlags.PROPERTY_TYPE)) {
NamedValuePropertyType nvpt = NamedValuePropertyType.Factory.newInstance();
nvpt.setNamedValue(nvt);
encodedObject = nvpt;
} else {
encodedObject = nvt;
}
} else if (element instanceof AbstractFeature) {
encodedObject = encodeFeatureOfInterest((AbstractFeature) element);
} else if (element instanceof SosProcedureDescription) {
encodedObject = encodeProcedureDescription((SosProcedureDescription<?>) element);
} else {
throw new UnsupportedEncoderInputException(this, element);
}
// XmlHelper.validateDocument(encodedObject));
return encodedObject;
}
use of org.n52.shetland.ogc.om.OmObservation in project arctic-sea by 52North.
the class AbstractOmEncoderv20 method setValidTime.
private void setValidTime(OmObservation observation, OMObservationType xb) throws EncodingException {
Time validTime = observation.getValidTime();
if (validTime == null) {
return;
}
if (validTime.getGmlId() == null) {
validTime.setGmlId(OmConstants.VALID_TIME_NAME + "_" + observation.getObservationID());
}
xb.addNewValidTime().addNewTimePeriod().set(encodeGML(validTime));
}
use of org.n52.shetland.ogc.om.OmObservation in project arctic-sea by 52North.
the class AbstractOmEncoderv20 method setFeatureOfInterest.
private void setFeatureOfInterest(OmObservation observation, OMObservationType xb) throws EncodingException {
AbstractFeature foi = observation.getObservationConstellation().getFeatureOfInterest();
XmlObject xbFoi = encodeFeatureOfInterest(foi);
xb.addNewFeatureOfInterest().set(xbFoi);
}
use of org.n52.shetland.ogc.om.OmObservation in project arctic-sea by 52North.
the class AbstractOmEncoderv20 method setMetaDataProperty.
private void setMetaDataProperty(OmObservation sosObservation, OMObservationType xbObservation) throws EncodingException {
if (sosObservation.isSetMetaDataProperty()) {
for (AbstractMetaData abstractMetaData : sosObservation.getMetaDataProperty()) {
XmlObject encodeObject = encodeGML(abstractMetaData);
XmlObject substituteElement = XmlHelper.substituteElement(xbObservation.addNewMetaDataProperty().addNewAbstractMetaData(), encodeObject);
substituteElement.set(encodeObject);
}
}
}
Aggregations