com.ibm.commerce.attachment.commands

Class AttachmentDeleteCmdImpl

  • All Implemented Interfaces:
    AttachmentDeleteCmd, AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, Protectable, com.ibm.websphere.cache.Sizeable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command, com.ibm.websphere.command.CommandCaller, com.ibm.websphere.command.TargetableCommand, java.io.Serializable


    public class AttachmentDeleteCmdImpl
    extends ControllerCommandImpl
    implements AttachmentDeleteCmd
    The AttachmentDeleteCmd is a URL and controller command that:
    • Deletes an Attachment Target.
    • Deletes the related Target Descriptions.
    • Deletes the related Attachment Assets for the Attachment Target.
    • Deletes the related Attachment Asset Languages for each Attachment Asset in the deleted Attachment Target
    Parameters:
    • Attachment Target ID
    • Store Entity ID
    • Attachment Target Identifier
    • Attachment Asset Path
    • Attachment Asset Id
    • Member Id for the Attachment Target
    • Attachment Assets for delete
    • deleteAssetsOnly flag (flag to indicate if this operation is for deleting the Attachment Assets only)
    Behaviour: When this command is called through URL:
    • Only 1 attachment asset can be deleted from the Attachment Target.
    • If the attachment asset ID or the attachment asset path is not null, only the asset and its asset languages will be deleted. If both attachment asset ID and attachment asset path are null, then the attachment target and everything under it will be deleted. This included the attachment target, its related target descriptions, all the related assets and all the related assets descriptions.
    When this command is called as a command,:
    • If the deleteAssetsOnly flag is set to true, then the vector of AttachmentAssetDataBean will be used for the delete command. This will deletes the list of attachment assets from the attachment target. All the attachment assets languages related to the deleted assets will also be deleted. The deleteAssetsOnly flag can be set to true by calling the method setDeleteAssetsOnly(true).
    • For each attachment asset data bean in the vector of AttachmentAssetDataBean for delete.
      • If the attachment asset ID is found, it will be used.
      • If the attachment asset ID is not found:
        • If the store entity ID is found in the attachment asset databean, it will be used. Otherwise the store entity ID from the instance variable will be used.
        • If the attachment target ID is found in the attachment asset databean, it must be the same as the attachment target ID in the instance variable.
        • If the attachment asset path is null, an exception will be thrown.
        • The store entity ID, the attachment target ID, and the attachment asset path are used together to obtain the attachment asset ID.
      The attachment asset ID found from above will be used to call the deleteAttachmentAsset to delete the attachment asset. If the attachment asset ID is still not found. A message will be put into the log and continue.
    • If the deleteAssetsOnly flag is set as false, this command will delete the attachment target and everything under it. This includes the attachment target, the related target descriptions, all the related assets and all the related assets descriptions.
    • If the attachment target ID is not specified, then it will use the identifier, store entity ID, and member ID to find the attachment target.
      • If the store entity ID is not specified, then it will be obtained from the command context store ID.
      • If the member ID is not specified, then it will be set as the owner ID of the store.
      • If the identifier is not specified, an exception will be thrown.
    • By default, the deleteAssetsOnly flag is set as false.
    Access Bean:
    • AttachmentTargetAccessBean
    Helper:
    • AttachmentTargetHelper
    See Also:
    Serialized Form
    • Field Detail

      • CLASSNAME

        public static final java.lang.String CLASSNAME
        Define the CLASSNAME.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AttachmentDeleteCmdImpl

        public AttachmentDeleteCmdImpl()
    • Method Detail

      • getAttachmentTargetId

        public java.lang.Long getAttachmentTargetId()
        Gets the attachment target ID.
        Specified by:
        getAttachmentTargetId in interface AttachmentDeleteCmd
        Returns:
        The attachment target ID
      • getStoreentId

        public java.lang.Integer getStoreentId()
        Gets the store entity ID.
        Specified by:
        getStoreentId in interface AttachmentDeleteCmd
        Returns:
        The store entity ID
      • getMemberId

        public java.lang.Long getMemberId()
        Gets the owner of the attachment target.
        Specified by:
        getMemberId in interface AttachmentDeleteCmd
        Returns:
        The owner ID of the attachment target
      • getIdentifier

        public java.lang.String getIdentifier()
        Gets the identifier of the attachment target
        Specified by:
        getIdentifier in interface AttachmentDeleteCmd
        Returns:
        The attachment target identifier
      • setAttachmentTargetId

        public void setAttachmentTargetId(java.lang.Long anAttachmentTargetId)
        Sets the attachment target ID for the attachment target to be deleted.
        Specified by:
        setAttachmentTargetId in interface AttachmentDeleteCmd
        Parameters:
        anAttachmentTargetId - The attachment target ID
      • setStoreentId

        public void setStoreentId(java.lang.Integer anStoreentId)
        Sets the store entity ID.
        Specified by:
        setStoreentId in interface AttachmentDeleteCmd
        Parameters:
        anStoreentId - The store entity ID
      • setAttachmentAssetsForDelete

        public void setAttachmentAssetsForDelete(java.util.Vector avAttachmentAssetDataBeansForDelete)
        Sets the vector of AttachmentAssetDataBean as the attachment assets to be deleted from the attachment target.
        Specified by:
        setAttachmentAssetsForDelete in interface AttachmentDeleteCmd
        Parameters:
        avAttachmentAssetDataBeansForDelete - The list of AttachmentAssetDataBean as the attachment assets for delete.
      • setDeleteAssetsOnly

        public void setDeleteAssetsOnly(boolean abFlag)
        Sets the flag to indicate that it will only deletes the assets indicated but not the target.
        Specified by:
        setDeleteAssetsOnly in interface AttachmentDeleteCmd
        Parameters:
        abFlag - the value of the flag.
      • setURL

        public void setURL(java.lang.String astrURL)
        Sets the redirect URL.
        Specified by:
        setURL in interface AttachmentDeleteCmd
        Parameters:
        astrURL - The redirect URL
      • setIdentifier

        public void setIdentifier(java.lang.String astrIdentifier)
        Sets the identifier of the attachment target.
        Specified by:
        setIdentifier in interface AttachmentDeleteCmd
        Parameters:
        astrIdentifier - The attachment target identifier
      • setMemberId

        public void setMemberId(java.lang.Long anMemberId)
        Sets the owner ID of the attachment target.
        Specified by:
        setMemberId in interface AttachmentDeleteCmd
        Parameters:
        anMemberId - The owner of the attachment target
      • reset

        public void reset()
        Resets all the parameters
        Specified by:
        reset in interface com.ibm.websphere.command.Command
        Overrides:
        reset in class AbstractECTargetableCommand
      • performExecute

        public void performExecute()
                            throws ECException
        Deletes the attachment relations related to the attachment target. It also deletes the attachment target, attachment target descriptions, attachment assets, and attachment asset languages.
        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class AbstractECTargetableCommand
        Throws:
        ECException