Search in sources :

Example 1 with ProcedureDescriptionFormat

use of org.n52.shetland.ogc.sos.ProcedureDescriptionFormat 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));
    }
}
Also used : ObservationOfferingList(net.opengis.sos.x10.ContentsDocument.Contents.ObservationOfferingList) ObservationOfferingType(net.opengis.sos.x10.ObservationOfferingType) TimePeriod(org.n52.shetland.ogc.gml.time.TimePeriod) CodeType(org.n52.shetland.ogc.gml.CodeType) SosObservationOffering(org.n52.shetland.ogc.sos.SosObservationOffering)

Aggregations

ObservationOfferingList (net.opengis.sos.x10.ContentsDocument.Contents.ObservationOfferingList)1 ObservationOfferingType (net.opengis.sos.x10.ObservationOfferingType)1 CodeType (org.n52.shetland.ogc.gml.CodeType)1 TimePeriod (org.n52.shetland.ogc.gml.time.TimePeriod)1 SosObservationOffering (org.n52.shetland.ogc.sos.SosObservationOffering)1