private void appendFcInfo(FeatureType ft, StringBuffer sb, String indent) throws IOException { if (ft instanceof FeatureCollectionType) { if (ft.isAbstract()) { sb.append( indent + "- <i>" + ft.getName().getPrefix() + ":" + ft.getName().getLocalPart() + " (abstract)</i><br/>"); } else { sb.append( indent + "- " + ft.getName().getPrefix() + ":" + ft.getName().getLocalPart() + "<br/>"); } } FeatureType[] fts = ft.getSchema().getDirectSubtypes(ft); Arrays.sort( fts, new Comparator<FeatureType>() { public int compare(FeatureType a, FeatureType b) { int order = a.getName().getNamespaceURI().compareTo(b.getName().getNamespaceURI()); if (order == 0) { order = a.getName().getLocalPart().compareTo(b.getName().getLocalPart()); } return order; } }); for (FeatureType childType : fts) { appendFcInfo(childType, sb, indent + " "); } }
private void appendFtInfo(FeatureType ft, FeatureStore store, StringBuffer sb, String indent) throws IOException { if (ft instanceof FeatureCollectionType) { return; } if (ft.isAbstract()) { sb.append( indent + "- <i>" + ft.getName().getPrefix() + ":" + ft.getName().getLocalPart() + " (abstract)</i><br/>"); } else { if (store.isMapped(ft.getName())) { Query query = new Query(ft.getName(), null, 0, -1, -1); int numInstances = -1; try { numInstances = store.queryHits(query); } catch (Exception e) { e.printStackTrace(); } sb.append( indent + "- " + ft.getName().getPrefix() + ":" + ft.getName().getLocalPart() + " (" + numInstances + " instances)<br/>"); } else { sb.append( indent + "- " + ft.getName().getPrefix() + ":" + ft.getName().getLocalPart() + " (not mapped)<br/>"); } } FeatureType[] fts = ft.getSchema().getDirectSubtypes(ft); Arrays.sort( fts, new Comparator<FeatureType>() { public int compare(FeatureType a, FeatureType b) { int order = a.getName().getNamespaceURI().compareTo(b.getName().getNamespaceURI()); if (order == 0) { order = a.getName().getLocalPart().compareTo(b.getName().getLocalPart()); } return order; } }); for (FeatureType childType : fts) { appendFtInfo(childType, store, sb, indent + " "); } }