Search in sources :

Example 1 with UnsupportedDecoderInputException

use of org.n52.svalbard.decode.exception.UnsupportedDecoderInputException in project arctic-sea by 52North.

the class FieldDecoder method decodeJSON.

public SweField decodeJSON(JsonNode node) throws DecodingException {
    final String type = node.path(JSONConstants.TYPE).textValue();
    final SweAbstractDataComponent element;
    if (type.equals(JSONConstants.BOOLEAN_TYPE)) {
        element = decodeBoolean(node);
    } else if (type.equals(JSONConstants.COUNT_TYPE)) {
        element = decodeCount(node);
    } else if (type.equals(JSONConstants.COUNT_RANGE_TYPE)) {
        element = decodeCountRange(node);
    } else if (type.equals(JSONConstants.OBSERVABLE_PROPERTY_TYPE)) {
        element = decodeObservableProperty(node);
    } else if (type.equals(JSONConstants.QUALITY_TYPE)) {
        element = decodeQuality(node);
    } else if (type.equals(JSONConstants.TEXT_TYPE)) {
        element = decodeText(node);
    } else if (type.equals(JSONConstants.QUANTITY_TYPE)) {
        element = decodeQuantity(node);
    } else if (type.equals(JSONConstants.QUANTITY_RANGE_TYPE)) {
        element = decodeQuantityRange(node);
    } else if (type.equals(JSONConstants.TIME_TYPE)) {
        element = decodeTime(node);
    } else if (type.equals(JSONConstants.TIME_RANGE_TYPE)) {
        element = decodeTimeRange(node);
    } else if (type.equals(JSONConstants.CATEGORY_TYPE)) {
        element = decodeCategory(node);
    } else {
        throw new UnsupportedDecoderInputException(this, node);
    }
    final String name = node.path(JSONConstants.NAME).textValue();
    element.setDescription(node.path(JSONConstants.DESCRIPTION).textValue());
    element.setIdentifier(node.path(JSONConstants.IDENTIFIER).textValue());
    element.setDefinition(node.path(JSONConstants.DEFINITION).textValue());
    element.setLabel(node.path(JSONConstants.LABEL).textValue());
    return new SweField(name, element);
}
Also used : SweField(org.n52.shetland.ogc.swe.SweField) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException)

Example 2 with UnsupportedDecoderInputException

use of org.n52.svalbard.decode.exception.UnsupportedDecoderInputException in project arctic-sea by 52North.

the class AbstractGmlDecoderv321 method parseNamedValueType.

protected NamedValue<?> parseNamedValueType(NamedValuePropertyType namedValueProperty) throws DecodingException {
    if (namedValueProperty.isSetNamedValue()) {
        NamedValueType namedValue = namedValueProperty.getNamedValue();
        NamedValue<?> sosNamedValue = parseNamedValueValue(namedValue.getValue());
        org.n52.shetland.ogc.gml.ReferenceType referenceType = (org.n52.shetland.ogc.gml.ReferenceType) decodeXmlObject(namedValue.getName());
        sosNamedValue.setName(referenceType);
        return sosNamedValue;
    } else if (namedValueProperty.isSetHref()) {
        NamedValue<org.n52.shetland.ogc.gml.ReferenceType> sosNamedValue = new NamedValue<>();
        org.n52.shetland.ogc.gml.ReferenceType referenceType = new org.n52.shetland.ogc.gml.ReferenceType(namedValueProperty.getHref());
        if (namedValueProperty.isSetTitle()) {
            referenceType.setTitle(namedValueProperty.getTitle());
        }
        sosNamedValue.setName(referenceType);
        return sosNamedValue;
    } else {
        throw new UnsupportedDecoderInputException(this, namedValueProperty);
    }
}
Also used : NamedValueType(net.opengis.om.x20.NamedValueType) NamedValue(org.n52.shetland.ogc.om.NamedValue) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException) ReferenceType(net.opengis.gml.x32.ReferenceType)

Example 3 with UnsupportedDecoderInputException

use of org.n52.svalbard.decode.exception.UnsupportedDecoderInputException in project arctic-sea by 52North.

the class SweCommonDecoderV20 method decode.

