Class AbstractPrimaryAssetCollisionService<P extends PrimaryAsset>

java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
com.broadleafcommerce.catalog.service.asset.AbstractPrimaryAssetCollisionService<P>
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
Direct Known Subclasses:
DefaultCategoryPrimaryAssetCollisionService, DefaultProductPrimaryAssetCollisionService

public abstract class AbstractPrimaryAssetCollisionService<P extends PrimaryAsset> extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
The abstract service that is used to resolve collisions of the primary assets. The entity can have only one primary asset if the new was assigned the previous should be un-set.
Author:
Dima Myroniuk (dmyroniuk)
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractPrimaryAssetCollisionService(com.broadleafcommerce.data.tracking.core.TrackableRepository<T> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract List<P>
    readAllPrimaryAssetsByParentIdsExcludeAssetIds(Iterable<String> parentIds, Iterable<String> assetIdsToExclude, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads all the primary assets for the given parent IDs excluding given asset IDs.
    com.broadleafcommerce.data.tracking.core.service.BulkPersistenceResponse<P>
    reconcilePrimaryAssetCollisions(com.broadleafcommerce.data.tracking.core.service.BulkPersistenceResponse<P> response, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Identifies a mapping of entity id to primary asset id.
    com.broadleafcommerce.data.tracking.core.service.BulkPersistenceResponse<P>
    reconcilePrimaryAssetCollisions(Iterable<String> parentIds, Iterable<String> assetIdsToExclude, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Identifies a mapping of entity id to primary asset id.
    com.broadleafcommerce.data.tracking.core.service.BulkPersistenceResponse<P>
    reconcilePrimaryAssetCollisions(String parentId, String assetIdToExclude, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Identifies a mapping of entity id to primary asset id.
    com.broadleafcommerce.data.tracking.core.service.BulkPersistenceResponse<P>
    reconcilePrimaryAssetCollisions(List<P> assets, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Identifies a mapping of entity id to primary asset id.
    com.broadleafcommerce.data.tracking.core.service.BulkPersistenceResponse<P>
    reconcilePrimaryAssetCollisions(Map<String,String> savedPrimaryAssets, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Identifies a mapping of entity id to primary asset id.
    com.broadleafcommerce.data.tracking.core.service.BulkPersistenceResponse<P>
    reconcilePrimaryAssetCollisions(P changedAsset, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Identifies a mapping of entity id to primary asset id.

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

    • AbstractPrimaryAssetCollisionService

      public AbstractPrimaryAssetCollisionService(com.broadleafcommerce.data.tracking.core.TrackableRepository<T> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper)
  • Method Details

    • reconcilePrimaryAssetCollisions

      public com.broadleafcommerce.data.tracking.core.service.BulkPersistenceResponse<P> reconcilePrimaryAssetCollisions(com.broadleafcommerce.data.tracking.core.service.BulkPersistenceResponse<P> response, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Identifies a mapping of entity id to primary asset id. If there are multiple primary assets for the entity, then the latest successfully persisted primary asset is given preference. Based on this mapping marks other assets as non-primary
      Parameters:
      response - the persistence response that contains the information about created or updated assets
      context - context information around sandboxing and multitenant state
      Returns:
      the BulkPersistenceResponse that contains information about which entities succeeded, and which entities failed and why
    • reconcilePrimaryAssetCollisions

      public com.broadleafcommerce.data.tracking.core.service.BulkPersistenceResponse<P> reconcilePrimaryAssetCollisions(List<P> assets, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Identifies a mapping of entity id to primary asset id. If there are multiple primary assets for the entity, then the latest successfully persisted primary asset is given preference. Based on this mapping marks other assets as non-primary
      Parameters:
      assets - the list of the created or updated assets
      context - context information around sandboxing and multitenant state
      Returns:
      the BulkPersistenceResponse that contains information about which entities succeeded, and which entities failed and why
    • reconcilePrimaryAssetCollisions

      public com.broadleafcommerce.data.tracking.core.service.BulkPersistenceResponse<P> reconcilePrimaryAssetCollisions(Map<String,String> savedPrimaryAssets, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Identifies a mapping of entity id to primary asset id. If there are multiple primary assets for the entity, then the latest successfully persisted primary asset is given preference. Based on this mapping marks other assets as non-primary
      Parameters:
      savedPrimaryAssets - a mapping of parent id to primary asset id
      context - context information around sandboxing and multitenant state
      Returns:
      the BulkPersistenceResponse that contains information about which entities succeeded, and which entities failed and why
    • reconcilePrimaryAssetCollisions

      public com.broadleafcommerce.data.tracking.core.service.BulkPersistenceResponse<P> reconcilePrimaryAssetCollisions(Iterable<String> parentIds, Iterable<String> assetIdsToExclude, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Identifies a mapping of entity id to primary asset id. If there are multiple primary assets for the entity, then the latest successfully persisted primary asset is given preference. Based on this mapping marks other assets as non-primary
      Parameters:
      parentIds - IDs of the parent entities for which to find primary assets
      assetIdsToExclude - IDs of the assets to exclude
      context - context information around sandboxing and multitenant state
      Returns:
      the BulkPersistenceResponse that contains information about which entities succeeded, and which entities failed and why
    • reconcilePrimaryAssetCollisions

      public com.broadleafcommerce.data.tracking.core.service.BulkPersistenceResponse<P> reconcilePrimaryAssetCollisions(P changedAsset, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Identifies a mapping of entity id to primary asset id. If there are multiple primary assets for the entity, then the latest successfully persisted primary asset is given preference. Based on this mapping marks other assets as non-primary
      Parameters:
      changedAsset - the created or updated asset
      context - context information around sandboxing and multitenant state
      Returns:
      the BulkPersistenceResponse that contains information about which entities succeeded, and which entities failed and why
    • reconcilePrimaryAssetCollisions

      public com.broadleafcommerce.data.tracking.core.service.BulkPersistenceResponse<P> reconcilePrimaryAssetCollisions(String parentId, String assetIdToExclude, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Identifies a mapping of entity id to primary asset id. If there are multiple primary assets for the entity, then the latest successfully persisted primary asset is given preference. Based on this mapping marks other assets as non-primary
      Parameters:
      parentId - the ID of the parent entity
      assetIdToExclude - the ID of the asset to exclude
      context - context information around sandboxing and multitenant state
      Returns:
      the BulkPersistenceResponse that contains information about which entities succeeded, and which entities failed and why
    • readAllPrimaryAssetsByParentIdsExcludeAssetIds

      protected abstract List<P> readAllPrimaryAssetsByParentIdsExcludeAssetIds(Iterable<String> parentIds, Iterable<String> assetIdsToExclude, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads all the primary assets for the given parent IDs excluding given asset IDs.
      Parameters:
      parentIds - IDs of the parent entities for which to find primary assets
      assetIdsToExclude - IDs of the assets to exclude
      contextInfo - context information around sandboxing and multitenant state
      Returns:
      the primary assets for the given parent IDs excluding given asset IDs.