Liferay 6.1.2-ce-ga3

com.liferay.portlet.shopping.service.persistence
Class ShoppingCartUtil

java.lang.Object
  extended by com.liferay.portlet.shopping.service.persistence.ShoppingCartUtil

public class ShoppingCartUtil
extends Object

The persistence utility for the shopping cart service. This utility wraps ShoppingCartPersistenceImpl and provides direct access to the database for CRUD operations. This utility should only be used by the service layer, as it must operate within a transaction. Never access this utility in a JSP, controller, model, or other front-end class.

Caching information and settings can be found in portal.properties

See Also:
ShoppingCartPersistence, ShoppingCartPersistenceImpl

Constructor Summary
ShoppingCartUtil()
           
 
Method Summary
static void cacheResult(List<ShoppingCart> shoppingCarts)
          Caches the shopping carts in the entity cache if it is enabled.
static void cacheResult(ShoppingCart shoppingCart)
          Caches the shopping cart in the entity cache if it is enabled.
static void clearCache()
           
static void clearCache(ShoppingCart shoppingCart)
           
static int countAll()
          Returns the number of shopping carts.
static int countByG_U(long groupId, long userId)
          Returns the number of shopping carts where groupId = ? and userId = ?.
static int countByGroupId(long groupId)
          Returns the number of shopping carts where groupId = ?.
static int countByUserId(long userId)
          Returns the number of shopping carts where userId = ?.
 long countWithDynamicQuery(DynamicQuery dynamicQuery)
           
static ShoppingCart create(long cartId)
          Creates a new shopping cart with the primary key.
static ShoppingCart fetchByG_U(long groupId, long userId)
          Returns the shopping cart where groupId = ? and userId = ? or returns null if it could not be found.
static ShoppingCart fetchByG_U(long groupId, long userId, boolean retrieveFromCache)
          Returns the shopping cart where groupId = ? and userId = ? or returns null if it could not be found, optionally using the finder cache.
static ShoppingCart fetchByGroupId_First(long groupId, OrderByComparator orderByComparator)
          Returns the first shopping cart in the ordered set where groupId = ?.
static ShoppingCart fetchByGroupId_Last(long groupId, OrderByComparator orderByComparator)
          Returns the last shopping cart in the ordered set where groupId = ?.
static ShoppingCart fetchByPrimaryKey(long cartId)
          Returns the shopping cart with the primary key or returns null if it could not be found.
static ShoppingCart fetchByUserId_First(long userId, OrderByComparator orderByComparator)
          Returns the first shopping cart in the ordered set where userId = ?.
static ShoppingCart fetchByUserId_Last(long userId, OrderByComparator orderByComparator)
          Returns the last shopping cart in the ordered set where userId = ?.
static List<ShoppingCart> findAll()
          Returns all the shopping carts.
static List<ShoppingCart> findAll(int start, int end)
          Returns a range of all the shopping carts.
static List<ShoppingCart> findAll(int start, int end, OrderByComparator orderByComparator)
          Returns an ordered range of all the shopping carts.
static ShoppingCart findByG_U(long groupId, long userId)
          Returns the shopping cart where groupId = ? and userId = ? or throws a NoSuchCartException if it could not be found.
static ShoppingCart findByGroupId_First(long groupId, OrderByComparator orderByComparator)
          Returns the first shopping cart in the ordered set where groupId = ?.
static ShoppingCart findByGroupId_Last(long groupId, OrderByComparator orderByComparator)
          Returns the last shopping cart in the ordered set where groupId = ?.
static ShoppingCart[] findByGroupId_PrevAndNext(long cartId, long groupId, OrderByComparator orderByComparator)
          Returns the shopping carts before and after the current shopping cart in the ordered set where groupId = ?.
static List<ShoppingCart> findByGroupId(long groupId)
          Returns all the shopping carts where groupId = ?.
static List<ShoppingCart> findByGroupId(long groupId, int start, int end)
          Returns a range of all the shopping carts where groupId = ?.
static List<ShoppingCart> findByGroupId(long groupId, int start, int end, OrderByComparator orderByComparator)
          Returns an ordered range of all the shopping carts where groupId = ?.
static ShoppingCart findByPrimaryKey(long cartId)
          Returns the shopping cart with the primary key or throws a NoSuchCartException if it could not be found.
static ShoppingCart findByUserId_First(long userId, OrderByComparator orderByComparator)
          Returns the first shopping cart in the ordered set where userId = ?.
