com.liferay.portlet.shopping.util
Class ShoppingUtil

java.lang.Object
  extended by com.liferay.portlet.shopping.util.ShoppingUtil

public class ShoppingUtil
extends java.lang.Object

View Source

Author:
Brian Wing Shun Chan

Constructor Summary
ShoppingUtil()
           
 
Method Summary
static double calculateActualPrice(com.liferay.portlet.shopping.model.ShoppingItem item)
           
static double calculateActualPrice(com.liferay.portlet.shopping.model.ShoppingItem item, int count)
           
static double calculateActualPrice(com.liferay.portlet.shopping.model.ShoppingItemPrice itemPrice)
           
static double calculateActualSubtotal(java.util.List<com.liferay.portlet.shopping.model.ShoppingOrderItem> orderItems)
           
static double calculateActualSubtotal(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items)
           
static double calculateAlternativeShipping(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items, int altShipping)
           
static double calculateCouponDiscount(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items, com.liferay.portlet.shopping.model.ShoppingCoupon coupon)
           
static double calculateCouponDiscount(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items, java.lang.String stateId, com.liferay.portlet.shopping.model.ShoppingCoupon coupon)
           
static double calculateDiscountPercent(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items)
           
static double calculateDiscountPrice(com.liferay.portlet.shopping.model.ShoppingItem item)
           
static double calculateDiscountPrice(com.liferay.portlet.shopping.model.ShoppingItem item, int count)
           
static double calculateDiscountPrice(com.liferay.portlet.shopping.model.ShoppingItemPrice itemPrice)
           
static double calculateDiscountSubtotal(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items)
           
static double calculateInsurance(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items)
           
static double calculatePrice(com.liferay.portlet.shopping.model.ShoppingItem item, int count)
           
static double calculateShipping(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items)
           
static double calculateSubtotal(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items)
           
static double calculateTax(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items, java.lang.String stateId)
           
static double calculateTotal(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items, java.lang.String stateId, com.liferay.portlet.shopping.model.ShoppingCoupon coupon, int altShipping, boolean insure)
           
static double calculateTotal(com.liferay.portlet.shopping.model.ShoppingOrder order)
           
static java.lang.String getBreadcrumbs(long categoryId, javax.servlet.jsp.PageContext pageContext, javax.portlet.RenderRequest renderRequest, javax.portlet.RenderResponse renderResponse)
           
static java.lang.String getBreadcrumbs(com.liferay.portlet.shopping.model.ShoppingCategory category, javax.servlet.jsp.PageContext pageContext, javax.portlet.RenderRequest renderRequest, javax.portlet.RenderResponse renderResponse)
           
static com.liferay.portlet.shopping.model.ShoppingCart getCart(javax.portlet.PortletRequest portletRequest)
           
static com.liferay.portlet.shopping.model.ShoppingCart getCart(com.liferay.portal.theme.ThemeDisplay themeDisplay)
           
static int getFieldsQuantitiesPos(com.liferay.portlet.shopping.model.ShoppingItem item, com.liferay.portlet.shopping.model.ShoppingItemField[] itemFields, java.lang.String[] fieldsArray)
           
static java.lang.String getItemFields(java.lang.String itemId)
           
static long getItemId(java.lang.String itemId)
           
static com.liferay.portal.kernel.util.OrderByComparator getItemOrderByComparator(java.lang.String orderByCol, java.lang.String orderByType)
           
static int getMinQuantity(com.liferay.portlet.shopping.model.ShoppingItem item)
           
static java.lang.String getPayPalNotifyURL(com.liferay.portal.theme.ThemeDisplay themeDisplay)
           
static java.lang.String getPayPalRedirectURL(ShoppingPreferences preferences, com.liferay.portlet.shopping.model.ShoppingOrder order, double total, java.lang.String returnURL, java.lang.String notifyURL)
           
static java.lang.String getPayPalReturnURL(javax.portlet.PortletURL portletURL, com.liferay.portlet.shopping.model.ShoppingOrder order)
           
static java.lang.String getPpPaymentStatus(com.liferay.portlet.shopping.model.ShoppingOrder order, javax.servlet.jsp.PageContext pageContext)
           
static java.lang.String getPpPaymentStatus(java.lang.String ppPaymentStatus)
           
static boolean isInStock(com.liferay.portlet.shopping.model.ShoppingItem item)
           
static boolean isInStock(com.liferay.portlet.shopping.model.ShoppingItem item, com.liferay.portlet.shopping.model.ShoppingItemField[] itemFields, java.lang.String[] fieldsArray, java.lang.Integer orderedQuantity)
           
