Class AbstractEntityDuplicationHelper<T>
java.lang.Object
org.broadleafcommerce.common.persistence.AbstractEntityDuplicationHelper<T>
- All Implemented Interfaces:
EntityDuplicationHelper<T>
- Direct Known Subclasses:
OfferDuplicateModifier
,ProductDuplicateModifier
public abstract class AbstractEntityDuplicationHelper<T>
extends Object
implements EntityDuplicationHelper<T>
Implements
getCopyHints()
and addCopyHint(String, String)
,
using a HashMap
as the underlying data structure for storing the hints. Also provides a
helper method getCopySuffix()
for the usual use-case of changing the name of the
duplicated entity.- Author:
- Nathan Moore (nathanmoore).
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractEntityDuplicationHelper
(org.springframework.core.env.Environment environment) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCopyHint
(String name, String hint) abstract boolean
canHandle
(MultiTenantCloneable candidate) protected String
Defaults to " - Copy" but can be overridden usingadmin.entity.duplication.suffix.default
.abstract void
modifyInitialDuplicateState
(T original, T copy, MultiTenantCopyContext context)
-
Field Details
-
env
protected final org.springframework.core.env.Environment env -
copyHints
-
-
Constructor Details
-
AbstractEntityDuplicationHelper
public AbstractEntityDuplicationHelper(org.springframework.core.env.Environment environment)
-
-
Method Details
-
getCopySuffix
Defaults to " - Copy" but can be overridden usingadmin.entity.duplication.suffix.default
.- Returns:
- suffix to append to the name/identifier of the entity copy
-
canHandle
- Specified by:
canHandle
in interfaceEntityDuplicationHelper<T>
-
getCopyHints
- Specified by:
getCopyHints
in interfaceEntityDuplicationHelper<T>
- Returns:
- Hints used to fine tune copying - generally support for hints is included in
MultiTenantCloneable.createOrRetrieveCopyInstance(org.broadleafcommerce.common.copy.MultiTenantCopyContext)
implementations.
-
addCopyHint
- Specified by:
addCopyHint
in interfaceEntityDuplicationHelper<T>
-
modifyInitialDuplicateState
public abstract void modifyInitialDuplicateState(T original, T copy, MultiTenantCopyContext context) throws CloneNotSupportedException - Specified by:
modifyInitialDuplicateState
in interfaceEntityDuplicationHelper<T>
- Throws:
CloneNotSupportedException
-