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 MultiTenantCopierExtensionManagerprotected Catalogprotected Siteprotected GenericEntityServiceprotected Booleanstatic final Stringstatic final Stringprotected Catalogprotected Site -
Constructor Summary
ConstructorsConstructorDescriptionMultiTenantCopyContext(Catalog fromCatalog, Catalog toCatalog, Site fromSite, Site toSite, GenericEntityService genericEntityService, MultiTenantCopierExtensionManager extensionManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDeferredOperation(DeferredOperation operation) voidaddDeferredOperations(List<DeferredOperation> operations) protected booleancheckCloneStatus(Object instance) voidprotected <G> GcreateNewInstance(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> TgetClonedVersion(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> GperformCopy(Object instance, Class<?> instanceClass, Long originalId) voidsetCopyHints(Map<String, String> copyHints) voidsetForDuplicate(Boolean forDuplicate) protected BroadleafRequestContextvoidstoreEquivalentMapping(String className, Object fromId, Object toId) protected voidtearDownContext(BroadleafRequestContext context) protected voidvalidateClone(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 voidvalidateOriginal(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
-