Class AttachmentUploadCmdImpl

  • All Implemented Interfaces:
    AccCommand, AttachmentUploadCmd, ControllerCommand, ECCommand, ECTargetableCommand, UploadToStreamCmd, Protectable,,,,,,
    Direct Known Subclasses:
    RFQAttachmentReplaceCmdImpl, RFQAttachmentUploadCmdImpl, RFQPattributeAttachmentAddCmdImpl, RFQResponseAttachmentUploadCmdImpl, RFQResponsePattributeAttachmentAddCmdImpl

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

    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\

    See Also:
    Serialized Form
    • Constructor Detail

      • AttachmentUploadCmdImpl

        public AttachmentUploadCmdImpl()
    • Method Detail

      • getAttachmentId

        public java.lang.Long getAttachmentId()
        This method gets the attachmentobj_id of the attachment object from the database table.
        Specified by:
        getAttachmentId in interface AttachmentUploadCmd
        This method returns the attachmentobj_id as a Long object.
      • setPersistDB

        public 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. The default is true.
        Specified by:
        setPersistDB in interface AttachmentUploadCmd
        flag - This is the flag represented as a boolean value.
      • performExecute

        public void performExecute()
                            throws ECException
        This method defines the business logic for this command. It will generate a unique temporary file name as the 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.
        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface
        performExecute in class UploadToStreamCmdImpl
        See Also:
      • getAttachusg_id

        public java.lang.String getAttachusg_id()
        This method gets attachusg_id.
        This method returns the attachusg_id as a String object.
      • setAttachusg_id

        public void setAttachusg_id(java.lang.String attachusg_id)
        This method sets attachusg_id.
        attachusg_id - This is the value of attachusg_id to set.