static ShoppingCart findByUserId_Last(long userId, OrderByComparator orderByComparator)
          Returns the last shopping cart in the ordered set where userId = ?.
static ShoppingCart[] findByUserId_PrevAndNext(long cartId, long userId, OrderByComparator orderByComparator)
          Returns the shopping carts before and after the current shopping cart in the ordered set where userId = ?.
static List<ShoppingCart> findByUserId(long userId)
          Returns all the shopping carts where userId = ?.
static List<ShoppingCart> findByUserId(long userId, int start, int end)
          Returns a range of all the shopping carts where userId = ?.
static List<ShoppingCart> findByUserId(long userId, int start, int end, OrderByComparator orderByComparator)
          Returns an ordered range of all the shopping carts where userId = ?.
static List<ShoppingCart> findWithDynamicQuery(DynamicQuery dynamicQuery)
           
static List<ShoppingCart> findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end)
           
static List<ShoppingCart> findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator orderByComparator)
           
static ShoppingCartPersistence getPersistence()
           
static ShoppingCart remove(long cartId)
          Removes the shopping cart with the primary key from the database.
static void removeAll()
          Removes all the shopping carts from the database.
static ShoppingCart removeByG_U(long groupId, long userId)
          Removes the shopping cart where groupId = ? and userId = ? from the database.
static void removeByGroupId(long groupId)
          Removes all the shopping carts where groupId = ? from the database.
static void removeByUserId(long userId)
          Removes all the shopping carts where userId = ? from the database.
 void setPersistence(ShoppingCartPersistence persistence)
          Deprecated.  
static ShoppingCart update(ShoppingCart shoppingCart, boolean merge)
           
static ShoppingCart update(ShoppingCart shoppingCart, boolean merge, ServiceContext serviceContext)
           
static ShoppingCart updateImpl(ShoppingCart shoppingCart, boolean merge)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShoppingCartUtil

public ShoppingCartUtil()
Method Detail

clearCache

public static void clearCache()
See Also:
BasePersistence.clearCache()

clearCache

public static void clearCache(ShoppingCart shoppingCart)
See Also:
BasePersistence.clearCache(com.liferay.portal.model.BaseModel)

countWithDynamicQuery

public long countWithDynamicQuery(DynamicQuery dynamicQuery)
                           throws SystemException
Throws:
SystemException
See Also:
BasePersistence.countWithDynamicQuery(DynamicQuery)

findWithDynamicQuery

public static List<ShoppingCart> findWithDynamicQuery(DynamicQuery dynamicQuery)
                                               throws SystemException
Throws:
SystemException
See Also:
BasePersistence.findWithDynamicQuery(DynamicQuery)

findWithDynamicQuery

public static List<ShoppingCart> findWithDynamicQuery(DynamicQuery dynamicQuery,
                                                      int start,
                                                      int end)
                                               throws SystemException
Throws:
SystemException
See Also:
BasePersistence.findWithDynamicQuery(DynamicQuery, int, int)

findWithDynamicQuery

public static List<ShoppingCart> findWithDynamicQuery(DynamicQuery dynamicQuery,
                                                      int start,
                                                      int end,
                                                      OrderByComparator orderByComparator)
                                               throws SystemException
Throws:
SystemException
See Also:
BasePersistence.findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)

update

public static ShoppingCart update(ShoppingCart shoppingCart,
                                  boolean merge)
                           throws SystemException
Throws:
SystemException
See Also:
BasePersistence.update(com.liferay.portal.model.BaseModel, boolean)

update

public static ShoppingCart update(ShoppingCart shoppingCart,
                                  boolean merge,
                                  ServiceContext serviceContext)
                           throws SystemException
Throws:
SystemException
See Also:
BasePersistence.update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)

cacheResult

public static void cacheResult(ShoppingCart shoppingCart)
Caches the shopping cart in the entity cache if it is enabled.

Parameters:
shoppingCart - the shopping cart

cacheResult

public static void cacheResult(List<ShoppingCart> shoppingCarts)
Caches the shopping carts in the entity cache if it is enabled.

Parameters:
shoppingCarts - the shopping carts

create

public static ShoppingCart create(long cartId)
Creates a new shopping cart with the primary key. Does not add the shopping cart to the database.

Parameters:
cartId - the primary key for the new shopping cart
Returns:
the new shopping cart

remove

