Search in sources :

Example 1 with ContentsType

use of net.opengis.sos.x20.ContentsType in project arctic-sea by 52North.

the class GetCapabilitiesResponseEncoder 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 {
    final ContentsType xbContType = xbContents.addNewContents();
    // for gml:id generation
    int offeringCounter = 0;
    for (final SosObservationOffering offering : offerings) {
        if (offering.isValidObservationOffering()) {
            ++offeringCounter;
            encodeObservationOffering(offering, offeringCounter, xbContType);
        }
    }
    // FIXME: change swes:AbstractOffering to sos:ObservationOffering and
    // the namespace prefix ns to sos due to
    // XMLBeans problems with substitution
    // (http://www.mail-archive.com/dev%40xmlbeans.apache.org/msg00962.html).
    renameContentsElementNames(xbContents);
}
Also used : SosObservationOffering(org.n52.shetland.ogc.sos.SosObservationOffering) ContentsType(net.opengis.sos.x20.ContentsType)

Example 2 with ContentsType

use of net.opengis.sos.x20.ContentsType 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);
         */
}
Also used : ObservationOfferingType(net.opengis.sos.x20.ObservationOfferingType) CodeType(org.n52.shetland.ogc.gml.CodeType) SosOffering(org.n52.shetland.ogc.sos.SosOffering)

Aggregations

ContentsType (net.opengis.sos.x20.ContentsType)1 ObservationOfferingType (net.opengis.sos.x20.ObservationOfferingType)1 CodeType (org.n52.shetland.ogc.gml.CodeType)1 SosObservationOffering (org.n52.shetland.ogc.sos.SosObservationOffering)1 SosOffering (org.n52.shetland.ogc.sos.SosOffering)1