public FeatureTypeMap(SimpleFeatureType originalFeatureType, SimpleFeatureType featureType) { this.originalFeatureType = originalFeatureType; this.featureType = featureType; this.originalName = originalFeatureType.getTypeName(); this.name = featureType.getTypeName(); }
public SimpleFeatureCollection getFeatures(Filter filter) throws IOException { return getFeatures(new Query(schema.getTypeName(), filter)); }
@Override protected String transformFeatureTypeName(String originalName) { if (originalName.equals(MockData.PRIMITIVEGEOFEATURE.getLocalPart())) return primitive.getTypeName(); else return super.transformFeatureTypeName(originalName); } };
@Override protected SimpleFeatureType transformFeatureType(SimpleFeatureType original) throws IOException { if (original.getTypeName() .equals(MockData.PRIMITIVEGEOFEATURE.getLocalPart())) return primitive; else return super.transformFeatureType(original); }
/** * Transforms the original feature type into a destination one according to the renaming rules. * For the moment, it's just a feature type name replacement * * @param original * @throws IOException */ protected SimpleFeatureType transformFeatureType(SimpleFeatureType original) throws IOException { String transfomedName = transformFeatureTypeName(original.getTypeName()); if (transfomedName.equals(original.getTypeName())) return original; try { SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.init(original); b.setName(transfomedName); return b.buildFeatureType(); } catch (Exception e) { throw new DataSourceException("Could not build the renamed feature type.", e); } }
/** * Retrieves the total extent of this FeatureSource. * * <p>Please note this extent will reflect the provided definitionQuery. * * @return Extent of this FeatureSource, or <code>null</code> if no optimizations exist. * @throws IOException If bounds of definitionQuery */ public ReferencedEnvelope getBounds() throws IOException { // since CRS is at most forced, we don't need to change this code if (definitionQuery == Filter.INCLUDE) { return source.getBounds(); } else { Query query = new Query(getSchema().getTypeName(), definitionQuery); return source.getBounds(query); } }
@Test public void testGetTypeNamesCalls() throws Exception { SimpleFeatureType orig = createNiceMock(SimpleFeatureType.class); expect(orig.getTypeName()).andReturn("orig").anyTimes(); replay(orig); SimpleFeatureType wrapped = createNiceMock(SimpleFeatureType.class); expect(wrapped.getTypeName()).andReturn("wrapped").anyTimes(); replay(wrapped); // ensure that getTypeNames() never called DataStore ds = createMock(DataStore.class); SimpleFeatureSource fs = createMock(SimpleFeatureSource.class); expect(fs.getSchema()).andReturn(orig).anyTimes(); expect(fs.getDataStore()).andReturn(ds).anyTimes(); expect(fs.getFeatures(new Query(orig.getTypeName(), Filter.INCLUDE))) .andReturn(null) .once(); replay(fs); SimpleFeatureSource rts = RetypingFeatureSource.getRetypingSource(fs, wrapped); rts.getFeatures(); } }
Query q = new Query(currFt.getTypeName(), Filter.INCLUDE); FeatureReader<SimpleFeatureType, SimpleFeature> ilReader; DataStore inlineFeatureDatastore = ul.getInlineFeatureDatastore();
private SeTable getTable() throws IOException { if (this.cachedTable == null) { final String typeName = this.featureType.getTypeName(); this.cachedTable = session.getTable(typeName); } return this.cachedTable; }
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)); }
/** * Implement getFeatures. * * <p>Description ... * * @param filter * @return @throws IOException */ public SimpleFeatureCollection getFeatures(Filter filter) throws IOException { return getFeatures(new DefaultQuery(schema.getTypeName(), filter)); }
private SeLayer getLayer() throws IOException { if (this.cachedLayer == null && featureType.getGeometryDescriptor() != null) { final String typeName = this.featureType.getTypeName(); final SeLayer layer = session.getLayer(typeName); this.cachedLayer = layer; } return this.cachedLayer; }
public SimpleFeature createSimpleFeature(Object[] array, SimpleFeatureType type, String id) { if (type.isAbstract()) { throw new IllegalArgumentException( "Cannot create an feature of an abstract FeatureType " + type.getTypeName()); } return new SimpleFeatureImpl(array, type, ff.featureId(id), validating); }
@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); }
if (featureType != null) { baseDirName = "featureTypes"; String name = featureType.getTypeName(); String namespace = featureType.getName().getNamespaceURI(); FeatureTypeInfo ftInfo = null;
String id(String raw, SimpleFeature f) { if (raw == null) { return null; } if (raw.startsWith(f.getType().getTypeName() + ".")) { return tname(f.getType().getTypeName()) + raw.substring(f.getType().getTypeName().length()); } return raw; }
public void createType(SimpleFeatureType featureType) throws IOException { Utilities.ensureNonNull("featureType", featureType); checkMosaicSchema(featureType); checkStore(); getTileIndexStore().createSchema(featureType); String typeName = featureType.getTypeName(); if (typeName != null) { addTypeName(typeName, true); } extractBasicProperties(typeName); }
public void testNaturalSortingAsc() throws Exception { Query q = new Query(featureSource.getSchema().getTypeName()); q.setSortBy(new SortBy[] {SortBy.NATURAL_ORDER}); try (SimpleFeatureIterator features = featureSource.getFeatures(q).features()) { String prevId = null; while (features.hasNext()) { String currId = features.next().getID(); if (prevId != null) assertTrue(prevId.compareTo(currId) <= 0); prevId = currId; } } }
public void testNaturalSortingdesc() throws Exception { Query q = new Query(featureSource.getSchema().getTypeName()); q.setSortBy(new SortBy[] {SortBy.REVERSE_ORDER}); try (SimpleFeatureIterator features = featureSource.getFeatures(q).features()) { String prevId = null; while (features.hasNext()) { String currId = features.next().getID(); if (prevId != null) assertTrue(prevId.compareTo(currId) >= 0); prevId = currId; } } }
public void testSchema() throws Exception { SimpleFeatureType schema = featureSource.getSchema(); assertEquals(tname("ft1"), schema.getTypeName()); assertEquals(dataStore.getNamespaceURI(), schema.getName().getNamespaceURI()); assertTrue(areCRSEqual(getWGS84(), schema.getCoordinateReferenceSystem())); assertEquals(4, schema.getAttributeCount()); assertNotNull(schema.getDescriptor(aname("geometry"))); assertNotNull(schema.getDescriptor(aname("intProperty"))); assertNotNull(schema.getDescriptor(aname("stringProperty"))); assertNotNull(schema.getDescriptor(aname("doubleProperty"))); }