com.ibm.commerce.command
Class AttachmentUploadCmdImpl
java.lang.Object
CacheableCommandImpl
com.ibm.commerce.command.AbstractECTargetableCommand
com.ibm.commerce.command.ControllerCommandImpl
com.ibm.commerce.command.UploadToStreamCmdImpl
com.ibm.commerce.command.AttachmentUploadCmdImpl
- All Implemented Interfaces:
- AccCommand, AttachmentUploadCmd, ControllerCommand, ECCommand, ECTargetableCommand, Protectable, UploadToStreamCmd
- Direct Known Subclasses:
- RFQAttachmentReplaceCmdImpl, RFQAttachmentUploadCmdImpl, RFQPattributeAttachmentAddCmdImpl, RFQResponseAttachmentUploadCmdImpl, RFQResponsePattributeAttachmentAddCmdImpl
- public class AttachmentUploadCmdImpl
- extends UploadToStreamCmdImpl
- implements AttachmentUploadCmd
The AttachmentUpload will upload File to an inputstream first and then store it into the database as BLOBs in the attachment table Note that this is not registered in URLREG, AttachmentUploadCmd is not intended to be used directly , it should be extended by other commands. Note that if the uploaded file is a jar/zip we will not check if the jar or zip contains any files that have file extensions that are not supported. No access control policies or check is set up for the AttachmentuploadCmd You should implement your own access control check In the jsp, you should use PoST method when invoke your own upload command which extends this command Note that the usage will be set to "DEFAULT" You should set it to your desired usage as long as the usage is defined in the ATTACHUSG table The persistDB flag is to indicate whether you only want to store upload file in database. If persistDB is true and filesizeis bigger than blob size in database exception will be thrown if persistDB is false, that means user do not limit only storing in database. if filesize is smaller than blob size is in database, we will store in database if the filesize is bigger than the blob size in the database , instead of persisting in the database, we will store it in the file system the location of the file will be stored in the attachmenturl field in the attachment table the default location will be the $wcsstores\web-inf\storename\
- See Also:
- Serialized Form
Method Summary |
java.lang.Long |
getAttachmentId()
Gets the attachmentobj_id of the attachment object in database table |
java.lang.String |
getAttachusg_id()
Gets the attachusg_id |
void |
performExecute()
This method contains the main business logic of this command. |
void |
setAttachusg_id(java.lang.String attachusg_id)
Sets the attachusg_id |
void |
setPersistDB(boolean flag)
Sets if you want to persist the attachment stream in database table as BLOB The default will be to persist the attachment into database as BLOB |
void |
setRequestProperties(TypedProperty reqParms)
Sets the request properties. |
Methods inherited from class com.ibm.commerce.command.UploadToStreamCmdImpl |
getAttachmentOwner, getAttachmentStream, getContentType, getErrorURL, getFileExtension, getFileName_NoExt, getFileName, getFileSize, getRootPath, getStoreName, getUrl, setErrorURL, setRefCmd, setRootPath, setUrl, validateParameters |
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 |
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.ECCommand |
checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters |
AttachmentUploadCmdImpl
public AttachmentUploadCmdImpl()
getAttachmentId
public java.lang.Long getAttachmentId()
- Gets the attachmentobj_id of the attachment object in database table
-
- Specified by:
- getAttachmentId in interface AttachmentUploadCmd
-
- Returns:
- Long attachmentobj_id
setPersistDB
public void setPersistDB(boolean flag)
- Sets if you want to persist the attachment stream in database table as BLOB The default will be to persist the attachment into database as BLOB
-
- Specified by:
- setPersistDB in interface AttachmentUploadCmd
setRequestProperties
public void setRequestProperties(TypedProperty reqParms)
throws ECException
- Description copied from interface: ControllerCommand
- Sets the request properties. The WebController calls this method before invoking the execute method in this command to set the request properties for this command. It is the responsibility of the implementer of the ControllerCommand to extract the required input parameters from the request properties and perform parameter checking.
-
- Specified by:
- setRequestProperties in interface ControllerCommand
- Overrides:
- setRequestProperties in class UploadToStreamCmdImpl
-
- Throws:
- ECException
- See Also:
- ContollerCommand#setRequestProperties()
performExecute
public void performExecute()
throws ECException
- This method contains the main business logic of this command. It will generate a unique temporary filename as the attachmentURL (which is the unique index) and uploaded the file as BLOB into database. Once the the attachment entry is created into database , the attachmentobj_id will be generated and we will use the attachmentobj_id as the attachmenturl -- in this way, you will know that the actual attachment is stored in database and not anywhere else on file system.
-
- Specified by:
- performExecute in interface ECCommand
- Overrides:
- performExecute in class UploadToStreamCmdImpl
-
- Throws:
- ECException
- See Also:
- ControllerComand#performExecute
getAttachusg_id
public java.lang.String getAttachusg_id()
- Gets the attachusg_id
-
- Returns:
- Returns a String
setAttachusg_id
public void setAttachusg_id(java.lang.String attachusg_id)
- Sets the attachusg_id
-
- Parameters:
- attachusg_id - The attachusg_id to set
Feedback
(C) Copyright IBM Corporation 1996, 2005. All Rights Reserved.