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.
Constructor and Description |
---|
CopyAttachmentCmdImpl() |
Modifier and Type | Method and Description |
---|---|
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.
|
protected byte[] | getBinaryStream()
This method gets the BinaryStream of the attachment object from database table.
|
java.lang.Long | getOrg_attachmentobj_id()
This method gets the org_attachmentobj_id.
|
boolean | performAccessCheck()
This method performs access control checking to control who can view the attachment.
|
void | performExecute()
This method contains the main business logic of this command.
|
void | setOrg_attachmentobj_id(java.lang.Long org_attachmentobj_id)
This method sets the org_attachmentobj_id.
|
public java.lang.Long getAttachmentId()
protected byte[] getBinaryStream()
public void performExecute() throws ECException
public boolean performAccessCheck()
public java.lang.Long getOrg_attachmentobj_id()
public void setOrg_attachmentobj_id(java.lang.Long org_attachmentobj_id)