public abstract class MultiTenantCopier extends Object implements org.springframework.core.Ordered
copyEntitiesOfType(Class, org.broadleafcommerce.common.site.domain.Site, org.broadleafcommerce.common.site.domain.Catalog, MultiTenantCopyContext)
one or more times inside of their copyEntities(MultiTenantCopyContext) implementation to clone and persist
an entity object tree.| Modifier and Type | Field and Description |
|---|---|
protected List<Pattern> |
classExcludeRegexPatternList
To add elements use
addPattern(Pattern) |
protected MultiTenantCopierExtensionManager |
extensionManager |
protected GenericEntityService |
genericEntityService |
protected static org.apache.commons.logging.Log |
LOG |
protected int |
order |
protected StreamingTransactionCapableUtil |
transUtil |
| Constructor and Description |
|---|
MultiTenantCopier() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addPattern(Pattern pattern)
Checks for similar items before adding to avoid duplication
|
abstract void |
copyEntities(MultiTenantCopyContext context)
Main method that should be implemented by each
MultiTenantCopier to drive the logic of
copying that particular entity to the new derived catalog. |
protected <T extends MultiTenantCloneable> |
copyEntitiesOfType(Class<T> clazz,
Site fromSite,
Catalog fromCatalog,
MultiTenantCopyContext context)
Subclasses will generally call this method in their
copyEntities(MultiTenantCopyContext) implementation. |
protected Boolean |
excludeFromCopyRegexPattern(Object copy) |
int |
getOrder() |
protected boolean |
needToAdd(Pattern pattern) |
protected <T,G extends Exception> |
persistCopyObjectTree(CopyOperation<T,G> copyOperation,
Class<T> clazz,
T original,
MultiTenantCopyContext context) |
protected void |
persistCopyObjectTreeInternal(Object copy,
Set<Integer> library,
MultiTenantCopyContext context) |
protected void |
persistNode(Object copy,
MultiTenantCopyContext context) |
protected <T> List<T> |
readAll(Class<T> clazz,
int limit,
int offset,
Site site,
Catalog catalog)
Returns a list of all entities in the system for the given class, site, and catalog.
|
protected <T> List<T> |
readAll(Class<T> clazz,
Site site,
Catalog catalog) |
protected List<Long> |
readAllIds(Class<?> clazz,
Site site,
Catalog catalog)
Returns the primary key values for all entities of the specified type in the site or catalog.
|
protected <T> Long |
readCount(Class<T> clazz,
Site site,
Catalog catalog)
Returns the count of the given entity class for the specified site and catalog
|
protected <T> T |
save(MultiTenantCopyContext context,
T object)
Saves the specified object in the toSite and toCatalog of the given context.
|
void |
setOrder(int order) |
protected static final org.apache.commons.logging.Log LOG
protected GenericEntityService genericEntityService
protected MultiTenantCopierExtensionManager extensionManager
protected StreamingTransactionCapableUtil transUtil
protected int order
protected List<Pattern> classExcludeRegexPatternList
addPattern(Pattern)public abstract void copyEntities(MultiTenantCopyContext context) throws Exception
MultiTenantCopier to drive the logic of
copying that particular entity to the new derived catalog.context - Exceptionpublic int getOrder()
getOrder in interface org.springframework.core.OrderedMultiTenantCopierpublic void setOrder(int order)
protected <T,G extends Exception> void persistCopyObjectTree(CopyOperation<T,G> copyOperation, Class<T> clazz, T original, MultiTenantCopyContext context) throws G extends Exception
G extends Exceptionprotected void persistCopyObjectTreeInternal(Object copy, Set<Integer> library, MultiTenantCopyContext context)
protected Boolean excludeFromCopyRegexPattern(Object copy)
copy - Copy objectprotected void persistNode(Object copy, MultiTenantCopyContext context)
protected <T extends MultiTenantCloneable> void copyEntitiesOfType(Class<T> clazz, Site fromSite, Catalog fromCatalog, MultiTenantCopyContext context) throws ServiceException, CloneNotSupportedException
copyEntities(MultiTenantCopyContext) implementation.T - clazz - fromSite - fromCatalog - context - ServiceExceptionCloneNotSupportedExceptionprotected <T> T save(MultiTenantCopyContext context, T object) throws ServiceException
context - object - ServiceExceptionprotected <T> Long readCount(Class<T> clazz, Site site, Catalog catalog) throws ServiceException
clazz - site - catalog - ServiceExceptionprotected <T> List<T> readAll(Class<T> clazz, Site site, Catalog catalog) throws ServiceException
clazz - site - catalog - ServiceExceptionreadAll(Class, int, int, Site, Catalog)protected List<Long> readAllIds(Class<?> clazz, Site site, Catalog catalog) throws ServiceException
clazz - site - catalog - ServiceExceptionprotected <T> List<T> readAll(Class<T> clazz, int limit, int offset, Site site, Catalog catalog) throws ServiceException
clazz - limit - offset - site - catalog - ServiceExceptionprotected void addPattern(Pattern pattern)
pattern - input patternprotected boolean needToAdd(Pattern pattern)
Copyright © 2024. All rights reserved.