@Override
public Object decode(Object element) throws DecodingException {
    if (element instanceof DataArrayPropertyType) {
        final DataArrayPropertyType dataArrayPropertyType = (DataArrayPropertyType) element;
        return parseAbstractDataComponent(dataArrayPropertyType.getDataArray1());
    } else if (element instanceof DataRecordPropertyType) {
        final DataRecordPropertyType dataRecordPropertyType = (DataRecordPropertyType) element;
        return parseAbstractDataComponent(dataRecordPropertyType.getDataRecord());
    } else if (element instanceof AbstractDataComponentDocument) {
        return parseAbstractDataComponentDocument((AbstractDataComponentDocument) element);
    } else if (element instanceof AbstractDataComponentType) {
        return parseAbstractDataComponent((AbstractDataComponentType) element);
    } else if (element instanceof Coordinate[]) {
        return parseCoordinates((Coordinate[]) element);
    } else if (element instanceof AnyScalarPropertyType[]) {
        return parseAnyScalarPropertyTypeArray((AnyScalarPropertyType[]) element);
    } else if (element instanceof TextEncodingDocument) {
        final TextEncodingDocument textEncodingDoc = (TextEncodingDocument) element;
        final SweTextEncoding sosTextEncoding = parseTextEncoding(textEncodingDoc.getTextEncoding());
        sosTextEncoding.setXml(textEncodingDoc.xmlText(getXmlOptions()));
        return sosTextEncoding;
    } else if (element instanceof TextEncodingType) {
        TextEncodingDocument textEncodingDoc = TextEncodingDocument.Factory.newInstance(getXmlOptions());
        TextEncodingType textEncoding = (TextEncodingType) element;
        textEncodingDoc.setTextEncoding(textEncoding);
        SweTextEncoding sosTextEncoding = parseTextEncoding(textEncoding);
        sosTextEncoding.setXml(textEncodingDoc.xmlText(getXmlOptions()));
        return sosTextEncoding;
    } else if (element instanceof TextPropertyType) {
        return parseAbstractDataComponent(((TextPropertyType) element).getText());
    } else if (element instanceof CountPropertyType) {
        return parseAbstractDataComponent(((CountPropertyType) element).getCount());
    } else if (element instanceof BooleanPropertyType) {
        return parseAbstractDataComponent(((BooleanPropertyType) element).getBoolean());
    } else if (element instanceof CategoryPropertyType) {
        return parseAbstractDataComponent(((CategoryPropertyType) element).getCategory());
    } else if (element instanceof QuantityPropertyType) {
        return parseAbstractDataComponent(((QuantityPropertyType) element).getQuantity());
    } else if (element instanceof DataStreamPropertyType) {
        return parseDataStream(((DataStreamPropertyType) element).getDataStream());
    } else if (element instanceof DataStreamType) {
        return parseDataStream((DataStreamType) element);
    } else if (element instanceof DataStreamDocument) {
        return parseDataStream(((DataStreamDocument) element).getDataStream());
    } else if (element instanceof XmlObject) {
        throw new UnsupportedDecoderXmlInputException(this, (XmlObject) element);
    } else {
        throw new UnsupportedDecoderInputException(this, element);
    }
}
Also used : TextEncodingDocument(net.opengis.swe.x20.TextEncodingDocument) DataStreamDocument(net.opengis.swe.x20.DataStreamDocument) AnyScalarPropertyType(net.opengis.swe.x20.AnyScalarPropertyType) DataRecordPropertyType(net.opengis.swe.x20.DataRecordPropertyType) DataArrayPropertyType(net.opengis.swe.x20.DataArrayPropertyType) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException) AbstractDataComponentType(net.opengis.swe.x20.AbstractDataComponentType) TextEncodingType(net.opengis.swe.x20.TextEncodingType) SweCoordinate(org.n52.shetland.ogc.swe.SweCoordinate) Coordinate(net.opengis.swe.x20.VectorType.Coordinate) CountPropertyType(net.opengis.swe.x20.CountPropertyType) DataStreamType(net.opengis.swe.x20.DataStreamType) DataStreamPropertyType(net.opengis.swe.x20.DataStreamPropertyType) SweTextEncoding(org.n52.shetland.ogc.swe.encoding.SweTextEncoding) QuantityPropertyType(net.opengis.swe.x20.QuantityPropertyType) XmlObject(org.apache.xmlbeans.XmlObject) UnsupportedDecoderXmlInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderXmlInputException) TextPropertyType(net.opengis.swe.x20.TextPropertyType) AbstractDataComponentDocument(net.opengis.swe.x20.AbstractDataComponentDocument) BooleanPropertyType(net.opengis.swe.x20.BooleanPropertyType) CategoryPropertyType(net.opengis.swe.x20.CategoryPropertyType)

