public class ShoppingCartUtil
extends java.lang.Object
com.liferay.shopping.service.persistence.impl.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
ShoppingCartPersistence
Constructor and Description |
---|
ShoppingCartUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
cacheResult(java.util.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 = ?.
|
static 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 useFinderCache)
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<ShoppingCart> orderByComparator)
Returns the first shopping cart in the ordered set where groupId = ?.
|
static ShoppingCart |
fetchByGroupId_Last(long groupId,
OrderByComparator<ShoppingCart> 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 java.util.Map<java.io.Serializable,ShoppingCart> |
fetchByPrimaryKeys(java.util.Set<java.io.Serializable> primaryKeys) |
static ShoppingCart |
fetchByUserId_First(long userId,
OrderByComparator<ShoppingCart> orderByComparator)
Returns the first shopping cart in the ordered set where userId = ?.
|
static ShoppingCart |
fetchByUserId_Last(long userId,
OrderByComparator<ShoppingCart> orderByComparator)
Returns the last shopping cart in the ordered set where userId = ?.
|
static java.util.List<ShoppingCart> |
findAll()
Returns all the shopping carts.
|
static java.util.List<ShoppingCart> |
findAll(int start,
int end)
Returns a range of all the shopping carts.
|
static java.util.List<ShoppingCart> |
findAll(int start,
int end,
OrderByComparator<ShoppingCart> orderByComparator)
Returns an ordered range of all the shopping carts.
|
static java.util.List<ShoppingCart> |
findAll(int start,
int end,
OrderByComparator<ShoppingCart> orderByComparator,
boolean useFinderCache)
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<ShoppingCart> orderByComparator)
Returns the first shopping cart in the ordered set where groupId = ?.
|
static ShoppingCart |
findByGroupId_Last(long groupId,
OrderByComparator<ShoppingCart> orderByComparator)
Returns the last shopping cart in the ordered set where groupId = ?.
|
static ShoppingCart[] |
findByGroupId_PrevAndNext(long cartId,
long groupId,
OrderByComparator<ShoppingCart> orderByComparator)
Returns the shopping carts before and after the current shopping cart in the ordered set where groupId = ?.
|
static java.util.List<ShoppingCart> |
findByGroupId(long groupId)
Returns all the shopping carts where groupId = ?.
|
static java.util.List<ShoppingCart> |
findByGroupId(long groupId,
int start,
int end)
Returns a range of all the shopping carts where groupId = ?.
|
static java.util.List<ShoppingCart> |
findByGroupId(long groupId,
int start,
int end,
OrderByComparator<ShoppingCart> orderByComparator)
Returns an ordered range of all the shopping carts where groupId = ?.
|
static java.util.List<ShoppingCart> |
findByGroupId(long groupId,
int start,
int end,
OrderByComparator<ShoppingCart> orderByComparator,
boolean useFinderCache)
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<ShoppingCart> orderByComparator)
Returns the first shopping cart in the ordered set where userId = ?.
|
static ShoppingCart |
findByUserId_Last(long userId,
OrderByComparator<ShoppingCart> orderByComparator)
Returns the last shopping cart in the ordered set where userId = ?.
|
static ShoppingCart[] |
findByUserId_PrevAndNext(long cartId,
long userId,
OrderByComparator<ShoppingCart> orderByComparator)
Returns the shopping carts before and after the current shopping cart in the ordered set where userId = ?.
|
static java.util.List<ShoppingCart> |
findByUserId(long userId)
Returns all the shopping carts where userId = ?.
|
static java.util.List<ShoppingCart> |
findByUserId(long userId,
int start,
int end)
Returns a range of all the shopping carts where userId = ?.
|
static java.util.List<ShoppingCart> |
findByUserId(long userId,
int start,
int end,
OrderByComparator<ShoppingCart> orderByComparator)
Returns an ordered range of all the shopping carts where userId = ?.
|
static java.util.List<ShoppingCart> |
findByUserId(long userId,
int start,
int end,
OrderByComparator<ShoppingCart> orderByComparator,
boolean useFinderCache)
Returns an ordered range of all the shopping carts where userId = ?.
|
static java.util.List<ShoppingCart> |
findWithDynamicQuery(DynamicQuery dynamicQuery) |
static java.util.List<ShoppingCart> |
findWithDynamicQuery(DynamicQuery dynamicQuery,
int start,
int end) |
static java.util.List<ShoppingCart> |
findWithDynamicQuery(DynamicQuery dynamicQuery,
int start,
int end,
OrderByComparator<ShoppingCart> 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.
|
static ShoppingCart |
update(ShoppingCart shoppingCart) |
static ShoppingCart |
update(ShoppingCart shoppingCart,
ServiceContext serviceContext) |
static ShoppingCart |
updateImpl(ShoppingCart shoppingCart) |
public static void clearCache()
BasePersistence.clearCache()
public static void clearCache(ShoppingCart shoppingCart)
public static long countWithDynamicQuery(DynamicQuery dynamicQuery)
public static java.util.Map<java.io.Serializable,ShoppingCart> fetchByPrimaryKeys(java.util.Set<java.io.Serializable> primaryKeys)
BasePersistence.fetchByPrimaryKeys(Set)
public static java.util.List<ShoppingCart> findWithDynamicQuery(DynamicQuery dynamicQuery)
public static java.util.List<ShoppingCart> findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end)
public static java.util.List<ShoppingCart> findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator<ShoppingCart> orderByComparator)
public static ShoppingCart update(ShoppingCart shoppingCart)
public static ShoppingCart update(ShoppingCart shoppingCart, ServiceContext serviceContext)
public static java.util.List<ShoppingCart> findByGroupId(long groupId)
groupId
- the group IDpublic static java.util.List<ShoppingCart> findByGroupId(long groupId, int start, int end)
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. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from ShoppingCartModelImpl
.
groupId
- the group IDstart
- the lower bound of the range of shopping cartsend
- the upper bound of the range of shopping carts (not inclusive)public static java.util.List<ShoppingCart> findByGroupId(long groupId, int start, int end, OrderByComparator<ShoppingCart> orderByComparator)
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. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from ShoppingCartModelImpl
.
groupId
- the group IDstart
- the lower bound of the range of shopping cartsend
- the upper bound of the range of shopping carts (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)public static java.util.List<ShoppingCart> findByGroupId(long groupId, int start, int end, OrderByComparator<ShoppingCart> orderByComparator, boolean useFinderCache)
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. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from ShoppingCartModelImpl
.
groupId
- the group IDstart
- the lower bound of the range of shopping cartsend
- the upper bound of the range of shopping carts (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)useFinderCache
- whether to use the finder cachepublic static ShoppingCart findByGroupId_First(long groupId, OrderByComparator<ShoppingCart> orderByComparator) throws NoSuchCartException
groupId
- the group IDorderByComparator
- the comparator to order the set by (optionally null
)NoSuchCartException
- if a matching shopping cart could not be foundpublic static ShoppingCart fetchByGroupId_First(long groupId, OrderByComparator<ShoppingCart> orderByComparator)
groupId
- the group IDorderByComparator
- the comparator to order the set by (optionally null
)null
if a matching shopping cart could not be foundpublic static ShoppingCart findByGroupId_Last(long groupId, OrderByComparator<ShoppingCart> orderByComparator) throws NoSuchCartException
groupId
- the group IDorderByComparator
- the comparator to order the set by (optionally null
)NoSuchCartException
- if a matching shopping cart could not be foundpublic static ShoppingCart fetchByGroupId_Last(long groupId, OrderByComparator<ShoppingCart> orderByComparator)
groupId
- the group IDorderByComparator
- the comparator to order the set by (optionally null
)null
if a matching shopping cart could not be foundpublic static ShoppingCart[] findByGroupId_PrevAndNext(long cartId, long groupId, OrderByComparator<ShoppingCart> orderByComparator) throws NoSuchCartException
cartId
- the primary key of the current shopping cartgroupId
- the group IDorderByComparator
- the comparator to order the set by (optionally null
)NoSuchCartException
- if a shopping cart with the primary key could not be foundpublic static void removeByGroupId(long groupId)
groupId
- the group IDpublic static int countByGroupId(long groupId)
groupId
- the group IDpublic static java.util.List<ShoppingCart> findByUserId(long userId)
userId
- the user IDpublic static java.util.List<ShoppingCart> findByUserId(long userId, int start, int end)
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. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from ShoppingCartModelImpl
.
userId
- the user IDstart
- the lower bound of the range of shopping cartsend
- the upper bound of the range of shopping carts (not inclusive)public static java.util.List<ShoppingCart> findByUserId(long userId, int start, int end, OrderByComparator<ShoppingCart> orderByComparator)
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. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from ShoppingCartModelImpl
.
userId
- the user IDstart
- the lower bound of the range of shopping cartsend
- the upper bound of the range of shopping carts (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)public static java.util.List<ShoppingCart> findByUserId(long userId, int start, int end, OrderByComparator<ShoppingCart> orderByComparator, boolean useFinderCache)
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. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from ShoppingCartModelImpl
.
userId
- the user IDstart
- the lower bound of the range of shopping cartsend
- the upper bound of the range of shopping carts (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)useFinderCache
- whether to use the finder cachepublic static ShoppingCart findByUserId_First(long userId, OrderByComparator<ShoppingCart> orderByComparator) throws NoSuchCartException
userId
- the user IDorderByComparator
- the comparator to order the set by (optionally null
)NoSuchCartException
- if a matching shopping cart could not be foundpublic static ShoppingCart fetchByUserId_First(long userId, OrderByComparator<ShoppingCart> orderByComparator)
userId
- the user IDorderByComparator
- the comparator to order the set by (optionally null
)null
if a matching shopping cart could not be foundpublic static ShoppingCart findByUserId_Last(long userId, OrderByComparator<ShoppingCart> orderByComparator) throws NoSuchCartException
userId
- the user IDorderByComparator
- the comparator to order the set by (optionally null
)NoSuchCartException
- if a matching shopping cart could not be foundpublic static ShoppingCart fetchByUserId_Last(long userId, OrderByComparator<ShoppingCart> orderByComparator)
userId
- the user IDorderByComparator
- the comparator to order the set by (optionally null
)null
if a matching shopping cart could not be foundpublic static ShoppingCart[] findByUserId_PrevAndNext(long cartId, long userId, OrderByComparator<ShoppingCart> orderByComparator) throws NoSuchCartException
cartId
- the primary key of the current shopping cartuserId
- the user IDorderByComparator
- the comparator to order the set by (optionally null
)NoSuchCartException
- if a shopping cart with the primary key could not be foundpublic static void removeByUserId(long userId)
userId
- the user IDpublic static int countByUserId(long userId)
userId
- the user IDpublic static ShoppingCart findByG_U(long groupId, long userId) throws NoSuchCartException
NoSuchCartException
if it could not be found.groupId
- the group IDuserId
- the user IDNoSuchCartException
- if a matching shopping cart could not be foundpublic static ShoppingCart fetchByG_U(long groupId, long userId)
null
if it could not be found. Uses the finder cache.groupId
- the group IDuserId
- the user IDnull
if a matching shopping cart could not be foundpublic static ShoppingCart fetchByG_U(long groupId, long userId, boolean useFinderCache)
null
if it could not be found, optionally using the finder cache.groupId
- the group IDuserId
- the user IDuseFinderCache
- whether to use the finder cachenull
if a matching shopping cart could not be foundpublic static ShoppingCart removeByG_U(long groupId, long userId) throws NoSuchCartException
groupId
- the group IDuserId
- the user IDNoSuchCartException
public static int countByG_U(long groupId, long userId)
groupId
- the group IDuserId
- the user IDpublic static void cacheResult(ShoppingCart shoppingCart)
shoppingCart
- the shopping cartpublic static void cacheResult(java.util.List<ShoppingCart> shoppingCarts)
shoppingCarts
- the shopping cartspublic static ShoppingCart create(long cartId)
cartId
- the primary key for the new shopping cartpublic static ShoppingCart remove(long cartId) throws NoSuchCartException
cartId
- the primary key of the shopping cartNoSuchCartException
- if a shopping cart with the primary key could not be foundpublic static ShoppingCart updateImpl(ShoppingCart shoppingCart)
public static ShoppingCart findByPrimaryKey(long cartId) throws NoSuchCartException
NoSuchCartException
if it could not be found.cartId
- the primary key of the shopping cartNoSuchCartException
- if a shopping cart with the primary key could not be foundpublic static ShoppingCart fetchByPrimaryKey(long cartId)
null
if it could not be found.cartId
- the primary key of the shopping cartnull
if a shopping cart with the primary key could not be foundpublic static java.util.List<ShoppingCart> findAll()
public static java.util.List<ShoppingCart> findAll(int start, int end)
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. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from ShoppingCartModelImpl
.
start
- the lower bound of the range of shopping cartsend
- the upper bound of the range of shopping carts (not inclusive)public static java.util.List<ShoppingCart> findAll(int start, int end, OrderByComparator<ShoppingCart> orderByComparator)
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. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from ShoppingCartModelImpl
.
start
- the lower bound of the range of shopping cartsend
- the upper bound of the range of shopping carts (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)public static java.util.List<ShoppingCart> findAll(int start, int end, OrderByComparator<ShoppingCart> orderByComparator, boolean useFinderCache)
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. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from ShoppingCartModelImpl
.
start
- the lower bound of the range of shopping cartsend
- the upper bound of the range of shopping carts (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)useFinderCache
- whether to use the finder cachepublic static void removeAll()
public static int countAll()
public static ShoppingCartPersistence getPersistence()