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 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).

    • 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 interface UploadToStreamCmd
        Returns:
        This method returns the owner id.
      • getFileSize

        long getFileSize()
        This method gets the file size of the uploaded file .
        Specified by:
        getFileSize in interface UploadToStreamCmd
        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 a Long object.
      • setPersistDB

        void setPersistDB(boolean flag)
        This method sets whether the attachment stream should be persisted in the database table as BLOB. The default behavior will be to persist the attachment into database as BLOB.
        Parameters:
        flag - This is a boolean value that represents the flag; true if the attachment stream should be persisted and false otherwise.