Package org.ametys.plugins.cart
Class CartsDAO
java.lang.Object
org.ametys.plugins.cart.CartsDAO
- All Implemented Interfaces:
Component
,Serviceable
DAO for manipulating carts
-
Field Summary
Modifier and TypeFieldDescriptionprotected UserManager
The user managerstatic final String
The Avalon role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Test if the current user has the right needed by the content type to view this cart.Add elements to a cart.boolean
canAssignRights
(UserIdentity userIdentity, Cart cart) Check if a user have rights to edit rights on a cartboolean
canRead
(UserIdentity userIdentity, Cart cart) Check if a user have read rights on a cartboolean
canWrite
(UserIdentity userIdentity, Cart cart) Check if a user have write rights on a cartcreateCart
(String title, String description, String documentation) Creates a cart.deleteCarts
(List<String> ids) Deletes some carts.Deletes elements of a cart.Get the cart with given idgetCartProperties
(Cart cart) Get the cart type propertiesgetCartsInformation
(List<String> cartIds) Gets carts information.void
service
(ServiceManager serviceManager) updateCart
(String id, String title, String description, String documentation) Updates a cart.
-
Field Details
-
ROLE
The Avalon role -
_userManager
The user manager
-
-
Constructor Details
-
CartsDAO
public CartsDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getCartsInformation
Gets carts information.- Parameters:
cartIds
- The ids of the carts to retrieve.- Returns:
- The carts information
-
createCart
Creates a cart.- Parameters:
title
- The titledescription
- The descriptiondocumentation
- The documentation of the cart- Returns:
- The id of the created cart
-
updateCart
public Map<String,String> updateCart(String id, String title, String description, String documentation) Updates a cart.- Parameters:
id
- The id of the cart to updatetitle
- The titledescription
- The descriptiondocumentation
- The documentation of the cart- Returns:
- The id of the updated cart
-
deleteCarts
Deletes some carts.- Parameters:
ids
- The ids of the carts to delete- Returns:
- The ids of the deleted carts
-
addElements
Add elements to a cart.- Parameters:
cartId
- The cart id.type
- The type of element.elementParams
- The parameters of the element.- Returns:
- The id of the cart or an error
-
deleteElements
Deletes elements of a cart.- Parameters:
cartId
- The cart id.cartElements
- The elements to delete.- Returns:
- The id of the cart or an error
-
getCart
Get the cart with given id- Parameters:
cartId
- The cart id- Returns:
- The retrieved cart or null.
-
getCartProperties
Get the cart type properties- Parameters:
cart
- The cart- Returns:
- The cart type properties
-
_hasRight
Test if the current user has the right needed by the content type to view this cart.- Parameters:
cart
- The cart- Returns:
- true if the user has the right needed, false otherwise.
-
canRead
Check if a user have read rights on a cart- Parameters:
userIdentity
- the usercart
- the cart- Returns:
- true if the user have read rights on a cart
-
canWrite
Check if a user have write rights on a cart- Parameters:
userIdentity
- the usercart
- the cart- Returns:
- true if the user have write rights on a cart
-
canAssignRights
Check if a user have rights to edit rights on a cart- Parameters:
userIdentity
- the usercart
- the cart- Returns:
- true if the user have write rights to edit rights on a cart
-