Search in sources :

Example 6 with Extensions

use of org.n52.shetland.ogc.ows.extension.Extensions in project arctic-sea by 52North.

the class SwesExtensionsTest method containsExtension_for_enum_schould_return_true.

@Test
public void containsExtension_for_enum_schould_return_true() {
    final Extensions extensions = new Extensions();
    extensions.addExtension(new SwesExtension<>().setDefinition(DEFINITION_1).setValue(new SweText()));
    extensions.addExtension(new SwesExtension<>().setDefinition(DEFINITION_2).setValue(new SweText()));
    extensions.addExtension(new SwesExtension<>().setDefinition(DEFINITION_3).setValue(new SweText()));
    assertThat(extensions.containsExtension(DEFINITION_1), is(TRUE));
    assertThat(extensions.containsExtension(DEFINITION_2), is(TRUE));
    assertThat(extensions.containsExtension(DEFINITION_3), is(TRUE));
}
Also used : SweText(org.n52.shetland.ogc.swe.simpleType.SweText) Extensions(org.n52.shetland.ogc.ows.extension.Extensions) Test(org.junit.Test)

Example 7 with Extensions

use of org.n52.shetland.ogc.ows.extension.Extensions in project arctic-sea by 52North.

the class SosDecoderv20 method parseGetFeatureOfInterest.

// private SwesExtensions parseSwesExtensions(final XmlObject[]
// extensionArray) throws OwsExceptionReport
// {
// final SwesExtensions extensions = new SwesExtensions();
// for (final XmlObject xbSwesExtension : extensionArray) {
// 
// final Object obj = CodingHelper.decodeXmlElement(xbSwesExtension);
// if (obj instanceof SwesExtension<?>) {
// extensions.addSwesExtension((SwesExtension<?>) obj);
// }
// }
// return extensions;
// }
/**
 * parses the passes XmlBeans document and creates a SOS
 * getFeatureOfInterest request
 *
 * @param getFoiDoc
 *            XmlBeans document representing the getFeatureOfInterest
 *            request
 * @return Returns SOS getFeatureOfInterest request
 *
 * @throws DecodingException
 *             * if validation of the request failed
 */
private OwsServiceRequest parseGetFeatureOfInterest(final GetFeatureOfInterestDocument getFoiDoc) throws DecodingException {
    final GetFeatureOfInterestRequest getFoiRequest = new GetFeatureOfInterestRequest();
    final GetFeatureOfInterestType getFoiType = getFoiDoc.getGetFeatureOfInterest();
    getFoiRequest.setService(getFoiType.getService());
    getFoiRequest.setVersion(getFoiType.getVersion());
    getFoiRequest.setFeatureIdentifiers(Arrays.asList(getFoiType.getFeatureOfInterestArray()));
    getFoiRequest.setObservedProperties(Arrays.asList(getFoiType.getObservedPropertyArray()));
    getFoiRequest.setProcedures(Arrays.asList(getFoiType.getProcedureArray()));
    getFoiRequest.setSpatialFilters(parseSpatialFilters4GetFeatureOfInterest(getFoiType.getSpatialFilterArray()));
    getFoiRequest.setExtensions(parseExtensibleRequest(getFoiType));
    return getFoiRequest;
}
Also used : GetFeatureOfInterestRequest(org.n52.shetland.ogc.sos.request.GetFeatureOfInterestRequest) GetFeatureOfInterestType(net.opengis.sos.x20.GetFeatureOfInterestType)

Example 8 with Extensions

use of org.n52.shetland.ogc.ows.extension.Extensions in project arctic-sea by 52North.

the class SwesDecoderv20 method parseDescribeSensor.

/**
 * parses the passes XmlBeans document and creates a SOS describeSensor
 * request
 *
 * @param xbDescSenDoc
 *            XmlBeans document representing the describeSensor request
 * @return Returns SOS describeSensor request
 *
 * @throws DecodingException
 *             * if validation of the request failed
 */
private OwsServiceRequest parseDescribeSensor(final DescribeSensorDocument xbDescSenDoc) throws DecodingException {
    final DescribeSensorRequest descSensorRequest = new DescribeSensorRequest();
    final DescribeSensorType xbDescSensor = xbDescSenDoc.getDescribeSensor();
    descSensorRequest.setService(xbDescSensor.getService());
    descSensorRequest.setVersion(xbDescSensor.getVersion());
    descSensorRequest.setProcedure(xbDescSensor.getProcedure());
    descSensorRequest.setProcedureDescriptionFormat(xbDescSensor.getProcedureDescriptionFormat());
    if (xbDescSensor.isSetValidTime()) {
        descSensorRequest.setValidTime(getValidTime(xbDescSensor.getValidTime()));
    }
    // extensions
    descSensorRequest.setExtensions(parseExtensibleRequest(xbDescSensor));
    return descSensorRequest;
}
Also used : DescribeSensorType(net.opengis.swes.x20.DescribeSensorType) DescribeSensorRequest(org.n52.shetland.ogc.sos.request.DescribeSensorRequest)

Example 9 with Extensions

use of org.n52.shetland.ogc.ows.extension.Extensions in project arctic-sea by 52North.

the class SwesDecoderv20 method parseInsertSensor.

