Class CartsDAO

java.lang.Object
org.ametys.plugins.cart.CartsDAO
All Implemented Interfaces:
Component, Serviceable

public class CartsDAO extends Object implements Serviceable, Component
DAO for manipulating carts
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager serviceManager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • getCartsInformation

      Gets carts information.
      Parameters:
      cartIds - The ids of the carts to retrieve.
      Returns:
      The carts information
    • createCart

      public Map<String,String> createCart(String title, String description, String documentation)
      Creates a cart.
      Parameters:
      title - The title
      description - The description
      documentation - 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 update
      title - The title
      description - The description
      documentation - 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

      public Map<String,Object> addElements(String cartId, String type, Map<String,Object> elementParams)
      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

      public Map<String,Object> deleteElements(String cartId, List<Map<String,String>> cartElements)
      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

      public Cart getCart(String cartId)
      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

      protected boolean _hasRight(Cart cart)
      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

      public boolean canRead(UserIdentity userIdentity, Cart cart)
      Check if a user have read rights on a cart
      Parameters:
      userIdentity - the user
      cart - the cart
      Returns:
      true if the user have read rights on a cart
    • canWrite

      public boolean canWrite(UserIdentity userIdentity, Cart cart)
      Check if a user have write rights on a cart
      Parameters:
      userIdentity - the user
      cart - the cart
      Returns:
      true if the user have write rights on a cart
    • canAssignRights

      public boolean canAssignRights(UserIdentity userIdentity, Cart cart)
      Check if a user have rights to edit rights on a cart
      Parameters:
      userIdentity - the user
      cart - the cart
      Returns:
      true if the user have write rights to edit rights on a cart