/** * Calls through to: <code><pre> * encodeFID(pkey, rs, 0); * </pre></code> */ protected String encodeFID(PrimaryKey pkey, ResultSet rs) throws SQLException, IOException { return encodeFID(pkey, rs, 0); }
public void init() throws SQLException, IOException { // get fid // PrimaryKey pkey = dataStore.getPrimaryKey(featureType); // TODO: factory fid prefixing out init(featureType.getTypeName() + "." + dataStore.encodeFID(key, rs, offset)); }
/** * Encodes a feature id from a primary key and result set values. * * <p><tt>offset</tt> specifies where in the result set to start from when reading values for * the primary key. */ protected String encodeFID(PrimaryKey pkey, ResultSet rs, int offset) throws SQLException, IOException { // no pk columns List<PrimaryKeyColumn> columns = pkey.getColumns(); if (columns.isEmpty()) { return SimpleFeatureBuilder.createDefaultFeatureId(); } // just one, no need to build support structures if (columns.size() == 1) { return dialect.getPkColumnValue(rs, columns.get(0), offset + 1); } // more than one List<Object> keyValues = new ArrayList<Object>(); for (int i = 0; i < columns.size(); i++) { String o = dialect.getPkColumnValue(rs, columns.get(0), offset + i + 1); keyValues.add(o); } return encodeFID(keyValues); }
featureType.getTypeName() + "." + JDBCDataStore.encodeFID(keyValues); feature.getUserData().put("fid", fid); keyValues.clear();
@Override public void postInsert( SimpleFeatureType featureType, SimpleFeature feature, Connection cx, Statement st) throws SQLException { if (!isPostInsert()) { return; } List<Object> keyValues = getLastValues(cx, st); String fid = featureType.getTypeName() + "." + JDBCDataStore.encodeFID(keyValues); feature.getUserData().put("fid", fid); }
/** Set all the key values (the ones that are known before insert) for a prepared statement. */ public int setKeyValues( PreparedStatementSQLDialect dialect, PreparedStatement ps, Connection cx, SimpleFeatureType featureType, SimpleFeature feature, int curFieldPos) throws IOException, SQLException { final List<Object> keyValues = getNextValues(cx, feature); for (int i = 0; i < key.getColumns().size(); i++) { final PrimaryKeyColumn col = key.getColumns().get(i); final Object value = keyValues.get(i); if (value != NOT_SET_BEFORE_INSERT) { dialect.setValue(value, col.getType(), ps, curFieldPos++, cx); } } if (!isPostInsert()) { // report the feature id as user data since we cant set the fid. String fid = featureType.getTypeName() + "." + JDBCDataStore.encodeFID(keyValues); feature.getUserData().put("fid", fid); } return curFieldPos; }
String fid = featureType.getTypeName() + "." + JDBCDataStore.encodeFID(keyValues); feature.getUserData().put("fid", fid);
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); } }
/** * Calls through to: * <code><pre> * encodeFID(pkey, rs, 0); * </pre></code> */ protected String encodeFID(PrimaryKey pkey, ResultSet rs) throws SQLException, IOException { return encodeFID(pkey, rs, 0); }
String fid = featureType.getTypeName() + "." + encodeFID(key, rs); lm.assertAccess(featureType.getTypeName(), fid, tx);
fid = dataStore.encodeFID(pkey, rs, offset); if (fid == null) {
public void init() throws SQLException, IOException { //get fid //PrimaryKey pkey = dataStore.getPrimaryKey(featureType); //TODO: factory fid prefixing out init(featureType.getTypeName() + "." + dataStore.encodeFID( key, rs, offset )); }
public void init() throws SQLException, IOException { //get fid //PrimaryKey pkey = dataStore.getPrimaryKey(featureType); //TODO: factory fid prefixing out init(featureType.getTypeName() + "." + dataStore.encodeFID( key, rs )); }
/** * Encodes a feature id from a primary key and result set values. */ protected String encodeFID( PrimaryKey pkey, ResultSet rs ) throws SQLException, IOException { // no pk columns if(pkey.getColumns().isEmpty()) { return SimpleFeatureBuilder.createDefaultFeatureId(); } // just one, no need to build support structures if(pkey.getColumns().size() == 1) return rs.getString(1); // more than one List<Object> keyValues = new ArrayList<Object>(); for(int i = 0; i < pkey.getColumns().size(); i++) { String o = rs.getString(i+1); keyValues.add( o ); } return encodeFID( keyValues ); }
/** * Encodes a feature id from a primary key and result set values. * <p> * <tt>offset</tt> specifies where in the result set to start from when reading values for the * primary key. * </p> */ protected String encodeFID( PrimaryKey pkey, ResultSet rs, int offset ) throws SQLException, IOException { // no pk columns if(pkey.getColumns().isEmpty()) { return SimpleFeatureBuilder.createDefaultFeatureId(); } // just one, no need to build support structures if(pkey.getColumns().size() == 1) return rs.getString(offset+1); // more than one List<Object> keyValues = new ArrayList<Object>(); for(int i = 0; i < pkey.getColumns().size(); i++) { String o = rs.getString(offset+i+1); keyValues.add( o ); } return encodeFID( keyValues ); }
String fid = featureType.getTypeName() + "." + encodeFID(nextKeyValues); feature.getUserData().put("fid", fid);
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 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); } }
InProcessLockingManager lm = (InProcessLockingManager) getLockingManager(); while( rs.next() ) { String fid = featureType.getTypeName() + "." + encodeFID( key, rs ); lm.assertAccess(featureType.getTypeName(), fid, tx );
InProcessLockingManager lm = (InProcessLockingManager) getLockingManager(); while( rs.next() ) { String fid = featureType.getTypeName() + "." + encodeFID( key, rs ); lm.assertAccess(featureType.getTypeName(), fid, tx );