public JDBCUpdateFeatureWriter( PreparedStatement ps, Connection cx, JDBCFeatureSource featureSource, Query query) throws SQLException, IOException { super(ps, cx, featureSource, featureSource.getSchema(), query); md = rs.getMetaData(); last = new ResultSetFeature(rs, ps.getConnection()); }
public void write() throws IOException { try { // figure out what the fid is PrimaryKey key = dataStore.getPrimaryKey(featureType); String fid = dataStore.encodeFID(key, rs); Id filter = dataStore .getFilterFactory() .id(Collections.singleton(dataStore.getFilterFactory().featureId(fid))); // figure out which attributes changed List<AttributeDescriptor> changed = new ArrayList<AttributeDescriptor>(); List<Object> values = new ArrayList<Object>(); for (AttributeDescriptor att : featureType.getAttributeDescriptors()) { if (last.isDirty(att.getLocalName())) { changed.add(att); values.add(last.getAttribute(att.getLocalName())); } } // do the write dataStore.update(featureType, changed, values, filter, st.getConnection()); // issue notification ContentEntry entry = featureSource.getEntry(); ContentState state = entry.getState(this.tx); if (state.hasListener()) { state.fireFeatureUpdated(featureSource, last, lastBounds); } } catch (Exception e) { throw (IOException) new IOException().initCause(e); } }
public void remove() throws IOException { try { dataStore.delete(featureType, last.getID(), st.getConnection()); // issue notification ContentEntry entry = featureSource.getEntry(); ContentState state = entry.getState(this.tx); if (state.hasListener()) { state.fireFeatureRemoved(featureSource, last); } } catch (SQLException e) { throw (IOException) new IOException().initCause(e); } }
public void write() throws IOException { try { //figure out what the fid is PrimaryKey key = dataStore.getPrimaryKey(featureType); String fid = dataStore.encodeFID(key, rs); Id filter = dataStore.getFilterFactory() .id(Collections.singleton(dataStore.getFilterFactory() .featureId(fid))); //figure out which attributes changed List<AttributeDescriptor> changed = new ArrayList<AttributeDescriptor>(); List<Object> values = new ArrayList<Object>(); for (AttributeDescriptor att : featureType.getAttributeDescriptors()) { if (last.isDirrty(att.getLocalName())) { changed.add(att); values.add(last.getAttribute(att.getLocalName())); } } // do the write dataStore.update(featureType, changed, values, filter, st.getConnection()); // issue notification ContentEntry entry = featureSource.getEntry(); ContentState state = entry.getState( this.tx ); if( state.hasListener() ){ state.fireFeatureUpdated( featureSource, last, lastBounds ); } } catch (Exception e) { throw (IOException) new IOException().initCause(e); } }
public void write() throws IOException { try { //figure out what the fid is PrimaryKey key = dataStore.getPrimaryKey(featureType); String fid = dataStore.encodeFID(key, rs); Id filter = dataStore.getFilterFactory() .id(Collections.singleton(dataStore.getFilterFactory() .featureId(fid))); //figure out which attributes changed List<AttributeDescriptor> changed = new ArrayList<AttributeDescriptor>(); List<Object> values = new ArrayList<Object>(); for (AttributeDescriptor att : featureType.getAttributeDescriptors()) { if (last.isDirrty(att.getLocalName())) { changed.add(att); values.add(last.getAttribute(att.getLocalName())); } } //do the write dataStore.update(featureType, changed, values, filter, st.getConnection()); } catch (Exception e) { throw (IOException) new IOException().initCause(e); } }
public SimpleFeature next() throws IOException, IllegalArgumentException, NoSuchElementException { ensureNext(); try { last.init(); } catch (Exception e) { e.printStackTrace(); } //reset next flag next = null; if( this.featureSource.getEntry().getState(tx).hasListener() ){ // record bounds as we have a listener who will be interested this.lastBounds = new ReferencedEnvelope( last.getBounds() ); } return last; }
public Object getAttribute(Name name) { return getAttribute(name.getLocalPart()); }
public Object getAttribute(Name name) { return getAttribute(name.getLocalPart()); }
public Object getAttribute(String name) { return getAttribute(index.get(name)); }
public void write() throws IOException { try { //do the insert dataStore.insert(last, featureType, st.getConnection()); //the datastore sets as userData, grab it and update the fid String fid = (String) last.getUserData().get( "fid" ); last.setID( fid ); ContentEntry entry = featureSource.getEntry(); ContentState state = entry.getState( this.tx ); state.fireFeatureAdded( featureSource, last ); } catch (SQLException e) { throw (IOException) new IOException().initCause(e); } }
public boolean isDirrty(String name) { return isDirty(index.get(name)); }
public Object getAttribute(String name) { return getAttribute(index.get(name)); }
public boolean isDirrty(String name) { return isDirty(index.get(name)); }
public void remove() throws IOException { try { dataStore.delete(featureType, last.getID(), st.getConnection()); // issue notification ContentEntry entry = featureSource.getEntry(); ContentState state = entry.getState( this.tx ); if( state.hasListener() ){ state.fireFeatureRemoved( featureSource, last ); } } catch (SQLException e) { throw (IOException) new IOException().initCause(e); } }
public Object getAttribute(int index) throws IndexOutOfBoundsException { return getAttributeInternal( index, mapToResultSetIndex(index) ); }
public Object getAttribute(int index) throws IndexOutOfBoundsException { return getAttributeInternal( index, mapToResultSetIndex(index) ); }
public Object getDefaultGeometry() { GeometryDescriptor defaultGeometry = featureType.getGeometryDescriptor(); return defaultGeometry != null ? getAttribute( defaultGeometry.getName() ) : null; }
public void write() throws IOException { try { //do the insert dataStore.insert(last, featureType, st.getConnection()); //the datastore sets as userData, grab it and update the fid String fid = (String) last.getUserData().get( "fid" ); last.setID( fid ); } catch (SQLException e) { throw (IOException) new IOException().initCause(e); } }
public void close() throws IOException { super.close(); if ( last != null ) { last.close(); last = null; } } }
public void remove() throws IOException { try { dataStore.delete(featureType, last.getID(), st.getConnection()); } catch (SQLException e) { throw (IOException) new IOException().initCause(e); } }