use of org.apereo.portal.io.xml.SpELDataTemplatingStrategy in project uPortal by Jasig.
the class TemplateDataTenantOperationsListener method importQueue.
/**
* Imports the specified entities in the proper order.
*/
private void importQueue(final ITenant tenant, final Map<PortalDataKey, Set<BucketTuple>> queue, final StringBuilder importReport) throws Exception {
final StandardEvaluationContext ctx = new StandardEvaluationContext();
ctx.setRootObject(new RootObjectImpl(tenant));
IDataTemplatingStrategy templating = new SpELDataTemplatingStrategy(portalSpELService, ctx);
Document doc = null;
try {
for (PortalDataKey pdk : dataKeyImportOrder) {
Set<BucketTuple> bucket = queue.get(pdk);
if (bucket != null) {
log.debug("Importing the specified PortalDataKey tenant '{}': {}", tenant.getName(), pdk.getName());
for (BucketTuple tuple : bucket) {
doc = tuple.getDocument();
Source data = templating.processTemplates(doc, tuple.getResource().getURL().toString());
dataHandlerService.importData(data, pdk);
importReport.append(createImportReportLineItem(pdk, tuple));
}
}
}
} catch (Exception e) {
log.error("Failed to process the specified template document:\n{}", (doc != null ? doc.asXML() : "null"), e);
throw e;
}
}
Aggregations