Search in sources :

Example 1 with SosObservationOffering

use of org.n52.shetland.ogc.sos.SosObservationOffering in project arctic-sea by 52North.

the class CapabilitiesDecoder method decode.

@Override
@SuppressFBWarnings("NP_LOAD_OF_KNOWN_NULL_VALUE")
public SosCapabilities decode(Capabilities c) throws DecodingException {
    if (c != null) {
        OwsCapabilities owsCapabilities = parseCapabilitiesBaseType(SosConstants.SOS, c);
        FilterCapabilities filterCapabilities = parseFilterCapabilities(c.getFilterCapabilities());
        Collection<SosObservationOffering> contents = parseContents(c.getContents());
        return new SosCapabilities(owsCapabilities, filterCapabilities, contents);
    }
    throw new UnsupportedDecoderInputException(this, c);
}
Also used : FilterCapabilities(org.n52.shetland.ogc.filter.FilterCapabilities) SosCapabilities(org.n52.shetland.ogc.sos.SosCapabilities) OwsCapabilities(org.n52.shetland.ogc.ows.OwsCapabilities) SosObservationOffering(org.n52.shetland.ogc.sos.SosObservationOffering) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Example 2 with SosObservationOffering

use of org.n52.shetland.ogc.sos.SosObservationOffering in project arctic-sea by 52North.

the class CapabilitiesDecoder method parseOffering.

private SosObservationOffering parseOffering(ObservationOfferingType obsOffType) {
    SosObservationOffering observationOffering = new SosObservationOffering();
    observationOffering.setOffering(obsOffType.getId());
    observationOffering.setProcedures(parseProcedure(obsOffType));
    observationOffering.setProcedureDescriptionFormat(parseProcedureDescriptionFormat(obsOffType));
    observationOffering.setObservableProperties(parseObservableProperties(obsOffType));
    observationOffering.setRelatedFeatures(parseRelatedFeatures(obsOffType));
    observationOffering.setObservedArea(parseObservedArea(obsOffType));
    observationOffering.setPhenomenonTime(parsePhenomenonTime(obsOffType));
    observationOffering.setResultTime(parseResultTime(obsOffType));
    observationOffering.setResponseFormats(parseResponseFormats(obsOffType));
    observationOffering.setObservationTypes(parseObservationTypes(obsOffType));
    observationOffering.setFeatureOfInterestTypes(parseFeatureOfInterestTypes(obsOffType));
    return observationOffering;
}
Also used : SosObservationOffering(org.n52.shetland.ogc.sos.SosObservationOffering)

Example 3 with SosObservationOffering

use of org.n52.shetland.ogc.sos.SosObservationOffering in project arctic-sea by 52North.

the class CapabilitiesTypeDecoder method decode.

@Override
@SuppressFBWarnings("NP_LOAD_OF_KNOWN_NULL_VALUE")
public SosCapabilities decode(CapabilitiesType ct) throws DecodingException {
    if (ct != null) {
        OwsCapabilities owsCapabilities = parseCapabilitiesBaseType(SosConstants.SOS, ct);
        FilterCapabilities filterCapabilities = parseFilterCapabilities(ct.getFilterCapabilities());
        Collection<SosObservationOffering> contents = parseContents(ct.getContents());
        return new SosCapabilities(owsCapabilities, filterCapabilities, contents);
    }
    throw new UnsupportedDecoderInputException(this, ct);
}
Also used : FilterCapabilities(org.n52.shetland.ogc.filter.FilterCapabilities) SosCapabilities(org.n52.shetland.ogc.sos.SosCapabilities) OwsCapabilities(org.n52.shetland.ogc.ows.OwsCapabilities) SosObservationOffering(org.n52.shetland.ogc.sos.SosObservationOffering) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Example 4 with SosObservationOffering

use of org.n52.shetland.ogc.sos.SosObservationOffering 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;
}
Also used : ObservationOfferingPropertyType(net.opengis.sos.x20.ObservationOfferingPropertyType) ObservationOfferingType(net.opengis.sos.x20.ObservationOfferingType) XmlException(org.apache.xmlbeans.XmlException) Node(org.w3c.dom.Node) DecodingException(org.n52.svalbard.decode.exception.DecodingException) SosObservationOffering(org.n52.shetland.ogc.sos.SosObservationOffering)

Example 5 with SosObservationOffering

use of org.n52.shetland.ogc.sos.SosObservationOffering 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

SosObservationOffering (org.n52.shetland.ogc.sos.SosObservationOffering)6 TimePeriod (org.n52.shetland.ogc.gml.time.TimePeriod)3 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)2 ObservationOfferingType (net.opengis.sos.x20.ObservationOfferingType)2 XmlObject (org.apache.xmlbeans.XmlObject)2 FilterCapabilities (org.n52.shetland.ogc.filter.FilterCapabilities)2 CodeType (org.n52.shetland.ogc.gml.CodeType)2 OwsCapabilities (org.n52.shetland.ogc.ows.OwsCapabilities)2 SosCapabilities (org.n52.shetland.ogc.sos.SosCapabilities)2 SosOffering (org.n52.shetland.ogc.sos.SosOffering)2 UnsupportedDecoderInputException (org.n52.svalbard.decode.exception.UnsupportedDecoderInputException)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 ObservationOfferingList (net.opengis.sos.x10.ContentsDocument.Contents.ObservationOfferingList)1 ObservationOfferingType (net.opengis.sos.x10.ObservationOfferingType)1 ContentsType (net.opengis.sos.x20.ContentsType)1 ObservationOfferingPropertyType (net.opengis.sos.x20.ObservationOfferingPropertyType)1 XmlException (org.apache.xmlbeans.XmlException)1 Envelope (org.locationtech.jts.geom.Envelope)1 DecodingException (org.n52.svalbard.decode.exception.DecodingException)1