com.ibm.commerce.fulfillment.beans

Class OrderItemShippingModeListDataBean

  • All Implemented Interfaces:
    DataBean, InputDataBean, SmartDataBean, Delegator, java.io.Serializable


    public class OrderItemShippingModeListDataBean
    extends SmartDataBeanImpl
    implements SmartDataBean, Delegator

    This OrderItemShippingModeListDataBean databean filters the allowable shipping modes and gives the estimated shipping charge for the given orderItems.

    Inputs:

    • Alternative parameter orderItemId sets one orderItem to the databean.
    • Alternative parameter orderItemIds sets a list of orderItems to the databean.
    • Optional parameter allowableShippingModeIds sets a list of allowable shipping modes to the databean. If this parameter is not set, the databean retrieves the union of allowable shipping modes for each passed orderItem.
    • If the calculateShippingCharge is set to true, it gives the estimated shipping charge for each shipping mode.
    • If the resolveFulfillmentCenter is set to true, it resolves the fulfillment centers for the orderItems before calculating shipping charge.
    • If the calculateShippingAdjustment is set to true, the returned estimated shipping charge includes shipping promotions and shipping adjustments.
    • If the checkAppliedItems is true in default. If you do not want to filter non-applicable shipping modes, set this flag to false. But ordinarily, users do not need to care about this flag.

    Output:
    Use shippingModes to get a list of filtered shipping mode databeans.
    Use shippingCharges to get a list of estimated shipping charges for each shipping mode.

    JSP usage example:

            <c:remove var="orderItemShippingModeList"/>
            <wcbase:useBean id="orderItemShippingModeList" classname="com.ibm.commerce.fulfillment.beans.OrderItemShippingModeListDataBean">
                    <c:set target="${orderItemShippingModeList}" property="orderItemIds" value="${orderItemIds}"/>
                    <c:set target="${orderItemShippingModeList}" property="resolveFulfillmentCenter" value="true"/>
                    <c:set target="${orderItemShippingModeList}" property="calculateShippingCharge" value="true"/>
                    <c:set target="${orderItemShippingModeList}" property="calculateShippingAdjustment" value="true"/>
            </wcbase:useBean>
     
            <table>
            <tr>
                    <th>Shipping Mode ID</th>
                    <th>Shipping Mode Description</th>
                    <th>Shipping Charge</th>
            </tr>
            <c:forEach items="${orderItemShippingModeList.shippingModes}" var="shippingMode" varStatus="status">
                    <tr>
                            <td><c:out value="${shippingMode.shippingModeId}"/></td>
                            <td><c:out value="${shippingMode.description.description}"/></td>
                            <td><c:out value="${orderItemShippingModeList.shippingCharges[status.index]}"/></td>
                    </tr>     
            </c:forEach>
            </table>
            
    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        The IBM copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • OrderItemShippingModeListDataBean

        public OrderItemShippingModeListDataBean()
    • Method Detail

      • getDelegate

        public Protectable getDelegate()
                                throws java.lang.Exception
        This method gets the delegate.
        Specified by:
        getDelegate in interface Delegator
        Returns:
        The Protectable object whose access control policies will indirectly control the access control for this object
        Throws:
        java.lang.Exception
        See Also:
        Delegator.getDelegate()
      • populate

        public void populate()
                      throws java.lang.Exception

        This method populates the data bean according to the passed parameters.

        1. This method calls retrieveAllowalbeShippingModes(Item) to retrieve all allowable shipping modes for the order item.
        2. For each shipping mode allowable:
          1. If the calculateShippingCharge parameter is true:
            1. If the resolveFulfillmentCenter parameter is true, it calls #resolveFulfillmentCenter(Item) to try to resolve the fulfillment centers for the specified shipping mode and shipping address. If the resolve fulfillment center succeeds, it means this shipping mode is applicable to the order item and the shipping address.
            2. Calls the #calculateShippingCharge(Item, Integer) method to calculate the shipping charge for the orderItem using the specified shipping mode.
          2. If the calculateShippingCharge parameter is false or not indicated, returns a zero shipping charge for the specified shipping mode for the item.
        Specified by:
        populate in interface SmartDataBean
        Overrides:
        populate in class SmartDataBeanImpl
        Throws:
        java.lang.Exception
      • setOrderItemId

        public void setOrderItemId(java.lang.Long anOrderItemId)
        Sets the orderItem ID.
        Parameters:
        anOrderItemId - the orderItem ID.
      • setOrderItemIds

        public void setOrderItemIds(java.lang.Long[] aOrderItemIds)
        Sets the orderItem IDs.
        Parameters:
        aOrderItemIds - the orderItem IDs.
      • setAllowableShippingModeIds

        public void setAllowableShippingModeIds(java.lang.Integer[] anAllowableShippingModeIds)
        Sets the inAllowableShippingModeIds.
        Parameters:
        anAllowableShippingModeIds - the inAllowableShippingModeIds.
      • setCalculateShippingCharge

        public void setCalculateShippingCharge(boolean abCalculateShippingCharge)
        Sets whether to calculate the shipping charges of the shipping modes. The default value is false.
        Parameters:
        abCalculateShippingCharge - Set to true to calculate the shipping charges.
      • setCalculateShippingAdjustment

        public void setCalculateShippingAdjustment(boolean abCalculateShippingAdjustment)
        This method sets whether to calculate the shipping adjustments of the shipping modes. The default value is false.
        Parameters:
        abCalculateShippingAdjustment - true if the shipping charges are to be calculated.
      • setCheckAppliedItems

        public void setCheckAppliedItems(boolean abCheckAppliedItems)
        This method sets whether to filter shipping modes by checking applied items. The default value is true. Non-applicable shipping modes will be filtered.
        Parameters:
        abCheckAppliedItems - true if non-applicable shipping modes are to be filtered.
      • setResolveFulfillmentCenter

        public void setResolveFulfillmentCenter(boolean abResolveFulfillmentCenter)
        Sets whether to resolve a fulfillment center before calculating shipping charges. Calls either ResolveFulfillmentCenterCmdor GetEligibleFulfillmentCentersCmd. Set to true if the fulfillment center affects either the shipping mode availability or the shipping charge. The default value is false.
        Parameters:
        abResolveFulfillmentCenter - true if fulfillment center is to be resolved.
      • getShippingModes

        public ShippingModeDataBean[] getShippingModes()
        Returns the shipping modes available to the order.
        Returns:
        the available shipping modes.