Class MultiTenantCopyContext
java.lang.Object
org.broadleafcommerce.common.copy.MultiTenantCopyContext
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]
hints used to fine tune copying - generally support for hints is included inMultiTenantCloneable.createOrRetrieveCopyInstance(org.broadleafcommerce.common.copy.MultiTenantCopyContext)
implementations.protected List<DeferredOperation>
protected MultiTenantCopierExtensionManager
protected Catalog
protected Site
protected GenericEntityService
protected Boolean
static final String
static final String
protected Catalog
protected Site
-
Constructor Summary
ConstructorsConstructorDescriptionMultiTenantCopyContext
(Catalog fromCatalog, Catalog toCatalog, Site fromSite, Site toSite, GenericEntityService genericEntityService, MultiTenantCopierExtensionManager extensionManager) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDeferredOperation
(DeferredOperation operation) void
addDeferredOperations
(List<DeferredOperation> operations) protected boolean
checkCloneStatus
(Object instance) void
protected <G> G
createNewInstance
(Class<?> instanceClass) <G> CreateResponse<G>
createOrRetrieveCopyInstance
(Object instance) Create a new instance of the polymorphic entity type - could be an extended type outside of Broadleaf.Field[]
getAllFields
(Class<?> targetClass) <T> T
getClonedVersion
(Class<T> clazz, Object originalId) Provides a place for the caller to provide generic information to inform the copy operation.getEquivalentId
(String className, Object fromId) getIdentifier
(Object entity) getPreviousClone
(Class<?> instanceClass, Long originalId) protected <G> CreateResponse<G>
handleEmbedded
(Class<?> instanceClass) protected <G> CreateResponse<G>
handleStandardEntity
(Object instance, BroadleafRequestContext context, Class<?> instanceClass) protected <G> G
performCopy
(Object instance, Class<?> instanceClass, Long originalId) void
setCopyHints
(Map<String, String> copyHints) void
setForDuplicate
(Boolean forDuplicate) protected BroadleafRequestContext
void
storeEquivalentMapping
(String className, Object fromId, Object toId) protected void
tearDownContext
(BroadleafRequestContext context) protected void
validateClone
(Object cloned) Detects whether or not the current cloned entity is an extension of an entity in Broadleaf, and if so, if the extension itself does not implement clone.protected void
validateOriginal
(Object instance)
-
Field Details
-
BROADLEAF_PACKAGE_PREFIXES
-
MANUAL_DUPLICATION
- See Also:
-
PROPAGATION
- See Also:
-
fromCatalog
-
toCatalog
-
fromSite
-
toSite
-
extensionManager
-
currentEquivalentMap
-
currentCloneMap
-
equivalentsMap
-
genericEntityService
-
deferredOperations
-
copyHints
hints used to fine tune copying - generally support for hints is included inMultiTenantCloneable.createOrRetrieveCopyInstance(org.broadleafcommerce.common.copy.MultiTenantCopyContext)
implementations. -
isForDuplicate
-
-
Constructor Details
-
MultiTenantCopyContext
public MultiTenantCopyContext(Catalog fromCatalog, Catalog toCatalog, Site fromSite, Site toSite, GenericEntityService genericEntityService, MultiTenantCopierExtensionManager extensionManager)
-
-
Method Details
-
getClonedVersion
-
getEquivalentId
-
storeEquivalentMapping
-
getIdentifier
-
getFromCatalog
-
getToCatalog
-
getFromSite
-
getToSite
-
createOrRetrieveCopyInstance
public <G> CreateResponse<G> createOrRetrieveCopyInstance(Object instance) throws CloneNotSupportedException Create a new instance of the polymorphic entity type - could be an extended type outside of Broadleaf.- Type Parameters:
G
-- Parameters:
instance
- the object instance for the actual entity type (could be extended)- Returns:
- the new, empty instance of the entity
- Throws:
CloneNotSupportedException
-
clearOriginalIdentifiers
public void clearOriginalIdentifiers() -
removeOriginalIdentifier
-
getAllFields
-
getPreviousClone
-
addDeferredOperation
-
addDeferredOperations
-
getDeferredOperations
-
getCopyHints
Provides a place for the caller to provide generic information to inform the copy operation. It's still up to the entity implementation ofMultiTenantCloneable.createOrRetrieveCopyInstance(org.broadleafcommerce.common.copy.MultiTenantCopyContext)
to actually harvest and utilize the information in some meaningful way.- Returns:
-
setCopyHints
-
getForDuplicate
-
setForDuplicate
-
checkCloneStatus
-
validateOriginal
- Throws:
CloneNotSupportedException
-
tearDownContext
-
setupContext
-
createNewInstance
-
handleStandardEntity
protected <G> CreateResponse<G> handleStandardEntity(Object instance, BroadleafRequestContext context, Class<?> instanceClass) throws CloneNotSupportedException - Throws:
CloneNotSupportedException
-
handleEmbedded
-
performCopy
protected <G> G performCopy(Object instance, Class<?> instanceClass, Long originalId) throws CloneNotSupportedException - Throws:
CloneNotSupportedException
-
validateClone
Detects whether or not the current cloned entity is an extension of an entity in Broadleaf, and if so, if the extension itself does not implement clone.- Parameters:
cloned
- the cloned entity instance- Throws:
CloneNotSupportedException
- thrown if the entity is an extension and is does not implement clone
-