new LinkedHashMap<CellID, CellDescription>(cells);
ViewCellCacheMO cache = viewCellCacheRef.get();
// go through and look at each cell to see if its granted or denied
for (ActionMap am : grants.values()) {
CellID id = ((CellIDResource) am.getResource()).getCellID();
// the resource is OK'd if the view action is granted
if (am.size() == 0) {
// cell is removed -- keep on the unload list only
cells.remove(id);
} else {
// cell is added -- keep on the load list only
unloadCells.remove(id);
}
}
// go through the load list and remove any cells that are
// already in the cache.
for (Iterator<CellID> loadCells = cells.keySet().iterator();
loadCells.hasNext();)
{
CellID loadID = loadCells.next();
// remove this id if it is already loaded
if (cache.isLoaded(loadID)) {
loadCells.remove();
}
// remove this id from the unload list. This will take
// care of any cells that don't have a security resource
// and therefore were not checked above
unloadCells.remove(loadID);
}
// now go through the unload list and remove any cells that
// are already unloaded
for (Iterator<CellID> unloads = unloadCells.keySet().iterator();
unloads.hasNext();)
{
CellID unloadID = unloads.next();
// remove this id if it is already unloaded
if (!cache.isLoaded(unloadID)) {
unloads.remove();
}