public class MultiTenantCopyContext extends Object
Modifier and Type | Field and Description |
---|---|
static String[] |
BROADLEAF_PACKAGE_PREFIXES |
protected Map<String,String> |
copyHints
hints used to fine tune copying - generally support for hints is included in
MultiTenantCloneable.createOrRetrieveCopyInstance(org.broadleafcommerce.common.copy.MultiTenantCopyContext) implementations. |
protected Map<Integer,Object> |
currentCloneMap |
protected com.google.common.collect.BiMap<Integer,String> |
currentEquivalentMap |
protected List<DeferredOperation> |
deferredOperations |
protected Map<String,Map<Object,Object>> |
equivalentsMap |
protected MultiTenantCopierExtensionManager |
extensionManager |
protected Catalog |
fromCatalog |
protected Site |
fromSite |
protected GenericEntityService |
genericEntityService |
protected Boolean |
isForDuplicate |
static String |
MANUAL_DUPLICATION |
static String |
PROPAGATION |
protected Catalog |
toCatalog |
protected Site |
toSite |
Constructor and Description |
---|
MultiTenantCopyContext(Catalog fromCatalog,
Catalog toCatalog,
Site fromSite,
Site toSite,
GenericEntityService genericEntityService,
MultiTenantCopierExtensionManager extensionManager) |
Modifier and Type | Method and Description |
---|---|
void |
addDeferredOperation(DeferredOperation operation) |
void |
addDeferredOperations(List<DeferredOperation> operations) |
protected boolean |
checkCloneStatus(Object instance) |
void |
clearOriginalIdentifiers() |
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) |
Map<String,String> |
getCopyHints()
Provides a place for the caller to provide generic information to inform the copy operation.
|
List<DeferredOperation> |
getDeferredOperations() |
Object |
getEquivalentId(String className,
Object fromId) |
Boolean |
getForDuplicate() |
Catalog |
getFromCatalog() |
Site |
getFromSite() |
Long |
getIdentifier(Object entity) |
Object |
getPreviousClone(Class<?> instanceClass,
Long originalId) |
Catalog |
getToCatalog() |
Site |
getToSite() |
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) |
Object |
removeOriginalIdentifier(Object copy) |
void |
setCopyHints(Map<String,String> copyHints) |
void |
setForDuplicate(Boolean forDuplicate) |
protected BroadleafRequestContext |
setupContext() |
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) |
public static final String[] BROADLEAF_PACKAGE_PREFIXES
public static final String MANUAL_DUPLICATION
public static final String PROPAGATION
protected Catalog fromCatalog
protected Catalog toCatalog
protected Site fromSite
protected Site toSite
protected MultiTenantCopierExtensionManager extensionManager
protected GenericEntityService genericEntityService
protected List<DeferredOperation> deferredOperations
protected Map<String,String> copyHints
MultiTenantCloneable.createOrRetrieveCopyInstance(org.broadleafcommerce.common.copy.MultiTenantCopyContext)
implementations.protected Boolean isForDuplicate
public MultiTenantCopyContext(Catalog fromCatalog, Catalog toCatalog, Site fromSite, Site toSite, GenericEntityService genericEntityService, MultiTenantCopierExtensionManager extensionManager)
public void storeEquivalentMapping(String className, Object fromId, Object toId)
public Catalog getFromCatalog()
public Catalog getToCatalog()
public Site getFromSite()
public Site getToSite()
public <G> CreateResponse<G> createOrRetrieveCopyInstance(Object instance) throws CloneNotSupportedException
G
- instance
- the object instance for the actual entity type (could be extended)CloneNotSupportedException
public void clearOriginalIdentifiers()
public void addDeferredOperation(DeferredOperation operation)
public void addDeferredOperations(List<DeferredOperation> operations)
public List<DeferredOperation> getDeferredOperations()
public Map<String,String> getCopyHints()
MultiTenantCloneable.createOrRetrieveCopyInstance(org.broadleafcommerce.common.copy.MultiTenantCopyContext)
to actually harvest and utilize the information in some meaningful way.public Boolean getForDuplicate()
public void setForDuplicate(Boolean forDuplicate)
protected boolean checkCloneStatus(Object instance)
protected void validateOriginal(Object instance) throws CloneNotSupportedException
CloneNotSupportedException
protected void tearDownContext(BroadleafRequestContext context)
protected BroadleafRequestContext setupContext()
protected <G> G createNewInstance(Class<?> instanceClass)
protected <G> CreateResponse<G> handleStandardEntity(Object instance, BroadleafRequestContext context, Class<?> instanceClass) throws CloneNotSupportedException
CloneNotSupportedException
protected <G> CreateResponse<G> handleEmbedded(Class<?> instanceClass)
protected <G> G performCopy(Object instance, Class<?> instanceClass, Long originalId) throws CloneNotSupportedException
CloneNotSupportedException
protected void validateClone(Object cloned) throws CloneNotSupportedException
cloned
- the cloned entity instanceCloneNotSupportedException
- thrown if the entity is an extension and is does not implement cloneCopyright © 2022. All rights reserved.