com.ibm.commerce.bi.commands
Class BIShowReportCmdImpl

com.ibm.commerce.command.AbstractECTargetableCommand
  |
  +--com.ibm.commerce.command.ControllerCommandImpl
        |
        +--com.ibm.commerce.tools.command.ToolsControllerCommandImpl
              |
              +--com.ibm.commerce.bi.commands.BIShowReportCmdImpl
All Implemented Interfaces:
AccCommand, BIShowReportCmd, ControllerCommand, ECCommand, ECTargetableCommand, Protectable, ToolsControllerCommand

public class BIShowReportCmdImpl
extends ToolsControllerCommandImpl
implements BIShowReportCmd

Sends the requested file to the browser.

The file type can be html, htm, jpg and css. For any other types of files, an error page is forwarded.

The file name is passed in via a request parameter reportId. The parameter name can be changed using setURLParamName

The path of the file is formed in buildReportPath using the WebSphere Commerce instance directory and the WebSphere Commerce Analyzer report directory. If the file is in a sub directory of the default WebSphere Commerce Analyzer report directory, the sub directory can be added by setReportSubDirectory.


Field Summary
protected static java.lang.String BASE_REPORT_DIR
           
protected static java.lang.String BI
           
protected static java.lang.String BI_REPORT_ERROR_VIEW
           
static java.lang.String COPYRIGHT
           
protected static java.lang.String CSA
           
protected static java.lang.String css_extension
           
protected static java.lang.String ERROR
           
protected static java.lang.String fileSeparator
           
protected static java.lang.String gif_extension
           
protected static java.lang.String htm_extension
           
protected static java.lang.String html_extension
           
protected static java.lang.String image_gif_content_type
           
protected static java.lang.String image_jpeg_content_type
           
protected static java.lang.String INSTANCE_DIR
           
protected static java.lang.String jpg_extension
           
protected static java.lang.String METHODbuildReportDirectoryPath
           
protected static java.lang.String METHODfileExtNotSupported
           
protected static java.lang.String METHODfileNotAvailable
           
protected static java.lang.String METHODisFileExtensionValid
           
protected static java.lang.String METHODlogAccess
           
protected static java.lang.String METHODperformExecute
           
protected static java.lang.String METHODsetReportSubDirectory
           
protected static java.lang.String METHODsetRequestProperties
           
protected static java.lang.String METHODsetViewName
           
protected static java.lang.String METHODssetURLParamName
           
protected static java.lang.String NOT_AVAILABLE
           
protected static java.lang.String NOT_SUPPORTED
           
protected static java.lang.String PAGE_NAME
           
protected  java.lang.String reportId
           
protected  java.lang.String reportSubDir
           
protected static java.lang.String storeIdPrefix
           
protected static java.lang.String text_css_content_type
           
protected static java.lang.String text_html_content_type
           
protected  java.lang.String urlParamName
           
protected  java.lang.String viewName
           
 
Fields inherited from class com.ibm.commerce.command.ControllerCommandImpl
requestProperties, responseProperties, retriable, viewReqProperties
 
Fields inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.bi.commands.BIShowReportCmd
defaultCommandClassName, NAME
 
Constructor Summary
BIShowReportCmdImpl()
          BIShowReportCmdImpl constructor.
 
Method Summary
protected  java.lang.String buildReportPath()
          Build the report path based on the WebSphere Commerce instance directory and the WebSphere Commerce Analyzer report directory.
protected  void fileExtNotSupported(java.lang.String docName)
          Forward to an error jsp when the file type is not supported.
protected  void fileNotAvailable(java.lang.String docName)
          Forward to an error jsp when the file cannot be found or the file size cannot be read.
 java.lang.String getReportId()
          Returns the report ID.
 AccessVector getResources()
          Gets the access vector accessed by this command.
protected  boolean isFileExtensionValid(java.lang.String filename)
          Test if the file is a supported file type.
protected  void logAccess()
          Logs all accesses to this command.
 void performExecute()
          This method calls the performExecute of the super class.
protected  void setReportId(java.lang.String id)
          Set report ID.
protected  void setReportSubDirectory()
          Sets the optional file sub directory.
 void setRequestProperties(TypedProperty reqProperties)
          Sets request properties.
protected  void setURLParamName()
          Sets the URL context parameter name.
protected  void setViewName()
          Sets the view name.
 
Methods inherited from class com.ibm.commerce.tools.command.ToolsControllerCommandImpl
getViewInputProperties
 
Methods inherited from class com.ibm.commerce.command.ControllerCommandImpl
fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputProperties
 
Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties, validateParameters
 
Methods inherited from interface com.ibm.commerce.command.ControllerCommand
execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRetriable, setViewInputProperties
 
Methods inherited from interface com.ibm.commerce.command.AccCommand
accessControlCheck, getAccCheck, getForUserId, setAccCheck, setForUserId, setOwner
 
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setDefaultProperties, validateParameters
 
Methods inherited from interface com.ibm.commerce.security.Protectable
fulfills, getOwner
 

Field Detail

BASE_REPORT_DIR

protected static final java.lang.String BASE_REPORT_DIR

BI

protected static final java.lang.String BI

BI_REPORT_ERROR_VIEW

