use of org.apereo.portal.events.aggr.DateDimension 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.DateDimension in project uPortal by Jasig.
the class JpaDateDimensionDao method createDateDimension.
@Override
@AggrEventsTransactional
public DateDimension createDateDimension(DateMidnight date, int quarter, String term) {
final DateDimension dateDimension = new DateDimensionImpl(date, quarter, term);
this.getEntityManager().persist(dateDimension);
return dateDimension;
}
use of org.apereo.portal.events.aggr.DateDimension in project uPortal by Jasig.
the class JpaLoginAggregationDaoTest method createAggregationKey.
@Override
protected LoginAggregationKey createAggregationKey(AggregationIntervalInfo intervalInfo, AggregatedGroupMapping aggregatedGroup) {
final DateDimension dateDimension = intervalInfo.getDateDimension();
final TimeDimension timeDimension = intervalInfo.getTimeDimension();
final AggregationInterval aggregationInterval = intervalInfo.getAggregationInterval();
return new LoginAggregationKeyImpl(dateDimension, timeDimension, aggregationInterval, aggregatedGroup);
}
use of org.apereo.portal.events.aggr.DateDimension in project uPortal by Jasig.
the class JpaTabRenderAggregationDaoTest method createAggregationKey.
@Override
protected TabRenderAggregationKey createAggregationKey(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");
return new TabRenderAggregationKeyImpl(dateDimension, timeDimension, aggregationInterval, aggregatedGroup, mappedTab);
}
use of org.apereo.portal.events.aggr.DateDimension in project uPortal by Jasig.
the class JpaDateTimeDimensionDaoTest method testGetMinMaxDateDimension.
@Test
public void testGetMinMaxDateDimension() {
this.execute(new CallableWithoutResult() {
@Override
protected void callWithoutResult() {
final DateDimension newestDateDimension = dateDimensionDao.getNewestDateDimension();
assertNull(newestDateDimension);
}
});
this.execute(new CallableWithoutResult() {
@Override
protected void callWithoutResult() {
final List<DateDimension> dateDimensions = dateDimensionDao.getDateDimensions();
assertEquals(Collections.EMPTY_LIST, dateDimensions);
}
});
this.executeInTransaction(new CallableWithoutResult() {
@Override
protected void callWithoutResult() {
DateMidnight date = new DateMidnight(2012, 1, 1);
for (int i = 0; i < 7; i++) {
dateDimensionDao.createDateDimension(date, 0, null);
date = date.plusDays(1);
}
}
});
this.execute(new CallableWithoutResult() {
@Override
protected void callWithoutResult() {
DateMidnight date = new DateMidnight(2012, 1, 1);
final DateDimension dateDimension = dateDimensionDao.getDateDimensionByDate(date);
assertNotNull(dateDimension);
}
});
this.execute(new CallableWithoutResult() {
@Override
protected void callWithoutResult() {
final List<DateDimension> dateDimensions = dateDimensionDao.getDateDimensions();
assertEquals(7, dateDimensions.size());
}
});
this.execute(new CallableWithoutResult() {
@Override
protected void callWithoutResult() {
final DateMidnight start = new DateMidnight(2012, 1, 2);
final DateMidnight end = new DateMidnight(2012, 1, 6);
final List<DateDimension> dateDimensions = dateDimensionDao.getDateDimensionsBetween(start, end);
assertEquals(4, dateDimensions.size());
}
});
this.execute(new CallableWithoutResult() {
@Override
protected void callWithoutResult() {
final DateDimension oldestDateDimension = dateDimensionDao.getOldestDateDimension();
assertEquals(2012, oldestDateDimension.getYear());
assertEquals(1, oldestDateDimension.getMonth());
assertEquals(1, oldestDateDimension.getDay());
}
});
this.execute(new CallableWithoutResult() {
@Override
protected void callWithoutResult() {
final DateDimension newestDateDimension = dateDimensionDao.getNewestDateDimension();
assertEquals(2012, newestDateDimension.getYear());
assertEquals(1, newestDateDimension.getMonth());
assertEquals(7, newestDateDimension.getDay());
}
});
}
Aggregations