private SimpleFeatureSource getTransactionSource(Update update) throws IOException { QName typeName = update.getTypeName(); final String name = typeName.getLocalPart(); final String namespaceURI; if (typeName.getNamespaceURI() != null) { namespaceURI = typeName.getNamespaceURI(); } else { namespaceURI = catalog.getDefaultNamespace().getURI(); } final FeatureTypeInfo meta = catalog.getFeatureTypeByName(namespaceURI, name); if (meta == null) { String msg = "Feature type '" + name + "' is not available: "; throw new WFSTransactionException(msg, (String) null, update.getHandle()); } FeatureSource source = meta.getFeatureSource(null, null); return DataUtilities.simple(source); }
/** * Takes an update and transforms it in an insert if the feature type is versioned, leave it as * is otherwise */ private TransactionElement transformUpdate( TransactionRequest request, Update update, Date referenceTime) throws IOException { FeatureTypeInfo featureTypeInfo = getFeatureTypeInfo(new NameImpl(update.getTypeName())); if (!TimeVersioning.isEnabled(featureTypeInfo)) { return update; } SimpleFeatureCollection features = getTransactionFeatures(update); List<SimpleFeature> recent = getMostRecentFeatures(features, featureTypeInfo); List<SimpleFeature> newFeatures = recent.stream() .map(f -> prepareInsertFeature(f, update, referenceTime)) .collect(Collectors.toList()); Insert insert = request.createInsert(); insert.setHandle(update.getHandle()); insert.getFeatures().addAll(newFeatures); return insert; }
"Could not locate feature type information for " + update.getTypeName(), e, update.getHandle());
public static UpdateElementType unadapt(Update update) { if (update instanceof WFS11) { return (UpdateElementType) update.getAdaptee(); } UpdateElementType ue = WfsFactory.eINSTANCE.createUpdateElementType(); ue.setHandle(update.getHandle()); ue.setTypeName(update.getTypeName()); ue.setFilter(update.getFilter()); for (Property p : update.getUpdateProperties()) { ue.getProperty().add(Property.WFS11.unadapt(p)); } return ue; } }
String handle = update.getHandle();