Skip to content

Commit

Permalink
Merge pull request #709 from lat-lon/replaceUseExistingId-3529
Browse files Browse the repository at this point in the history
Updated behaviour of replace transaction in WFS 2.0.0
  • Loading branch information
copierrj authored Aug 17, 2016
2 parents f60cdf8 + a0a0897 commit d89d779
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
package org.deegree.feature.persistence.memory;

import static org.deegree.feature.i18n.Messages.getMessage;
import static org.deegree.protocol.wfs.transaction.action.IDGenMode.USE_EXISTING;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -569,7 +570,7 @@ public String performReplace( Feature replacement, Filter filter, Lock lock, IDG
}
GenericFeatureCollection col = new GenericFeatureCollection();
col.add( replacement );
List<String> ids = performInsert( col, idGenMode );
List<String> ids = performInsert( col, USE_EXISTING );
if ( ids.isEmpty() || ids.size() > 1 ) {
throw new FeatureStoreException( "Unable to determine new feature id." );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

import static org.deegree.feature.Features.findFeaturesAndGeometries;
import static org.deegree.feature.types.property.GeometryPropertyType.CoordinateDimension.DIM_2;
import static org.deegree.protocol.wfs.transaction.action.IDGenMode.USE_EXISTING;

import java.io.ByteArrayOutputStream;
import java.sql.Connection;
Expand Down Expand Up @@ -1062,11 +1063,11 @@ public String performReplace( final Feature replacement, final Filter filter, fi
}
final GenericFeatureCollection col = new GenericFeatureCollection();
col.add( replacement );
final List<String> ids = performInsert( col, idGenMode );
final List<String> ids = performInsert( col, USE_EXISTING );
if ( ids.isEmpty() || ids.size() > 1 ) {
throw new FeatureStoreException( "Unable to determine new feature id." );
}
return ids.get( 0 );
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@

import org.deegree.commons.jdbc.SQLIdentifier;
import org.deegree.commons.tom.primitive.BaseType;
import org.deegree.commons.tom.primitive.PrimitiveType;
import org.deegree.commons.tom.primitive.PrimitiveValue;
import org.deegree.commons.tom.sql.PrimitiveParticleConverter;
import org.deegree.commons.utils.Pair;
import org.deegree.feature.Feature;
import org.deegree.feature.persistence.FeatureStoreException;
Expand Down Expand Up @@ -199,9 +202,13 @@ private void preInsertUseExisting( FeatureTypeMapping ftMapping )
}
for ( int i = 0; i < fidMapping.getColumns().size(); i++ ) {
Pair<SQLIdentifier, BaseType> idColumn = fidMapping.getColumns().get( i );
// TODO mapping to non-string columns
Object value = idKernels[i];
addPreparedArgument( idColumn.getFirst(), value );
BaseType baseType = idColumn.second != null ? idColumn.second : BaseType.STRING;
PrimitiveType type = new PrimitiveType( baseType );
PrimitiveValue primitiveValue = new PrimitiveValue( value, type );
PrimitiveParticleConverter primitiveConverter = mgr.getDialect().getPrimitiveConverter( idColumn.first.getName(),
type );
addPreparedArgument( idColumn.getFirst(), primitiveValue, primitiveConverter );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ By default, WFS-T requests will be rejected. Setting the ``EnableTransactions``
.. hint::
In a WFS 1.1.0 insert, the id generation mode can be overridden by attribute *idGenMode* of the ``Insert`` element. WFS 1.0.0 and WFS 2.0.0 don't support to specify the id generation mode on a request basis.

.. hint::
When a feature is replaced the ``UseExisting`` option is always activated for that transaction. The gml:id of the feature is used for the new version of the feature. The filter is used to identify the feature to be replaced.

^^^^^^^^^^^^^^^^^^
SupportedRequests
^^^^^^^^^^^^^^^^^^
Expand Down

0 comments on commit d89d779

Please sign in to comment.