com.ibm.commerce.command
Interface AttachmentUploadCmd
-
- All Superinterfaces:
- AccCommand, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command, com.ibm.websphere.command.CommandCaller, ControllerCommand, ECCommand, Protectable, java.io.Serializable, com.ibm.websphere.command.TargetableCommand, UploadToStreamCmd
- All Known Subinterfaces:
- RFQAttachmentReplaceCmd, RFQAttachmentUploadCmd, RFQPattributeAttachmentAddCmd, RFQResponseAttachmentUploadCmd, RFQResponsePattributeAttachmentAddCmd
- All Known Implementing Classes:
- AttachmentUploadCmdImpl, RFQAttachmentReplaceCmdImpl, RFQAttachmentUploadCmdImpl, RFQPattributeAttachmentAddCmdImpl, RFQResponseAttachmentUploadCmdImpl, RFQResponsePattributeAttachmentAddCmdImpl
public interface AttachmentUploadCmd extends UploadToStreamCmd
This class will upload a file to an input stream and then store it in the database as
BLOBs
in the attachment table. Note that this command is not registered in theURL
configuration.AttachmentUploadCmd
is not intended to be used directly. It should be extended by other commands. If the uploaded file is aJAR
orZIP
file, the system will not verify whether theJAR
orZIP
file contains unsupported file types or file name extensions.Writing a command that extends
AttachmentUploadCmd
requires setting up the attachment configuration section in the instance file:<Attachment display="false" maxuploadsize="100000000"> <Command maxuploadsize="1000000" name="MyUploadCmd" supportedFileExtension="gif,jpg" uploadReturnURL_enabled="false" viruscheck="no" /> </Attachment>
name = MyUploadCmd
: This is the command name that extends theTempUploadCmd
. This must be the command name that is retrieved from the command context.maxuploadsize
: This is the maximum allowable upload size forMyUploadCmd
. It must be less than the sitemaxuploadsize
.supportedFileExtension
: This is the file extension that is allowed to be uploaded.uploadReturnURL_enabled
: This indicates to return to theURL
when command is completed. The command writers' own commands should set the response properties and handle the returns according to their requirements.virusCheck
: This indicates whethervirusCheck
should be enabled. Virus checking is not provided by default.
This class returns the attachment identifier to retrieve the attachment (
attachment_id
).
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.String
COPYRIGHT
IBM copyright notice fieldstatic java.lang.String
defaultCommandClassName
This is the default class name.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description java.lang.Long
getAttachmentId()
This method gets the id of the attachment object in database.long
getAttachmentOwner()
This method gets the owner id of the creator of the uploaded attachment.long
getFileSize()
This method gets the file size of the uploaded file .void
setPersistDB(boolean flag)
This method sets whether the attachment stream should be persisted in the database table asBLOB
.-
Methods inherited from interface com.ibm.commerce.command.UploadToStreamCmd
getAttachmentStream, getFileName, getUrl
-
Methods inherited from interface com.ibm.commerce.command.ControllerCommand
checkPermission, execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRequestProperties, setRetriable, setViewInputProperties
-
Methods inherited from interface com.ibm.websphere.command.CacheableCommand
executeFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, updateCache
-
Methods inherited from interface com.ibm.websphere.command.TargetableCommand
getCommandTarget, getCommandTargetName, hasOutputProperties, performExecute, setCommandTarget, setCommandTargetName, setOutputProperties
-
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, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, performExecute, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
-
Methods inherited from interface com.ibm.commerce.security.Protectable
fulfills, getOwner
-
-
-
-
Field Detail
-
COPYRIGHT
static final java.lang.String COPYRIGHT
IBM copyright notice field- See Also:
- Constant Field Values
-
defaultCommandClassName
static final java.lang.String defaultCommandClassName
This is the default class name.- See Also:
- Constant Field Values
-
-
Method Detail
-
getAttachmentOwner
long getAttachmentOwner()
This method gets the owner id of the creator of the uploaded attachment. The owner is the one who logs into the store and performs the command.- Specified by:
getAttachmentOwner
in interfaceUploadToStreamCmd
- Returns:
- This method returns the owner id.
-
getFileSize
long getFileSize()
This method gets the file size of the uploaded file .- Specified by:
getFileSize
in interfaceUploadToStreamCmd
- Returns:
- This method returns the size of the file.
-
getAttachmentId
java.lang.Long getAttachmentId()
This method gets the id of the attachment object in database.- Returns:
- This method returns the
attachment_id
as aLong
object.
-
setPersistDB
void setPersistDB(boolean flag)
This method sets whether the attachment stream should be persisted in the database table asBLOB
. The default behavior will be to persist the attachment into database asBLOB
.- Parameters:
flag
- This is aboolean
value that represents the flag;true
if the attachment stream should be persisted andfalse
otherwise.
-
-