com.ibm.commerce.command
Class AttachmentViewCmdImpl

java.lang.Object
  CacheableCommandImpl
      com.ibm.commerce.command.AbstractECTargetableCommand
          com.ibm.commerce.command.ControllerCommandImpl
              com.ibm.commerce.command.AttachmentViewCmdImpl
All Implemented Interfaces:
AccCommand, AttachmentViewCmd, ControllerCommand, ECCommand, ECTargetableCommand, Protectable
Direct Known Subclasses:
OrderItemAttachmentViewCmdImpl, RFQAttachmentViewCmdImpl

public class AttachmentViewCmdImpl
extends ControllerCommandImpl
implements AttachmentViewCmd

The AttachmentViewCmdImpl will retrieve the attachment content from database and return the stream as DirectView to browser if the attachmentURL is same as attachment_id If the attachmentURL is not the same as attachment_id, we will assume that the attachment is not stored as BLOB in attachment table in database. We will open up the file as specified in AttachmentURL and return the stream as DirectView to browser AttachmentViewCmdImpl is only intended to be extended and not used directly . The AttachmentViewCmdImpl is not registered in the URLREG or CMDREG

See Also:
Serialized Form

Field Summary
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.command.AttachmentViewCmd
defaultCommandClassName
Constructor Summary
AttachmentViewCmdImpl()
Method Summary
protected java.lang.Long getAttachmentId()
Gets the attachmentobj_id of the attachment object in database table
protected byte[] getBinaryStream()
Gets the BinaryStream of the attachment object from database table
protected long getFileSize()
Gets the filesize of the attachment object from database table
protected java.lang.String getMimeType()
Gets the contentType of the attachment object from database table
boolean performAccessCheck()
your own access control check performAccessCheck
void performExecute()
This method contains the main business logic of this command.
void setAttachmentId(java.lang.String id)
Sets the attachmentobj_id of the attachment object in database table
void setRequestProperties(TypedProperty reqParms)
setRequestProperties
Methods inherited from class com.ibm.commerce.command.ControllerCommandImpl
checkPermission, fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResourceOwners, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputProperties
Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkParameters, checkResourcePermission, createCommandExecutionEvent, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.ibm.commerce.command.ControllerCommand
checkPermission, 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, getResourceOwners, setAccCheck, setForUserId, setOwner
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
Methods inherited from interface com.ibm.commerce.security.Protectable
fulfills, getOwner

Constructor Detail

AttachmentViewCmdImpl

public AttachmentViewCmdImpl()
Method Detail

getAttachmentId

protected java.lang.Long getAttachmentId()
Gets the attachmentobj_id of the attachment object in database table
Returns:
Long attachmentobj_id

getMimeType

protected java.lang.String getMimeType()
Gets the contentType of the attachment object from database table
Returns:
String contentType

getFileSize

protected long getFileSize()
Gets the filesize of the attachment object from database table
Returns:
long filesize

getBinaryStream

protected byte[] getBinaryStream()
Gets the BinaryStream of the attachment object from database table
Returns:
byte[] binarytream

setAttachmentId

public void setAttachmentId(java.lang.String id)
Sets the attachmentobj_id of the attachment object in database table
Specified by:
setAttachmentId in interface AttachmentViewCmd

setRequestProperties

public void setRequestProperties(TypedProperty reqParms)
                          throws ECException
setRequestProperties
Specified by:
setRequestProperties in interface ControllerCommand
Overrides:
setRequestProperties in class ControllerCommandImpl
Throws:
ECException

performExecute

public void performExecute()
                    throws ECException
This method contains the main business logic of this command. It will generate a unique filename and uploaded tthe file
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException

performAccessCheck

public boolean performAccessCheck()
your own access control check performAccessCheck
Specified by:
performAccessCheck in interface AttachmentViewCmd
Returns:
boolean

Feedback