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 the URL
configuration. AttachmentUploadCmd
is not
intended to be used directly. It should be extended by other commands.
If the uploaded file is a JAR
or ZIP
file, the system will not verify whether
the JAR
or ZIP
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 the
TempUploadCmd
. This must be the command name that is retrieved from the command context.maxuploadsize
: This is the maximum allowable upload size for MyUploadCmd
.
It must be less than the site maxuploadsize
.supportedFileExtension
: This is the file extension that is allowed to be uploaded.uploadReturnURL_enabled
: This indicates to return to the URL
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 whether virusCheck
should be enabled. Virus
checking is not provided by default.This class returns the attachment identifier to retrieve the attachment (attachment_id
).
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field
|
static java.lang.String |
defaultCommandClassName
This is the default class name.
|
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 as
BLOB . |
getAttachmentStream, getFileName, getUrl
checkPermission, execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRequestProperties, setRetriable, setViewInputProperties
executeFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, updateCache
getCommandTarget, getCommandTargetName, hasOutputProperties, performExecute, setCommandTarget, setCommandTargetName, setOutputProperties
accessControlCheck, getAccCheck, getForUserId, getResourceOwners, setAccCheck, setForUserId, setOwner
checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, performExecute, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
fulfills, getOwner
static final java.lang.String COPYRIGHT
static final java.lang.String defaultCommandClassName
long getAttachmentOwner()
getAttachmentOwner
in interface UploadToStreamCmd
long getFileSize()
getFileSize
in interface UploadToStreamCmd
java.lang.Long getAttachmentId()
attachment_id
as a Long
object.void setPersistDB(boolean flag)
BLOB
. The default behavior will be to persist the attachment into database as
BLOB
.flag
- This is a boolean
value that represents the flag; true
if the
attachment stream should be persisted and false
otherwise.