Search in sources :

Example 1 with SosInsertionMetadataPropertyType

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

the class SwesDecoderv20 method parseMetadata.

private SosInsertionMetadata parseMetadata(final Metadata[] metadataArray) throws DecodingException {
    final SosInsertionMetadata sosMetadata = new SosInsertionMetadata();
    try {
        for (final Metadata metadata : metadataArray) {
            SosInsertionMetadataType xbSosInsertionMetadata = null;
            if (metadata.getInsertionMetadata() != null && metadata.getInsertionMetadata().schemaType() == SosInsertionMetadataType.type) {
                xbSosInsertionMetadata = (SosInsertionMetadataType) metadata.getInsertionMetadata();
            } else {
                if (metadata.getDomNode().hasChildNodes()) {
                    final Node node = getNodeFromNodeList(metadata.getDomNode().getChildNodes());
                    final SosInsertionMetadataPropertyType xbMetadata = SosInsertionMetadataPropertyType.Factory.parse(node);
                    xbSosInsertionMetadata = xbMetadata.getSosInsertionMetadata();
                }
            }
            if (xbSosInsertionMetadata != null) {
                // featureOfInterest types
                if (xbSosInsertionMetadata.getFeatureOfInterestTypeArray() != null) {
                    sosMetadata.setFeatureOfInterestTypes(Arrays.asList(xbSosInsertionMetadata.getFeatureOfInterestTypeArray()));
                }
                // observation types
                if (xbSosInsertionMetadata.getObservationTypeArray() != null) {
                    sosMetadata.setObservationTypes(Arrays.asList(xbSosInsertionMetadata.getObservationTypeArray()));
                }
            }
        }
    } catch (final XmlException xmle) {
        throw new DecodingException("An error occurred while parsing the metadata in the http post request", xmle);
    }
    return sosMetadata;
}
Also used : XmlException(org.apache.xmlbeans.XmlException) Node(org.w3c.dom.Node) SosInsertionMetadata(org.n52.shetland.ogc.sos.SosInsertionMetadata) Metadata(net.opengis.swes.x20.InsertSensorType.Metadata) SosInsertionMetadataPropertyType(net.opengis.sos.x20.SosInsertionMetadataPropertyType) SosInsertionMetadata(org.n52.shetland.ogc.sos.SosInsertionMetadata) DecodingException(org.n52.svalbard.decode.exception.DecodingException) SosInsertionMetadataType(net.opengis.sos.x20.SosInsertionMetadataType)

Aggregations

SosInsertionMetadataPropertyType (net.opengis.sos.x20.SosInsertionMetadataPropertyType)1 SosInsertionMetadataType (net.opengis.sos.x20.SosInsertionMetadataType)1 Metadata (net.opengis.swes.x20.InsertSensorType.Metadata)1 XmlException (org.apache.xmlbeans.XmlException)1 SosInsertionMetadata (org.n52.shetland.ogc.sos.SosInsertionMetadata)1 DecodingException (org.n52.svalbard.decode.exception.DecodingException)1 Node (org.w3c.dom.Node)1