public abstract class BaseJavaReport
extends com.labvantage.sapphire.BaseCustom
implements com.labvantage.sapphire.report.ReportConstants
The following is an OOB Java report class that accepts a 'keyid1' QCBatchId and generates an excel file with each of the samples from QCBatcItems.
public class QCBatchRunFile extends BaseJavaReport {
private HashMap paramsMap;
public void init( String reportid, String reportVersionid, HashMap paramsMap, ConnectionInfo connectionInfo ) { // Remember the params. We will need this later this.paramsMap = paramsMap; }
public String getLogicalFileName( String defaultFileName ) { // This file always returns a .xslx file - but will allow an alternative filename to be provided return defaultFileName.endsWith( ".xlsx" ) ? defaultFileName : "sequence.xlsx"; }
public String[] getReportParameters() { return new String[] { "keyid1" }; }
public void runReport( OutputStream outputStream ) throws SapphireException { // Load the sampleids from qcbatchitem String qcbatchid = (String)paramsMap.get( "keyid1" ); SafeSQL safeSQL = new SafeSQL(); DataSet ds = getQueryProcessor().getPreparedSqlDataSet( "select distinct keyid1 from sdidata where s_qcbatchid=" + safeSQL.addVar( qcbatchid ), safeSQL.getValues() );
String runfilecontent = ds.toString() // Convert the dataset into a String with the required content
try { outputStream.write( runfilecontent.getBytes() ); } catch ( IOException e ) { throw new SapphireException( "Unable to stream the report back" ); } } }
DISPLAY_TYPE_CSV, DISPLAY_TYPE_DOC, DISPLAY_TYPE_DOCX, DISPLAY_TYPE_HTML, DISPLAY_TYPE_PDF, DISPLAY_TYPE_RTF, DISPLAY_TYPE_XLS, DISPLAY_TYPE_XLSX, REPORTTYPE_BO, REPORTTYPE_COLLATED, REPORTTYPE_EMBEDDEDJASPER, REPORTTYPE_JASPER, REPORTTYPE_JAVA, REPORTTYPE_NWA, REPORTTYPE_TALEND| Constructor and Description |
|---|
BaseJavaReport() |
| Modifier and Type | Method and Description |
|---|---|
void |
adjustPrintOptions(PrintReportOptions options)
Prior to sending the output file to a printer, you can override this method to adjust the print options if needed.
|
boolean |
canPrint() |
java.lang.ClassLoader |
getClassLoader() |
abstract java.lang.String |
getLogicalFileName(java.lang.String defaultFileName)
Return the logical name of the file.
|
java.lang.String |
getMimeType(java.lang.String filename)
LabVantage will try to assign a mimi-type for known filetypes.
|
java.lang.String[] |
getReportParameters() |
abstract void |
init(java.lang.String reportid,
java.lang.String reportVersionid,
java.util.HashMap paramsMap,
ConnectionInfo connectionInfo)
In this oiverride you can retain this information needed downstream, such as the report parameters
|
abstract void |
runReport(java.io.OutputStream outputStream)
Send the contents of the report to this output stream to be sent to a browser or to a file
|
void |
sendToPrinter(java.lang.String printerName,
java.io.File file,
PrintReportOptions options)
LabVantage knows how to print various file types, include excel, word, pdf, text and images.
|
void |
setClassLoader(java.lang.ClassLoader classLoader) |
getAccessorErrorIds, getAccessorErrorMsgs, getActionProcessor, getConfigurationProcessor, getConnectionid, getConnectionId, getConnectionProcessor, getDAMProcessor, getDepartmentList, getHttpProcessor, getQueryProcessor, getRakFile, getSDCProcessor, getSDIProcessor, getSequenceProcessor, getTranslationProcessor, setConnectionId, setLanguage, setRakFilepublic java.lang.String[] getReportParameters()
public void setClassLoader(java.lang.ClassLoader classLoader)
public java.lang.ClassLoader getClassLoader()
public abstract void init(java.lang.String reportid,
java.lang.String reportVersionid,
java.util.HashMap paramsMap,
ConnectionInfo connectionInfo)
throws SapphireException
reportid - reportVersionid - paramsMap - connectionInfo - SapphireExceptionpublic abstract java.lang.String getLogicalFileName(java.lang.String defaultFileName)
defaultFileName - public abstract void runReport(java.io.OutputStream outputStream)
throws SapphireException
outputStream - SapphireExceptionpublic java.lang.String getMimeType(java.lang.String filename)
filename - public void adjustPrintOptions(PrintReportOptions options)
options - public void sendToPrinter(java.lang.String printerName,
java.io.File file,
PrintReportOptions options)
printerName - file - options - public boolean canPrint()