public static ShoppingCart remove(long cartId)
                           throws SystemException,
                                  NoSuchCartException
Removes the shopping cart with the primary key from the database. Also notifies the appropriate model listeners.

Parameters:
cartId - the primary key of the shopping cart
Returns:
the shopping cart that was removed
Throws:
NoSuchCartException - if a shopping cart with the primary key could not be found
SystemException - if a system exception occurred

updateImpl

public static ShoppingCart updateImpl(ShoppingCart shoppingCart,
                                      boolean merge)
                               throws SystemException
Throws:
SystemException

findByPrimaryKey

public static ShoppingCart findByPrimaryKey(long cartId)
                                     throws SystemException,
                                            NoSuchCartException
Returns the shopping cart with the primary key or throws a NoSuchCartException if it could not be found.

Parameters:
cartId - the primary key of the shopping cart
Returns:
the shopping cart
Throws:
NoSuchCartException - if a shopping cart with the primary key could not be found
SystemException - if a system exception occurred

fetchByPrimaryKey

public static ShoppingCart fetchByPrimaryKey(long cartId)
                                      throws SystemException
Returns the shopping cart with the primary key or returns null if it could not be found.

Parameters:
cartId - the primary key of the shopping cart
Returns:
the shopping cart, or null if a shopping cart with the primary key could not be found
Throws:
SystemException - if a system exception occurred

findByGroupId

public static List<ShoppingCart> findByGroupId(long groupId)
                                        throws SystemException
Returns all the shopping carts where groupId = ?.

Parameters:
groupId - the group ID
Returns:
the matching shopping carts
Throws:
SystemException - if a system exception occurred

findByGroupId

public static List<ShoppingCart> findByGroupId(long groupId,
                                               int start,
                                               int end)
                                        throws SystemException
Returns a range of all the shopping carts where groupId = ?.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
groupId - the group ID
start - the lower bound of the range of shopping carts
end - the upper bound of the range of shopping carts (not inclusive)
Returns:
the range of matching shopping carts
Throws:
SystemException - if a system exception occurred

findByGroupId

public static List<ShoppingCart> findByGroupId(long groupId,
                                               int start,
                                               int end,
                                               OrderByComparator orderByComparator)
                                        throws SystemException
Returns an ordered range of all the shopping carts where groupId = ?.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
groupId - the group ID
start - the lower bound of the range of shopping carts
end - the upper bound of the range of shopping carts (not inclusive)
orderByComparator - the comparator to order the results by (optionally null)
Returns:
the ordered range of matching shopping carts
Throws:
SystemException - if a system exception occurred

findByGroupId_First

public static ShoppingCart findByGroupId_First(long groupId,
                                               OrderByComparator orderByComparator)
                                        throws SystemException,
                                               NoSuchCartException
Returns the first shopping cart in the ordered set where groupId = ?.

Parameters:
groupId - the group ID
orderByComparator - the comparator to order the set by (optionally null)
Returns:
the first matching shopping cart
Throws:
NoSuchCartException - if a matching shopping cart could not be found
SystemException - if a system exception occurred

fetchByGroupId_First

public static ShoppingCart fetchByGroupId_First(long groupId,
                                                OrderByComparator orderByComparator)
                                         throws SystemException
Returns the first shopping cart in the ordered set where groupId = ?.

Parameters:
groupId - the group ID
orderByComparator - the comparator to order the set by (optionally null)
Returns:
the first matching shopping cart, or null if a matching shopping cart could not be found
Throws:
SystemException - if a system exception occurred

findByGroupId_Last

public static ShoppingCart findByGroupId_Last(long groupId,
                                              OrderByComparator orderByComparator)
                                       throws SystemException,
                                              NoSuchCartException
Returns the last shopping cart in the ordered set where groupId = ?.

Parameters:
groupId - the group ID
orderByComparator - the comparator to order the set by (optionally null)
Returns:
the last matching shopping cart
Throws:
NoSuchCartException - if a matching shopping cart could not be found
SystemException - if a system exception occurred

fetchByGroupId_Last

public static ShoppingCart fetchByGroupId_Last(long groupId,
                                               OrderByComparator orderByComparator)
                                        throws SystemException
Returns the last shopping cart in the ordered set where groupId = ?.

Parameters:
groupId - the group ID
orderByComparator - the comparator to order the set by (optionally null)
Returns:
the last matching shopping cart, or null if a matching shopping cart could not be found
Throws:
SystemException - if a system exception occurred