Example 4 with UnsupportedDecoderInputException

use of org.n52.svalbard.decode.exception.UnsupportedDecoderInputException in project arctic-sea by 52North.

the class GetFeatureOfInterestResponseDocumentDecoder method decode.

@Override
@SuppressFBWarnings("NP_LOAD_OF_KNOWN_NULL_VALUE")
public GetFeatureOfInterestResponse decode(GetFeatureOfInterestResponseDocument gfoird) throws DecodingException {
    if (gfoird != null) {
        GetFeatureOfInterestResponse response = new GetFeatureOfInterestResponse();
        setService(response);
        setVersions(response);
        GetFeatureOfInterestResponseType gfoirt = gfoird.getGetFeatureOfInterestResponse();
        response.setExtensions(parseExtensibleResponse(gfoirt));
        response.setAbstractFeature(parseFeatures(gfoirt));
        return response;
    }
    throw new UnsupportedDecoderInputException(this, gfoird);
}
Also used : GetFeatureOfInterestResponse(org.n52.shetland.ogc.sos.response.GetFeatureOfInterestResponse) GetFeatureOfInterestResponseType(net.opengis.sos.x20.GetFeatureOfInterestResponseType) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Example 5 with UnsupportedDecoderInputException

use of org.n52.svalbard.decode.exception.UnsupportedDecoderInputException in project arctic-sea by 52North.

the class GetObservationResponseDocumentDecoder method decode.

@Override
@SuppressFBWarnings("NP_LOAD_OF_KNOWN_NULL_VALUE")
public GetObservationResponse decode(GetObservationResponseDocument gord) throws DecodingException {
    if (gord != null) {
        GetObservationResponse response = new GetObservationResponse();
        setService(response);
        setVersions(response);
        GetObservationResponseType gort = gord.getGetObservationResponse();
        response.setExtensions(parseExtensibleResponse(gort));
        response.setObservationCollection(ObservationStream.of(parseObservtions(gort)));
        return response;
    }
    throw new UnsupportedDecoderInputException(this, gord);
}
Also used : GetObservationResponseType(net.opengis.sos.x20.GetObservationResponseType) GetObservationResponse(org.n52.shetland.ogc.sos.response.GetObservationResponse) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Aggregations

UnsupportedDecoderInputException (org.n52.svalbard.decode.exception.UnsupportedDecoderInputException)21 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)7 OwsCapabilities (org.n52.shetland.ogc.ows.OwsCapabilities)4 XmlObject (org.apache.xmlbeans.XmlObject)3 DecodingException (org.n52.svalbard.decode.exception.DecodingException)3 FilterCapabilities (org.n52.shetland.ogc.filter.FilterCapabilities)2 NamedValue (org.n52.shetland.ogc.om.NamedValue)2 GetCapabilitiesResponse (org.n52.shetland.ogc.ows.service.GetCapabilitiesResponse)2 SosCapabilities (org.n52.shetland.ogc.sos.SosCapabilities)2 SosObservationOffering (org.n52.shetland.ogc.sos.SosObservationOffering)2 DeleteObservationRequest (org.n52.shetland.ogc.sos.delobs.DeleteObservationRequest)2 DocumentCitationType (eu.europa.ec.inspire.schemas.base2.x20.DocumentCitationType)1 Link (eu.europa.ec.inspire.schemas.base2.x20.DocumentCitationType.Link)1 RelatedPartyType (eu.europa.ec.inspire.schemas.base2.x20.RelatedPartyType)1 BigDecimal (java.math.BigDecimal)1 DeleteResultTemplateDocument (net.opengis.drt.x10.DeleteResultTemplateDocument)1 ReferenceType (net.opengis.gml.x32.ReferenceType)1 InsertFeatureOfInterestDocument (net.opengis.ifoi.x10.InsertFeatureOfInterestDocument)1 NamedValueType (net.opengis.om.x20.NamedValueType)1 GetFeatureOfInterestResponseType (net.opengis.sos.x20.GetFeatureOfInterestResponseType)1