Search in sources :

Example 21 with UnsupportedEncoderInputException

use of org.n52.svalbard.encode.exception.UnsupportedEncoderInputException in project arctic-sea by 52North.

the class DeleteResultTemplateEncoder method create.

@Override
protected XmlObject create(DeleteResultTemplateResponse drtr) throws EncodingException {
    if (drtr == null) {
        throw new UnsupportedEncoderInputException(this, DeleteResultTemplateResponse.class);
    }
    DeleteResultTemplateResponseDocument drtrd = DeleteResultTemplateResponseDocument.Factory.newInstance(getXmlOptions());
    DeleteResultTemplateResponseType drtrt = drtrd.addNewDeleteResultTemplateResponse();
    if (drtr.isSetResultTemplates()) {
        for (String resultTemplate : drtr.getResultTemplates()) {
            drtrt.addDeletedTemplate(resultTemplate);
        }
    }
    return drtrd;
}
Also used : DeleteResultTemplateResponseType(net.opengis.drt.x10.DeleteResultTemplateResponseType) DeleteResultTemplateResponseDocument(net.opengis.drt.x10.DeleteResultTemplateResponseDocument) UnsupportedEncoderInputException(org.n52.svalbard.encode.exception.UnsupportedEncoderInputException)

Example 22 with UnsupportedEncoderInputException

use of org.n52.svalbard.encode.exception.UnsupportedEncoderInputException in project arctic-sea by 52North.

the class EnvironmentalMonitoringFaciltityPropertyTypeEncoder method encode.

@Override
public XmlObject encode(AbstractFeature abstractFeature, EncodingContext context) throws EncodingException {
    if (abstractFeature instanceof EnvironmentalMonitoringFacility) {
        EnvironmentalMonitoringFacilityPropertyType emfpt = EnvironmentalMonitoringFacilityPropertyType.Factory.newInstance();
        emfpt.setEnvironmentalMonitoringFacility(createEnvironmentalMonitoringFaciltityType((EnvironmentalMonitoringFacility) abstractFeature));
        return emfpt;
    }
    throw new UnsupportedEncoderInputException(this, abstractFeature);
}
Also used : EnvironmentalMonitoringFacility(org.n52.shetland.inspire.ef.EnvironmentalMonitoringFacility) EnvironmentalMonitoringFacilityPropertyType(eu.europa.ec.inspire.schemas.ef.x40.EnvironmentalMonitoringFacilityPropertyType) UnsupportedEncoderInputException(org.n52.svalbard.encode.exception.UnsupportedEncoderInputException)

Example 23 with UnsupportedEncoderInputException

use of org.n52.svalbard.encode.exception.UnsupportedEncoderInputException in project arctic-sea by 52North.

the class InspireEncoderTest method getMinimalInspireExtendedCapabilities.

/*
     * xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     * xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=
     * "http://inspire.ec.europa.eu/schemas/inspire_dls/1.0 http://inspire.ec.europa.eu/schemas/inspire_dls/1.0/inspire_dls.xsd"
     */
