public class AttachmentUploadCmdImpl extends UploadToStreamCmdImpl implements AttachmentUploadCmd
This class will upload a file to an input stream and then store it in
the database as BLOB
s 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.
No access control policies or checking is set up for the this class. Access control checking will need
to be implemented by the command writer. In the JSP
, the POST
method should be used
to invoke an upload command which extends this command.
Note that the usage will be set to "DEFAULT". It should be set to the desired usage as long as the
usage is defined in the ATTACHUSG
table. The persistDB
flag is used to indicate
whether the upload file should be stored only in the database. If persistDB
is true and
the file size is bigger than the BLOB
size in the database then an exception will be thrown.
If persistDB
is false, the upload file storage is not limited to the database.
If the file size is smaller than the BLOB
size in database, the file will be stored in the database.
If the file size is bigger than the BLOB
size in the database the file will be stored 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 $wcsstores\web-inf\storename\
defaultCommandClassName
Constructor and Description |
---|
AttachmentUploadCmdImpl() |
Modifier and Type | Method and Description |
---|---|
java.lang.Long |
getAttachmentId()
This method gets the
attachmentobj_id of the attachment object from the database table. |
java.lang.String |
getAttachusg_id()
This method gets
attachusg_id . |
void |
performExecute()
This method defines the business logic for this command.
|
void |
setAttachusg_id(java.lang.String attachusg_id)
This method sets
attachusg_id . |
void |
setPersistDB(boolean flag)
This method sets the flag that indicates whether the attachment stream should be persisted the attachment stream in the database table as
BLOB . |
void |
setRequestProperties(TypedProperty reqParms)
This method sets the request properties.
|
getAttachmentOwner, getAttachmentStream, getErrorURL, getFileName, getFileSize, getRootPath, getUrl, setErrorURL, setRefCmd, setRootPath, setUrl, validateParameters
checkPermission, fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResourceOwners, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputProperties
accessControlCheck, checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getObjectSize, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
executeFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, setObjectSize, unionDependencies, updateCache
getCommandTarget, getCommandTargetName, getTargetPolicy, hasOutputProperties, setCommandTarget, setCommandTargetName, setHasOutputProperties, setOutputProperties, setTargetPolicy
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAttachmentOwner, getFileSize
getAttachmentStream, getFileName, getUrl
checkPermission, execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRetriable, setViewInputProperties
executeFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, updateCache
getCommandTarget, getCommandTargetName, hasOutputProperties, 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, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
fulfills, getOwner
public java.lang.Long getAttachmentId()
attachmentobj_id
of the attachment object from the database table.getAttachmentId
in interface AttachmentUploadCmd
attachmentobj_id
as a Long
object.public void setPersistDB(boolean flag)
BLOB
.
The default is true.setPersistDB
in interface AttachmentUploadCmd
flag
- This is the flag represented as a boolean
value.public void setRequestProperties(TypedProperty reqParms) throws ECException
setRequestProperties(TypedProperty)
method from the superclass.setRequestProperties
in interface ControllerCommand
setRequestProperties
in class UploadToStreamCmdImpl
reqParms
- This is a TypedProperty
object that represents the request properties.ECException
ContollerCommand#setRequestProperties()
public void performExecute() throws ECException
attachmenturl
(the unique index)
and upload the file as BLOB
into database. Once the attachment entry is
created in database, the attachmentobj_id
will be generated. The attachmentobj_id
will be used as the attachmenturl
. This will indicate that the actual attachment is stored in
the database and not anywhere else on file system.performExecute
in interface ECCommand
performExecute
in interface com.ibm.websphere.command.TargetableCommand
performExecute
in class UploadToStreamCmdImpl
ECException
ControllerComand#performExecute
public java.lang.String getAttachusg_id()
attachusg_id
.attachusg_id
as a String
object.public void setAttachusg_id(java.lang.String attachusg_id)
attachusg_id
.attachusg_id
- This is the value of attachusg_id
to set.