DomainGroupCacheUpdaterRequest request = (DomainGroupCacheUpdaterRequest) inActionContext.getParams();
Long domainGroupId = request.getDomainGroupId();
log.info("Loading domain group by id #" + domainGroupId);
DomainGroup domainGroup = domainGroupMapper.findById(domainGroupId);
log.info("Updating the cached list of coordinators for group #" + domainGroupId + " from the database");
List<Long> peopleIds = groupCoordinatorCacheManager.execute(domainGroup);
// if this is a private group, this change will affect the coordinators'
// and followers' activity search
if (!domainGroup.isPublicGroup())
{
if (request.getIsUpdate())
{
log.info("Looping across the coordinators to update"
+ " their private group access list to include the group #" + domainGroupId);
for (Long coordinatorPersonId : peopleIds)
{
cache.addToSet(CacheKeys.PRIVATE_GROUP_IDS_VIEWABLE_BY_PERSON_AS_COORDINATOR + coordinatorPersonId,
domainGroupId);
}
}
// skip if it is pending. Will be added on approval.
else if (!domainGroup.isPending())
{
// This will search for all users who have coordinator access to this group
// through either group or org coordinator roles and add the id to their cached
// private group access list.
addPrivateGroupIdToCachedListMapper.execute(domainGroupId);
}
}
// find all the activity ids to update
List<Long> activityIds = getActivityIdsAuthordedByEntityDbMapper.execute(domainGroup.getShortName(),
EntityType.GROUP);
if (log.isInfoEnabled())
{
log.info("Found info for '" + domainGroup.getShortName() + "' - applying it to " + activityIds.size()
+ " activities.");
}
for (Long activityId : activityIds)
{