/** * Next Feature from reader or new content. * * @see org.geotools.data.FeatureWriter#next() */ public SimpleFeature next() throws IOException { SimpleFeatureType type = getFeatureType(); if (hasNext()) { // hasNext() will take care recording // any modifications to current live = next; // update live value next = null; // hasNext will need to search again current = SimpleFeatureBuilder.copy(live); return current; } else { if (diff == null) { throw new IOException("FeatureWriter has been closed"); } // Create new content // created with an empty ID // (The real writer will supply a FID later) live = null; next = null; current = builder.buildFeature( "new" + diff.nextFID, new Object[type.getAttributeCount()]); diff.nextFID++; return current; } }
/** * Provides a wrapper on the provided reader which gives a diff writer. * * @param contentFeatureStore ContentFeatureStore * @param reader FeatureReader requiring diff support * @return FeatureWriter with diff support */ public FeatureWriter<SimpleFeatureType, SimpleFeature> diffWriter( ContentFeatureStore contentFeatureStore, FeatureReader<SimpleFeatureType, SimpleFeature> reader) { return new DiffContentFeatureWriter(contentFeatureStore, diff, reader); } }
@Override public synchronized SimpleFeature next() throws IOException { checkClosed(); return super.next(); }
@Override public boolean hasNext() throws IOException { checkClosed(); return super.hasNext(); }
@Override public void write() throws IOException { checkClosed(); super.write(); if (autoCommitState != null) { autoCommitState.commit(); } }
@Override public void remove() throws IOException { checkClosed(); super.remove(); if (autoCommitState != null) { autoCommitState.commit(); } }
@Override public boolean hasNext() throws IOException { checkClosed(); return super.hasNext(); }
@Override public void write() throws IOException { checkClosed(); super.write(); if (autoCommitState != null) { autoCommitState.commit(); } }
@Override public void remove() throws IOException { checkClosed(); super.remove(); if (autoCommitState != null) { autoCommitState.commit(); } }
/** * Next Feature from reader or new content. * * @see org.geotools.data.FeatureWriter#next() */ public SimpleFeature next() throws IOException { SimpleFeatureType type = getFeatureType(); if (hasNext()) { // hasNext() will take care recording // any modifications to current live = next; // update live value next = null; // hasNext will need to search again current = SimpleFeatureBuilder.copy(live); return current; } else { // Create new content // created with an empty ID // (The real writer will supply a FID later) live = null; next = null; current = SimpleFeatureBuilder.build(type, new Object[type.getAttributeCount()], "new"+ diff.nextFID); diff.nextFID++; return current; } }
DiffTransactionState state = (DiffTransactionState) getTransaction().getState(getEntry()); FeatureReader<SimpleFeatureType, SimpleFeature> reader = getReader(query); writer = new DiffContentFeatureWriter(this, state.getDiff(), reader); } else { writer = getWriterInternal(query, flags);
@Override public synchronized SimpleFeature next() throws IOException { checkClosed(); return super.next(); }