Interface CustomerService<P extends Customer>

  • All Superinterfaces:
    com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
    All Known Implementing Classes:
    DefaultCustomerService

    public interface CustomerService<P extends Customer>
    extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
    Service API for Customers. Supported by CustomerRepository.
    Author:
    Samarth Dhruva (samarthd)
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      List<P> readAllByEmail​(Set<String> emails, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Searches for customers in the data store whose Customer.email contains in the given emails.
      org.springframework.data.domain.Page<P> readAllByFullName​(String nameQuery, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Searches for customers in the data store whose Customer#name matches the given nameQuery.
      List<String> readAllUniqueIds​(int page, cz.jirutka.rsql.parser.ast.Node filters)
      Retrieves a list of unique customer context IDs no larger than page.
      Optional<P> readByContextIdOpt​(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Read a single instance of an entity in the form of a business domain.
      Optional<P> readByEmail​(String email, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find a customer by email.
      Stream<P> readCustomersPagingStream​(cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads all customers matching the given filters.
      Stream<P> streamAll​(cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Sort sort, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Stream a list of customers matching the provided filters
      • Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService

        create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort
      • Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService

        readAll, readAll, readAll, readAll
    • Method Detail

      • readByContextIdOpt

        Optional<P> readByContextIdOpt​(@NonNull
                                       String id,
                                       @Nullable
                                       com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Read a single instance of an entity in the form of a business domain.
        Parameters:
        id - The context id for the entity. This is the id by which the business recognizes the item.
        context - Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.
        Returns:
        an Optional containing the narrowed entity instance in the form of a business instance if found, Optional.empty() otherwise
      • readAllByFullName

        @NonNull
        org.springframework.data.domain.Page<P> readAllByFullName​(@NonNull
                                                                  String nameQuery,
                                                                  @NonNull
                                                                  cz.jirutka.rsql.parser.ast.Node filters,
                                                                  @NonNull
                                                                  org.springframework.data.domain.Pageable page,
                                                                  @Nullable
                                                                  com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Searches for customers in the data store whose Customer#name matches the given nameQuery. Ignores case.
        Parameters:
        nameQuery - the name to search for
        filters - An RSQL filter used to narrow query results. May be EmptyNode if no filters should be applied.
        page - the requested page of results from the database
        contextInfo - context information surrounding sandboxing and multitenant state
        Returns:
        the customers in the data store whose Customer#name matches the given nameQuery. Ignores case.
      • readAllByEmail

        @NonNull
        List<P> readAllByEmail​(@NonNull
                               Set<String> emails,
                               @Nullable
                               com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Searches for customers in the data store whose Customer.email contains in the given emails. Ignores case.
        Parameters:
        emails - the set of emails to search for
        contextInfo - context information surrounding sandboxing and multitenant state
        Returns:
        the customers in the data store whose Customer.email contains in the given emails. Ignores case.
      • readAllUniqueIds

        List<String> readAllUniqueIds​(int page,
                                      @NonNull
                                      cz.jirutka.rsql.parser.ast.Node filters)
        Retrieves a list of unique customer context IDs no larger than page. It is expected that any appropriate offset is achieved through criteria designated in filters.
        Parameters:
        page - the requested page of results from the database. -1 indicates no limit.
        filters - An RSQL filter used to narrow query results. May be EmptyNode if no filters should be applied.
        Returns:
        unique customer IDs
      • streamAll

        Stream<P> streamAll​(@NonNull
                            cz.jirutka.rsql.parser.ast.Node filters,
                            @NonNull
                            org.springframework.data.domain.Sort sort,
                            @Nullable
                            com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Stream a list of customers matching the provided filters
        Parameters:
        filters - An RSQL filter used to narrow query results. May be EmptyNode if no filters should be applied.
        sort - The string containing the structured list of sorts to apply. May be Sort.unsorted()
        contextInfo - context information surrounding sandboxing and multitenant state
        Returns:
        A stream of customers matching the filters.
      • readCustomersPagingStream

        Stream<P> readCustomersPagingStream​(@Nullable
                                            cz.jirutka.rsql.parser.ast.Node filters,
                                            @Nullable
                                            com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Reads all customers matching the given filters. In case filters are empty, all customers are returned.
        Parameters:
        filters - additional filters to apply in the query
        contextInfo - Request context information around sandbox and multitenant state
        Returns:
        the customers matching the given filters
      • readByEmail

        Optional<P> readByEmail​(String email,
                                @Nullable
                                com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Find a customer by email. Note: While e-mail is guaranteed to be unique per customer context, this is not guaranteed across multiple customer contexts. Therefore, the contextInfo argument is required.
        Parameters:
        email - The email to search for
        contextInfo - The current context
        Returns:
        The customer associated with the supplied email address.