com.ibm.commerce.command
Class CopyAttachmentCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.TaskCommandImpl
                    |
                    +--com.ibm.commerce.command.CopyAttachmentCmdImpl
All Implemented Interfaces:
CopyAttachmentCmd, ECCommand, ECTargetableCommand, TaskCommand

public class CopyAttachmentCmdImpl
extends TaskCommandImpl
implements CopyAttachmentCmd

The CopyAttachmentCmdImpl will make a copy of the existing Attachment Object based on the org_attachment_id . A new attachment Object will be created and the new attachment object_id will be returned It will be a field by field copy including timecreated and timeupated as well as the markfordelete field , reserved field will be copied from the orginal attachment object to the new attachment object. The owner of the Copy attachment will be the owner-id in the command context ie.e the person who intitiate the copy. 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 attachment_id, the attachment is stored on the file system as specified in the attachmentURL.. We will open up the file as specified in AttachmentURL in orginal attachment object, generate a new unqiue file name , then copy the file content to 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, if the attachment is stored on the file system,a log of the attachmenturl will be generated. It is up to the user to go to the filesystem to delete the file.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.command. CopyAttachmentCmd
COPYRIGHT, defaultCommandClassName, NAME
 
Fields inherited from interface com.ibm.commerce.command. ECTargetableCommand
COPYRIGHT
 
Fields inherited from interface com.ibm.commerce.command. ECCommand
defaultCommandClassName
 
Constructor Summary
CopyAttachmentCmdImpl()
           
 
Method Summary
 java.lang.Long getAttachmentId()
          Gets the attachmentobj_id of the attachment object in database table
protected  byte[] getBinaryStream()
          Gets the BinaryStream of the attachment object from database table
 java.lang.Long getOrg_attachmentobj_id()
          Gets the org_attachmentobj_id
 boolean performAccessCheck()
          your own access control check performAccessCheck
 void performExecute()
          This method contains the main business logic of this command.
 void setOrg_attachmentobj_id(java.lang.Long org_attachmentobj_id)
          Sets the org_attachmentobj_id
 
Methods inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkParameters, checkResourcePermission, createCommandExecutionEvent, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CopyAttachmentCmdImpl

public CopyAttachmentCmdImpl()
Method Detail

getAttachmentId

public java.lang.Long getAttachmentId()
Gets the attachmentobj_id of the attachment object in database table
Specified by:
getAttachmentId in interface CopyAttachmentCmd
Returns:
Long attachmentobj_id

getBinaryStream

protected byte[] getBinaryStream()
Gets the BinaryStream of the attachment object from database table
Returns:
byte[] binarytream

performExecute

public void performExecute()
                    throws ECException
This method contains the main business logic of this command. It will generate a unique filename and uploaded tthe file
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException

performAccessCheck

public boolean performAccessCheck()
your own access control check performAccessCheck
Specified by:
performAccessCheck in interface CopyAttachmentCmd
Returns:
boolean

getOrg_attachmentobj_id

public java.lang.Long getOrg_attachmentobj_id()
Gets the org_attachmentobj_id
Specified by:
getOrg_attachmentobj_id in interface CopyAttachmentCmd
Returns:
Returns a Long

setOrg_attachmentobj_id

public void setOrg_attachmentobj_id(java.lang.Long org_attachmentobj_id)
Sets the org_attachmentobj_id
Specified by:
setOrg_attachmentobj_id in interface CopyAttachmentCmd
Parameters:
org_attachmentobj_id - The org_attachmentobj_id to set