Class DefaultStarredItemService<P extends StarredItem>

java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
com.broadleafcommerce.content.service.DefaultStarredItemService<P>
All Implemented Interfaces:
StarredItemService<P>, com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>

public class DefaultStarredItemService<P extends StarredItem> extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P> implements StarredItemService<P>
Author:
Susana Cruz (susanaccruz)
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultStarredItemService(StarredItemRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, ContentItemService<ContentItem> contentItemService, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.broadleafcommerce.data.tracking.core.tenant.service.CommonCatalogService<com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog> catalogService)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    createAll(@NonNull String userId, @NonNull List<String> contentItemIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Create StarredItems based on the supplied user id and content item ids.
    protected P
    createStarredItem(String userId, String contentItemId)
     
    protected List<P>
    createStarredItems(String userId, List<String> contentItemIds)
     
    protected com.broadleafcommerce.data.tracking.core.tenant.service.CommonCatalogService<com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog>
     
     
    protected StarredItemRepository<com.broadleafcommerce.data.tracking.core.Trackable>
     
    protected com.broadleafcommerce.common.extension.TypeFactory
     
    protected void
    hydrateCatalogInfoInAppContext(@NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @NonNull ContentItem contentItem)
    When performing a starring operation, typically for bulk starring in an application context, it is not necessarily possible for the caller to identify which assigned catalog (a.k.a., profile) the starred xref should belong to since multiple items may be getting starred and multiple catalogs can be assigned to the application.
    readAllByUserId(@NonNull String userId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Read all StarredItems, optionally filtered by name.
    readAllByUserIdAndContentItemIds(@NonNull String userId, @NonNull List<String> contentItemIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Read all StarredItems, optionally filtered by user id and content item ids.

    Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService

    getRsqlHelper, readAll, readAll, readAll, readAll

    Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService

    convertFromPersistentDomain, convertToPersistentDomain, create, createAll, createAllAllowingPartialSuccess, delete, getHelper, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, update, updateAll, updateAllAllowingPartialSuccess, updateSort

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    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
  • Constructor Details

    • DefaultStarredItemService

      public DefaultStarredItemService(StarredItemRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, ContentItemService<ContentItem> contentItemService, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, com.broadleafcommerce.data.tracking.core.tenant.service.CommonCatalogService<com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog> catalogService)
  • Method Details

    • readAllByUserId

      public List<P> readAllByUserId(@NonNull @NonNull String userId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: StarredItemService
      Read all StarredItems, optionally filtered by name.
      Specified by:
      readAllByUserId in interface StarredItemService<P extends StarredItem>
      Parameters:
      userId - the user ID to filter by
      contextInfo - context information surrounding sandboxing and multitenant state
      Returns:
      all StarredItems, optionally filtered by name
    • readAllByUserIdAndContentItemIds

      public List<P> readAllByUserIdAndContentItemIds(@NonNull @NonNull String userId, @NonNull @NonNull List<String> contentItemIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: StarredItemService
      Read all StarredItems, optionally filtered by user id and content item ids.
      Specified by:
      readAllByUserIdAndContentItemIds in interface StarredItemService<P extends StarredItem>
      Parameters:
      userId - the user ID to filter by
      contentItemIds - the content item IDs to filter by
      context - context information surrounding sandboxing and multitenant state
      Returns:
      all StarredItems, optionally filtered by user id and content item ids
    • createAll

      public List<P> createAll(@NonNull @NonNull String userId, @NonNull @NonNull List<String> contentItemIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: StarredItemService
      Create StarredItems based on the supplied user id and content item ids.
      Specified by:
      createAll in interface StarredItemService<P extends StarredItem>
      Parameters:
      userId - the user ID to create the starred items with
      contentItemIds - the content item IDs to create the starred items with
      context - context information surrounding sandboxing and multitenant state
      Returns:
      all newly created StarredItems
    • createStarredItem

      protected P createStarredItem(String userId, String contentItemId)
    • createStarredItems

      protected List<P> createStarredItems(String userId, List<String> contentItemIds)
    • hydrateCatalogInfoInAppContext

      protected void hydrateCatalogInfoInAppContext(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @NonNull @NonNull ContentItem contentItem)
      When performing a starring operation, typically for bulk starring in an application context, it is not necessarily possible for the caller to identify which assigned catalog (a.k.a., profile) the starred xref should belong to since multiple items may be getting starred and multiple catalogs can be assigned to the application. Therefore, the items could be from different catalogs. To handle this, the item being starred will be consulted to glean its catalog. Then, this method will resolve the implicit catalog matching the original but which belongs to the current application. This will be set on the ContextRequest.
      Parameters:
      context - The request's ContextInfo that needs to be hydrated.
      contentItem - The item to be starred.
      Throws:
      com.broadleafcommerce.data.tracking.core.exception.NotPermittedException - when the original item's catalog has no implicit catalog belonging to the current application.
    • getRepository

      protected StarredItemRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()
      Overrides:
      getRepository in class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends StarredItem>
    • getContentItemService

      protected ContentItemService<ContentItem> getContentItemService()
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
    • getCatalogService

      protected com.broadleafcommerce.data.tracking.core.tenant.service.CommonCatalogService<com.broadleafcommerce.data.tracking.core.tenant.domain.Catalog> getCatalogService()