/** * Creates the new feature store. * * @param entry The datastore entry. * @param query The defining query. */ public JDBCFeatureSource(ContentEntry entry, Query query) throws IOException { super(entry, query); // TODO: cache this primaryKey = ((JDBCDataStore) entry.getDataStore()).getPrimaryKey(entry); }
protected PrimaryKey getPrimaryKey(String typeName) throws IOException { SimpleFeatureType featureType = dataStore.getSchema(typeName); return dataStore.getPrimaryKey(featureType); }
/** * Returns the primary key object for a particular feature type / table, deriving it from the * underlying database metadata. */ public PrimaryKey getPrimaryKey(SimpleFeatureType featureType) throws IOException { return getPrimaryKey(ensureEntry(featureType.getName())); }
Connection cx) throws IOException { PrimaryKey key = getPrimaryKey(featureType);
key = dataStore.getPrimaryKey(featureType); int count = md.getColumnCount(); columnNames = new String[count];
throws IOException { if ((sort != null) && (sort.length > 0)) { PrimaryKey key = getPrimaryKey(featureType); sql.append(" ORDER BY ");
key = store.getPrimaryKey(lastType); } catch (IOException e) { throw new RuntimeException(e);
key = getPrimaryKey(featureType); } catch (IOException e) { throw new RuntimeException(e);
SimpleFeatureType joinFeatureType = getDataStore().getSchema(typeName); try { joinKey = getDataStore().getPrimaryKey(joinFeatureType); } catch (IOException e) { throw new RuntimeException(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.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); } }
key = getPrimaryKey(featureType); } catch (IOException e) { throw new RuntimeException(e);
key = getPrimaryKey(featureType); } catch (IOException e) { throw new RuntimeException(e);
PrimaryKey key = getPrimaryKey(featureType);
joinKey = getDataStore().getPrimaryKey(joinFeatureType); } catch (IOException e) { throw new RuntimeException(e); key = getDataStore().getPrimaryKey(origType); } catch (IOException e) { throw new RuntimeException(e);
key = getDataStore().getPrimaryKey(featureType); } catch (IOException e) { throw new RuntimeException(e); joinKey = getDataStore().getPrimaryKey(joinFeatureType); } catch (IOException e) { throw new RuntimeException(e);
finalSql.append("SELECT "); SimpleFeatureType featureType = getDataStore().getSchema(mv.getTargetTable()); PrimaryKey primaryKeys = getDataStore().getPrimaryKey(featureType); for (PrimaryKeyColumn primaryKey : primaryKeys.getColumns()) { encodeColumnName(finalSql, mv.getTargetTable(), primaryKey.getName());
pkey = dataStore.getPrimaryKey(featureType); } catch (IOException e) { throw new RuntimeException(e);
public void testGetFeatureById() throws Exception { FeatureSource fsView = dataStore.getFeatureSource("riverReducedPk"); assertFalse(fsView instanceof FeatureStore); // the problem is actually in pk computation PrimaryKey pk = dataStore.getPrimaryKey((SimpleFeatureType) fsView.getSchema()); assertEquals("riverReducedPk", pk.getTableName()); assertEquals(1, pk.getColumns().size()); PrimaryKeyColumn col = pk.getColumns().get(0); assertEquals(aname("id"), col.getName()); assertTrue(Number.class.isAssignableFrom(col.getType())); FilterFactory ff = CommonFactoryFinder.getFilterFactory(null); Id filter = ff.id(Collections.singleton(ff.featureId("riverReducedPk.0"))); assertEquals(1, fsView.getCount(new Query(null, filter))); }
PrimaryKey pkey = getDataStore().getPrimaryKey(entry); VirtualTable virtualTable = getDataStore().getVirtualTables().get(entry.getTypeName());
/** * Returns the primary key object for a particular feature type / table, * deriving it from the underlying database metadata. * */ protected PrimaryKey getPrimaryKey(SimpleFeatureType featureType) throws IOException { return getPrimaryKey(ensureEntry(featureType.getName())); }