throws ReportCancelledException {
log.info(String.format("Generating report: %s", request.getReportSpec().getName()));
final int totalSteps = request.getProfileIds().size() * request.getReportSpec().getItems().size();
int stepCount = 0;
Report report = new Report();
report.setTitle(request.getReportSpec().getName());
for (ReportSpecItem specItem : request.getReportSpec().getItems()) {
ReportItem item = new ReportItem();
item.setReportSpecItem(specItem);
report.addItem(item);
Map<String, GroupedFieldItem> groups = new LinkedHashMap<String, GroupedFieldItem>();
for (String profileId : request.getProfileIds()) {
ProfileInstance profile = profileContextLocator.getProfileInstance(profileId);
report.addProfile(profile);
ProfileInstanceManager profileInstanceManager =
profileContextLocator.openProfileInstanceManager(profile);
Filter filterToUse = optionalFilter == null ? profile.getFilter() : optionalFilter;