Class DefaultCloneCategoryService<P extends Category,R extends CloneCategoryRequest>

java.lang.Object
com.broadleafcommerce.catalog.clone.category.service.DefaultCloneCategoryService<P,R>
All Implemented Interfaces:
CloneCategoryService<P,R>

public class DefaultCloneCategoryService<P extends Category,R extends CloneCategoryRequest> extends Object implements CloneCategoryService<P,R>
Default implementation for CloneCategoryService.
Author:
Chad Harchar (charchar)
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultCloneCategoryService(CategoryService<P> categoryService, CloneCategoryRelationshipsManager<P,R> cRelationshipService, CategoryRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager, com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager domainMapper, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManager validator, org.springframework.transaction.support.TransactionTemplate template, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    cloneCategory(R request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Clone the category with an id CloneCategoryRequest.getCategoryId().
    protected void
    doPostCloneActivities(R request, P original, P cloned, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Initiates additional cloning and post-processing of the cloned category including cloning of the category's relationships such as assets and category-products.
    protected com.broadleafcommerce.data.tracking.core.Trackable
    generateClone(R request, @NonNull com.broadleafcommerce.data.tracking.core.Trackable category, @NonNull Class<P> businessType, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Generates the clone of the category.
    protected CategoryService<P>
     
    protected R
    getChildCategoryCloneRequest(R request, P clonedBI, Category cat)
     
     
    protected com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager
     
    protected com.broadleafcommerce.common.messaging.notification.NotificationManager
     
    protected com.fasterxml.jackson.databind.ObjectMapper
     
    protected CategoryRepository<com.broadleafcommerce.data.tracking.core.Trackable>
     
    protected org.springframework.transaction.support.TransactionTemplate
     
    protected com.broadleafcommerce.common.extension.TypeFactory
     
    protected com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManager
     
    protected void
    sendNotificationsOfCloning(String originalId, @NonNull com.broadleafcommerce.data.tracking.core.Trackable cloned)
    Sends notifications out to the system following the cloning process similar to when persistence events occur.

    Methods inherited from class java.lang.Object

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

    • DefaultCloneCategoryService

      public DefaultCloneCategoryService(CategoryService<P> categoryService, CloneCategoryRelationshipsManager<P,R> cRelationshipService, CategoryRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager, com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager domainMapper, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManager validator, org.springframework.transaction.support.TransactionTemplate template, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
  • Method Details

    • cloneCategory

      public P cloneCategory(@NonNull R request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: CloneCategoryService

      Clone the category with an id CloneCategoryRequest.getCategoryId(). This will also clone the Category relationships DefaultRelationshipType which are specified in CloneCategoryRequest.getCloneRelationships().

      Additional relationships can be cloned via the P@link CloneCategoryRelationshipsService}

      Specified by:
      cloneCategory in interface CloneCategoryService<P extends Category,R extends CloneCategoryRequest>
      Parameters:
      request - the request to perform the clone operation
      context - context information surrounding sandboxing and multitenant state
      Returns:
      the cloned Category
    • getChildCategoryCloneRequest

      protected R getChildCategoryCloneRequest(@NonNull R request, P clonedBI, Category cat)
    • generateClone

      protected com.broadleafcommerce.data.tracking.core.Trackable generateClone(@NonNull R request, @NonNull @NonNull com.broadleafcommerce.data.tracking.core.Trackable category, @NonNull @NonNull Class<P> businessType, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Generates the clone of the category.
      Parameters:
      request - the request to perform the clone operation
      category - Category to clone
      businessType - The projection domain corresponding to the persistent category
      context - context information surrounding sandboxing and multitenant state
      Returns:
      Clone of category.
    • doPostCloneActivities

      protected void doPostCloneActivities(@NonNull R request, @NonNull P original, @NonNull P cloned, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Initiates additional cloning and post-processing of the cloned category including cloning of the category's relationships such as assets and category-products.
      Parameters:
      request - the request to perform the clone operation
      original - The original Category that was cloned
      cloned - Result of cloning original
      context - context information surrounding sandboxing and multitenant state
    • sendNotificationsOfCloning

      protected void sendNotificationsOfCloning(String originalId, @NonNull @NonNull com.broadleafcommerce.data.tracking.core.Trackable cloned)
      Sends notifications out to the system following the cloning process similar to when persistence events occur.
      Parameters:
      cloned - Result of cloning a category
    • getCategoryService

      protected CategoryService<P> getCategoryService()
    • getCRelationshipService

      protected CloneCategoryRelationshipsManager<P,R> getCRelationshipService()
    • getRepository

      protected CategoryRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()
    • getNotificationManager

      protected com.broadleafcommerce.common.messaging.notification.NotificationManager getNotificationManager()
    • getDomainMapper

      protected com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager getDomainMapper()
    • getObjectMapper

      protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
    • getValidator

      protected com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorManager getValidator()
    • getTemplate

      protected org.springframework.transaction.support.TransactionTemplate getTemplate()
    • getTypeFactory

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