findByGroupId_PrevAndNext

public static ShoppingCart[] findByGroupId_PrevAndNext(long cartId,
                                                       long groupId,
                                                       OrderByComparator orderByComparator)
                                                throws SystemException,
                                                       NoSuchCartException
Returns the shopping carts before and after the current shopping cart in the ordered set where groupId = ?.

Parameters:
cartId - the primary key of the current shopping cart
groupId - the group ID
orderByComparator - the comparator to order the set by (optionally null)
Returns:
the previous, current, and next shopping cart
Throws:
NoSuchCartException - if a shopping cart with the primary key could not be found
SystemException - if a system exception occurred

findByUserId

public static List<ShoppingCart> findByUserId(long userId)
                                       throws SystemException
Returns all the shopping carts where userId = ?.

Parameters:
userId - the user ID
Returns:
the matching shopping carts
Throws:
SystemException - if a system exception occurred

findByUserId

public static List<ShoppingCart> findByUserId(long userId,
                                              int start,
                                              int end)
                                       throws SystemException
Returns a range of all the shopping carts where userId = ?.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
userId - the user ID
start - the lower bound of the range of shopping carts
end - the upper bound of the range of shopping carts (not inclusive)
Returns:
the range of matching shopping carts
Throws:
SystemException - if a system exception occurred

findByUserId

public static List<ShoppingCart> findByUserId(long userId,
                                              int start,
                                              int end,
                                              OrderByComparator orderByComparator)
                                       throws SystemException
Returns an ordered range of all the shopping carts where userId = ?.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
userId - the user ID
start - the lower bound of the range of shopping carts
end - the upper bound of the range of shopping carts (not inclusive)
orderByComparator - the comparator to order the results by (optionally null)
Returns:
the ordered range of matching shopping carts
Throws:
SystemException - if a system exception occurred

findByUserId_First

public static ShoppingCart findByUserId_First(long userId,
                                              OrderByComparator orderByComparator)
                                       throws SystemException,
                                              NoSuchCartException
Returns the first shopping cart in the ordered set where userId = ?.

Parameters:
userId - the user ID
orderByComparator - the comparator to order the set by (optionally null)
Returns:
the first matching shopping cart
Throws:
NoSuchCartException - if a matching shopping cart could not be found
SystemException - if a system exception occurred

fetchByUserId_First

public static ShoppingCart fetchByUserId_First(long userId,
                                               OrderByComparator orderByComparator)
                                        throws SystemException
Returns the first shopping cart in the ordered set where userId = ?.

Parameters:
userId - the user ID
orderByComparator - the comparator to order the set by (optionally null)
Returns:
the first matching shopping cart, or null if a matching shopping cart could not be found
Throws:
SystemException - if a system exception occurred

findByUserId_Last

public static ShoppingCart findByUserId_Last(long userId,
                                             OrderByComparator orderByComparator)
                                      throws SystemException,
                                             NoSuchCartException
Returns the last shopping cart in the ordered set where userId = ?.

Parameters:
userId - the user ID
orderByComparator - the comparator to order the set by (optionally null)
Returns:
the last matching shopping cart
Throws:
NoSuchCartException - if a matching shopping cart could not be found
SystemException - if a system exception occurred

fetchByUserId_Last

public static ShoppingCart fetchByUserId_Last(long userId,
                                              OrderByComparator orderByComparator)
                                       throws SystemException
Returns the last shopping cart in the ordered set where userId = ?.

Parameters:
userId - the user ID
orderByComparator - the comparator to order the set by (optionally null)
Returns:
the last matching shopping cart, or null if a matching shopping cart could not be found
Throws:
SystemException - if a system exception occurred

findByUserId_PrevAndNext

public static ShoppingCart[] findByUserId_PrevAndNext(long cartId,
                                                      long userId,
                                                      OrderByComparator orderByComparator)
                                               throws SystemException,
                                                      NoSuchCartException
Returns the shopping carts before and after the current shopping cart in the ordered set where userId = ?.

Parameters:
cartId - the primary key of the current shopping cart
userId - the user ID
orderByComparator - the comparator to order the set by (optionally null)
Returns:
the previous, current, and next shopping cart
Throws:
NoSuchCartException - if a shopping cart with the primary key could not be found
SystemException - if a system exception occurred

findByG_U

