Class DefaultCartNoteOperationService<P extends com.broadleafcommerce.cart.client.domain.CartNote>

java.lang.Object
com.broadleafcommerce.cartoperation.service.note.DefaultCartNoteOperationService<P>
All Implemented Interfaces:
CartNoteOperationService<P>

public class DefaultCartNoteOperationService<P extends com.broadleafcommerce.cart.client.domain.CartNote> extends Object implements CartNoteOperationService<P>
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected cz.jirutka.rsql.parser.ast.Node
    buildCartNoteFilters(@NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, String cartItemId, @NonNull cz.jirutka.rsql.parser.ast.Node existingFilters, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Builds the Node filters based on the cart item id and the currently authenticated CustomerRef used to retrieve CartNotes.
    createCartNote(P cartNote, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Create a new cart note.
    void
    deleteCartNote(@NonNull String cartId, @NonNull String cartNoteId, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deletes the cart note.
    protected CartNoteProvider<P>
     
    protected QuoteAuthUtils
     
    protected P
    populateAuthorDetails(P cartNote, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Populates the CartNote's author details.
    org.springframework.data.domain.Page<P>
    readByCartId(@NonNull String cartId, boolean cartLevelOnly, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @NonNull cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves all cart notes based on the given cart id and filter.
    org.springframework.data.domain.Page<P>
    readByCartItemId(@NonNull String cartId, @NonNull String cartItemId, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @NonNull cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves all cart notes based on the given cart item id and filter.
    replaceCartNote(@NonNull String cartId, @NonNull String cartNoteId, P cartNote, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Replaces the cart note.
    protected void
    validateCartNoteOwnership(@NonNull String cartId, @NonNull String cartNoteId, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Validates the ownership of a CartNote.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • createCartNote

      public P createCartNote(@NonNull P cartNote, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartNoteOperationService
      Create a new cart note.
      Specified by:
      createCartNote in interface CartNoteOperationService<P extends com.broadleafcommerce.cart.client.domain.CartNote>
      Parameters:
      cartNote - the cart note to create
      customerRef - the currently authenticated CustomerRef
      contextInfo - context information around sandbox and multitenant state.
      Returns:
      the created cart note.
    • readByCartId

      public org.springframework.data.domain.Page<P> readByCartId(@NonNull @NonNull String cartId, boolean cartLevelOnly, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @NonNull @NonNull cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartNoteOperationService
      Retrieves all cart notes based on the given cart id and filter.
      Specified by:
      readByCartId in interface CartNoteOperationService<P extends com.broadleafcommerce.cart.client.domain.CartNote>
      Parameters:
      cartId - the id of the cart to find the notes for
      cartLevelOnly - whether to retrieve cart-level notes only
      filters - the filters to apply
      pageable - the requested page of results
      contextInfo - context information around sandbox and multitenant state.
      Returns:
      the cart notes based on the given cart id and filter
    • readByCartItemId

      public org.springframework.data.domain.Page<P> readByCartItemId(@NonNull @NonNull String cartId, @NonNull @NonNull String cartItemId, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @NonNull @NonNull cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartNoteOperationService
      Retrieves all cart notes based on the given cart item id and filter.

      This is used to retrieve CartItem-level notes.

      Specified by:
      readByCartItemId in interface CartNoteOperationService<P extends com.broadleafcommerce.cart.client.domain.CartNote>
      Parameters:
      cartId - the id of the cart to find the notes for
      cartItemId - the id of the cart item to find the notes for
      filters - the filters to apply
      pageable - the requested page of results
      contextInfo - context information around sandbox and multitenant state.
      Returns:
      the cart notes based on the given cart id and filter
    • replaceCartNote

      public P replaceCartNote(@NonNull @NonNull String cartId, @NonNull @NonNull String cartNoteId, @NonNull P cartNote, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartNoteOperationService
      Replaces the cart note.
      Specified by:
      replaceCartNote in interface CartNoteOperationService<P extends com.broadleafcommerce.cart.client.domain.CartNote>
      Parameters:
      cartId - the id of the cart that this note belongs to
      cartNoteId - the id of the cart note that is being replaced
      cartNote - the cart note payload
      contextInfo - context information around sandbox and multitenant state.
      Returns:
      the updated cart note
    • deleteCartNote

      public void deleteCartNote(@NonNull @NonNull String cartId, @NonNull @NonNull String cartNoteId, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartNoteOperationService
      Deletes the cart note.
      Specified by:
      deleteCartNote in interface CartNoteOperationService<P extends com.broadleafcommerce.cart.client.domain.CartNote>
      Parameters:
      cartId - the id of the cart that this note belongs to
      cartNoteId - the id of the cart note that is being deleted
      contextInfo - context information around sandbox and multitenant state.
    • populateAuthorDetails

      protected P populateAuthorDetails(@NonNull P cartNote, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Populates the CartNote's author details.
      Parameters:
      cartNote - the CartNote to populate the author details for
      customerRef - the currently authenticated CustomerRef
      contextInfo - context information around sandbox and multitenant state.
      Returns:
      the CartNote populated with author details.
    • buildCartNoteFilters

      protected cz.jirutka.rsql.parser.ast.Node buildCartNoteFilters(@NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @Nullable String cartItemId, @NonNull @NonNull cz.jirutka.rsql.parser.ast.Node existingFilters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Builds the Node filters based on the cart item id and the currently authenticated CustomerRef used to retrieve CartNotes.

      If the currently authenticated user is not a sales rep, see QuoteAuthUtils.isSalesRep(ContextInfo), then a filter for CartNote.isInternalOnly() is added to prevent non-sales-rep users from seeing internal notes.

      Parameters:
      customerRef - the currently authenticated CustomerRef
      cartItemId - the cart item id that the notes belong to, this is only relevant for cart item level notes
      existingFilters - exising filters to build on top of
      Returns:
      the Node filters based on the cart item id and the currently authenticated CustomerRef
    • validateCartNoteOwnership

      protected void validateCartNoteOwnership(@NonNull @NonNull String cartId, @NonNull @NonNull String cartNoteId, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Validates the ownership of a CartNote.
      Parameters:
      cartId - the id of the cart that the CartNote belongs to
      cartNoteId - the id of the CartNote being validated
      customerRef - the currently authenticated CustomerRef
      contextInfo - context information surrounding sandboxing and multitenant state
      Throws:
      CartNoteAccessException - if the currently authenticated user doesn't have access
    • getQuoteAuthUtils

      protected QuoteAuthUtils getQuoteAuthUtils()
    • getCartNoteProvider

      protected CartNoteProvider<P> getCartNoteProvider()