protected MasterReport tuneForMigrationMode(final MasterReport report) {
   final CompatibilityUpdater updater = new CompatibilityUpdater();
   updater.performUpdate(report);
   report.setAttribute(
       AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.COMAPTIBILITY_LEVEL, null);
   return report;
 }
예제 #2
0
  /**
   * @param model
   * @param dataFactory
   * @param reportTemplate
   * @param output
   * @return
   * @throws ReportException
   * @throws ReportProcessingException
   * @throws SaikuAdhocException
   * @throws IOException
   * @throws ResourceException
   */
  protected MasterReport processReport(SaikuMasterModel model)
      throws ReportException, ReportProcessingException, SaikuAdhocException, ResourceException,
          IOException {

    CachingDataFactory dataFactory = null;

    try {

      model.deriveModels();

      final MasterReport reportTemplate = model.getDerivedModels().getReportTemplate();

      final WizardSpecification wizardSpecification = model.getWizardSpecification();

      reportTemplate.setDataFactory(model.getDerivedModels().getCdaDataFactory());
      reportTemplate.setQuery(model.getDerivedModels().getSessionId());

      reportTemplate.setAttribute(
          AttributeNames.Wizard.NAMESPACE, "wizard-spec", wizardSpecification);

      final ProcessingContext processingContext = new DefaultProcessingContext();
      final DataSchemaDefinition definition = reportTemplate.getDataSchemaDefinition();

      final ReportParameterValues parameterValues =
          StateUtilities.computeParameterValueSet(reportTemplate, getReportParameterValues(model));

      final ParameterDefinitionEntry[] parameterDefinitions =
          reportTemplate.getParameterDefinition().getParameterDefinitions();

      final DefaultFlowController flowController =
          new DefaultFlowController(
              processingContext, definition, parameterValues, parameterDefinitions, false);

      ensureSaikuPreProcessorIsAdded(reportTemplate, model);
      ensureHasOverrideWizardFormatting(reportTemplate, flowController);

      dataFactory = new CachingDataFactory(reportTemplate.getDataFactory(), false);
      dataFactory.initialize(
          processingContext.getConfiguration(),
          processingContext.getResourceManager(),
          processingContext.getContentBase(),
          processingContext.getResourceBundleFactory());

      final DefaultFlowController postQueryFlowController =
          flowController.performQuery(
              dataFactory,
              reportTemplate.getQuery(),
              reportTemplate.getQueryLimit(),
              reportTemplate.getQueryTimeout(),
              flowController.getMasterRow().getResourceBundleFactory());

      reportTemplate.setAttribute(
          AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE, Boolean.TRUE);

      ReportPreProcessor processor = new SaikuAdhocPreProcessor();
      ((SaikuAdhocPreProcessor) processor).setSaikuMasterModel(model);
      MasterReport output = processor.performPreProcessing(reportTemplate, postQueryFlowController);
      output.setAttribute(
          AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE, Boolean.FALSE);

      output.setAttribute(
          AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE, Boolean.FALSE);

      TemplateUtils.mergePageSetup(model, output);

      return output;

    } finally {
      dataFactory.close();
    }
  }
 protected MasterReport tuneForCurrentMode(final MasterReport report) {
   report.setAttribute(
       AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.COMAPTIBILITY_LEVEL, null);
   return report;
 }