protected Map<String, String> getFeatureTypeNsPrefixes( Collection<FeatureType> fts ) { if ( fts == null ) { fts = format.getMaster().getStoreManager().getFeatureTypes(); } Map<String, String> prefixToNs = new HashMap<String, String>(); for ( FeatureType ft : fts ) { QName ftName = ft.getName(); if ( ftName.getPrefix() != null ) { prefixToNs.put( ftName.getPrefix(), ftName.getNamespaceURI() ); } } return prefixToNs; }
List<QName> collectAndSortFeatureTypesToExport( List<QName> configuredReturnFeatureTypes ) { Collection<FeatureType> featureTypes = wfs.getStoreManager().getFeatureTypes(); List<QName> ftNames = collectFeatureTypes( configuredReturnFeatureTypes, featureTypes ); Collections.sort( ftNames, new Comparator<QName>() { @Override public int compare( QName arg0, QName arg1 ) { String s0 = arg0.toString(); String s1 = arg1.toString(); return s0.compareTo( s1 ); } } ); return ftNames; }
private List<QName> collectFeatureTypes( StoredQueryDefinition queryDef ) { Collection<FeatureType> featureTypes = wfs.getStoreManager().getFeatureTypes(); List<QueryExpressionText> queryExpressionTextEls = queryDef.getQueryExpressionTextEls(); List<QName> allConfiguredReturnFeatureTypes = new ArrayList<QName>(); for ( QueryExpressionText queryExpressionTextEl : queryExpressionTextEls ) { List<QName> configuredReturnFeatureTypes = queryExpressionTextEl.getReturnFeatureTypes(); List<QName> featureTypesToExport = collectFeatureTypes( configuredReturnFeatureTypes, featureTypes ); for ( QName featureTypeToExport : featureTypesToExport ) { if ( !allConfiguredReturnFeatureTypes.contains( featureTypeToExport ) ) allConfiguredReturnFeatureTypes.add( featureTypeToExport ); } } return allConfiguredReturnFeatureTypes; }
private Collection<FeatureType> getAllFeatureTypes() { Comparator<FeatureType> comp = new Comparator<FeatureType>() { @Override public int compare( FeatureType ftMd1, FeatureType ftMd2 ) { QName a = ftMd1.getName(); QName b = ftMd2.getName(); int order = a.getNamespaceURI().compareTo( b.getNamespaceURI() ); if ( order == 0 ) { order = a.getLocalPart().compareTo( b.getLocalPart() ); } return order; } }; Collection<FeatureType> sortedFts = new TreeSet<FeatureType>( comp ); for ( FeatureType ft : service.getFeatureTypes() ) { FeatureStore fs = service.getStore( ft.getName() ); if ( fs.isMapped( ft.getName() ) ) { sortedFts.add( ft ); } } return sortedFts; }