if (domain.getSharedSnapshotCache() != null) {
domain.getSharedSnapshotCache().clear();
}
context.getQueryCache().clear();
GenericResponse response = new GenericResponse();
response.addUpdateCount(1);
this.response = response;
return DONE;
}
Collection<Persistent> objects = (Collection<Persistent>) refreshQuery
.getObjects();
if (objects != null && !objects.isEmpty()) {
Collection<ObjectId> ids = new ArrayList<ObjectId>(objects.size());
for (final Persistent object : objects) {
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 (String group : groups) {
domain.getQueryCache().removeGroup(group);
}
GenericResponse response = new GenericResponse();
response.addUpdateCount(1);
this.response = response;
return DONE;
}
}