Class EntityDuplicatorImpl
java.lang.Object
org.broadleafcommerce.common.copy.MultiTenantCopier
org.broadleafcommerce.common.persistence.EntityDuplicatorImpl
- All Implemented Interfaces:
EntityDuplicator
,org.springframework.core.Ordered
@Service("blEntityDuplicator")
public class EntityDuplicatorImpl
extends MultiTenantCopier
implements EntityDuplicator
- Author:
- Jeff Fischer
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Collection<EntityDuplicationHelper>
protected EntityDuplicatorExtensionManager
protected boolean
protected MultiTenantCopierExtensionManager
Fields inherited from class org.broadleafcommerce.common.copy.MultiTenantCopier
catalogCopierOptimizationEnabled, classExcludeRegexPatternList, genericEntityService, LOG, order, transUtil
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> T
Create a production duplicate of the entity specified in the params.<T> T
copy
(Class<T> entityClass, Long id, Map<String, String> copyHints, EntityDuplicateModifier... modifiers) Deprecated.<T> T
copy
(MultiTenantCopyContext context, MultiTenantCloneable<T> entity) Create a production duplicate of the entity specified in the params.<T> T
copy
(MultiTenantCopyContext context, MultiTenantCloneable<T> entity, Map<String, String> copyHints, EntityDuplicateModifier... modifiers) Deprecated.void
copyEntities
(MultiTenantCopyContext context) Main method that should be implemented by eachMultiTenantCopier
to drive the logic of copying that particular entity to the new derived catalog.protected Set<EntityDuplicationHelper>
protected <T> T
performCopy
(MultiTenantCopyContext context, MultiTenantCloneable<T> entity) protected <T> T
performCopy
(MultiTenantCopyContext context, MultiTenantCloneable<T> entity, Map<String, String> copyHints, EntityDuplicateModifier... modifiers) Deprecated.protected void
putAllCopyHints
(MultiTenantCopyContext context, Set<EntityDuplicationHelper> helpers) boolean
Validate whether or not this feature is enabled and whether the passed entity params are valid for duplication.boolean
Validate whether or not this feature is enabled and whether or not the passed entity params are valid for duplication.Methods inherited from class org.broadleafcommerce.common.copy.MultiTenantCopier
addPattern, copyEntitiesOfType, dontTraversThroughEntityFromTheDB, excludeFromCopyRegexPattern, getOrder, needToAdd, persistCopyObjectTree, persistCopyObjectTreeInternal, persistNode, readAll, readAll, readAllIds, readCount, save, setOrder
-
Field Details
-
isActive
@Value("${admin.entity.duplication.isactive:false}") protected boolean isActive -
extensionManager
-
mtCopierExtensionManager
-
entityDuplicationHelpers
-
-
Constructor Details
-
EntityDuplicatorImpl
public EntityDuplicatorImpl()
-
-
Method Details
-
copyEntities
Description copied from class:MultiTenantCopier
Main method that should be implemented by eachMultiTenantCopier
to drive the logic of copying that particular entity to the new derived catalog.- Specified by:
copyEntities
in classMultiTenantCopier
- Throws:
Exception
-
validate
Description copied from interface:EntityDuplicator
Validate whether or not this feature is enabled and whether the passed entity params are valid for duplication.- Specified by:
validate
in interfaceEntityDuplicator
- Returns:
-
validate
Description copied from interface:EntityDuplicator
Validate whether or not this feature is enabled and whether or not the passed entity params are valid for duplication.- Specified by:
validate
in interfaceEntityDuplicator
- Returns:
-
copy
@Deprecated public <T> T copy(Class<T> entityClass, Long id, Map<String, String> copyHints, EntityDuplicateModifier... modifiers) Deprecated.Instead of passing inEntityDuplicateModifier
s, add the beans toEntityDuplicationHelpers
. Additionally, add copy hints to the helpers. Also, note that you should implementAbstractEntityDuplicationHelper
now instead asEntityDuplicateModifier
is deprecated.- Specified by:
copy
in interfaceEntityDuplicator
-
copy
@Deprecated public <T> T copy(MultiTenantCopyContext context, MultiTenantCloneable<T> entity, Map<String, String> copyHints, EntityDuplicateModifier... modifiers) Deprecated.Instead of passing inEntityDuplicateModifier
s, add the beans toEntityDuplicationHelpers
. Additionally, add copy hints to the helpers. Also, note that you should implementAbstractEntityDuplicationHelper
now instead asEntityDuplicateModifier
is deprecated.- Specified by:
copy
in interfaceEntityDuplicator
-
copy
Description copied from interface:EntityDuplicator
Create a production duplicate of the entity specified in the params. The is the most oft used copy method.- Specified by:
copy
in interfaceEntityDuplicator
- Type Parameters:
T
- the entity type- Parameters:
entityClass
- the class for the entityid
- the primary key- Returns:
- the duplicated entity
-
copy
@Transactional("blTransactionManager") public <T> T copy(MultiTenantCopyContext context, MultiTenantCloneable<T> entity) Description copied from interface:EntityDuplicator
Create a production duplicate of the entity specified in the params. The is the least oft used copy method.- Specified by:
copy
in interfaceEntityDuplicator
- Type Parameters:
T
- the entity type- Parameters:
context
- prepopulated copy context that is setup for catalog and/or siteentity
- the instance to duplicate- Returns:
- the duplicated entity
-
performCopy
@Deprecated protected <T> T performCopy(MultiTenantCopyContext context, MultiTenantCloneable<T> entity, Map<String, String> copyHints, EntityDuplicateModifier... modifiers) throws ExceptionDeprecated.Instead of passing inEntityDuplicateModifier
s, add the beans toEntityDuplicationHelpers
. Additionally, add copy hints to the helpers. Also, note that you should implementAbstractEntityDuplicationHelper
now instead asEntityDuplicateModifier
is deprecated.- Throws:
Exception
-
performCopy
protected <T> T performCopy(MultiTenantCopyContext context, MultiTenantCloneable<T> entity) throws Exception - Throws:
Exception
-
filterDuplicationHelpers
-
putAllCopyHints
protected void putAllCopyHints(MultiTenantCopyContext context, Set<EntityDuplicationHelper> helpers)
-