use of org.apereo.portal.events.aggr.AggregationInterval 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.AggregationInterval in project uPortal by Jasig.
the class PortletExecutionAggregator method createAggregationKey.
@Override
protected PortletExecutionAggregationKey createAggregationKey(PortletExecutionEvent e, EventAggregationContext eventAggregationContext, AggregationIntervalInfo intervalInfo, AggregatedGroupMapping aggregatedGroup) {
final TimeDimension timeDimension = intervalInfo.getTimeDimension();
final DateDimension dateDimension = intervalInfo.getDateDimension();
final AggregationInterval aggregationInterval = intervalInfo.getAggregationInterval();
Map<String, AggregatedPortletMapping> mappedPortlets = eventAggregationContext.getAttribute(MAPPED_PORTLETS_CACHE_KEY);
if (mappedPortlets == null) {
mappedPortlets = new HashMap<String, AggregatedPortletMapping>();
eventAggregationContext.setAttribute(MAPPED_PORTLETS_CACHE_KEY, mappedPortlets);
}
final String fname = e.getFname();
AggregatedPortletMapping mappedPortlet = mappedPortlets.get(fname);
if (mappedPortlet == null) {
mappedPortlet = this.aggregatedPortletLookupDao.getMappedPortletForFname(fname);
mappedPortlets.put(fname, mappedPortlet);
}
return new PortletExecutionAggregationKeyImpl(dateDimension, timeDimension, aggregationInterval, aggregatedGroup, mappedPortlet, executionType);
}
use of org.apereo.portal.events.aggr.AggregationInterval 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.AggregationInterval 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.AggregationInterval in project uPortal by Jasig.
the class EventAggregationConfigurationImporterExporter method importData.
@Transactional("aggrEventsTransactionManager")
@Override
public void importData(ExternalEventAggregationConfiguration data) {
//Import interval configs
final Set<AggregatedIntervalConfig> oldAggregatedIntervalConfigs = new HashSet<AggregatedIntervalConfig>(this.aggregationManagementDao.getAggregatedIntervalConfigs());
for (final ExternalAggregatedIntervalConfig extAggregatedIntervalConfig : data.getAggregatedIntervalConfigs()) {
final String aggregatorTypeName = extAggregatedIntervalConfig.getAggregatorType();
final Class<? extends IPortalEventAggregator> aggregatorType = getAggregatorType(aggregatorTypeName);
AggregatedIntervalConfig aggregatedIntervalConfig = this.aggregationManagementDao.getAggregatedIntervalConfig(aggregatorType);
if (aggregatedIntervalConfig == null) {
aggregatedIntervalConfig = this.aggregationManagementDao.createAggregatedIntervalConfig(aggregatorType);
}
//Remove the config from the old configs set, marking it as updated
oldAggregatedIntervalConfigs.remove(aggregatedIntervalConfig);
//Copy over excludes
final Set<AggregationInterval> excluded = aggregatedIntervalConfig.getExcluded();
excluded.clear();
for (final ExternalAggregationInterval extInterval : extAggregatedIntervalConfig.getExcludes()) {
excluded.add(convert(extInterval));
}
//Copy over includes
final Set<AggregationInterval> included = aggregatedIntervalConfig.getIncluded();
included.clear();
for (final ExternalAggregationInterval extInterval : extAggregatedIntervalConfig.getIncludes()) {
included.add(convert(extInterval));
}
this.aggregationManagementDao.updateAggregatedIntervalConfig(aggregatedIntervalConfig);
}
//Delete interval configs that were not updated
for (final AggregatedIntervalConfig aggregatedIntervalConfig : oldAggregatedIntervalConfigs) {
this.aggregationManagementDao.deleteAggregatedIntervalConfig(aggregatedIntervalConfig);
}
//Import Group configs
final Set<AggregatedGroupConfig> oldAggregatedGroupConfigs = new HashSet<AggregatedGroupConfig>(this.aggregationManagementDao.getAggregatedGroupConfigs());
for (final ExternalAggregatedGroupConfig extAggregatedGroupConfig : data.getAggregatedGroupConfigs()) {
final String aggregatorTypeName = extAggregatedGroupConfig.getAggregatorType();
final Class<? extends IPortalEventAggregator> aggregatorType = getAggregatorType(aggregatorTypeName);
AggregatedGroupConfig aggregatedGroupConfig = this.aggregationManagementDao.getAggregatedGroupConfig(aggregatorType);
if (aggregatedGroupConfig == null) {
aggregatedGroupConfig = this.aggregationManagementDao.createAggregatedGroupConfig(aggregatorType);
}
//Remove the config from the old configs set, marking it as updated
oldAggregatedGroupConfigs.remove(aggregatedGroupConfig);
//Copy over excludes
final Set<AggregatedGroupMapping> excluded = aggregatedGroupConfig.getExcluded();
excluded.clear();
for (final ExternalAggregatedGroupMapping extGroup : extAggregatedGroupConfig.getExcludes()) {
excluded.add(convert(extGroup));
}
//Copy over includes
final Set<AggregatedGroupMapping> included = aggregatedGroupConfig.getIncluded();
included.clear();
for (final ExternalAggregatedGroupMapping extGroup : extAggregatedGroupConfig.getIncludes()) {
included.add(convert(extGroup));
}
this.aggregationManagementDao.updateAggregatedGroupConfig(aggregatedGroupConfig);
}
//Delete interval configs that were not updated
for (final AggregatedGroupConfig aggregatedGroupConfig : oldAggregatedGroupConfigs) {
this.aggregationManagementDao.deleteAggregatedGroupConfig(aggregatedGroupConfig);
}
//Set quarter details if configured or set default quarters
final List<ExternalQuarterDetail> extQuarterDetails = data.getQuarterDetails();
final List<QuarterDetail> quarterDetails;
if (!extQuarterDetails.isEmpty()) {
quarterDetails = convertQuarterDetail(extQuarterDetails);
} else {
quarterDetails = EventDateTimeUtils.createStandardQuarters();
}
this.aggregationManagementDao.setQuarterDetails(quarterDetails);
//Set academic term if configured
final List<AcademicTermDetail> academicTerms = Lists.transform(data.getTermDetails(), new Function<ExternalTermDetail, AcademicTermDetail>() {
public AcademicTermDetail apply(ExternalTermDetail externalTermDetail) {
return new AcademicTermDetailImpl(new DateMidnight(externalTermDetail.getStart()), new DateMidnight(externalTermDetail.getEnd()), externalTermDetail.getName());
}
});
this.aggregationManagementDao.setAcademicTermDetails(academicTerms);
}
Aggregations