Class CartsDAO

    • Method Detail

      • createCart

        public Map<String,​StringcreateCart​(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,​StringupdateCart​(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

        public Map<String,​ObjectdeleteCarts​(List<String> ids)
        Deletes some carts.
        Parameters:
        ids - The ids of the carts to delete
        Returns:
        The ids of the deleted carts
      • addElements

        public Map<String,​ObjectaddElements​(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
      • getCart

        public Cart getCart​(String cartId)
        Get the cart with given id
        Parameters:
        cartId - The cart id
        Returns:
        The retrieved cart or null.
      • _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.
      • hasReadRightOnCart

        public boolean hasReadRightOnCart​(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
      • hasWriteRightOnCart

        public boolean hasWriteRightOnCart​(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
      • hasRightAffectationRightOnCart

        public boolean hasRightAffectationRightOnCart​(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