Package org.pentaho.reporting.engine.classic.core

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


      {
        this.expressions[length] = (Expression) expressionSlot.clone();
      }
      catch (final CloneNotSupportedException e)
      {
        throw new ReportProcessingException("Failed to clone the expression.", e);
      }
    }

    final String name = expressionSlot.getName();
    length += 1;
View Full Code Here


        return null;
      }
      else
      {
        logger.info("EMail Task failed:", processTask.getError());
        throw new ReportProcessingException("EMail Task failed", processTask.getError());
      }
    }

    final EmailRepository repository = new EmailRepository(session);
    final MimeBodyPart messageBodyPart = repository.getBodypart();
    final ByteArrayDataSource dataSource = new ByteArrayDataSource(bout.toByteArray(), processTask.getReportMimeType());
    messageBodyPart.setDataHandler(new DataHandler(dataSource));

    final int attachmentsSize = mailDefinition.getAttachmentCount();
    for (int i = 0; i < attachmentsSize; i++)
    {
      final MasterReport report = mailDefinition.getAttachmentReport(i);
      final String type = mailDefinition.getAttachmentType(i);
      final ContentLocation location = repository.getRoot();
      final ContentLocation bulkLocation = location.createLocation("attachment-" + i);

      final ReportProcessTask attachmentProcessTask = registry.createProcessTask(type);
      attachmentProcessTask.setBodyContentLocation(bulkLocation);
      attachmentProcessTask.setBodyNameGenerator(new DefaultNameGenerator(bulkLocation, "report"));
      attachmentProcessTask.setReport(report);
      if (attachmentProcessTask instanceof MultiStreamReportProcessTask)
      {
        final MultiStreamReportProcessTask mtask = (MultiStreamReportProcessTask) attachmentProcessTask;
        mtask.setBulkLocation(bulkLocation);
        mtask.setBulkNameGenerator(new DefaultNameGenerator(bulkLocation, "data"));
        mtask.setUrlRewriter(new MailURLRewriter());
      }
      attachmentProcessTask.run();

      if (attachmentProcessTask.isTaskSuccessful() == false)
      {
        if (attachmentProcessTask.isTaskAborted())
        {
          logger.info("EMail Task received interrupt.");
        }
        else
        {
          logger.info("EMail Task failed:", attachmentProcessTask.getError());
          throw new ReportProcessingException("EMail Task failed", attachmentProcessTask.getError());
        }
      }
    }

    return repository.getEmail();
View Full Code Here

   */
  public void run()
  {
    if (isValid() == false)
    {
      setError(new ReportProcessingException("Error: The task is not configured properly."));
      return;
    }

    setError(null);
    try
View Full Code Here

      throws ReportProcessingException
  {
    super(report, outputProcessor);
    if (outputProcessor.getMetaData().isFeatureSupported(OutputProcessorFeature.PAGEBREAKS))
    {
      throw new ReportProcessingException
          ("Streaming report processors cannot be used in conjunction with pageable-outputs");
    }
  }
View Full Code Here

    }
    this.fileName = report.getConfiguration().getConfigProperty
        ("org.pentaho.reporting.engine.classic.core.modules.gui.xls.FileName"); //$NON-NLS-1$
    if (fileName == null)
    {
      throw new ReportProcessingException("ExcelExportTask(): Filename is not defined"); //$NON-NLS-1$
    }
    this.progressDialog = dialog;
    this.report = report;
    if (swingGuiContext != null)
    {
View Full Code Here

                           final ReportProgressDialog progressDialog,
                           final SwingGuiContext swingGuiContext) throws ReportProcessingException
  {
    if (report == null)
    {
      throw new ReportProcessingException("HtmlDirExportTask(..): Report-Parameter cannot be null"); //$NON-NLS-1$
    }

    this.progressDialog = progressDialog;
    this.report = report;

    final Configuration config = report.getConfiguration();
    final String dataDirectoryName = config.getConfigProperty
        ("org.pentaho.reporting.engine.classic.core.modules.gui.html.file.DataDirectory"); //$NON-NLS-1$
    final String targetFileName = config.getConfigProperty
        ("org.pentaho.reporting.engine.classic.core.modules.gui.html.file.TargetFileName"); //$NON-NLS-1$
    exportMethod = config.getConfigProperty
        ("org.pentaho.reporting.engine.classic.core.modules.gui.html.file.ExportMethod"); //$NON-NLS-1$

    try
    {
      if (swingGuiContext != null)
      {
        this.statusListener = swingGuiContext.getStatusListener();
        this.messages = new Messages(swingGuiContext.getLocale(), HtmlExportGUIModule.BASE_RESOURCE_CLASS,
            ObjectUtilities.getClassLoader(HtmlExportGUIModule.class));
      }
      else
      {
        this.messages = new Messages(Locale.getDefault(), HtmlExportGUIModule.BASE_RESOURCE_CLASS,
            ObjectUtilities.getClassLoader(HtmlExportGUIModule.class));
      }

      final File targetFile = new File(targetFileName).getCanonicalFile();
      targetDirectory = targetFile.getParentFile();

      final File tempDataDir = new File(dataDirectoryName).getCanonicalFile();
      if ("".equals(dataDirectoryName) == false && tempDataDir.isAbsolute())
      {
        dataDirectory = tempDataDir;
      }
      else
      {
        dataDirectory = new File(targetDirectory, dataDirectoryName).getCanonicalFile();
      }
      if (dataDirectory.exists() && dataDirectory.isDirectory() == false)
      {
        dataDirectory = dataDirectory.getParentFile();
        if (dataDirectory.isDirectory() == false)
        {
          throw new ReportProcessingException
              ("HtmlDirExportTask(..): Data-Directory is invalid: " + dataDirectory); //$NON-NLS-1$
        }
      }
      else if (dataDirectory.exists() == false)
      {
        dataDirectory.mkdirs();
      }

      suffix = getSuffix(targetFileName);
      filename = IOUtils.getInstance().stripFileExtension(targetFile.getName());

      if (targetFile.exists())
      {
        // lets try to delete it ..
        if (targetFile.delete() == false)
        {
          throw new ReportProcessingException(messages.getErrorString("HtmlDirExportTask.ERROR_0003_TARGET_FILE_EXISTS",
              targetFile.getAbsolutePath())); //$NON-NLS-1$
        }
      }
    }
    catch (IOException ioe)
    {
      throw new ReportProcessingException("Failed to normalize directories.", ioe);
    }
  }
