use of org.apereo.portal.events.aggr.tabs.AggregatedTabMapping in project uPortal by Jasig.
the class JpaTabRenderAggregationDaoTest method createAggregations.
@Override
protected Map<TabRenderAggregationKey, TabRenderAggregationImpl> createAggregations(AggregationIntervalInfo intervalInfo, AggregatedGroupMapping aggregatedGroup) {
final DateDimension dateDimension = intervalInfo.getDateDimension();
final TimeDimension timeDimension = intervalInfo.getTimeDimension();
final AggregationInterval aggregationInterval = intervalInfo.getAggregationInterval();
final AggregatedTabMapping mappedTab = this.aggregatedTabLookupDao.getMappedTabForLayoutId("u1l1n1");
final TabRenderAggregationKeyImpl key = new TabRenderAggregationKeyImpl(dateDimension, timeDimension, aggregationInterval, aggregatedGroup, mappedTab);
final TabRenderAggregationImpl aggr = renderAggregationDao.createAggregation(key);
return Collections.<TabRenderAggregationKey, TabRenderAggregationImpl>singletonMap(key, aggr);
}
use of org.apereo.portal.events.aggr.tabs.AggregatedTabMapping in project uPortal by Jasig.
the class TabRenderStatisticsController method createColumnDiscriminatorMap.
protected Map<TabRenderAggregationDiscriminator, SortedSet<TabRenderAggregation>> createColumnDiscriminatorMap(TabRenderReportForm form) {
//Collections used to track the queried groups and the results
final Map<TabRenderAggregationDiscriminator, SortedSet<TabRenderAggregation>> groupedAggregations = new TreeMap<TabRenderAggregationDiscriminator, SortedSet<TabRenderAggregation>>(TabRenderAggregationDiscriminatorImpl.Comparator.INSTANCE);
//Get concrete group mapping objects that are being queried for
List<Long> groups = form.getGroups();
List<Long> tabs = form.getTabs();
for (final Long queryGroupId : groups) {
AggregatedGroupMapping groupMapping = this.aggregatedGroupDao.getGroupMapping(queryGroupId);
for (final Long tabId : tabs) {
AggregatedTabMapping tabMapping = this.aggregatedTabLookupDao.getTabMapping(tabId);
final TabRenderAggregationDiscriminator mapping = new TabRenderAggregationDiscriminatorImpl(groupMapping, tabMapping);
//Create the set the aggregations for this report column will be stored in, sorted chronologically
final SortedSet<TabRenderAggregation> aggregations = new TreeSet<TabRenderAggregation>(BaseAggregationDateTimeComparator.INSTANCE);
//Map the group to the set
groupedAggregations.put(mapping, aggregations);
}
}
return groupedAggregations;
}
use of org.apereo.portal.events.aggr.tabs.AggregatedTabMapping 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);
}
use of org.apereo.portal.events.aggr.tabs.AggregatedTabMapping in project uPortal by Jasig.
the class TabRenderAggregator method createAggregationKey.
@Override
protected TabRenderAggregationKey createAggregationKey(PortalRenderEvent e, EventAggregationContext eventAggregationContext, AggregationIntervalInfo intervalInfo, AggregatedGroupMapping aggregatedGroup) {
final TimeDimension timeDimension = intervalInfo.getTimeDimension();
final DateDimension dateDimension = intervalInfo.getDateDimension();
final AggregationInterval aggregationInterval = intervalInfo.getAggregationInterval();
Map<String, AggregatedTabMapping> mappedTabs = eventAggregationContext.getAttribute(MAPPED_TABS_CACHE_KEY);
if (mappedTabs == null) {
mappedTabs = new HashMap<String, AggregatedTabMapping>();
eventAggregationContext.setAttribute(MAPPED_TABS_CACHE_KEY, mappedTabs);
}
final String targetedLayoutNodeId = e.getTargetedLayoutNodeId();
AggregatedTabMapping mappedTab = mappedTabs.get(targetedLayoutNodeId);
if (mappedTab == null) {
mappedTab = this.aggregatedTabLookupDao.getMappedTabForLayoutId(targetedLayoutNodeId);
mappedTabs.put(targetedLayoutNodeId, mappedTab);
}
return new TabRenderAggregationKeyImpl(dateDimension, timeDimension, aggregationInterval, aggregatedGroup, mappedTab);
}
use of org.apereo.portal.events.aggr.tabs.AggregatedTabMapping in project uPortal by Jasig.
the class AnalyticsIncorporationComponent method serializePageData.
protected String serializePageData(HttpServletRequest request, long startTime) {
final Map<String, Object> pageData = new HashMap<String, Object>();
pageData.put("executionTimeNano", System.nanoTime() - startTime);
final IPortalRequestInfo portalRequestInfo = urlSyntaxProvider.getPortalRequestInfo(request);
pageData.put("urlState", portalRequestInfo.getUrlState());
final String targetedLayoutNodeId = portalRequestInfo.getTargetedLayoutNodeId();
if (targetedLayoutNodeId != null) {
final AggregatedTabMapping mappedTabForLayoutId = aggregatedTabLookupDao.getMappedTabForLayoutId(targetedLayoutNodeId);
pageData.put("tab", mappedTabForLayoutId);
}
try {
return mapper.writeValueAsString(pageData);
} catch (JsonParseException e) {
logger.warn("Failed to convert this request's page data to JSON, no page level analytics will be included", e);
} catch (JsonMappingException e) {
logger.warn("Failed to convert this request's page data to JSON, no page level analytics will be included", e);
} catch (IOException e) {
logger.warn("Failed to convert this request's page data to JSON, no page level analytics will be included", e);
}
return "{}";
}
Aggregations