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
ConstructorDescriptionDefaultCloneCategoryService
(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 TypeMethodDescriptioncloneCategory
(R request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Clone the category with an idCloneCategoryRequest.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 thecategory
.protected CategoryService<P>
protected R
getChildCategoryCloneRequest
(R request, P clonedBI, Category cat) protected CloneCategoryRelationshipsManager<P,
R> 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.
-
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 theCategory
relationshipsDefaultRelationshipType
which are specified inCloneCategoryRequest.getCloneRelationships()
.Additional relationships can be cloned via the P@link
CloneCategoryRelationshipsService
}- Specified by:
cloneCategory
in interfaceCloneCategoryService<P extends Category,
R extends CloneCategoryRequest> - Parameters:
request
- the request to perform the clone operationcontext
- context information surrounding sandboxing and multitenant state- Returns:
- the cloned
Category
-
getChildCategoryCloneRequest
-
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 thecategory
.- Parameters:
request
- the request to perform the clone operationcategory
- Category to clonebusinessType
- The projection domain corresponding to the persistentcategory
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 operationoriginal
- The original Category that was clonedcloned
- Result of cloningoriginal
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
-
getCRelationshipService
-
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()
-