com.ibm.commerce.command
Interface AttachmentUploadCmd

All Superinterfaces:
AccCommand, ControllerCommand, ECCommand, UploadToStreamCmd
All Known Subinterfaces:
RFQAttachmentReplaceCmd, RFQAttachmentUploadCmd, RFQPattributeAttachmentAddCmd, RFQResponseAttachmentUploadCmd, RFQResponsePattributeAttachmentAddCmd
All Known Implementing Classes:
AttachmentUploadCmdImpl, RFQAttachmentReplaceCmdImpl, RFQAttachmentUploadCmdImpl, RFQPattributeAttachmentAddCmdImpl, RFQResponseAttachmentUploadCmdImpl, RFQResponsePattributeAttachmentAddCmdImpl

public interface AttachmentUploadCmd
extends UploadToStreamCmd

AttachmentUpload will upload file to an inputstream first and then store it into the database as BLOBs in the attachment table Note that this command 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.

To write your command which extend AttachmentUploadCmd, requires setting up 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>

Returns the attachement identifier to retrieve the attachment (attachment_id).


Field Summary
static java.lang.String COPYRIGHT
          IBM copyright notice field
static java.lang.String defaultCommandClassName
          default class name
 
Method Summary
 java.lang.Long getAttachmentId()
          Gets the id of the attachment object in database
 long getAttachmentOwner()
          Gets the owner_id of the creator of the uploaded attachment.
 long getFileSize()
          Gets the filesize if the uploaded file .
 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
 
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.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, getResources, getStoreId, getUser, getUserId, performExecute, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
 

Field Detail
public static final java.lang.String COPYRIGHT
IBM copyright notice field
See Also:
Constant Field Values

defaultCommandClassName

public static final java.lang.String defaultCommandClassName
default class name
See Also:
Constant Field Values
Method Detail

getAttachmentOwner

public long getAttachmentOwner()
Gets the owner_id of the creator of the uploaded attachment. the owner is the one who logs into the store and perform the commmand.
Specified by:
getAttachmentOwner in interface UploadToStreamCmd
Returns:
owner_id

getFileSize

public long getFileSize()
Gets the filesize if the uploaded file .
Specified by:
getFileSize in interface UploadToStreamCmd
Returns:
filesize

getAttachmentId

public java.lang.Long getAttachmentId()
Gets the id of the attachment object in database
Returns:
Long attachment_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