if (domain.getSharedSnapshotCache() != null) {
domain.getSharedSnapshotCache().clear();
}
context.getQueryCache().clear();
GenericResponse response = new GenericResponse();
response.addUpdateCount(1);
this.response = response;
return DONE;
}
Collection objects = refreshQuery.getObjects();
if (objects != null && !objects.isEmpty()) {
Collection ids = new ArrayList(objects.size());
Iterator it = objects.iterator();
while (it.hasNext()) {
Persistent object = (Persistent) it.next();
ids.add(object.getObjectId());
}
if (domain.getSharedSnapshotCache() != null) {
// send an event for removed snapshots
domain.getSharedSnapshotCache().processSnapshotChanges(
context.getObjectStore(),
Collections.EMPTY_MAP,
Collections.EMPTY_LIST,
ids,
Collections.EMPTY_LIST);
}
GenericResponse response = new GenericResponse();
response.addUpdateCount(1);
this.response = response;
return DONE;
}
// 3. refresh query - this shouldn't normally happen as child datacontext
// usually does a cascading refresh
if (refreshQuery.getQuery() != null) {
Query cachedQuery = refreshQuery.getQuery();
String cacheKey = cachedQuery
.getMetaData(context.getEntityResolver())
.getCacheKey();
context.getQueryCache().remove(cacheKey);
this.response = domain.onQuery(context, cachedQuery);
return DONE;
}
// 4. refresh groups...
if (refreshQuery.getGroupKeys() != null
&& refreshQuery.getGroupKeys().length > 0) {
String[] groups = refreshQuery.getGroupKeys();
for (int i = 0; i < groups.length; i++) {
domain.getQueryCache().removeGroup(groups[i]);
}
GenericResponse response = new GenericResponse();
response.addUpdateCount(1);
this.response = response;
return DONE;
}
}