it.eng.spagobi.engines.worksheet.services.export
Class ExportWorksheetAction

java.lang.Object
  extended by it.eng.spago.dispatching.service.DefaultRequestContext
      extended by it.eng.spago.dispatching.service.DefaultHttpRequestContext
          extended by it.eng.spago.dispatching.action.AbstractHttpAction
              extended by it.eng.spagobi.utilities.service.AbstractBaseHttpAction
                  extended by it.eng.spagobi.utilities.engines.AbstractEngineAction
                      extended by it.eng.spagobi.engines.worksheet.services.AbstractWorksheetEngineAction
                          extended by it.eng.spagobi.engines.worksheet.services.runtime.ExecuteWorksheetQueryAction
                              extended by it.eng.spagobi.engines.worksheet.services.export.ExportWorksheetAction
All Implemented Interfaces:
it.eng.spago.dispatching.action.ActionIFace, it.eng.spago.dispatching.service.HttpRequestContextIFace, it.eng.spago.dispatching.service.RequestContextIFace, it.eng.spago.dispatching.service.ServiceIFace, it.eng.spago.init.InitializerIFace, java.io.Serializable

public class ExportWorksheetAction
extends ExecuteWorksheetQueryAction

See Also:
Serialized Form

Field Summary
static java.lang.String CONTENT
           
static java.lang.String CONTENT_PARS
           
static java.lang.String EXPORTED_SHEETS
           
static java.lang.String FIELDS_OPTIONS
           
static org.apache.log4j.Logger logger
          Logger component.
static java.lang.String MASSIVE_SPLITTING_FILTER
           
static java.lang.String METADATA
           
static java.lang.String MIME_TYPE
           
protected  java.text.DecimalFormat numberFormat
           
static java.lang.String OUTPUT_FORMAT_JPEG
           
static java.lang.String OUTPUT_FORMAT_PDF
           
static java.lang.String OUTPUT_FORMAT_PNG
           
static java.lang.String OUTPUT_FORMAT_SVG
           
static java.lang.String PARAMETERS
           
static java.lang.String RESPONSE_TYPE
           
static java.lang.String RESPONSE_TYPE_ATTACHMENT
           
static java.lang.String RESPONSE_TYPE_INLINE
           
static java.lang.String SHEETS_NUM
           
static java.lang.String SPLITTING_FILTER
           
protected  boolean splittingFilter
           
static java.lang.String SVG
           
protected  java.lang.String userDateFormat
           
static java.lang.String WORKSHEETS
           
static java.lang.String WORKSHEETS_ADDITIONAL_DATA
           
 
Fields inherited from class it.eng.spagobi.engines.worksheet.services.runtime.ExecuteWorksheetQueryAction
LIMIT, OPTIONAL_VISIBLE_COLUMNS, SHEET, START
 
Fields inherited from class it.eng.spagobi.engines.worksheet.services.AbstractWorksheetEngineAction
auditlogger
 
Fields inherited from class it.eng.spagobi.utilities.engines.AbstractEngineAction
PRIVATE_SCOPE, PUBLIC_SCOPE
 
Constructor Summary
ExportWorksheetAction()
           
 
Method Summary
protected  java.lang.String buildSqlStatement(CrosstabDefinition crosstabDefinition, it.eng.spagobi.tools.dataset.persist.IDataSetTableDescriptor descriptor, java.util.List<it.eng.qbe.query.WhereField> filters, it.eng.spagobi.tools.datasource.bo.IDataSource dataSource)
          Build the sql statement to query the temporary table
 org.json.JSONObject convertToExportJSON(WorksheetEngineInstance engineInstance, org.json.JSONObject worksheetJSON)
           
static byte[] decodeToByteArray(java.lang.String data)
           