static boolean meetsMinOrder(ShoppingPreferences preferences, java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShoppingUtil

public ShoppingUtil()
Method Detail

calculateActualPrice

public static double calculateActualPrice(com.liferay.portlet.shopping.model.ShoppingItem item)

calculateActualPrice

public static double calculateActualPrice(com.liferay.portlet.shopping.model.ShoppingItem item,
                                          int count)
                                   throws com.liferay.portal.PortalException,
                                          com.liferay.portal.SystemException
Throws:
com.liferay.portal.PortalException
com.liferay.portal.SystemException

calculateActualPrice

public static double calculateActualPrice(com.liferay.portlet.shopping.model.ShoppingItemPrice itemPrice)

calculateActualSubtotal

public static double calculateActualSubtotal(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items)
                                      throws com.liferay.portal.PortalException,
                                             com.liferay.portal.SystemException
Throws:
com.liferay.portal.PortalException
com.liferay.portal.SystemException

calculateActualSubtotal

public static double calculateActualSubtotal(java.util.List<com.liferay.portlet.shopping.model.ShoppingOrderItem> orderItems)

calculateAlternativeShipping

public static double calculateAlternativeShipping(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items,
                                                  int altShipping)
                                           throws com.liferay.portal.PortalException,
                                                  com.liferay.portal.SystemException
Throws:
com.liferay.portal.PortalException
com.liferay.portal.SystemException

calculateCouponDiscount

public static double calculateCouponDiscount(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items,
                                             com.liferay.portlet.shopping.model.ShoppingCoupon coupon)
                                      throws com.liferay.portal.PortalException,
                                             com.liferay.portal.SystemException
Throws:
com.liferay.portal.PortalException
com.liferay.portal.SystemException

calculateCouponDiscount

public static double calculateCouponDiscount(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items,
                                             java.lang.String stateId,
                                             com.liferay.portlet.shopping.model.ShoppingCoupon coupon)
                                      throws com.liferay.portal.PortalException,
                                             com.liferay.portal.SystemException
Throws:
com.liferay.portal.PortalException
com.liferay.portal.SystemException

calculateDiscountPercent

public static double calculateDiscountPercent(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items)
                                       throws com.liferay.portal.PortalException,
                                              com.liferay.portal.SystemException
Throws:
com.liferay.portal.PortalException
com.liferay.portal.SystemException

calculateDiscountPrice

public static double calculateDiscountPrice(com.liferay.portlet.shopping.model.ShoppingItem item)

calculateDiscountPrice

public static double calculateDiscountPrice(com.liferay.portlet.shopping.model.ShoppingItem item,
                                            int count)
                                     throws com.liferay.portal.PortalException,
                                            com.liferay.portal.SystemException
Throws:
com.liferay.portal.PortalException
com.liferay.portal.SystemException

calculateDiscountPrice

public static double calculateDiscountPrice(com.liferay.portlet.shopping.model.ShoppingItemPrice itemPrice)

calculateDiscountSubtotal

public static double calculateDiscountSubtotal(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items)
                                        throws com.liferay.portal.PortalException,
                                               com.liferay.portal.SystemException
Throws:
com.liferay.portal.PortalException
com.liferay.portal.SystemException

calculateInsurance

public static double calculateInsurance(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items)
                                 throws com.liferay.portal.PortalException,
                                        com.liferay.portal.SystemException
Throws:
com.liferay.portal.PortalException
com.liferay.portal.SystemException

calculatePrice

public static double calculatePrice(com.liferay.portlet.shopping.model.ShoppingItem item,
                                    int count)
                             throws com.liferay.portal.PortalException,
                                    com.liferay.portal.SystemException
Throws:
com.liferay.portal.PortalException
com.liferay.portal.SystemException

calculateShipping

public static double calculateShipping(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items)
                                throws com.liferay.portal.PortalException,
                                       com.liferay.portal.SystemException
Throws:
com.liferay.portal.PortalException
com.liferay.portal.SystemException

calculateSubtotal

public static double calculateSubtotal(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items)
                                throws com.liferay.portal.PortalException,
                                       com.liferay.portal.SystemException
Throws:
com.liferay.portal.PortalException
com.liferay.portal.SystemException

calculateTax

public static double calculateTax(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items,
                                  java.lang.String stateId)
                           throws com.liferay.portal.PortalException,
                                  com.liferay.portal.SystemException
Throws:
com.liferay.portal.PortalException
com.liferay.portal.SystemException

calculateTotal

public static double calculateTotal(java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items,
                                    java.lang.String stateId,
                                    com.liferay.portlet.shopping.model.ShoppingCoupon coupon,
                                    int altShipping,
                                    boolean insure)
                             throws com.liferay.portal.PortalException,
                                    com.liferay.portal.SystemException
Throws:
com.liferay.portal.PortalException
com.liferay.portal.SystemException

calculateTotal

public static double calculateTotal(com.liferay.portlet.shopping.model.ShoppingOrder order)
                             throws com.liferay.portal.SystemException
Throws:
com.liferay.portal.SystemException

getBreadcrumbs

public static java.lang.String getBreadcrumbs(long categoryId,
                                              javax.servlet.jsp.PageContext pageContext,
                                              javax.portlet.RenderRequest renderRequest,
                                              javax.portlet.RenderResponse renderResponse)
                                       throws java.lang.Exception
Throws:
java.lang.Exception

getBreadcrumbs

public static java.lang.String getBreadcrumbs(com.liferay.portlet.shopping.model.ShoppingCategory category,
                                              javax.servlet.jsp.PageContext pageContext,
                                              javax.portlet.RenderRequest renderRequest,
                                              javax.portlet.RenderResponse renderResponse)
                                       throws java.lang.Exception
Throws:
java.lang.Exception

getCart

public static com.liferay.portlet.shopping.model.ShoppingCart getCart(com.liferay.portal.theme.ThemeDisplay themeDisplay)

getCart

public static com.liferay.portlet.shopping.model.ShoppingCart getCart(javax.portlet.PortletRequest portletRequest)
                                                               throws com.liferay.portal.PortalException,
                                                                      com.liferay.portal.SystemException
Throws:
com.liferay.portal.PortalException
com.liferay.portal.SystemException

getFieldsQuantitiesPos

public static int getFieldsQuantitiesPos(com.liferay.portlet.shopping.model.ShoppingItem item,
                                         com.liferay.portlet.shopping.model.ShoppingItemField[] itemFields,
                                         java.lang.String[] fieldsArray)

getItemId

public static long getItemId(java.lang.String itemId)

getItemFields

public static java.lang.String getItemFields(java.lang.String itemId)

getItemOrderByComparator

public static com.liferay.portal.kernel.util.OrderByComparator getItemOrderByComparator(java.lang.String orderByCol,
                                                                                        java.lang.String orderByType)

getMinQuantity

public static int getMinQuantity(com.liferay.portlet.shopping.model.ShoppingItem item)
                          throws com.liferay.portal.PortalException,
                                 com.liferay.portal.SystemException
Throws:
com.liferay.portal.PortalException
com.liferay.portal.SystemException

getPayPalNotifyURL

public static java.lang.String getPayPalNotifyURL(com.liferay.portal.theme.ThemeDisplay themeDisplay)

getPayPalRedirectURL

public static java.lang.String getPayPalRedirectURL(ShoppingPreferences preferences,
                                                    com.liferay.portlet.shopping.model.ShoppingOrder order,
                                                    double total,
                                                    java.lang.String returnURL,
                                                    java.lang.String notifyURL)

getPayPalReturnURL

public static java.lang.String getPayPalReturnURL(javax.portlet.PortletURL portletURL,
                                                  com.liferay.portlet.shopping.model.ShoppingOrder order)

getPpPaymentStatus

public static java.lang.String getPpPaymentStatus(java.lang.String ppPaymentStatus)

getPpPaymentStatus

public static java.lang.String getPpPaymentStatus(com.liferay.portlet.shopping.model.ShoppingOrder order,
                                                  javax.servlet.jsp.PageContext pageContext)

isInStock

public static boolean isInStock(com.liferay.portlet.shopping.model.ShoppingItem item)

isInStock

public static boolean isInStock(com.liferay.portlet.shopping.model.ShoppingItem item,
                                com.liferay.portlet.shopping.model.ShoppingItemField[] itemFields,
                                java.lang.String[] fieldsArray,
                                java.lang.Integer orderedQuantity)

meetsMinOrder

public static boolean meetsMinOrder(ShoppingPreferences preferences,
                                    java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem,java.lang.Integer> items)
                             throws com.liferay.portal.PortalException,
                                    com.liferay.portal.SystemException
Throws:
com.liferay.portal.PortalException
com.liferay.portal.SystemException