public AttributeType[] getAttributeTypes() { return featureType.getAttributeTypes(); } }
public AttributeType[] getAttributeTypes() { return featureType.getAttributeTypes(); } }
/** * Query featureType information the complete restrictions for the indicated name. * * @param featureType * @param name */ public Filter getRestrictions( FeatureType featureType, String name ){ if( featureType == null || featureType.getAttributeTypes() == null ) return Filter.EXCLUDE; return restriction( featureType, name, Filter.INCLUDE ); }
/** Exact equality based on typeNames, namespace, attributes and ancestors */ public static boolean equals( FeatureType typeA, FeatureType typeB ) { if (typeA == typeB) return true; if (typeA == null || typeB == null) { return false; } return equalsId(typeA, typeB) && equals(typeA.getAttributeTypes(), typeB.getAttributeTypes()) && equalsAncestors( typeA, typeB ); }
/** * This order is to be respected, based on Ancestors and so on. * <p> * This method is "faster" then actually constructing the merged * AttribtueTypes. * </p> */ public List getNames( FeatureType featureType, List names ){ if( featureType == null || featureType.getAttributeTypes() == null ){ return names; } FeatureType ancestors[] = featureType.getAncestors(); if( ancestors != null && ancestors.length != 0 ){ for( int i=0, length = ancestors.length; i<length; i++ ){ FeatureType superType = ancestors[i]; getNames( superType, names ); } } AttributeType attributes[] = featureType.getAttributeTypes(); if( attributes != null && attributes.length != 0 ){ for( int i=0, length = attributes.length; i<length; i++ ){ AttributeType type = attributes[i]; String name = type.getName(); if( !names.contains( name )){ names.add( name ); } } } return names; }
if( featureType == null || featureType.getAttributeTypes() == null ) { return list; AttributeType attributes[] = featureType.getAttributeTypes(); if( attributes != null && attributes.length != 0 ){ for( int i=0, length = attributes.length; i<length; i++ ){
/** * Creates the prepared statement for feature deletes * * @param conn * @param featureType * * * @throws SQLException */ protected PreparedStatement createDeleteStatement(Connection conn, FeatureType featureType) throws SQLException { AttributeType[] attributeTypes = featureType.getAttributeTypes(); String tableName = featureType.getTypeName(); StringBuffer statementSQL = new StringBuffer("DELETE " + tableName + "WHERE "); if (!mapper.returnFIDColumnsAsAttributes()) { for (int i = 0; i < mapper.getColumnCount(); i++) { if (!mapper.isAutoIncrement(i)) { statementSQL.append(mapper.getColumnName(i)).append(" = ?"); if (i < (mapper.getColumnCount() - 1)) { statementSQL.append(" AND "); } } } } String sql = statementSQL.toString(); return conn.prepareStatement(sql); }
/** * Encode the supplied feature type. * * @param type the feature type to encode * * @throws RuntimeException DOCUMENT ME! */ protected void encode(FeatureType type) { AttributeType[] attributes = type.getAttributeTypes(); try { startSchemaType(type.getTypeName(), type.getNamespace()); for (int i = 0; i < attributes.length; i++) { encode(attributes[i]); } endSchemaType(); } catch (SAXException e) { throw new RuntimeException(e); } }
info = new FeatureTypeInfo(featureTypeName, schema, mapper); AttributeType[] types = schema.getAttributeTypes();
AttributeType[] types = featureType.getAttributeTypes(); StringBuffer buf = new StringBuffer();
private Filter restriction( FeatureType featureType, String name, Filter filter ){ FeatureType ancestors[] = featureType.getAncestors(); if( ancestors != null && ancestors.length != 0 ){ for( int i=0, length = ancestors.length; i<length; i++ ){ FeatureType superType = ancestors[i]; filter = restriction( superType, name, filter ); } } AttributeType attributes[] = featureType.getAttributeTypes(); if( attributes != null && attributes.length != 0 ){ for( int i=0, length = attributes.length; i<length; i++ ){ AttributeType type = attributes[i]; if( name.equals( type.getName() )){ filter = override( filter, type.getRestriction() ); } } } return filter; }
FeatureTypeInfo ftInfo = queryData.getFeatureTypeInfo(); FeatureType featureType = ftInfo.getSchema(); AttributeType[] attributes = featureType.getAttributeTypes();
/** * Returns the attribute reader, allowing for a pure shapefile reader, or a combined dbf/shp reader. * * @param _readDbf - if true, the dbf fill will be opened and read * @return * @throws IOException */ protected Reader getAttributesReader(boolean _readDbf) throws IOException { AttributeType[] atts = (schema_ == null) ? readAttributes() : schema_.getAttributeTypes(); if (!_readDbf) { LOGGER.fine("The DBF file won't be opened since no attributes will be read from it"); atts = new AttributeType[] { schema_.getDefaultGeometry() }; return new Reader(atts, openShapeReader(), null); } return new Reader(atts, openShapeReader(), openDbfReader()); }
/** * Returns the attribute reader, allowing for a pure shapefile reader, or a * combined dbf/shp reader. * * @param readDbf - if true, the dbf fill will be opened and read * * * @throws IOException */ protected Reader getAttributesReader(boolean readDbf) throws IOException { AttributeType[] atts = (schema == null) ? readAttributes() : schema.getAttributeTypes(); if (!readDbf) { LOGGER.fine( "The DBF file won't be opened since no attributes will be read from it"); atts = new AttributeType[] { schema.getDefaultGeometry() }; return new Reader(atts, openShapeReader(), null); } return new Reader(atts, openShapeReader(), openDbfReader()); }
this.hints = hints; AttributeType[] attributeTypes = featureTypeInfo.getSchema().getAttributeTypes();
public FeatureCollection getVersionedFeatures(Query query) throws IOException { final FeatureType ft = getSchema(); // check the feature type is the right one final String typeName = ft.getTypeName(); if(query.getTypeName() != null && !query.getTypeName().equals(typeName)) throw new IOException("Incompatible type, this class can access only " + typeName); // make sure the view is around if(!Arrays.asList(store.wrapped.getTypeNames()).contains(store.getVFCViewName(typeName))) store.createVersionedFeatureCollectionView(typeName); // we have to hit the view DefaultQuery vq = new DefaultQuery(query); vq.setTypeName(VersionedPostgisDataStore.getVFCViewName(typeName)); vq = store.buildVersionedQuery(vq); FeatureCollection fc = store.wrapped.getFeatureSource(VersionedPostgisDataStore.getVFCViewName(typeName)).getFeatures(vq); try { final FeatureType fcSchema = fc.getSchema(); FeatureType renamedFt = FeatureTypes.newFeatureType(fcSchema.getAttributeTypes(), ft.getTypeName(), ft.getNamespace(), ft.isAbstract(), ft.getAncestors(), fcSchema.getDefaultGeometry()); return new ReTypingFeatureCollection(fc, renamedFt); } catch(SchemaException e) { throw new DataSourceException("Error ranming feature type", e); } }
public void testFixture() throws Exception { FeatureType type = DataUtilities.createType("namespace.typename", "name:String,id:0,geom:MultiLineString"); assertEquals("namespace", new URI("namespace"), type.getNamespace()); assertEquals("typename", "typename", type.getTypeName()); assertEquals("attributes", 3, type.getAttributeCount()); AttributeType[] a = type.getAttributeTypes(); assertEquals("a1", "name", a[0].getName()); assertEquals("a1", String.class, a[0].getType()); assertEquals("a2", "id", a[1].getName()); assertEquals("a2", Integer.class, a[1].getType()); assertEquals("a3", "geom", a[2].getName()); assertEquals("a3", MultiLineString.class, a[2].getType()); }
/** * Fills the insert parameters * * @param statement * @param feature * * @throws IOException * @throws SQLException */ private void fillInsertParameters(PreparedStatement statement, MutableFIDFeature feature) throws IOException, SQLException { int baseIndex = fillPrimaryKeyParameters(statement, feature, 1); Object[] attributes = feature.getAttributes(null); AttributeType[] attributeTypes = feature.getFeatureType() .getAttributeTypes(); AttributeIO[] aios = queryData.getAttributeHandlers(); FeatureTypeInfo ftInfo = queryData.getFeatureTypeInfo(); for (int i = 0; i < attributeTypes.length; i++) { if (attributeTypes[i] instanceof GeometryAttributeType ) { String geomName = attributeTypes[i].getName(); int srid = ftInfo.getSRID(geomName); // ((Geometry) attributes[i]).setSRID(srid); // SRID is a bad assumption aios[i].write(statement, baseIndex + i, attributes[i]); } else { aios[i].write(statement, baseIndex + i, attributes[i]); } } }
Object[] attributes = current.getAttributes(null); AttributeType[] attributeTypes = current.getFeatureType() .getAttributeTypes(); AttributeIO[] aios = queryData.getAttributeHandlers(); FeatureTypeInfo ftInfo = queryData.getFeatureTypeInfo();