com.ibm.commerce.marketing.commands

Class CouponAddRemoveControllerCmdImpl

  • All Implemented Interfaces:
    AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, CouponAddRemoveControllerCmd, 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 CouponAddRemoveControllerCmdImpl
    extends ControllerCommandImpl
    implements CouponAddRemoveControllerCmd

    This Controller Command adds or removes a Coupon from an Order or deletes a Coupon. It implements CouponAddRemoveControllerCmd interface. This command is mapped to CouponsAddRemove URL.

    If the command is executed as a url Command the following URL parameters must be set

    • couponId (Coupon's Id. If more than one CouponId needs to be specified they should be separated by a , )
    • orderId (The id of the order to which Coupon should be added to or removed from)
    • taskType (The task type. A for adding the Coupon to Order, R for removing Coupon from Order, D for deleting the Coupon.)

    Optionally the following url parameters can be set

    • URL (URL to which the request should be redirected after the command is successfuly executed)
    • VIEW (VIEW to which the request should be forwarded after the command is successfuly executed)
    • userIdentifier (If for guest shopper we need to set a token which uniquely identifies her/him)
              Note: If both URL & VIEW parameters are specified, the request will be redirected to URL. 
     If both are not specified the request will be forwarded to CouponsDisplayView.
     

    If executing this Command as a task Command, the methods listed below must be invoked before calling the command

                    setCouponIds
                    setURL or setViewName
                    setTaskType
                    setOrderId
     

    Optionally the following methods can be invoked

                    setUserIdentifier  (If for guest shopper we need to set a token which 
                                                             uniquely identifies her/him)
     
    See Also:
    Serialized Form
    • Constructor Detail

      • CouponAddRemoveControllerCmdImpl

        public CouponAddRemoveControllerCmdImpl()
        Constructor
    • Method Detail

      • setUserIdentifier

        public void setUserIdentifier(java.lang.String userIdentifier)
        This method sets the userIdentifier.
        Parameters:
        userIdentifier - is the userIdentifier to set.
      • setURL

        public void setURL(java.lang.String url)
        This method sets the redirect URL
        Parameters:
        url - is the redirect URL
      • setTaskType

        public void setTaskType(java.lang.String taskType)
        This method sets the taskType. taskType should be A for adding Coupon to order or R for removing Coupon from order or D for deleting the Coupon.
        Parameters:
        taskType - is the task type to set.
      • setOrderId

        public void setOrderId(java.lang.Long orderId)
        This method sets the orderId for which the Coupon should be added or removed.
        Parameters:
        orderId - is the order id to set.
      • setCouponIds

        public void setCouponIds(java.util.Vector couponIds)
        This method sets the list of CouponId that should be added or removed.
        Parameters:
        couponIds - is the list of couponId.
      • setViewName

        public void setViewName(java.lang.String viewName)
        This method sets the view name.
        Parameters:
        viewName - is the view name to set.
      • getViewName

        public java.lang.String getViewName()
        This methods returns the View Name.
        Returns:
        java.lang.String gets the View Name.
      • getUserIdentifier

        public java.lang.String getUserIdentifier()
        This method gets the userIdentifier.
        Returns:
        java.lang.String gets the userIdentifier.
      • getURL

        public java.lang.String getURL()
        This method gets the redirect URL
        Returns:
        java.lang.String gets the redirect URL
      • getTaskType

        public java.lang.String getTaskType()
        This method gets the task type. Possible values include A for adding Coupon to order or R for removing Coupon from order or D for deleting the Coupon.
        Returns:
        Returns the task type.
      • getOrderId

        public java.lang.Long getOrderId()
        This method gets the order ID for which the Coupon should be added or removed.
        Returns:
        java.lang.Long gets the order ID for which the Coupon should be added or removed.
      • getCouponIds

        public java.util.Vector getCouponIds()
        This method gets the list of CouponId.
        Returns:
        java.util.Vector a list of couponId to get.
      • performExecute

        public void performExecute()
                            throws ECSystemException,
                                   ECException
        Command execution body for performing different tasks depending upon the task type. Possible values of the task types include A for adding Coupon to order or R for removing Coupon from order or D for deleting the Coupon.
        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class AbstractECTargetableCommand
        Throws:
        ECSystemException - when a system exception is encountered.
        ECException - when a general exception is encountered.