return super.features(typeName);
}
};
final TestMemoryDataStore ds = new TestMemoryDataStore();
final SimpleFeatureType ft = DataUtilities.createType("IssuesFeatureType", //$NON-NLS-1$
"*"+BOUNDS+":MultiPolygon," + //$NON-NLS-1$ //$NON-NLS-2$
EXTENSION_ID_ATTR+":String,"+ //$NON-NLS-1$
ISSUE_ID_ATTR+":String,"+ //$NON-NLS-1$
GROUP_ID_ATTR+":String,"+ //$NON-NLS-1$
RESOLUTION_ATTR+":String,"+ //$NON-NLS-1$
PRIORITY_ATTR+":String,"+ //$NON-NLS-1$
DESCRIPTION_ATTR+":String,"+ //$NON-NLS-1$
ISSUE_MEMENTO_DATA_ATTR+":String,"+ //$NON-NLS-1$
VIEW_MEMENTO_DATA_ATTR+":String"); //$NON-NLS-1$
ds.createSchema(ft);
IListStrategy strategy=new AbstractDatastoreStrategy(){
@Override
public FeatureCollection<SimpleFeatureType, SimpleFeature> getFeatures() throws IOException {
return new AdaptorFeatureCollection("type", ft){
@Override
protected void closeIterator( Iterator close ) {
}
@SuppressWarnings("unchecked")
@Override
protected Iterator openIterator() {
try {
ArrayList<SimpleFeature> features = new ArrayList<SimpleFeature>(ds.features(ft.getName().getLocalPart()).values());
Collections.sort(features, new Comparator<SimpleFeature>(){
public int compare( SimpleFeature o1, SimpleFeature o2 ) {
return ((String)o1.getAttribute(ISSUE_ID_ATTR)).compareTo((String)o2.getAttribute(ISSUE_ID_ATTR));
}
});
final Iterator<SimpleFeature> iter=features.iterator();
return new Iterator(){
public boolean hasNext() {
return iter.hasNext();
}
public Object next() {
return iter.next();
}
public void remove() {
throw new UnsupportedOperationException();
}
};
} catch (IOException e) {
throw (RuntimeException) new RuntimeException( ).initCause( e );
}
}
@Override
public int size() {
try {
return ds.features(ft.getName().getLocalPart()).size();
} catch (IOException e) {
throw (RuntimeException) new RuntimeException( ).initCause( e );
}
}
};
}
protected FeatureStore<SimpleFeatureType, SimpleFeature> getFeatureStore() throws IOException {
return (FeatureStore<SimpleFeatureType, SimpleFeature>) ds.getFeatureSource(ft.getName().getLocalPart());
}
public String getExtensionID() {
return ""; //$NON-NLS-1$
}