// 
// @BeforeClass
// public static void init() {
// Map<String, String> prefixes = new HashMap<String, String>();
// prefixes.put(InspireConstants.NS_INSPIRE_COMMON, InspireConstants.NS_INSPIRE_COMMON_PREFIX);
// prefixes.put(InspireConstants.NS_INSPIRE_DLS, InspireConstants.NS_INSPIRE_DLS_PREFIX);
// xmlOptions.setSaveSuggestedPrefixes(prefixes);
// xmlOptions.setSaveImplicitNamespaces(prefixes);
// xmlOptions.setSaveAggressiveNamespaces();
// xmlOptions.setSavePrettyPrint();
// xmlOptions.setSaveNamespacesFirst();
// xmlOptions.setCharacterEncoding("UTF-8");
// }
// 
// @Test
// public void enocodeMinimalInspireExtendedCapabilities() throws UnsupportedEncoderInputException,
// OwsExceptionReport, SAXException, IOException {
// InspireXmlEncoder inspireEncoder = new InspireXmlEncoder();
// validate(inspireEncoder.encode(getMinimalInspireExtendedCapabilities()));
// }
// 
// @Test
// public void enocodeFullIsnpireExtendedCapabilities() throws UnsupportedEncoderInputException, OwsExceptionReport,
// SAXException, IOException {
// InspireXmlEncoder inspireEncoder = new InspireXmlEncoder();
// validate(inspireEncoder.encode(getFullInspireExtendedCapabilities()));
// }
// 
// @Test
// public void valid_iso8601() {
// // date
// String datePattern = "\\d{4}-(1[0-2]|0[1-9])-(3[0-1]|0[1-9]|[1-2][0-9])";
// String date = "2013-09-26";
// Assert.assertThat(Pattern.matches(datePattern, date), Matchers.is(true));
// // time
// String timePattern = "(T(2[0-3]|[0-1][0-9]):([0-5][0-9]):([0-5][0-9])(\\.[0-9]+)?)?";
// String time_HH_MM_SS_S = "T12:49:41.740";
// Assert.assertThat(Pattern.matches(timePattern, time_HH_MM_SS_S), Matchers.is(true));
// String time_HH_MM_SS = "T12:49:41";
// Assert.assertThat(Pattern.matches(timePattern, time_HH_MM_SS), Matchers.is(true));
// // offset
// String offsetPattern = "(Z|[+|-](2[0-3]|[0-1][0-9]):([0-5][0-9]))?";
// String offset_PLUS_HH_MM = "+02:00";
// Assert.assertThat(Pattern.matches(offsetPattern, offset_PLUS_HH_MM), Matchers.is(true));
// String offset_MINUS_HH_MM = "-02:00";
// Assert.assertThat(Pattern.matches(offsetPattern, offset_MINUS_HH_MM), Matchers.is(true));
// String offset_Z = "Z";
// Assert.assertThat(Pattern.matches(offsetPattern, offset_Z), Matchers.is(true));
// // date time
// String dtPattern = datePattern + timePattern;
// Assert.assertThat(Pattern.matches(dtPattern, date + time_HH_MM_SS_S), Matchers.is(true));
// Assert.assertThat(Pattern.matches(dtPattern, date + time_HH_MM_SS), Matchers.is(true));
// // date time offset
// String dtoPattern = dtPattern + offsetPattern;
// Assert.assertThat(Pattern.matches(dtoPattern, date + time_HH_MM_SS_S + offset_PLUS_HH_MM), Matchers.is(true));
// Assert.assertThat(Pattern.matches(dtoPattern, date + time_HH_MM_SS_S + offset_MINUS_HH_MM), Matchers.is(true));
// Assert.assertThat(Pattern.matches(dtoPattern, date + time_HH_MM_SS_S + offset_Z), Matchers.is(true));
// Assert.assertThat(Pattern.matches(dtoPattern, date + time_HH_MM_SS + offset_PLUS_HH_MM), Matchers.is(true));
// Assert.assertThat(Pattern.matches(dtoPattern, date + time_HH_MM_SS + offset_MINUS_HH_MM), Matchers.is(true));
// Assert.assertThat(Pattern.matches(dtoPattern, date + time_HH_MM_SS + offset_Z), Matchers.is(true));
// // valid patter for schema: \d{4}-(1[0-2]|0[1-9])-(3[0-1]|0[1-9]|[1-2][0-9])(T(2[0-3]|[0-1][0-9]):([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?)?(Z|[+|-](2[0-3]|[0-1][0-9]):([0-5][0-9]))?
// 
// //        String pattern =
// //                "\\d{4}-(1[0-2]|0[1-9])-(3[0-1]|0[1-9]|[1-2][0-9])(T(2[0-3]|[0-1][0-9]):([0-5][0-9]):([0-5][0-9])(\\.[0-9]+)?)?(Z|([+|-](2[0-3]|[0-1][0-9]):([0-5][0-9]):([0-5][0-9])(\\.[0-9])?)?)?";
// //        Assert.assertThat(Pattern.matches(pattern, "2013-09-26T12:49:41.740+02:00"), Matchers.is(true));
// }
private MinimalInspireExtendedCapabilities getMinimalInspireExtendedCapabilities() {
    // --------------------
    InspireResourceLocator resourceLocator = new InspireResourceLocator("http://min.test.org/sos");
    resourceLocator.addMediaType(MediaTypes.APPLICATION_SOAP_XML);
    // --------------------
    InspireSupportedLanguages inspireSupportedLanguages = new InspireSupportedLanguages(InspireLanguageISO6392B.ENG);
    // --------------------
    InspireLanguageISO6392B responseLanguage = InspireLanguageISO6392B.ENG;
    // --------------------
    Set<InspireUniqueResourceIdentifier> spatialDataSetIdentifier = Sets.newHashSet();
    InspireUniqueResourceIdentifier iuri = new InspireUniqueResourceIdentifier("test");
    iuri.setNamespace("http://test.org");
    spatialDataSetIdentifier.add(iuri);
    // --------------------
    return new MinimalInspireExtendedCapabilities(resourceLocator, inspireSupportedLanguages, responseLanguage, spatialDataSetIdentifier, new InspireSupportedCRS("4326"));
}
Also used : InspireSupportedCRS(org.n52.shetland.inspire.InspireSupportedCRS) InspireUniqueResourceIdentifier(org.n52.shetland.inspire.InspireUniqueResourceIdentifier) InspireResourceLocator(org.n52.shetland.inspire.InspireResourceLocator) InspireLanguageISO6392B(org.n52.shetland.inspire.InspireLanguageISO6392B) InspireSupportedLanguages(org.n52.shetland.inspire.InspireSupportedLanguages) MinimalInspireExtendedCapabilities(org.n52.shetland.inspire.dls.MinimalInspireExtendedCapabilities)

