Examples of EmailRepository


Examples of org.pentaho.reporting.libraries.repository.email.EmailRepository

        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

Examples of org.pentaho.reporting.libraries.repository.email.EmailRepository

        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
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.