Iterator it = diff.getModified().values().iterator();
FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
Set<FeatureId> modifiedFids = new HashSet<FeatureId>();
while(it.hasNext()){
SimpleFeature feature = (SimpleFeature) it.next();
modifiedFids.add(ff.featureId(feature.getID()));
}
Id idFilter = ff.id(modifiedFids);
Query q = new Query(query);
q.setFilter(ff.and(idFilter, query.getFilter()));
bounds = getBoundsInternal(q);