Class CopyAttachmentCmdImpl

  • All Implemented Interfaces:, CopyAttachmentCmd, ECCommand, ECTargetableCommand, TaskCommand,,,,,,

    public class CopyAttachmentCmdImpl
    extends TaskCommandImpl
    implements CopyAttachmentCmd

    This class makes a copy of the attachment object as specified by org_attachmentobj_id. A new attachment object will be created and the new attachment object_id will be returned. The copy made will be a field by field copy including the timecreated, timeupated and markfordelete fields. The reserved field will be copied from the original attachment object to the new attachment object.

    If the attachmentURL is the same as the org_attachment_id in the attachment table, the content of the attachment is stored in BLOB. It will be copied into the new attachment table as BLOB as well.

    If the attachmentURL is not the same as the attachment_id, the attachment is stored on the file system as specified in the attachmentURL. The file will be opened as specified in the attachmentURL in the original attachment object. A new unique file name will be generated, and the file content will be copied into the new file. The new filename will be the attachmenturl of the new attachment object.

    Note that when the attachment object is deleted during DBClean, a log of the attachmenturl will be generated if the attachment is stored on the file system. It is up to the user to delete the file.

    This class does not provide access control checking. The command writer should implement his/her own access control checking and make sure the caller is authorized to make a copy of the attachment object.

    See Also:
    Serialized Form
    • Constructor Detail

      • CopyAttachmentCmdImpl

        public CopyAttachmentCmdImpl()
    • Method Detail

      • getAttachmentId

        public java.lang.Long getAttachmentId()
        This method gets the attachmentobj_id of the attachment object in the database table that is a duplication of the original attachment.
        Specified by:
        getAttachmentId in interface CopyAttachmentCmd
        This method returns a Long object that represents the attachmentobj_id.
      • performAccessCheck

        public boolean performAccessCheck()
        This method performs access control checking to control who can view the attachment. This method should be written by the command writer.
        Specified by:
        performAccessCheck in interface CopyAttachmentCmd
        This method returns a boolean value.
      • getOrg_attachmentobj_id

        public java.lang.Long getOrg_attachmentobj_id()
        This method gets the org_attachmentobj_id.
        Specified by:
        getOrg_attachmentobj_id in interface CopyAttachmentCmd
        This method returns a Long object that represents the org_attachmentobj_id.
      • setOrg_attachmentobj_id

        public void setOrg_attachmentobj_id(java.lang.Long org_attachmentobj_id)
        This method sets the org_attachmentobj_id.
        Specified by:
        setOrg_attachmentobj_id in interface CopyAttachmentCmd
        org_attachmentobj_id - This is the org_attachmentobj_id to set