@Override public OXFFeatureCollection unmarshalFeatures() throws OXFException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Unmarshalling features from: {}\n", xmlObject.xmlText()); } if (isGmlFeatureCollectionDocument(xmlObject)) { FeatureCollectionDocument2 xb_featureCollDoc = (FeatureCollectionDocument2) xmlObject; return unmarshalAbstractCollectionType(xb_featureCollDoc.getFeatureCollection()); } else if (isSamplingPointDocument(xmlObject)) { SamplingPointDocument xb_samplingPointDoc = (SamplingPointDocument) xmlObject; OXFFeature feature = OXFSamplingPointType.create(xb_samplingPointDoc); OXFFeatureCollection coll = new OXFFeatureCollection("any_ID", null); coll.add(feature); return coll; } // FIXME IMPLEMENT throw new RuntimeException(String.format("Unmarshalling of '%s' is not supported", xmlObject.schemaType())); }
AbstractFeatureCollectionType fct; if (feature instanceof FeatureCollectionDocument2) { fct = ((FeatureCollectionDocument2) feature).getFeatureCollection(); } else { fct = ((FeatureCollectionDocument) feature).getFeatureCollection();
@Deprecated @Override public OXFFeatureCollection unmarshalFeatures(OperationResult opsRes) throws OXFException { // 1. try to parse the feature data as a FeatureCollection: try { FeatureCollectionDocument2 xb_featureCollDoc = FeatureCollectionDocument2.Factory.parse(opsRes.getIncomingResultAsAutoCloseStream()); AbstractFeatureCollectionType xb_collection = xb_featureCollDoc.getFeatureCollection(); return unmarshalAbstractCollectionType(xb_collection); } // 2. try to parse the feature data as one single SamplingPoint: catch (org.apache.xmlbeans.XmlException xmlException) { try { SamplingPointDocument xb_samplingPointDoc = SamplingPointDocument.Factory.parse(opsRes.getIncomingResultAsAutoCloseStream()); OXFFeature feature = OXFSamplingPointType.create(xb_samplingPointDoc); OXFFeatureCollection coll = new OXFFeatureCollection("any_ID", null); coll.add(feature); return coll; } catch (IOException | XmlException e) { throw new OXFException(e); } } catch (IOException ioException) { throw new OXFException(ioException); } }