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<Matcher> |
classExcludeRegexList |
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 |
---|---|
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 |
excludeFromCopyRegex(Object copy) |
int |
getOrder() |
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
public abstract void copyEntities(MultiTenantCopyContext context) throws Exception
MultiTenantCopier
to drive the logic of
copying that particular entity to the new derived catalog.context
- Exception
public int getOrder()
getOrder
in interface org.springframework.core.Ordered
MultiTenantCopier
public 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 Exception
protected void persistCopyObjectTreeInternal(Object copy, Set<Integer> library, MultiTenantCopyContext context)
protected 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
- ServiceException
CloneNotSupportedException
protected <T> T save(MultiTenantCopyContext context, T object) throws ServiceException
context
- object
- ServiceException
protected <T> Long readCount(Class<T> clazz, Site site, Catalog catalog) throws ServiceException
clazz
- site
- catalog
- ServiceException
protected <T> List<T> readAll(Class<T> clazz, Site site, Catalog catalog) throws ServiceException
clazz
- site
- catalog
- ServiceException
readAll(Class, int, int, Site, Catalog)
protected List<Long> readAllIds(Class<?> clazz, Site site, Catalog catalog) throws ServiceException
clazz
- site
- catalog
- ServiceException
protected <T> List<T> readAll(Class<T> clazz, int limit, int offset, Site site, Catalog catalog) throws ServiceException
clazz
- limit
- offset
- site
- catalog
- ServiceException
Copyright © 2022. All rights reserved.