com.ibm.commerce.rest.coupon.handler

Class CouponHandler

  • All Implemented Interfaces:
    DocumentedResourceHandler, IResourceHandler


    @Path(value="store/{storeId}/coupon")
     @Encoded
    public class CouponHandler
    extends com.ibm.commerce.foundation.rest.resourcehandler.AbstractClassicResourceHandler
    This class provides RESTful services to get and process coupon information. For example, deleting a coupon from the list.
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM Copyright notice field.
        See Also:
        Constant Field Values
      • RESOURCE_NAME

        public static final java.lang.String RESOURCE_NAME
        The Constant RESOURCE_NAME.
        See Also:
        Constant Field Values
      • RESOURCE_MAPPING_KEY

        public static final java.lang.String RESOURCE_MAPPING_KEY
        The Constant RESOURCE_MAPPING_KEY.
        See Also:
        Constant Field Values
      • FORMAT_GROUP_NAME

        public static final java.lang.String FORMAT_GROUP_NAME
        The constant FORMAT_GROUP_NAME
        See Also:
        Constant Field Values
    • Constructor Detail

      • CouponHandler

        public CouponHandler()
    • Method Detail

      • getResourceName

        public java.lang.String getResourceName()
        Description copied from interface: IResourceHandler
        This method returns the name of the resource used primarily to determine the representation of the resource. This class can be overridden to change the name of the resource and therefore the representation, while keeping all the methods in this class.
        Returns:
        the resource name
        See Also:
        IResourceHandler.getResourceName()
      • getHelper

        public CouponHelper getHelper()
        This method returns the BOD helper associated with the Coupon resource. This method can be override to use the extended CouponHelper for customization.
        Returns:
        CouponHelper
      • getCoupon

        @GET
         @Path(value="@self")
         @Produces(value={"application/json","application/xml","application/xhtml+xml","application/atom+xml"})
        public javax.ws.rs.core.Response getCoupon(@PathParam(value="storeId")
                                                                                                                                                                                      java.lang.String storeId,
                                                                                                                                                                                      @QueryParam(value="responseFormat")
                                                                                                                                                                                      java.lang.String responseFormat,
                                                                                                                                                                                      @QueryParam(value="pageNumber")
                                                                                                                                                                                      int pageNumber,
                                                                                                                                                                                      @QueryParam(value="pageSize")
                                                                                                                                                                                      int pageSize)
        This method returns the coupon list for the current shopper.
        Parameters:
        storeId - the store id
        responseFormat - the response format
        pageNumber - the page number.
        pageSize - the page size.
        Returns:
        a collection of coupons in the specified format.
      • deleteCouponById

        @DELETE
         @Produces(value={"application/json","application/xml","application/xhtml+xml","application/atom+xml"})
         @Path(value="{couponId}")
        public javax.ws.rs.core.Response deleteCouponById(@PathParam(value="storeId")
                                                                                                                                                                                                     java.lang.String storeId,
                                                                                                                                                                                                     @PathParam(value="couponId")
                                                                                                                                                                                                     java.lang.String couponId,
                                                                                                                                                                                                     @QueryParam(value="responseFormat")
                                                                                                                                                                                                     java.lang.String responseFormat)
        This method deletes the coupon by coupon id.
        Parameters:
        storeId - the store id.
        couponId - the coupon id.
        responseFormat - the response format.
        Returns:
        the response
      • preProcess

        public void preProcess(java.util.Map<java.lang.String,java.lang.Object> responseMap)
        This method can be used to do the pre-processing of the response map before the entity provider is invoked passing the response map.
        Specified by:
        preProcess in interface IResourceHandler
        Overrides:
        preProcess in class AbstractBaseResourceHandler
        Parameters:
        responseMap - the response map.
      • postProcess

        public void postProcess(java.util.Map<java.lang.String,java.lang.Object> responseMap)
        Method to provide post process in out of box JSON/XML entity providers after each DataObject has been converted to a Map and before constructing the REST response. In this method, it replaces the noun name WalletItem with Coupon.
        Specified by:
        postProcess in interface IResourceHandler
        Overrides:
        postProcess in class AbstractBaseResourceHandler
        Parameters:
        responseMap - The response Map after each DataObject has been converted to a Map.
      • issueCoupon

        @POST
         @Path(value="@self")
         @Produces(value={"application/json","application/xml","application/xhtml+xml","application/atom+xml"})
        public javax.ws.rs.core.Response issueCoupon(@PathParam(value="storeId")
                                                                                                                                                                                         java.lang.String storeId,
                                                                                                                                                                                         @QueryParam(value="responseFormat")
                                                                                                                                                                                         java.lang.String responseFormat)
        This method is used by shopper to self-obtain a coupon.
        Parameters:
        storeId - the store id.
        responseFormat - the response format.
        Returns:
        the response.