protected static final java.lang.String BI_REPORT_ERROR_VIEW

COPYRIGHT

public static final java.lang.String COPYRIGHT

CSA

protected static final java.lang.String CSA

css_extension

protected static final java.lang.String css_extension

ERROR

protected static final java.lang.String ERROR

fileSeparator

protected static final java.lang.String fileSeparator

gif_extension

protected static final java.lang.String gif_extension

htm_extension

protected static final java.lang.String htm_extension

html_extension

protected static final java.lang.String html_extension

image_gif_content_type

protected static final java.lang.String image_gif_content_type

image_jpeg_content_type

protected static final java.lang.String image_jpeg_content_type

INSTANCE_DIR

protected static final java.lang.String INSTANCE_DIR

jpg_extension

protected static final java.lang.String jpg_extension

METHODbuildReportDirectoryPath

protected static final java.lang.String METHODbuildReportDirectoryPath

METHODfileExtNotSupported

protected static final java.lang.String METHODfileExtNotSupported

METHODfileNotAvailable

protected static final java.lang.String METHODfileNotAvailable

METHODisFileExtensionValid

protected static final java.lang.String METHODisFileExtensionValid

METHODlogAccess

protected static final java.lang.String METHODlogAccess

METHODperformExecute

protected static final java.lang.String METHODperformExecute

METHODsetReportSubDirectory

protected static final java.lang.String METHODsetReportSubDirectory

METHODsetRequestProperties

protected static final java.lang.String METHODsetRequestProperties

METHODsetViewName

protected static final java.lang.String METHODsetViewName

METHODssetURLParamName

protected static final java.lang.String METHODssetURLParamName

NOT_AVAILABLE

protected static final java.lang.String NOT_AVAILABLE

NOT_SUPPORTED

protected static final java.lang.String NOT_SUPPORTED

PAGE_NAME

protected static final java.lang.String PAGE_NAME

reportId

protected java.lang.String reportId

reportSubDir

protected java.lang.String reportSubDir

storeIdPrefix

protected static final java.lang.String storeIdPrefix

text_css_content_type

protected static final java.lang.String text_css_content_type

text_html_content_type

protected static final java.lang.String text_html_content_type

urlParamName

protected java.lang.String urlParamName

viewName

protected java.lang.String viewName
Constructor Detail

BIShowReportCmdImpl

public BIShowReportCmdImpl()
BIShowReportCmdImpl constructor.
Method Detail

buildReportPath

protected java.lang.String buildReportPath()

Build the report path based on the WebSphere Commerce instance directory and the WebSphere Commerce Analyzer report directory. If the file is in a sub directory of the WCA directory, the sub directory can be added via setReportSubDirectory.

It is called in performExecute after the performExecute of the super class is called. The sub directory must be set before this method is called.

Returns:
The full qualified file name.

fileExtNotSupported

protected void fileExtNotSupported(java.lang.String docName)

Forward to an error jsp when the file type is not supported.

Parameters:
docName - The file name.

fileNotAvailable

protected void fileNotAvailable(java.lang.String docName)

Forward to an error jsp when the file cannot be found or the file size cannot be read.

Parameters:
docName - The file name.

getReportId

public java.lang.String getReportId()

Returns the report ID.

Returns:
The report ID.

getResources

public AccessVector getResources()
                          throws ECException
Gets the access vector accessed by this command.

Specified by:
getResources in interface ECCommand
Overrides:
getResources in class AbstractECTargetableCommand
Returns:
The vector of resource action pairs.

isFileExtensionValid

protected boolean isFileExtensionValid(java.lang.String filename)
Test if the file is a supported file type.
Parameters:
filename - The file to be tested.
Returns:
true if the file is supported.

logAccess

protected void logAccess()

Logs all accesses to this command.


performExecute

public void performExecute()
                    throws ECException

This method calls the performExecute of the super class. The performExecute of the super class calls the checkParameter and the file name is parsed in this method.

After the full path name of the file name is constructed. The file is opened as an input stream and passed to a direct view.

Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
com.ibm.commerce.command.CommandException - The superclass for all ECExceptions.

setReportId

protected void setReportId(java.lang.String id)
Set report ID.
Parameters:
id - The report ID.

setReportSubDirectory

protected void setReportSubDirectory()

Sets the optional file sub directory.


setRequestProperties

public void setRequestProperties(TypedProperty reqProperties)
                          throws ECApplicationException

Sets request properties.

If a sub class needs to have a different parameter name, override the setURLParamName to set the urlParamName to the required name.

If a sub class needs to have a different view name, override the setViewName to set the viewName to the required name.

If the report is in a sub directory, override setReportSubDirectory to set reportSubDir to the sub directory.

Specified by:
setRequestProperties in interface ControllerCommand
Overrides:
setRequestProperties in class ToolsControllerCommandImpl
Parameters:
reqProperties - The request properties.
Throws:
ECApplicationException - If the URL parameter is not passed in.

setURLParamName

protected void setURLParamName()

Sets the URL context parameter name.

If a sub class needs to have a different parameter name, override this method to set the urlParamName to the required name.


setViewName

protected void setViewName()

Sets the view name.

If a sub class needs to have a different view name, override this method to set the viewName to the required name.