Example 24 with UnsupportedEncoderInputException

use of org.n52.svalbard.encode.exception.UnsupportedEncoderInputException in project arctic-sea by 52North.

the class AbstractOmV20XmlStreamWriter method writeProcedure.

/**
 * Write om:procedure encoded or as xlink:href to stream
 *
 * @throws XMLStreamException
 *             If an error occurs when writing to stream
 * @throws UnsupportedEncoderInputException
 *             If the procedure could not be encoded
 * @throws EncodingException
 *             If an error occurs when creating elements to be written
 */
protected void writeProcedure() throws XMLStreamException, EncodingException {
    empty(OmConstants.QN_OM_20_PROCEDURE);
    OmObservation observation = getElement();
    addXlinkHrefAttr(observation.getObservationConstellation().getProcedure().getIdentifier());
    if (observation.getObservationConstellation().getProcedure().isSetName() && observation.getObservationConstellation().getProcedure().getFirstName().isSetValue()) {
        addXlinkTitleAttr(observation.getObservationConstellation().getProcedure().getFirstName().getValue());
    }
}
Also used : OmObservation(org.n52.shetland.ogc.om.OmObservation)

Example 25 with UnsupportedEncoderInputException

use of org.n52.svalbard.encode.exception.UnsupportedEncoderInputException in project arctic-sea by 52North.

the class Iso19139GcoEncoder method encode.

@Override
public XmlObject encode(Object element, EncodingContext additionalValues) throws EncodingException, UnsupportedEncoderInputException {
    XmlObject encodedObject = null;
    if (element instanceof AbstractRole) {
        encodedObject = encodeRole((AbstractRole) element);
    } else {
        throw new UnsupportedEncoderInputException(this, element);
    }
    XmlHelper.validateDocument(encodedObject, EncodingException::new);
    return encodedObject;
}
Also used : EncodingException(org.n52.svalbard.encode.exception.EncodingException) XmlObject(org.apache.xmlbeans.XmlObject) AbstractRole(org.n52.shetland.iso.gco.AbstractRole) UnsupportedEncoderInputException(org.n52.svalbard.encode.exception.UnsupportedEncoderInputException)

Aggregations

UnsupportedEncoderInputException (org.n52.svalbard.encode.exception.UnsupportedEncoderInputException)29 XmlObject (org.apache.xmlbeans.XmlObject)16 EncodingException (org.n52.svalbard.encode.exception.EncodingException)12 XmlException (org.apache.xmlbeans.XmlException)5 Geometry (org.locationtech.jts.geom.Geometry)3 LineString (org.locationtech.jts.geom.LineString)3 Point (org.locationtech.jts.geom.Point)3 Polygon (org.locationtech.jts.geom.Polygon)3 GeometryPropertyType (net.opengis.gml.x32.GeometryPropertyType)2 AbstractFeature (org.n52.shetland.ogc.gml.AbstractFeature)2 OmObservation (org.n52.shetland.ogc.om.OmObservation)2 FeatureCollection (org.n52.shetland.ogc.om.features.FeatureCollection)2 AbstractSamplingFeature (org.n52.shetland.ogc.om.features.samplingFeatures.AbstractSamplingFeature)2 CategoryValue (org.n52.shetland.ogc.om.values.CategoryValue)2 QuantityValue (org.n52.shetland.ogc.om.values.QuantityValue)2 AbstractSensorML (org.n52.shetland.ogc.sensorML.AbstractSensorML)2 SweDataRecord (org.n52.shetland.ogc.swe.SweDataRecord)2 SweField (org.n52.shetland.ogc.swe.SweField)2 EnvelopeOrGeometry (org.n52.shetland.util.EnvelopeOrGeometry)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1