public static ShoppingCart findByG_U(long groupId,
                                     long userId)
                              throws SystemException,
                                     NoSuchCartException
Returns the shopping cart where groupId = ? and userId = ? or throws a NoSuchCartException if it could not be found.

Parameters:
groupId - the group ID
userId - the user ID
Returns:
the matching shopping cart
Throws:
NoSuchCartException - if a matching shopping cart could not be found
SystemException - if a system exception occurred

fetchByG_U

public static ShoppingCart fetchByG_U(long groupId,
                                      long userId)
                               throws SystemException
Returns the shopping cart where groupId = ? and userId = ? or returns null if it could not be found. Uses the finder cache.

Parameters:
groupId - the group ID
userId - the user ID
Returns:
the matching shopping cart, or null if a matching shopping cart could not be found
Throws:
SystemException - if a system exception occurred

fetchByG_U

public static ShoppingCart fetchByG_U(long groupId,
                                      long userId,
                                      boolean retrieveFromCache)
                               throws SystemException
Returns the shopping cart where groupId = ? and userId = ? or returns null if it could not be found, optionally using the finder cache.

Parameters:
groupId - the group ID
userId - the user ID
retrieveFromCache - whether to use the finder cache
Returns:
the matching shopping cart, or null if a matching shopping cart could not be found
Throws:
SystemException - if a system exception occurred

findAll

public static List<ShoppingCart> findAll()
                                  throws SystemException
Returns all the shopping carts.

Returns:
the shopping carts
Throws:
SystemException - if a system exception occurred

findAll

public static List<ShoppingCart> findAll(int start,
                                         int end)
                                  throws SystemException
Returns a range of all the shopping carts.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
start - the lower bound of the range of shopping carts
end - the upper bound of the range of shopping carts (not inclusive)
Returns:
the range of shopping carts
Throws:
SystemException - if a system exception occurred

findAll

public static List<ShoppingCart> findAll(int start,
                                         int end,
                                         OrderByComparator orderByComparator)
                                  throws SystemException
Returns an ordered range of all the shopping carts.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
start - the lower bound of the range of shopping carts
end - the upper bound of the range of shopping carts (not inclusive)
orderByComparator - the comparator to order the results by (optionally null)
Returns:
the ordered range of shopping carts
Throws:
SystemException - if a system exception occurred

removeByGroupId

public static void removeByGroupId(long groupId)
                            throws SystemException
Removes all the shopping carts where groupId = ? from the database.

Parameters:
groupId - the group ID
Throws:
SystemException - if a system exception occurred

removeByUserId

public static void removeByUserId(long userId)
                           throws SystemException
Removes all the shopping carts where userId = ? from the database.

Parameters:
userId - the user ID
Throws:
SystemException - if a system exception occurred

removeByG_U

public static ShoppingCart removeByG_U(long groupId,
                                       long userId)
                                throws SystemException,
                                       NoSuchCartException
Removes the shopping cart where groupId = ? and userId = ? from the database.

Parameters:
groupId - the group ID
userId - the user ID
Returns:
the shopping cart that was removed
Throws:
SystemException - if a system exception occurred
NoSuchCartException

removeAll

public static void removeAll()
                      throws SystemException
Removes all the shopping carts from the database.

Throws:
SystemException - if a system exception occurred

countByGroupId

public static int countByGroupId(long groupId)
                          throws SystemException
Returns the number of shopping carts where groupId = ?.

Parameters:
groupId - the group ID
Returns:
the number of matching shopping carts
Throws:
SystemException - if a system exception occurred

countByUserId

public static int countByUserId(long userId)
                         throws SystemException
Returns the number of shopping carts where userId = ?.

Parameters:
userId - the user ID
Returns:
the number of matching shopping carts
Throws:
SystemException - if a system exception occurred

countByG_U

public static int countByG_U(long groupId,
                             long userId)
                      throws SystemException
Returns the number of shopping carts where groupId = ? and userId = ?.

Parameters:
groupId - the group ID
userId - the user ID
Returns:
the number of matching shopping carts
Throws:
SystemException - if a system exception occurred

countAll

public static int countAll()
                    throws SystemException
Returns the number of shopping carts.

Returns:
the number of shopping carts
Throws:
SystemException - if a system exception occurred

getPersistence

public static ShoppingCartPersistence getPersistence()

setPersistence

public void setPersistence(ShoppingCartPersistence persistence)
Deprecated. 


Liferay 6.1.2-ce-ga3