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)
      Creates a cart.
      Parameters:
      title - The title
      description - The description
      Returns:
      The id of the created cart
    • updateCart

      public Map<String,String> updateCart(String id, String title, String description)
      Updates a cart.
      Parameters:
      id - The id of the cart to update
      title - The title
      description - The description
      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
    • changeVisibility

      public Map<String,Object> changeVisibility(String cartId, String visibilityStr)
      Changes the visibility of a cart.
      Parameters:
      cartId - The cart id.
      visibilityStr - The visibility to set.
      Returns:
      An empty map, or an error message.
    • assignRights

      public Map<String,Object> assignRights(String cartId, String profileId, List<Map<String,String>> entries, String type)
      Adds users or groups to a cart profile.
      Parameters:
      cartId - The cart id.
      profileId - The profile id.
      entries - The users (or groups) entries.
      type - The type of the entries to add: 'users' or 'groups'
      Returns:
      An empty map, or an error.
    • removeAssignment

      public Map<String,Object> removeAssignment(String cartId, String profileId, List<Map<String,String>> users, List<Map<String,String>> groups)
      Deletes users or groups to a cart profile.
      Parameters:
      cartId - The cart id.
      profileId - The profile id.
      users - The users to delete.
      groups - The groups to delete;
      Returns:
      An empty map, 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.