/** * Removes the features from the store which match the specified filter. * * <p>This method operates by obtaining an updating feature writer based on the specified * <tt>filter</tt> and removing every feature from it. * * <p>The <tt>filter</tt> must not be <code>null</code>, in this case this method will throw an * {@link IllegalArgumentException}. */ public void removeFeatures(Filter filter) throws IOException { if (filter == null) { String msg = "Must specify a filter, must not be null."; throw new IllegalArgumentException(msg); } filter = resolvePropertyNames(filter); // grab a feature writer FeatureWriter<SimpleFeatureType, SimpleFeature> writer = getWriter(filter, WRITER_UPDATE); try { // remove everything while (writer.hasNext()) { writer.next(); writer.remove(); } } finally { writer.close(); } } }
/** * Modifies/updates the features of the store which match the specified filter. * * <p>This method operates by obtaining an updating feature writer based on the specified * <tt>filter</tt> and writing the updated values to it. * * <p>The <tt>filter</tt> must not be <code>null</code>, in this case this method will throw an * {@link IllegalArgumentException}. */ public void modifyFeatures(Name[] type, Object[] value, Filter filter) throws IOException { if (filter == null) { String msg = "Must specify a filter, must not be null."; throw new IllegalArgumentException(msg); } filter = resolvePropertyNames(filter); // grab a feature writer FeatureWriter<SimpleFeatureType, SimpleFeature> writer = getWriter(filter, WRITER_UPDATE); try { while (writer.hasNext()) { SimpleFeature toWrite = writer.next(); for (int i = 0; i < type.length; i++) { toWrite.setAttribute(type[i], value[i]); } writer.write(); } } finally { writer.close(); } }
throws IOException { query = joinQuery(query); query = resolvePropertyNames(query);
throw new IllegalArgumentException( msg ); filter = resolvePropertyNames(filter);
throw new IllegalArgumentException( msg ); filter = resolvePropertyNames(filter);
query = resolvePropertyNames(query);