@ConfigurationProperties(value="broadleaf.mapping.create") public class CreateSetupDomainMapperMember extends Object implements DomainMapperMember, IdAware
A special DomainMapperMember
which is responsible for performing any required operations
on entities prior to their creation in the database.
For request-by-request control of what happens with generating context ids, consider setting
ContextInfo.setContextIdOverwriteBehavior(com.broadleafcommerce.data.tracking.core.context.ContextIdOverwriteBehavior)
ContextInfo.getContextIdOverwriteBehavior()
IdAware.Id
Constructor and Description |
---|
CreateSetupDomainMapperMember() |
Modifier and Type | Method and Description |
---|---|
<D> D |
fromBusinessDomain(Object businessDomain,
D repositoryDomain,
ContextInfo contextInfo)
Autogenerates a ULID context ID for the repository domain if the context is a create
operation.
|
String |
getDataRoutePartition() |
int |
getOrder() |
boolean |
isAutogenerateContextIdIfUnset()
Whether or not the system will generate a contextId for Trackable domain in the case there
was no contextId found in the domain to begin with.
|
boolean |
isOverwriteExistingContextIdOnCreate()
Whether or not a contextId that might have already been mapped in from a Trackable domain
should be overwritten with a generated value.
|
void |
setAutogenerateContextIdIfUnset(boolean autogenerateContextIdIfUnset)
Whether or not the system will generate a contextId for Trackable domain in the case there
was no contextId found in the domain to begin with.
|
void |
setOverwriteExistingContextIdOnCreate(boolean overwriteExistingContextIdOnCreate)
Whether or not a contextId that might have already been mapped in from a Trackable domain
should be overwritten with a generated value.
|
protected boolean |
shouldContextIdBeGenerated(IdAware.Id id,
String contextId,
ContextInfo contextInfo)
Determines whether the context ID should be generated by the system for the given
repositoryDomain entity. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
fromRepositoryDomain
deleteMap, getBusinessDomainType, modifyMap
public String getDataRoutePartition()
getDataRoutePartition
in interface com.broadleafcommerce.common.extension.data.DataRoutePartitionAware
public <D> D fromBusinessDomain(@Nullable Object businessDomain, @Nullable D repositoryDomain, @Nullable ContextInfo contextInfo)
fromBusinessDomain
in interface DomainMapperMember
D
- The repository domain typebusinessDomain
- The business instance containing the relevant property informationrepositoryDomain
- The repository specific instance to affect and returncontextInfo
- The context information used to make tracking determinations relevant to
sandboxing and multitenant concerns. See TrackableRepository
for more info on
persistence behavior based on context.ContextInfo.getContextIdOverwriteBehavior()
,
overwriteExistingContextIdOnCreate
,
autogenerateContextIdIfUnset
protected boolean shouldContextIdBeGenerated(@Nullable IdAware.Id id, @Nullable String contextId, @Nullable ContextInfo contextInfo)
repositoryDomain
entity.id
- The id of the projectioncontextId
- The Trackable repository specific instance contextIdcontextInfo
- The context information used to make tracking determinations relevant to
sandboxing and multitenant concerns. See TrackableRepository
for more info on
persistence behavior based on context.repositoryDomain
.public int getOrder()
getOrder
in interface DomainMapperMember
getOrder
in interface org.springframework.core.Ordered
public boolean isAutogenerateContextIdIfUnset()
public void setAutogenerateContextIdIfUnset(boolean autogenerateContextIdIfUnset)
public boolean isOverwriteExistingContextIdOnCreate()
public void setOverwriteExistingContextIdOnCreate(boolean overwriteExistingContextIdOnCreate)
Copyright © 2021. All rights reserved.