View Full Code Here

    final String filename = report.getConfiguration().getConfigProperty
        ("org.pentaho.reporting.engine.classic.core.modules.gui.csv.FileName"); //$NON-NLS-1$
    if (filename == null)
    {
      throw new ReportProcessingException
          ("CSVTableExportTask(..): Configuration does not contain a valid filename"); //$NON-NLS-1$
    }

    this.progressDialog = dialog;
    this.report = report;
View Full Code Here

    }
    this.fileName = report.getConfiguration().getConfigProperty
        ("org.pentaho.reporting.engine.classic.core.modules.gui.xls.FileName"); //$NON-NLS-1$
    if (fileName == null)
    {
      throw new ReportProcessingException("ExcelExportTask(): Filename is not defined"); //$NON-NLS-1$
    }
    this.progressDialog = dialog;
    this.report = report;
    if (swingGuiContext != null)
    {
View Full Code Here

   */
  public void run()
  {
    if (isValid() == false)
    {
      setError(new ReportProcessingException("Error: The task is not configured properly."));
      return;
    }

    setError(null);
    try
View Full Code Here

       final ReportProgressDialog dialog,
       final SwingGuiContext swingGuiContext) throws ReportProcessingException
  {
    if (report == null)
    {
      throw new ReportProcessingException("RtfExportTask(..): Report-Parameter cannot be null"); //$NON-NLS-1$
    }

    if (swingGuiContext != null)
    {
      this.statusListener = swingGuiContext.getStatusListener();
      this.messages = new Messages(swingGuiContext.getLocale(), RTFExportPlugin.BASE_RESOURCE_CLASS,
          ObjectUtilities.getClassLoader(RTFExportPlugin.class));
    }
    else
    {
      this.messages = new Messages(Locale.getDefault(), RTFExportPlugin.BASE_RESOURCE_CLASS,
          ObjectUtilities.getClassLoader(RTFExportPlugin.class));
    }

    final String filename = report.getConfiguration().getConfigProperty
        ("org.pentaho.reporting.engine.classic.core.modules.gui.rtf.FileName"); //$NON-NLS-1$
    if (filename == null)
    {
      throw new ReportProcessingException(messages.getErrorString(
          "RTFExportTask.RTFExportTask.ERROR_0001_NULL_FILENAME")); //$NON-NLS-1$
    }
    this.fileName = filename;
    this.progressDialog = dialog;
    this.report = report;
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.ReportProcessingException

Copyright © 2018 www.massapicom. 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.