private OwsServiceRequest parseInsertSensor(final InsertSensorDocument xbInsSensDoc) throws DecodingException {
    final InsertSensorRequest request = new InsertSensorRequest();
    final InsertSensorType xbInsertSensor = xbInsSensDoc.getInsertSensor();
    request.setService(xbInsertSensor.getService());
    request.setVersion(xbInsertSensor.getVersion());
    // format
    request.setProcedureDescriptionFormat(xbInsertSensor.getProcedureDescriptionFormat());
    // observable properties
    if (CollectionHelper.isNotNullOrEmpty(xbInsertSensor.getObservablePropertyArray())) {
        request.setObservableProperty(Arrays.asList(xbInsertSensor.getObservablePropertyArray()));
    }
    // related features
    if (CollectionHelper.isNotNullOrEmpty(xbInsertSensor.getRelatedFeatureArray())) {
        request.setRelatedFeature(parseRelatedFeature(xbInsertSensor.getRelatedFeatureArray()));
    }
    // metadata
    if (CollectionHelper.isNotNullOrEmpty(xbInsertSensor.getMetadataArray())) {
        request.setMetadata(parseMetadata(xbInsertSensor.getMetadataArray()));
    }
    // extensions
    request.setExtensions(parseExtensibleRequest(xbInsertSensor));
    try {
        final XmlObject xbProcedureDescription = XmlObject.Factory.parse(getNodeFromNodeList(xbInsertSensor.getProcedureDescription().getDomNode().getChildNodes()));
        checkFormatWithNamespace(xbInsertSensor.getProcedureDescriptionFormat(), XmlHelper.getNamespace(xbProcedureDescription));
        final Decoder<?, XmlObject> decoder = getDecoder(new XmlNamespaceDecoderKey(xbInsertSensor.getProcedureDescriptionFormat(), xbProcedureDescription.getClass()));
        if (decoder != null) {
            final Object decodedProcedureDescription = decoder.decode(xbProcedureDescription);
            if (decodedProcedureDescription instanceof SosProcedureDescription) {
                request.setProcedureDescription((SosProcedureDescription) decodedProcedureDescription);
            } else if (decodedProcedureDescription instanceof AbstractFeature) {
                request.setProcedureDescription(new SosProcedureDescription<>((AbstractFeature) decodedProcedureDescription));
            }
        }
    } catch (final XmlException xmle) {
        throw new DecodingException("Error while parsing procedure description of InsertSensor request!", xmle);
    }
    return request;
}
Also used : XmlException(org.apache.xmlbeans.XmlException) InsertSensorType(net.opengis.swes.x20.InsertSensorType) SosProcedureDescription(org.n52.shetland.ogc.sos.SosProcedureDescription) AbstractFeature(org.n52.shetland.ogc.gml.AbstractFeature) XmlObject(org.apache.xmlbeans.XmlObject) OwsServiceCommunicationObject(org.n52.shetland.ogc.ows.service.OwsServiceCommunicationObject) XmlObject(org.apache.xmlbeans.XmlObject) DecodingException(org.n52.svalbard.decode.exception.DecodingException) InsertSensorRequest(org.n52.shetland.ogc.sos.request.InsertSensorRequest)

Example 10 with Extensions

use of org.n52.shetland.ogc.ows.extension.Extensions in project arctic-sea by 52North.

the class SwesDecoderv20 method parseDeleteSensor.

private OwsServiceRequest parseDeleteSensor(final DeleteSensorDocument xbDelSenDoc) throws DecodingException {
    final DeleteSensorRequest request = new DeleteSensorRequest();
    DeleteSensorType deleteSensor = xbDelSenDoc.getDeleteSensor();
    request.setService(deleteSensor.getService());
    request.setVersion(deleteSensor.getVersion());
    request.setProcedureIdentifier(deleteSensor.getProcedure());
    // extensions
    request.setExtensions(parseExtensibleRequest(deleteSensor));
    return request;
}
Also used : DeleteSensorRequest(org.n52.shetland.ogc.sos.request.DeleteSensorRequest) DeleteSensorType(net.opengis.swes.x20.DeleteSensorType)

Aggregations

Extensions (org.n52.shetland.ogc.ows.extension.Extensions)11 Test (org.junit.Test)10 SweText (org.n52.shetland.ogc.swe.simpleType.SweText)4 XmlObject (org.apache.xmlbeans.XmlObject)3 DecodingException (org.n52.svalbard.decode.exception.DecodingException)3 XmlException (org.apache.xmlbeans.XmlException)2 AbstractFeature (org.n52.shetland.ogc.gml.AbstractFeature)2 OwsCapabilities (org.n52.shetland.ogc.ows.OwsCapabilities)2 OwsCapabilitiesExtension (org.n52.shetland.ogc.ows.OwsCapabilitiesExtension)2 OwsOperationsMetadata (org.n52.shetland.ogc.ows.OwsOperationsMetadata)2 OwsServiceIdentification (org.n52.shetland.ogc.ows.OwsServiceIdentification)2 OwsServiceProvider (org.n52.shetland.ogc.ows.OwsServiceProvider)2 OwsServiceCommunicationObject (org.n52.shetland.ogc.ows.service.OwsServiceCommunicationObject)2 SosProcedureDescription (org.n52.shetland.ogc.sos.SosProcedureDescription)2 Locale (java.util.Locale)1 GetFeatureOfInterestType (net.opengis.sos.x20.GetFeatureOfInterestType)1 DeleteSensorType (net.opengis.swes.x20.DeleteSensorType)1 DescribeSensorType (net.opengis.swes.x20.DescribeSensorType)1 InsertSensorType (net.opengis.swes.x20.InsertSensorType)1 SensorDescriptionType (net.opengis.swes.x20.SensorDescriptionType)1