public interface EntityDuplicator
Creates a production duplicate of an entity. In the case of the enterprise module, the entity to be duplicated may not be a sandbox copy. In the case of the multitenant module, the entity to be duplicated must not be referenced in a derived catalog (apart from a standard site override) and must not be owned by another site.
The feature must first be enabled before use. To enable, add the following property to your Spring property file:admin.entity.duplication.isactive=true
. Furthermore,
for any entity you wish to be able to duplicate, you must implement an
EntityDuplicationHelper
. Consider extending AbstractEntityDuplicationHelper
because it implements EntityDuplicationHelper.getCopyHints()
and
EntityDuplicationHelper.addCopyHint(String, String)
for you.
CopyHints can be added to change the behavior of
MultiTenantCloneable.createOrRetrieveCopyInstance(MultiTenantCopyContext)
for a
specific entity. See org.broadleafcommerce.core.offer.service.OfferDuplicateModifier
and org.broadleafcommerce.core.offer.domain.OfferImpl
for an example.
Modifier and Type | Method and Description |
---|---|
<T> T |
copy(Class<T> entityClass,
Long id)
Create a production duplicate of the entity specified in the params.
|
<T> T |
copy(Class<T> entityClass,
Long id,
Map<String,String> copyHints,
EntityDuplicateModifier... modifiers)
Deprecated.
use
copy(Class, Long) . Modifiers have been moved to a list bean
to allow easier inclusion (see EntityDuplicationHelpers ) and copy hints can be added
to implementations of EntityDuplicationHelper s |
<T> T |
copy(MultiTenantCopyContext context,
MultiTenantCloneable<T> entity)
Create a production duplicate of the entity specified in the params.
|
<T> T |
copy(MultiTenantCopyContext context,
MultiTenantCloneable<T> entity,
Map<String,String> copyHints,
EntityDuplicateModifier... modifiers)
Deprecated.
use
copy(MultiTenantCopyContext, MultiTenantCloneable) .
Modifiers have been moved to a list bean
to allow easier inclusion (see EntityDuplicationHelpers ) and copy hints can be added
to implementations of EntityDuplicationHelper s |
boolean |
validate(Class<?> entityClass,
Long id)
Validate whether or not this feature is enabled and whether the passed entity params are
valid for duplication.
|
boolean |
validate(Object entity)
Validate whether or not this feature is enabled and whether or not the passed entity params
are valid for duplication.
|
boolean validate(Class<?> entityClass, Long id)
entityClass
- id
- boolean validate(Object entity)
entity
- @Deprecated <T> T copy(Class<T> entityClass, Long id, Map<String,String> copyHints, EntityDuplicateModifier... modifiers)
copy(Class, Long)
. Modifiers have been moved to a list bean
to allow easier inclusion (see EntityDuplicationHelpers
) and copy hints can be added
to implementations of EntityDuplicationHelper
s@Deprecated <T> T copy(MultiTenantCopyContext context, MultiTenantCloneable<T> entity, Map<String,String> copyHints, EntityDuplicateModifier... modifiers)
copy(MultiTenantCopyContext, MultiTenantCloneable)
.
Modifiers have been moved to a list bean
to allow easier inclusion (see EntityDuplicationHelpers
) and copy hints can be added
to implementations of EntityDuplicationHelper
s<T> T copy(Class<T> entityClass, Long id)
T
- the entity typeentityClass
- the class for the entityid
- the primary key<T> T copy(MultiTenantCopyContext context, MultiTenantCloneable<T> entity)
T
- the entity typecontext
- prepopulated copy context that is setup for catalog and/or siteentity
- the instance to duplicateCopyright © 2022. All rights reserved.