use of net.opengis.sos.x10.ObservationOfferingType in project arctic-sea by 52North.
the class CapabilitiesTypeDecoder method parseOffering.
private SosObservationOffering parseOffering(AbstractContentsType.Offering offering) {
SosObservationOffering observationOffering = new SosObservationOffering();
if (offering.getDomNode().hasChildNodes()) {
final Node node = XmlHelper.getNodeFromNodeList(offering.getDomNode().getChildNodes());
try {
ObservationOfferingPropertyType offeringType = ObservationOfferingPropertyType.Factory.parse(node);
ObservationOfferingType obsOffPropType = offeringType.getObservationOffering();
observationOffering.setOffering(parseOffering(obsOffPropType));
observationOffering.setProcedures(parseProcedure(obsOffPropType));
observationOffering.setProcedureDescriptionFormat(parseProcedureDescriptionFormat(obsOffPropType));
observationOffering.setObservableProperties(parseObservableProperties(obsOffPropType));
observationOffering.setRelatedFeatures(parseRelatedFeatures(obsOffPropType));
observationOffering.setObservedArea(parseObservedArea(obsOffPropType));
observationOffering.setPhenomenonTime(parsePhenomenonTime(obsOffPropType));
observationOffering.setResultTime(parseResultTime(obsOffPropType));
observationOffering.setResponseFormats(parseResponseFormats(obsOffPropType));
observationOffering.setObservationTypes(parseObservationTypes(obsOffPropType));
observationOffering.setFeatureOfInterestTypes(parseFeatureOfInterestTypes(obsOffPropType));
observationOffering.setExtensions(parseOfferingExtension(obsOffPropType));
} catch (XmlException | DecodingException ex) {
LOGGER.error(ex.getLocalizedMessage(), ex);
}
}
return observationOffering;
}
use of net.opengis.sos.x10.ObservationOfferingType in project arctic-sea by 52North.
the class SosV1GetCapabilitiesResponseEncoder method setContents.
/**
* Sets the content section to the Capabilities document.
*
* @param xbContents SOS 2.0 contents section
* @param offerings SOS offerings for contents
* @param version SOS response version
*
* @throws EncodingException * if an error occurs.
*/
protected void setContents(Contents xbContents, Collection<SosObservationOffering> offerings, String version) throws EncodingException {
// Contents xbContType = xbContents.addNewContents();
ObservationOfferingList xbObservationOfferings = xbContents.addNewObservationOfferingList();
for (SosObservationOffering offering : offerings) {
ObservationOfferingType xbObservationOffering = xbObservationOfferings.addNewObservationOffering();
// TODO check NAme or ID
xbObservationOffering.setId(NcName.makeValid(offering.getOffering().getIdentifier()));
// envelope
if (offering.isSetObservedArea()) {
xbObservationOffering.addNewBoundedBy().addNewEnvelope().set(encodeObjectToXml(GmlConstants.NS_GML, offering.getObservedArea()));
}
// set gml:name to offering's id (not ncname resolved)
for (CodeType name : offering.getOffering().getName()) {
xbObservationOffering.addNewName().set(encodeObjectToXml(GmlConstants.NS_GML, name));
}
// set up time
if (offering.getPhenomenonTime() instanceof TimePeriod) {
xbObservationOffering.addNewTime().set(encodeObjectToXml(SweConstants.NS_SWE_101, offering.getPhenomenonTime()));
}
offering.getObservableProperties().forEach(phenomenon -> xbObservationOffering.addNewObservedProperty().setHref(phenomenon));
offering.getFeatureOfInterestTypes().forEach(featureOfInterestType -> xbObservationOffering.addNewFeatureOfInterest().setHref(featureOfInterestType));
offering.getProcedureDescriptionFormats().forEach(procedureDescriptionFormat -> xbObservationOffering.addNewProcedure().setHref(procedureDescriptionFormat));
offering.getProcedures().forEach(procedure -> xbObservationOffering.addNewProcedure().setHref(procedure));
offering.getFeatureOfInterest().forEach(featureOfInterest -> xbObservationOffering.addNewFeatureOfInterest().setHref(featureOfInterest));
offering.getResultModels().forEach(xbObservationOffering::addResultModel);
offering.getResponseFormats().forEach(responseFormat -> xbObservationOffering.addNewResponseFormat().setStringValue(responseFormat));
offering.getResponseModes().forEach(responseMode -> xbObservationOffering.addNewResponseMode().setStringValue(responseMode));
}
}
use of net.opengis.sos.x10.ObservationOfferingType in project arctic-sea by 52North.
the class GetCapabilitiesResponseEncoder method encodeObservationOffering.
private void encodeObservationOffering(SosObservationOffering offering, int offeringCounter, ContentsType xbContType) throws EncodingException {
final ObservationOfferingType xbObsOff = ObservationOfferingType.Factory.newInstance(getXmlOptions());
SosOffering sosOffering = offering.getOffering();
xbObsOff.setIdentifier(sosOffering.getIdentifier());
if (sosOffering.isSetName()) {
for (CodeType name : sosOffering.getName()) {
xbObsOff.addNewName().set(encodeObjectToXml(GmlConstants.NS_GML_32, name));
}
}
if (sosOffering.isSetDescription()) {
xbObsOff.setDescription(sosOffering.getDescription());
}
encodeOfferingExtension(offering, xbObsOff);
offering.getProcedures().forEach(xbObsOff::setProcedure);
encodeObservableProperties(offering, xbObsOff);
encodeRelatedFeatures(offering, xbObsOff);
encodeObservedArea(offering, xbObsOff);
encodePhenomenonTime(offering, offeringCounter, xbObsOff);
encodeResultTime(offering, offeringCounter, xbObsOff);
encodeResponseFormat(offering, xbObsOff);
encodeObservationType(offering, xbObsOff);
encodeFeatureOfInterestTypes(offering, xbObsOff);
encodeProcedureDescriptionFormats(offering, xbObsOff);
xbContType.addNewOffering().setAbstractOffering(xbObsOff);
/*
* Offering addNewOffering = xbContType.addNewOffering();
* addNewOffering.addNewAbstractOffering().set(xbObsOff); XmlHelper
* .substituteElement(addNewOffering.getAbstractOffering(), xbObsOff);
*/
}
Aggregations