public class TempUploadCmdImpl extends ControllerCommandImpl implements TempUploadCmd
This class will upload file to a file system with a unique generated filename.
Note that this is not registered in the URL configuration or the command
configuration. This class is not intended to be used directly. It should be extended by other commands.
The file path to be uploaded is $wcsstore\storename\filepath. $wcsstore
is defined in instance configuration file. storename is based on the store_id
retrieved from the command context, that is, the store that you logon to. filepath
is user input.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
COPYRIGHT
IBM Copyright notice field.
|
defaultCommandClassName| Constructor and Description |
|---|
TempUploadCmdImpl() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
constructFileString()
This method constructs the
attachmenturl |
long |
getAttachmentOwner()
This method gets the creator of the uploaded attachment, that is, the user who logs on to the store.
|
java.lang.String |
getAttachmentURL()
This method gets the
attachmenturl of the uploaded file. |
java.lang.String |
getErrorURL()
This method gets the
errorURL where the user should be redirected when an error occurs
during upload. |
java.lang.String |
getFileName()
This method gets the
fileName of the uploaded file. |
java.lang.String |
getFilePath()
This method gets the file path (after the predefined path) of the attachment to be uploaded.
|
long |
getFileSize()
This method gets the
filesize of the uploaded file. |
java.lang.String |
getRename()
This method gets the new name that the user wishes to assign to the uploaded file (the "rename").
|
java.lang.String |
getRootPath()
This method gets the
rootPath where the file should be uploaded. |
java.lang.String |
getStoreName()
This method gets the
storeName from the command context. |
java.lang.String |
getUrl()
This method gets the
URL to be returned when the upload is completed. |
void |
performExecute()
This method contains the main business logic of this command.
|
void |
setErrorURL(java.lang.String errorURL)
This method sets the errorURL to be forwarded when an error occurs during upload.
|
void |
setFilePath(java.lang.String path)
This method sets the subdirectories (after the predefined path) of the attachment to be uploaded.
|
void |
setRefCmd(java.lang.String name)
This method sets the
refcmd of the command which extends the base TempUpload. |
void |
setRename(java.lang.String name)
This method sets the new name that the user wishes to assign to the uploaded file (the "rename").
|
void |
setRequestProperties(TypedProperty reqParms)
This method sets the request properties.
|
void |
setRootPath(java.lang.String path)
This method sets the
rootPath where the file should be uploaded. |
void |
setUrl(java.lang.String returnURL)
This method sets the
URL to be returned/redirected when the upload is completed. |
void |
validateParameters()
This method checks the validity of the parameters.
|
checkPermission, fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResourceOwners, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputPropertiesaccessControlCheck, checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getObjectSize, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultPropertiesexecuteFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, setObjectSize, unionDependencies, updateCachegetCommandTarget, getCommandTargetName, getTargetPolicy, hasOutputProperties, setCommandTarget, setCommandTargetName, setHasOutputProperties, setOutputProperties, setTargetPolicyequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcheckPermission, execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRetriable, setViewInputPropertiesexecuteFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, updateCachegetCommandTarget, getCommandTargetName, hasOutputProperties, setCommandTarget, setCommandTargetName, setOutputPropertiesaccessControlCheck, getAccCheck, getForUserId, getResourceOwners, setAccCheck, setForUserId, setOwnercheckIsAllowed, checkResourcePermission, createCommandExecutionEvent, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultPropertiesfulfills, getOwnerpublic static final java.lang.String COPYRIGHT
public java.lang.String getAttachmentURL()
attachmenturl of the uploaded file.getAttachmentURL in interface TempUploadCmdString that represents the attachmenturl.public void setErrorURL(java.lang.String errorURL)
A - String that represents the errorURL.public void setFilePath(java.lang.String path)
rootpath\storename.
For example,
if xml file
rootpath= drive:\WebSphere\AppServer\InstalledApps\wcsstores.war\xml
else
rootpath=drive:\WebSphere\AppServer\InstalledApps\wcsstores.war\
A - String that represents the file path.public java.lang.String getFilePath()
String that represents the file path.public void setRefCmd(java.lang.String name)
refcmd of the command which extends the base TempUpload.
The refcmd should match the command name in attachment configuration in the
<instance_name>.xml file. It should also be the commandName in the
command context, that is, the URL command that extends tempUploadCmd.name - A String that represents the component command name.public void setRename(java.lang.String name)
name - A String that represents the rename.public void setUrl(java.lang.String returnURL)
URL to be returned/redirected when the upload is completed.name - A String that represents the returnURL.public java.lang.String getRename()
String that represents the returnURL.public void setRootPath(java.lang.String path)
rootPath where the file should be uploaded.path - A String that represents the rootpath.public java.lang.String getRootPath()
rootPath where the file should be uploaded.String that represents the rootpath.public java.lang.String getStoreName()
storeName from the command context.String that represents the storeName.public java.lang.String getFileName()
fileName of the uploaded file.getFileName in interface TempUploadCmdString that represents the fileName.public java.lang.String getUrl()
URL to be returned when the upload is completed.getUrl in interface TempUploadCmdString that represents the URL.public java.lang.String getErrorURL()
errorURL where the user should be redirected when an error occurs
during upload.String that represents the errorURL.public long getFileSize()
filesize of the uploaded file.getFileSize in interface TempUploadCmdlong value that represents the size of the uploaded file.public long getAttachmentOwner()
getAttachmentOwner in interface TempUploadCmdlong value that represents the owner_id of the user who uploads
the attachment.public void setRequestProperties(TypedProperty reqParms) throws ECException
refcmd,
filepath, rename, filename, and errorURL.
This method gets the user_id and store_id from the command context
It gets the configurable parameters maxuploadsize, viruscheck and the
supportedfile extension from <instance_name>.xml based on
refcmd.setRequestProperties in interface ControllerCommandsetRequestProperties in class ControllerCommandImplreqParms - The request parameters.ECExceptionControllerComand#performExecutepublic void validateParameters()
throws ECException
validateParameters in interface ECCommandvalidateParameters in class AbstractECTargetableCommandECException -
Thrown with the message ECMessage._ERR_UPLOAD_MISSING_REFCMD when refcmd is missing from the <instance_name>.xml file attachment configuration section.
Thrown with the message ECMessage._ERR_UPLOAD_FILECONTENTTYPE_NOTALLOWED when the contenttype of the upload file does not match the file extension.
Thrown with the message ECMessage._ERR_UPLOAD_FILETYPE_NOTALLOWED when the file type is not contained in supportedfileextension as specified in the attachment configuration.
Thrown with the message ECMessage._ERR_UPLOAD_FILESIZE_TOOBIG when the filesize exceeds the maximum allowable size in the attachment configuration section of the <instance_name>.xml file.
public java.lang.String constructFileString()
attachmenturl.String that represents the attachmenturl of the uploaded file.public void performExecute()
throws ECException
performExecute in interface ECCommandperformExecute in interface com.ibm.websphere.command.TargetableCommandperformExecute in class AbstractECTargetableCommandECExceptionECComand#performExecute