protected  void dropTemporaryTableIfRequested()
           
 void exportMetadataToXLS(org.apache.poi.ss.usermodel.Workbook wb, WorkSheetXLSExporter exporter, org.apache.poi.ss.usermodel.CreationHelper createHelper, org.json.JSONArray metadataPropertiesJSON, org.json.JSONArray parametersJSON)
           
 void exportSheetToXLS(org.apache.poi.ss.usermodel.Workbook wb, org.json.JSONObject sheetJ, org.json.JSONArray fieldOptions, WorkSheetXLSExporter exporter, org.apache.poi.ss.usermodel.CreationHelper createHelper, it.eng.qbe.query.WhereField splittingWhereField)
           
 void exportToPDF(org.json.JSONObject worksheetJSON, java.io.OutputStream outputStream)
           
 void exportToXLS(WorkSheetXLSExporter exporter, org.json.JSONObject worksheetJSON, org.json.JSONArray metadataPropertiesJSON, org.json.JSONArray parametersJSON, java.io.OutputStream stream)
           
 int fillSheetContent(org.apache.poi.ss.usermodel.Workbook wb, org.apache.poi.ss.usermodel.Sheet sheet, org.json.JSONObject sheetJ, org.json.JSONArray fieldOptions, it.eng.qbe.query.WhereField splittingWhereField, org.apache.poi.ss.usermodel.CreationHelper createHelper, WorkSheetXLSExporter exporter, org.apache.poi.ss.usermodel.Drawing patriarch, int sheetRow)
           
 CrossTab getCrosstab(org.json.JSONObject crosstabDefinitionJSON, org.json.JSONArray fieldOptions, org.json.JSONObject optionalFilters, java.lang.String sheetName, it.eng.qbe.query.WhereField splittingWhereField, org.json.JSONArray calculateFieldsJSON)
           
 java.util.List<it.eng.qbe.query.WhereField> getSplittingFieldValues(org.json.JSONObject optionalFilters, java.lang.String sheetName)
           
 boolean isTableContent(org.json.JSONObject sheetJSON)
          Return true if the content of a sheet is a table
 void service(it.eng.spago.base.SourceBean request, it.eng.spago.base.SourceBean response)
           
 
Methods inherited from class it.eng.spagobi.engines.worksheet.services.runtime.ExecuteWorksheetQueryAction
executeQuery, executeQuery, executeQuery, serializeDataStore
 
Methods inherited from class it.eng.spagobi.engines.worksheet.services.AbstractWorksheetEngineAction
adjustMetadata, adjustMetadata, applyOptions, buildSqlStatement, executeWorksheetQuery, getAllFields, getConnection, getDataSource, getEngineInstance, getFiltersOnDomainValues, getGlobalFiltersOnDomainValues, getOptionalFilters, getSheetFiltersOnDomainValues, getUserSheetFilterValues, persistDataSet, setDataSource, setEngineInstance, transformIntoWhereClauses, transformIntoWhereClauses, updateWorksheetDefinition
 
Methods inherited from class it.eng.spagobi.utilities.engines.AbstractEngineAction
getAuditServiceProxy, getConetxtManager, getEnv, getLocale, getSpagoBIHttpSessionContainer, getSpagoBISessionContainer, init, saveAnalysisState, setLocale
 
Methods inherited from class it.eng.spagobi.utilities.service.AbstractBaseHttpAction
delAttributeFromHttpSession, delAttributeFromSession, getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsCsvStringList, getAttributeAsInteger, getAttributeAsJSONArray, getAttributeAsJSONObject, getAttributeAsList, getAttributeAsString, getAttributeFromHttpSession, getAttributeFromHttpSessionAsBoolean, getAttributeFromHttpSessionAsBoolean, getAttributeFromHttpSessionAsString, getAttributeFromSession, getAttributeFromSessionAsBoolean, getAttributeFromSessionAsBoolean, getAttributeFromSessionAsString, getAttributesAsLinkedMap, getAttributesAsMap, getHttpSession, getSessionContainer, getSpagoBIRequestContainer, getSpagoBIResponseContainer, httpSessionContainsAttribute, requestContainsAttribute, requestContainsAttribute, sessionContainsAttribute, setAttribute, setAttributeInHttpSession, setAttributeInSession, setSpagoBIRequestContainer, setSpagoBIResponseContainer, tryToWriteBackToClient, writeBackToClient, writeBackToClient, writeBackToClient, writeBackToClient, writeBackToClient
 
