private static void printFtHierarchy( AppSchema schema, Set<String> ftNames, Set<String> propNames ) { int concrete = 0; for ( FeatureType ft : schema.getFeatureTypes() ) { if ( !ft.isAbstract() ) { concrete++; } printFt( ft, ftNames, propNames ); } System.out.println( schema.getFeatureTypes().length + " feature types (" + concrete + " concrete)" ); }
public void export( XMLStreamWriter writer, AppSchema schema ) throws XMLStreamException { export( writer, schema.getFeatureTypes( null, true, true ) ); }
private void initFtToFeaturesMap( AppSchema schema, StoredFeatures former ) { for ( FeatureType ft : schema.getFeatureTypes( null, true, false ) ) { FeatureCollection fc = new GenericFeatureCollection(); if ( former != null ) { FeatureCollection oldFc = former.ftToFeatures.get( ft ); fc.addAll( oldFc ); } ftToFeatures.put( ft, fc ); } }
FeatureType[] fts = schema.getFeatureTypes(); Arrays.sort( fts, new Comparator<FeatureType>() { @Override
/** * Collects all property names of a given feature type, or all feature types if the given name is null. * * @param schema * @param featureType * @return a set of property qnames */ public static Set<QName> collectProperyNames( AppSchema schema, QName featureType ) { HashSet<QName> set = new HashSet<QName>(); for ( FeatureType ft : schema.getFeatureTypes() ) { if ( featureType == null || featureType.equals( ft.getName() ) ) { for ( PropertyType pt : ft.getPropertyDeclarations() ) { set.add( pt.getName() ); } } } return set; }
/** * Returns the {@link MappedAppSchema} derived from GML application schemas / configuration. * * @return mapped application schema, never <code>null</code> */ @Override public MappedAppSchema getMappedSchema() { FeatureType[] fts = gmlSchema.getFeatureTypes(); org.deegree.feature.persistence.sql.FeatureTypeMapping[] ftMappings = ftNameToMapping.values().toArray( new org.deegree.feature.persistence.sql.FeatureTypeMapping[ftNameToMapping.size()] ); Map<FeatureType, FeatureType> ftToSuperFt = gmlSchema.getFtToSuperFt(); Map<String, String> prefixToNs = new HashMap<String, String>(); Iterator<String> prefixIter = nsBindings.getPrefixes(); while ( prefixIter.hasNext() ) { String prefix = prefixIter.next(); prefixToNs.put( prefix, nsBindings.getNamespaceURI( prefix ) ); } GMLSchemaInfoSet xsModel = gmlSchema.getGMLSchema(); return new MappedAppSchema( fts, ftToSuperFt, prefixToNs, xsModel, ftMappings, bboxMapping, blobMapping, geometryParams, deleteCascadingByDB, null, gmlSchema.getGmlObjectTypes(), gmlSchema.getGeometryToSuperType() ); }
throw new IllegalArgumentException( msg ); for ( FeatureType ft : fs.getSchema().getFeatureTypes( null, true, false ) ) { if ( ft.getName().getNamespaceURI().equals( GMLNS ) || ft.getName().getNamespaceURI().equals( GML3_2_NS ) ) {
AppSchema schema = xsdDecoder.extractAppSchema(); System.out.println( "- Total feature types: " + schema.getFeatureTypes().length ); System.out.println( "- Non-abstract feature types: " + schema.getFeatureTypes( null, true, false ).size() ); System.out.println( "- Non-abstract feature types w/o collections: " + schema.getFeatureTypes( null, false, false ).size() ); sortedFts.addAll( schema.getFeatureTypes( null, false, false ) ); int i = 0; for ( FeatureType ft : sortedFts ) {
Matcher m = pattern.matcher( uri ); if ( m.find() ) { List<FeatureType> fts = fs.getSchema().getFeatureTypes( null, false, false ); TypeName[] typeNames = new TypeName[fts.size()]; for ( int i = 0; i < fts.size(); ++i ) {
private void reencodeSchema( DescribeFeatureType request, XMLStreamWriter writer, String targetNs, Collection<String> importNs, GMLVersion version ) throws XMLStreamException { Map<String, String> importMap = buildImportMap( request, importNs ); WfsFeatureStoreManager storeManager = format.getMaster().getStoreManager(); Map<String, String> prefixToNs = storeManager.getPrefixToNs(); GMLAppSchemaWriter exporter = new GMLAppSchemaWriter( version, targetNs, importMap, prefixToNs ); List<FeatureType> fts = new ArrayList<FeatureType>(); for ( FeatureStore fs : storeManager.getStores() ) { for ( FeatureType ft : fs.getSchema().getFeatureTypes( targetNs, true, true ) ) { fts.add( ft ); } } exporter.export( writer, fts ); }
List<Query> buildMapQueries() { List<Query> queries = new ArrayList<Query>(); Integer maxFeats = query.getRenderingOptions().getMaxFeatures( layerName ); final int maxFeatures = maxFeats == null ? -1 : maxFeats; if ( ftName == null && featureStore != null ) { final Filter filter2 = filter; queries.addAll( map( featureStore.getSchema().getFeatureTypes( null, false, false ), new Mapper<Query, FeatureType>() { @Override public Query apply( FeatureType u ) { Filter fil = addBBoxConstraint( bbox, filter2, geomProp, true ); return createQuery( u.getName(), fil, round( query.getScale() ), maxFeatures, query.getResolution(), sortBy ); } } ) ); } else { Query fquery = createQuery( ftName, addBBoxConstraint( bbox, filter, geomProp, true ), round( query.getScale() ), maxFeatures, query.getResolution(), sortBy ); queries.add( fquery ); } return queries; }
this.useIntegerFids = useIntegerFids; List<FeatureType> ftList = appSchema.getFeatureTypes( null, false, false ); List<FeatureType> blackList = new ArrayList<FeatureType>(); for ( FeatureType ft : ftList ) {
MultipleLayerStore createInAutoMode( AutoLayers auto ) throws ResourceInitException { LOG.debug( "Creating feature layers for all feature types automatically." ); Map<String, Layer> map = new LinkedHashMap<String, Layer>(); String id = auto.getFeatureStoreId(); FeatureStore store = workspace.getResource( FeatureStoreProvider.class, id ); if ( store == null ) { throw new ResourceInitException( "Feature layer config was invalid, feature store with id " + id + " is not available." ); } id = auto.getStyleStoreId(); StyleStore sstore = null; if ( id != null ) { sstore = workspace.getResource( StyleStoreProvider.class, id ); } if ( id != null && sstore == null ) { throw new ResourceInitException( "Feature layer config was invalid, style store with id " + id + " is not available." ); } for ( FeatureType ft : store.getSchema().getFeatureTypes() ) { addLayer( store, ft, sstore, map ); } return new MultipleLayerStore( map, metadata ); }
List<Query> buildInfoQueries() { List<Query> queries = new ArrayList<Query>(); if ( ftName == null ) { queries.addAll( map( featureStore.getSchema().getFeatureTypes( null, false, false ), new Mapper<Query, FeatureType>() { @Override public Query apply( FeatureType u ) { Filter f; if ( filter == null ) { f = buildFilter( null, u, bbox ); } else { f = buildFilter( ( (OperatorFilter) filter ).getOperator(), u, bbox ); } return createQuery( u.getName(), f, -1, query.getFeatureCount(), -1, sortBy ); } } ) ); clearNulls( queries ); } else { Filter f; if ( filter == null ) { f = buildFilter( null, featureStore.getSchema().getFeatureType( ftName ), bbox ); } else { f = buildFilter( ( (OperatorFilter) filter ).getOperator(), featureStore.getSchema().getFeatureType( ftName ), bbox ); } queries.add( createQuery( ftName, f, -1, query.getFeatureCount(), -1, sortBy ) ); } return queries; }
/** * Ignores all errors, tries to aggregate all envelopes of all feature types. * * @param fs * @return null, if none of the feature types had an envelope */ public static Envelope getCombinedEnvelope( FeatureStore fs ) { Envelope env = null; for ( FeatureType ft : fs.getSchema().getFeatureTypes() ) { if ( env == null ) { try { env = fs.getEnvelope( ft.getName() ); } catch ( Throwable e ) { // ignore it } } else { try { Envelope b = fs.getEnvelope( ft.getName() ); if ( b != null ) { env = env.merge( b ); } } catch ( Throwable e ) { // ignore it } } } return env; }
md.getFeatureTypes().add( store.getSchema().getFeatureType( featureType ) ); } else { md.getFeatureTypes().addAll( Arrays.asList( store.getSchema().getFeatureTypes() ) );