Search in sources :

Example 11 with UnsupportedDecoderInputException

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

the class InsertObservationResponseV20Decoder method decode.

@Override
public InsertObservationResponse decode(XmlObject xmlObject) throws DecodingException {
    LOGGER.debug("REQUESTTYPE: {}", xmlObject != null ? xmlObject.getClass() : "null recevied");
    if (!(xmlObject instanceof InsertObservationResponseDocument)) {
        throw new UnsupportedDecoderInputException(this, xmlObject);
    }
    InsertObservationResponseType isr = ((InsertObservationResponseDocument) xmlObject).getInsertObservationResponse();
    if (isr == null) {
        throw new DecodingException("Received XML document is not valid. Set log level to debug to get more details");
    }
    return new InsertObservationResponse();
}
Also used : InsertObservationResponseDocument(net.opengis.sos.x20.InsertObservationResponseDocument) DecodingException(org.n52.svalbard.decode.exception.DecodingException) InsertObservationResponseType(net.opengis.sos.x20.InsertObservationResponseType) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException) InsertObservationResponse(org.n52.shetland.ogc.sos.response.InsertObservationResponse)

Example 12 with UnsupportedDecoderInputException

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

the class InsertResultTemplateResponseDecoder method decode.

@Override
public InsertResultTemplateResponse decode(XmlObject xmlObject) throws DecodingException {
    LOGGER.debug("REQUESTTYPE: {}", xmlObject != null ? xmlObject.getClass() : "null recevied");
    if (!(xmlObject instanceof InsertResultTemplateResponseDocument)) {
        throw new UnsupportedDecoderInputException(this, xmlObject);
    }
    InsertResultTemplateResponseDocument isrd = (InsertResultTemplateResponseDocument) xmlObject;
    InsertResultTemplateResponseType isr = isrd.getInsertResultTemplateResponse();
    if (isr == null) {
        throw new DecodingException("Received XML document is not valid. Set log level to debug to get more details");
    }
    InsertResultTemplateResponse decodedResponse = new InsertResultTemplateResponse(SosConstants.SOS, Sos2Constants.SERVICEVERSION);
    decodedResponse.setAcceptedTemplate(isr.getAcceptedTemplate());
    return decodedResponse;
}
Also used : InsertResultTemplateResponse(org.n52.shetland.ogc.sos.response.InsertResultTemplateResponse) InsertResultTemplateResponseDocument(net.opengis.sos.x20.InsertResultTemplateResponseDocument) DecodingException(org.n52.svalbard.decode.exception.DecodingException) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException) InsertResultTemplateResponseType(net.opengis.sos.x20.InsertResultTemplateResponseType)

Example 13 with UnsupportedDecoderInputException

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

the class InsertSensorResponseDecoder method decode.

@Override
public InsertSensorResponse decode(XmlObject xmlObject) throws DecodingException {
    LOGGER.debug("REQUESTTYPE: {}", xmlObject != null ? xmlObject.getClass() : "null recevied");
    if (!(xmlObject instanceof InsertSensorResponseDocument)) {
        throw new UnsupportedDecoderInputException(this, xmlObject);
    }
    InsertSensorResponseDocument isrd = (InsertSensorResponseDocument) xmlObject;
    InsertSensorResponseType isr = isrd.getInsertSensorResponse();
    if (isr == null) {
        throw new DecodingException("Received XML document is not valid. Set log level to debug to get more details");
    }
    InsertSensorResponse decodedResponse = new InsertSensorResponse(SosConstants.SOS, Sos2Constants.SERVICEVERSION);
    decodedResponse.setAssignedOffering(isr.getAssignedOffering());
    decodedResponse.setAssignedProcedure(isr.getAssignedProcedure());
    return decodedResponse;
}
Also used : InsertSensorResponseType(net.opengis.swes.x20.InsertSensorResponseType) InsertSensorResponseDocument(net.opengis.swes.x20.InsertSensorResponseDocument) DecodingException(org.n52.svalbard.decode.exception.DecodingException) InsertSensorResponse(org.n52.shetland.ogc.sos.response.InsertSensorResponse) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException)

Example 14 with UnsupportedDecoderInputException

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

the class SwesExtensionDecoderv20 method decode.

@Override
public SwesExtension<?> decode(XmlObject xmlObject) throws DecodingException, UnsupportedDecoderInputException {
    if (isSwesExtension(xmlObject)) {
        XmlObject[] children = xmlObject.selectPath("./*");
        if (children.length == 1) {
            Object xmlObj = decodeXmlElement(children[0]);
            if (xmlObj instanceof SweAbstractDataComponent) {
                SwesExtension<SweAbstractDataComponent> extension = new SwesExtension<>();
                extension.setValue((SweAbstractDataComponent) xmlObj);
                return extension;
            }
        }
    }
    throw new UnsupportedDecoderXmlInputException(this, xmlObject);
}
Also used : SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent) XmlObject(org.apache.xmlbeans.XmlObject) XmlObject(org.apache.xmlbeans.XmlObject) UnsupportedDecoderXmlInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderXmlInputException) SwesExtension(org.n52.shetland.ogc.swes.SwesExtension)

Example 15 with UnsupportedDecoderInputException

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

the class RelatedPartyTypeDecoder method decode.

@Override
public RelatedParty decode(XmlObject xmlObject) throws DecodingException {
    if (xmlObject instanceof RelatedPartyType) {
        RelatedPartyType rpt = (RelatedPartyType) xmlObject;
        RelatedParty relatedParty = new RelatedParty();
        relatedParty.setContact(parseContact(rpt));
        relatedParty.setIndividualName((PT_FreeText) decodeXmlElement(rpt.getIndividualName()));
        relatedParty.setOrganisationName((PT_FreeText) decodeXmlElement(rpt.getOrganisationName()));
        relatedParty.setPositionName((PT_FreeText) decodeXmlElement(rpt.getPositionName()));
        relatedParty.setRoles(parseRole(rpt));
        return relatedParty;
    }
    throw new UnsupportedDecoderInputException(this, xmlObject);
}
Also used : RelatedParty(org.n52.shetland.inspire.base2.RelatedParty) RelatedPartyType(eu.europa.ec.inspire.schemas.base2.x20.RelatedPartyType) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException)

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