Methods inherited from class it.eng.spago.dispatching.action.AbstractHttpAction
getActionMethod, getActionName, getConfig, setActionMethod, setActionName
 
Methods inherited from class it.eng.spago.dispatching.service.DefaultHttpRequestContext
freezeHttpResponse, getHttpRequest, getHttpResponse, getServletConfig, isHttpResponseFreezed, setRequestContext, unfreezeHttpResponse
 
Methods inherited from class it.eng.spago.dispatching.service.DefaultRequestContext
getErrorHandler, getRequestContainer, getResponseContainer, getServiceRequest, getServiceResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface it.eng.spago.dispatching.service.RequestContextIFace
getErrorHandler, getRequestContainer, getResponseContainer, getServiceRequest, getServiceResponse
 

Field Detail

MIME_TYPE

public static final java.lang.String MIME_TYPE
See Also:
Constant Field Values

RESPONSE_TYPE

public static final java.lang.String RESPONSE_TYPE
See Also:
Constant Field Values

WORKSHEETS

public static final java.lang.String WORKSHEETS
See Also:
Constant Field Values

METADATA

public static final java.lang.String METADATA
See Also:
Constant Field Values

PARAMETERS

public static final java.lang.String PARAMETERS
See Also:
Constant Field Values

SHEETS_NUM

public static final java.lang.String SHEETS_NUM
See Also:
Constant Field Values

EXPORTED_SHEETS

public static final java.lang.String EXPORTED_SHEETS
See Also:
Constant Field Values

CONTENT

public static final java.lang.String CONTENT
See Also:
Constant Field Values

CONTENT_PARS

public static final java.lang.String CONTENT_PARS
See Also:
Constant Field Values

SPLITTING_FILTER

public static final java.lang.String SPLITTING_FILTER
See Also:
Constant Field Values

WORKSHEETS_ADDITIONAL_DATA

public static java.lang.String WORKSHEETS_ADDITIONAL_DATA

FIELDS_OPTIONS

public static java.lang.String FIELDS_OPTIONS

MASSIVE_SPLITTING_FILTER

public static final java.lang.String MASSIVE_SPLITTING_FILTER
See Also:
Constant Field Values

RESPONSE_TYPE_INLINE

public static final java.lang.String RESPONSE_TYPE_INLINE
See Also:
Constant Field Values

RESPONSE_TYPE_ATTACHMENT

public static final java.lang.String RESPONSE_TYPE_ATTACHMENT
See Also:
Constant Field Values

SVG

public static java.lang.String SVG

OUTPUT_FORMAT_PNG

public static java.lang.String OUTPUT_FORMAT_PNG

OUTPUT_FORMAT_JPEG

public static java.lang.String OUTPUT_FORMAT_JPEG

OUTPUT_FORMAT_PDF

public static java.lang.String OUTPUT_FORMAT_PDF

OUTPUT_FORMAT_SVG

public static java.lang.String OUTPUT_FORMAT_SVG

numberFormat

protected java.text.DecimalFormat numberFormat

userDateFormat

protected java.lang.String userDateFormat

splittingFilter

protected boolean splittingFilter

logger

public static transient org.apache.log4j.Logger logger
Logger component.

Constructor Detail

ExportWorksheetAction

public ExportWorksheetAction()
Method Detail

service

public void service(it.eng.spago.base.SourceBean request,
                    it.eng.spago.base.SourceBean response)
Specified by:
service in interface it.eng.spago.dispatching.service.ServiceIFace
Overrides:
service in class ExecuteWorksheetQueryAction

dropTemporaryTableIfRequested

