Examples of AbstractReportDefinition


Examples of org.pentaho.reporting.engine.classic.core.AbstractReportDefinition

   * @throws SAXException if there is a parsing error.
   */
  protected void doneParsing() throws SAXException
  {
    super.doneParsing();
    final AbstractReportDefinition report = (AbstractReportDefinition)
        getRootHandler().getHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME);

    final ItemBand itemBand = report.getItemBand();
    final NoDataBand noDataBand = report.getNoDataBand();
    final DetailsFooter detailsFooter = report.getDetailsFooter();
    final DetailsHeader detailsHeader = report.getDetailsHeader();

    if (groupReadHandler != null)
    {
      report.setRootGroup(groupReadHandler.getGroup());
    }
    report.setItemBand(itemBand);
    report.setNoDataBand(noDataBand);
    report.setDetailsFooter(detailsFooter);
    report.setDetailsHeader(detailsHeader);

  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.AbstractReportDefinition

    rootAttributes.addNamespaceDeclaration("wizard", AttributeNames.Wizard.NAMESPACE);

    final AttributeList attList = createMainAttributes(element, xmlWriter, rootAttributes);
    xmlWriter.writeTag(BundleNamespaces.LAYOUT, "layout", attList, XmlWriterSupport.OPEN);

    final AbstractReportDefinition report = (AbstractReportDefinition) element;
    final ReportPreProcessor[] processors = report.getPreProcessors();
    for (int i = 0; i < processors.length; i++)
    {
      final ReportPreProcessor processor = processors[i];
      // write the preprocessor ...
      try
      {
        xmlWriter.writeTag(BundleNamespaces.LAYOUT, "preprocessor",
            "class", processor.getClass().getName(), XmlWriterSupport.OPEN);
        writePreProcessor(xmlWriter, processor);
        xmlWriter.writeCloseTag();
      }
      catch (IntrospectionException e)
      {
        throw new BundleWriterException("Failed to write pre-processor", e);
      }
      catch (BeanException e)
      {
        throw new BundleWriterException("Failed to write pre-processor", e);
      }
    }
    if (ExpressionWriterUtility.isElementLayoutExpressionActive(state))
    {
      xmlWriter.writeTag(BundleNamespaces.LAYOUT, "layout-processors", XmlWriterSupport.OPEN);
      ExpressionWriterUtility.writeElementLayoutExpressions(bundle, state, xmlWriter);
      xmlWriter.writeCloseTag();
    }

    writeElementBody(bundle, state, element, xmlWriter);

    writeChildElement(bundle, state, xmlWriter, report.getReportHeader());
    writeChildElement(bundle, state, xmlWriter, report.getRootGroup());
    writeChildElement(bundle, state, xmlWriter, report.getReportFooter());

    xmlWriter.writeCloseTag();
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.AbstractReportDefinition

    final WizardEditorModel editorModel = getEditorModel();
    try
    {
      if (startFromFile && fileName != null)
      {
        final AbstractReportDefinition substituteReportDefinition = loadDefinitionFromFile(new File(fileName));
        if (substituteReportDefinition == null)
        {
          return false;
        }
        substituteReportDefinition.setName(editorModel.getReportDefinition().getName());
        substituteReportDefinition.setAttribute("http://reporting.pentaho.org/namespaces/engine/attributes/wizard", "template", fileName);
        editorModel.setReportDefinition(substituteReportDefinition, false);
        return true;
      }

      if (editorModel.isEditing())
      {
        if (selectedTemplateChanged)
        {
          final AbstractReportDefinition report;
          if (selectedTemplate == -1)
          {
            report = editorModel.getEmptyTemplate();
          }
          else
          {
            final File file = templateHash.get(selectedTemplate);
            if (file != null)
            {
              fileName = file.getAbsolutePath();
              report = loadDefinitionFromFile(file);
              if (report == null)
              {
                return false;
              }
            }
            else
            {
              return false;
            }
          }
          final WizardSpecification specification = editorModel.getReportSpec();
          final DataFactory dataFactory = editorModel.getReportDefinition().getDataFactory().derive();
          final String oldName = editorModel.getReportDefinition().getName();

          report.setAttribute("http://reporting.pentaho.org/namespaces/engine/attributes/wizard", "template", fileName);
          report.setDataFactory(dataFactory);
          report.setName(oldName);
          WizardProcessorUtil.applyWizardSpec(report, specification);
          editorModel.setReportDefinition(report, true);
          return true;
        }
        return true;
      }

      if (!startFromFile && selectedTemplate == -1)
      {
        final AbstractReportDefinition report = editorModel.getEmptyTemplate();
        final DefaultWizardSpecification specification = new DefaultWizardSpecification();
        WizardProcessorUtil.applyWizardSpec(report, specification);
        editorModel.setReportDefinition(report, false);
        return true;
      }
      if (selectedTemplate != -1)
      {
        final File reportFile = templateHash.get(selectedTemplate);
        if (reportFile != null)
        {
          this.fileName = reportFile.getAbsolutePath();
        }
        else
        {
          this.fileName = null;
        }
      }

      if (fileName == null || fileName.length() < 1)
      {
        return false;
      }

      final AbstractReportDefinition fileReportDefinition = loadDefinitionFromFile(new File(fileName));
      if (fileReportDefinition == null)
      {
        return false;
      }
      if (fileReportDefinition instanceof MasterReport)
      {
        WizardProcessorUtil.resetDocumentMetaData((MasterReport) fileReportDefinition);
      }
      fileReportDefinition.setAttribute("http://reporting.pentaho.org/namespaces/engine/attributes/wizard", "template", fileName);
      editorModel.setReportDefinition(fileReportDefinition);
      return true;
    }
    catch (Exception e)
    {
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.AbstractReportDefinition

   * @throws java.io.IOException   if there is an I/O problem.
   * @throws ReportWriterException if the report serialisation failed.
   */
  public void write() throws IOException, ReportWriterException
  {
    final AbstractReportDefinition reportDef = getReport();
    if (reportDef instanceof MasterReport == false)
    {
      // subreports have no data-factory at all.
      return;
    }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.AbstractReportDefinition

   *
   * @return true, if there are functions, marked properties or expressions defined, false otherwise.
   */
  private boolean shouldWriteFunctions()
  {
    final AbstractReportDefinition report = getReport();
    if (report.getProperties().containsMarkedProperties())
    {
      return true;
    }
    return report.getExpressions().size() != 0;
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.AbstractReportDefinition

  }

  protected boolean validateStep()
  {
    // If we have no createdDataFactory and we don't have anything in the model then we can't continue
    final AbstractReportDefinition reportDefinition = getEditorModel().getReportDefinition();
    if (reportDefinition.getDataFactory() == null ||
        StringUtils.isEmpty(reportDefinition.getQuery()))
    {
      DebugLog.log("Have no query or no datafactory " +
          reportDefinition.getDataFactory() + " " + reportDefinition.getQuery());
      return false;
    }

    // if we have a DataFactory and a query make sure that they are contained in cdf.
    final String queryName = reportDefinition.getQuery();
    if (cdf.isQueryExecutable(queryName, new StaticDataRow()) == false)
    {
      return false;
    }

    try
    {
      final AbstractReportDefinition abstractReportDefinition =
          (AbstractReportDefinition) reportDefinition.derive();
      abstractReportDefinition.setDataFactory(cdf.derive());
      final DataSchemaModel schemaModel = WizardEditorModel.compileDataSchemaModel(abstractReportDefinition);
      return schemaModel.isValid();
    }
    catch (Exception ee)
    {
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.AbstractReportDefinition

      throws IOException, ReportWriterException
  {
    final XmlWriter xmlWriter = getXmlWriter();
    xmlWriter.writeTag(ExtParserModule.NAMESPACE, AbstractXMLDefinitionWriter.REPORT_CONFIG_TAG, XmlWriterSupport.OPEN);

    final AbstractReportDefinition report = getReport();
    if (report instanceof MasterReport)
    {
      final MasterReport masterReport = (MasterReport) report;
      final DataFactoryWriter writer = new DataFactoryWriter(getReportWriter(), getXmlWriter());
      writer.write();
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.AbstractReportDefinition

   * @throws SAXException if there is a parsing error.
   */
  protected void doneParsing() throws SAXException
  {
    super.doneParsing();
    final AbstractReportDefinition report = (AbstractReportDefinition)
        getRootHandler().getHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME);

    for (int i = 0; i < functions.size(); i++)
    {
      final ReportFunctionReadHandler handler = (ReportFunctionReadHandler) functions.get(i);
      report.addExpression((Expression) handler.getObject());
    }
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.AbstractReportDefinition

    {
      rootLevelBand.setAttribute(ReportDesignerParserModule.NAMESPACE,
          "visual-height", new Double(visualHeightParsed));
    }

    final AbstractReportDefinition report = (AbstractReportDefinition)
        getRootHandler().getHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME);
    if (rowBandingDefinitionReadHandler != null)
    {
      final Expression expression = (Expression) rowBandingDefinitionReadHandler.getObject();
      if (expression != null)
      {
        report.addExpression(expression);
      }
    }

    if (rootLevelBand instanceof AbstractRootLevelBand)
    {
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.AbstractReportDefinition

    writer.writeTag(BundleNamespaces.DATADEFINITION, "data-definition", rootAttributes, XmlWriterSupport.OPEN);// NON-NLS

    // write parameters
    writeParameterDefinitions(contentState, writer);
    // write data-source
    final AbstractReportDefinition report = contentState.getReport();

    final String query = report.getQuery();
    final int queryLimit = report.getQueryLimit();
    final AttributeList dataSourceAtts = new AttributeList();
    if (query != null)
    {
      dataSourceAtts.setAttribute(BundleNamespaces.DATADEFINITION, "report-query", query);// NON-NLS
      dataSourceAtts.setAttribute(BundleNamespaces.DATADEFINITION, "limit", String.valueOf(queryLimit));// NON-NLS
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.