use of org.apereo.portal.events.aggr.groups.AggregatedGroupMapping in project uPortal by Jasig.
the class JpaEventSessionDao method getGroupsForEvent.
/** Get groups for the event */
protected Set<AggregatedGroupMapping> getGroupsForEvent(PortalEvent event) {
final Set<AggregatedGroupMapping> groupMappings = new LinkedHashSet<AggregatedGroupMapping>();
if (event instanceof LoginEvent) {
for (final String groupKey : ((LoginEvent) event).getGroups()) {
final AggregatedGroupMapping groupMapping = this.aggregatedGroupLookupDao.getGroupMapping(groupKey);
if (groupMapping != null) {
groupMappings.add(groupMapping);
}
}
} else {
final String userName = event.getUserName();
final IGroupMember groupMember = this.compositeGroupService.getGroupMember(userName, IPerson.class);
for (@SuppressWarnings("unchecked") final Iterator<IEntityGroup> containingGroups = this.compositeGroupService.findParentGroups(groupMember); containingGroups.hasNext(); ) {
final IEntityGroup group = containingGroups.next();
final AggregatedGroupMapping groupMapping = this.aggregatedGroupLookupDao.getGroupMapping(group.getServiceName().toString(), group.getName());
groupMappings.add(groupMapping);
}
}
return groupMappings;
}
use of org.apereo.portal.events.aggr.groups.AggregatedGroupMapping in project uPortal by Jasig.
the class JpaEventSessionDao method getEventSession.
@AggrEventsTransactional
@Override
public EventSession getEventSession(PortalEvent event) {
final String eventSessionId = event.getEventSessionId();
final CacheKey key = CacheKey.build(EVENT_SESSION_CACHE_SOURCE, eventSessionId);
EventSessionImpl eventSession = this.entityManagerCache.get(BaseAggrEventsJpaDao.PERSISTENCE_UNIT_NAME, key);
if (eventSession != null) {
return eventSession;
}
final NaturalIdQuery<EventSessionImpl> naturalIdQuery = this.createNaturalIdQuery(EventSessionImpl.class);
naturalIdQuery.using(EventSessionImpl_.eventSessionId, eventSessionId);
eventSession = naturalIdQuery.load();
if (eventSession == null) {
//No event session, somehow we missed the login event. Look at the groups the user is currently a member of
final Set<AggregatedGroupMapping> groupMappings = this.getGroupsForEvent(event);
final DateTime eventDate = event.getTimestampAsDate();
eventSession = new EventSessionImpl(eventSessionId, eventDate, groupMappings);
this.getEntityManager().persist(eventSession);
this.entityManagerCache.put(BaseAggrEventsJpaDao.PERSISTENCE_UNIT_NAME, key, eventSession);
}
return eventSession;
}
use of org.apereo.portal.events.aggr.groups.AggregatedGroupMapping in project uPortal by Jasig.
the class JpaLoginAggregationDao method createAggregationInstance.
@Override
protected LoginAggregationImpl createAggregationInstance(LoginAggregationKey key) {
final TimeDimension timeDimension = key.getTimeDimension();
final DateDimension dateDimension = key.getDateDimension();
final AggregationInterval interval = key.getInterval();
final AggregatedGroupMapping aggregatedGroup = key.getAggregatedGroup();
return new LoginAggregationImpl(timeDimension, dateDimension, interval, aggregatedGroup);
}
use of org.apereo.portal.events.aggr.groups.AggregatedGroupMapping in project uPortal by Jasig.
the class JpaPortletExecutionAggregationDao method createAggregationInstance.
@Override
protected PortletExecutionAggregationImpl createAggregationInstance(PortletExecutionAggregationKey key) {
final TimeDimension timeDimension = key.getTimeDimension();
final DateDimension dateDimension = key.getDateDimension();
final AggregationInterval interval = key.getInterval();
final AggregatedGroupMapping aggregatedGroup = key.getAggregatedGroup();
final AggregatedPortletMapping portletMapping = key.getPortletMapping();
final ExecutionType executionType = key.getExecutionType();
return new PortletExecutionAggregationImpl(timeDimension, dateDimension, interval, aggregatedGroup, portletMapping, executionType);
}
use of org.apereo.portal.events.aggr.groups.AggregatedGroupMapping in project uPortal by Jasig.
the class JpaTabRenderAggregationDao method createAggregationInstance.
@Override
protected TabRenderAggregationImpl createAggregationInstance(TabRenderAggregationKey key) {
final TimeDimension timeDimension = key.getTimeDimension();
final DateDimension dateDimension = key.getDateDimension();
final AggregationInterval interval = key.getInterval();
final AggregatedGroupMapping aggregatedGroup = key.getAggregatedGroup();
final AggregatedTabMapping tabMapping = key.getTabMapping();
return new TabRenderAggregationImpl(timeDimension, dateDimension, interval, aggregatedGroup, tabMapping);
}
Aggregations