protected void dropTemporaryTableIfRequested()

exportToPDF

public void exportToPDF(org.json.JSONObject worksheetJSON,
                        java.io.OutputStream outputStream)
                 throws java.lang.Exception
Throws:
java.lang.Exception

exportToXLS

public void exportToXLS(WorkSheetXLSExporter exporter,
                        org.json.JSONObject worksheetJSON,
                        org.json.JSONArray metadataPropertiesJSON,
                        org.json.JSONArray parametersJSON,
                        java.io.OutputStream stream)
                 throws java.lang.Exception
Throws:
java.lang.Exception

exportMetadataToXLS

public void exportMetadataToXLS(org.apache.poi.ss.usermodel.Workbook wb,
                                WorkSheetXLSExporter exporter,
                                org.apache.poi.ss.usermodel.CreationHelper createHelper,
                                org.json.JSONArray metadataPropertiesJSON,
                                org.json.JSONArray parametersJSON)
                         throws java.lang.Exception
Throws:
java.lang.Exception

exportSheetToXLS

public void exportSheetToXLS(org.apache.poi.ss.usermodel.Workbook wb,
                             org.json.JSONObject sheetJ,
                             org.json.JSONArray fieldOptions,
                             WorkSheetXLSExporter exporter,
                             org.apache.poi.ss.usermodel.CreationHelper createHelper,
                             it.eng.qbe.query.WhereField splittingWhereField)
                      throws java.lang.Exception
Throws:
java.lang.Exception

fillSheetContent

public int fillSheetContent(org.apache.poi.ss.usermodel.Workbook wb,
                            org.apache.poi.ss.usermodel.Sheet sheet,
                            org.json.JSONObject sheetJ,
                            org.json.JSONArray fieldOptions,
                            it.eng.qbe.query.WhereField splittingWhereField,
                            org.apache.poi.ss.usermodel.CreationHelper createHelper,
                            WorkSheetXLSExporter exporter,
                            org.apache.poi.ss.usermodel.Drawing patriarch,
                            int sheetRow)
                     throws java.lang.Exception
Throws:
java.lang.Exception

isTableContent

public boolean isTableContent(org.json.JSONObject sheetJSON)
Return true if the content of a sheet is a table

Parameters:
sheetJSON - a sheet
Returns:
true if the content of a sheet is a table

getCrosstab

public CrossTab getCrosstab(org.json.JSONObject crosstabDefinitionJSON,
                            org.json.JSONArray fieldOptions,
                            org.json.JSONObject optionalFilters,
                            java.lang.String sheetName,
                            it.eng.qbe.query.WhereField splittingWhereField,
                            org.json.JSONArray calculateFieldsJSON)
                     throws java.lang.Exception
Throws:
java.lang.Exception

buildSqlStatement

protected java.lang.String buildSqlStatement(CrosstabDefinition crosstabDefinition,
                                             it.eng.spagobi.tools.dataset.persist.IDataSetTableDescriptor descriptor,
                                             java.util.List<it.eng.qbe.query.WhereField> filters,
                                             it.eng.spagobi.tools.datasource.bo.IDataSource dataSource)
Build the sql statement to query the temporary table

Parameters:
crosstabDefinition - definition of the crosstab
descriptor - the temporary table descriptor
dataSource - the datasource
tableName - the temporary table name
Returns:
the sql statement to query the temporary table

getSplittingFieldValues

public java.util.List<it.eng.qbe.query.WhereField> getSplittingFieldValues(org.json.JSONObject optionalFilters,
                                                                           java.lang.String sheetName)
                                                                    throws org.json.JSONException
Throws:
org.json.JSONException

convertToExportJSON

public org.json.JSONObject convertToExportJSON(WorksheetEngineInstance engineInstance,
                                               org.json.JSONObject worksheetJSON)
                                        throws org.json.JSONException
Throws:
org.json.JSONException

decodeToByteArray

public static byte[] decodeToByteArray(java.lang.String data)