use of org.apereo.portal.concurrency.CachingException in project uPortal by Jasig.
the class MapBackedEntityCache method add.
/* (non-Javadoc)
* @see org.apereo.portal.concurrency.IEntityCache#add(org.apereo.portal.IBasicEntity)
*/
public void add(IBasicEntity entity) throws CachingException {
final EntityIdentifier entityIdentifier = entity.getEntityIdentifier();
final Class<? extends IBasicEntity> addType = entityIdentifier.getType();
if (!this.entityType.isAssignableFrom(addType)) {
throw new CachingException("Problem adding " + entity + ": entity type '" + addType + "' is incompatible with cache type '" + this.entityType + "'.");
}
this.cache.put(entityIdentifier.getKey(), entity);
}
use of org.apereo.portal.concurrency.CachingException in project uPortal by Jasig.
the class ReferenceIndividualGroupService method findParentGroups.
/**
* Returns and caches the containing groups for the <code>IGroupMember</code>
*
* @param gm IGroupMember
*/
@Override
public Iterator findParentGroups(IGroupMember gm) throws GroupsException {
log.debug("Finding containing groups for member {}", gm.getKey());
Collection groups = new ArrayList(10);
IEntityGroup group = null;
for (Iterator it = getGroupStore().findParentGroups(gm); it.hasNext(); ) {
group = (IEntityGroup) it.next();
group.setLocalGroupService(this);
groups.add(group);
if (cacheInUse()) {
try {
if (getGroupFromCache(group.getEntityIdentifier().getKey()) == null) {
cacheAdd(group);
}
} catch (CachingException ce) {
throw new GroupsException("Problem finding containing groups", ce);
}
}
}
return groups.iterator();
}
use of org.apereo.portal.concurrency.CachingException in project uPortal by Jasig.
the class ReferenceIndividualGroupService method findLocalMemberGroups.
/**
* Returns and caches the member groups for the <code>IEntityGroup</code>
*
* @param eg IEntityGroup
*/
protected Iterator findLocalMemberGroups(IEntityGroup eg) throws GroupsException {
Collection groups = new ArrayList(10);
IEntityGroup group = null;
for (Iterator it = getGroupStore().findMemberGroups(eg); it.hasNext(); ) {
group = (IEntityGroup) it.next();
if (group == null) {
log.warn("A null IEntityGroup object was part of a list groupStore.findMemberGroups");
continue;
}
group.setLocalGroupService(this);
groups.add(group);
if (cacheInUse()) {
try {
if (getGroupFromCache(group.getEntityIdentifier().getKey()) == null) {
cacheAdd(group);
}
} catch (CachingException ce) {
throw new GroupsException("Problem finding member groups", ce);
}
}
}
return groups.iterator();
}
use of org.apereo.portal.concurrency.CachingException in project uPortal by Jasig.
the class GroupService method ifinishedSession.
/**
* Receives notice that the UserInstance has been unbound from the HttpSession. In response, we
* remove the corresponding group member from the cache. We use the roundabout route of creating
* a group member and then getting its EntityIdentifier because we need the EntityIdentifier for
* the group member, which is cached, not the EntityIdentifier for the IPerson, which is not.
*
* @param person org.apereo.portal.security.IPerson
*/
private void ifinishedSession(IPerson person) throws GroupsException {
IGroupMember gm = getGroupMember(person.getEntityIdentifier());
try {
final EntityIdentifier entityIdentifier = gm.getEntityIdentifier();
EntityCachingService.getEntityCachingService().remove(entityIdentifier.getType(), entityIdentifier.getKey());
} catch (CachingException ce) {
throw new GroupsException("Problem removing group member " + gm.getKey() + " from cache", ce);
}
}
Aggregations