extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/pdf/PdfReportWorker.java

Code
Comments
Other
Rev Date Author Line
3506 23 Sep 15 nicklas 1 package net.sf.basedb.reggie.pdf;
3499 21 Sep 15 nicklas 2
3499 21 Sep 15 nicklas 3 import java.io.IOException;
3499 21 Sep 15 nicklas 4
3499 21 Sep 15 nicklas 5 import net.sf.basedb.core.DbControl;
6031 29 Oct 20 nicklas 6 import net.sf.basedb.core.plugin.ExportOutputStream;
3499 21 Sep 15 nicklas 7 import net.sf.basedb.reggie.dao.Rawbioassay;
6036 02 Nov 20 nicklas 8 import net.sf.basedb.reggie.script.ScriptResult;
3499 21 Sep 15 nicklas 9
3499 21 Sep 15 nicklas 10 /**
3506 23 Sep 15 nicklas 11   A PDF report worker is responsible for running a script
3506 23 Sep 15 nicklas 12   that analyses the data and then create a PDF with the 
3506 23 Sep 15 nicklas 13   result.
3506 23 Sep 15 nicklas 14   
3499 21 Sep 15 nicklas 15   @since 3.7
3499 21 Sep 15 nicklas 16 */
3506 23 Sep 15 nicklas 17 public abstract class PdfReportWorker 
3499 21 Sep 15 nicklas 18 {
3506 23 Sep 15 nicklas 19   private final PdfReportTemplate template;
3499 21 Sep 15 nicklas 20   
3506 23 Sep 15 nicklas 21   protected PdfReportWorker(PdfReportTemplate template)
3499 21 Sep 15 nicklas 22   {
3506 23 Sep 15 nicklas 23     this.template = template;
3499 21 Sep 15 nicklas 24   }
3499 21 Sep 15 nicklas 25
3499 21 Sep 15 nicklas 26   /**
3506 23 Sep 15 nicklas 27     Get the PDF template this worker is associated with.
3499 21 Sep 15 nicklas 28   */
3506 23 Sep 15 nicklas 29   public PdfReportTemplate getTemplate()
3499 21 Sep 15 nicklas 30   {
3506 23 Sep 15 nicklas 31     return template;
3499 21 Sep 15 nicklas 32   }
3499 21 Sep 15 nicklas 33   
3499 21 Sep 15 nicklas 34   /**
3506 23 Sep 15 nicklas 35     Run the script and generate a PDF that should be written to
3506 23 Sep 15 nicklas 36     the given output stream.
3499 21 Sep 15 nicklas 37   */
6036 02 Nov 20 nicklas 38   public abstract ScriptResult runAndCreatePdf(DbControl dc, Rawbioassay raw, ExportOutputStream out, ReportOptions options)
3506 23 Sep 15 nicklas 39     throws IOException;
3499 21 Sep 15 nicklas 40   
3499 21 Sep 15 nicklas 41   /**
6092 14 Dec 20 nicklas 42     Called before adding personal information to a PDF to let the worker
6092 14 Dec 20 nicklas 43     erase data from the existing PDF that should not be included in the
6092 14 Dec 20 nicklas 44     PDF with personal information. If redaction is needed, {@link PdfUtil7#open(java.io.OutputStream)}
6092 14 Dec 20 nicklas 45     must be called. Then, {@link PdfUtil7#redactRect(float, float, float, float)} or {@link PdfUtil7#redactText(String)}
6092 14 Dec 20 nicklas 46     should be used to remove data. Finally, call {@link PdfUtil7#close()} and return the   
6092 14 Dec 20 nicklas 47     the generated output as a byte[]. If no redaction is needed, null should be returned 
6092 14 Dec 20 nicklas 48     and the PdfUtil7 instance should not be used.
6092 14 Dec 20 nicklas 49     @since 4.29
6092 14 Dec 20 nicklas 50   */
6092 14 Dec 20 nicklas 51   public byte[] redactBeforePersonalInformation(DbControl dc, Rawbioassay raw, PdfUtil7 pdf)
6092 14 Dec 20 nicklas 52     throws IOException
6092 14 Dec 20 nicklas 53   {
6092 14 Dec 20 nicklas 54     return null;
6092 14 Dec 20 nicklas 55   }
6092 14 Dec 20 nicklas 56   
6092 14 Dec 20 nicklas 57   /**
3506 23 Sep 15 nicklas 58     Add personal information to an already existing report.
3506 23 Sep 15 nicklas 59     The given pdf is a writable clone of the original pdf.
3503 22 Sep 15 nicklas 60   */
6060 17 Nov 20 nicklas 61   public void addPersonalInformation(DbControl dc, Rawbioassay raw, PdfUtil7 pdf)
3503 22 Sep 15 nicklas 62     throws IOException
3503 22 Sep 15 nicklas 63   {}
3499 21 Sep 15 nicklas 64   
3499 21 Sep 15 nicklas 65 }