Class CrudEntityHelper
java.lang.Object
com.broadleafcommerce.data.tracking.core.service.CrudEntityHelper
- All Implemented Interfaces:
ChangeNotifier
,PropagationIntegrator
Helper class responsible for providing basic CRUD support for business domain types. Using a
repository instance and a
DomainMapperManager
instance, this helper is capable of mapping
a business domain object to a repository specific domain object and performing persistence
operations using that business domain instance and the repository instance. This helper is
intended to be used in support of CrudEntityServices
when interacting
with Trackable
repository domain. Most of the methods require supplying the
TrackableRepository
from those services.
Typically, it is sufficient to extend BaseCrudEntityService
in order to gain access to
this helper; however, if a service implementation spans several repository types, it is recommend
to inject this class instead:
@Service
public class DefaultMyService<P extends MyPayload> implements MyService<P>
{private final CrudEntityHelper helper;
private final MyTrackableRepository repository;
public DefaultMyService(MyTrackableRepository repository, DomainMapperManager mapper) { this.helper = new CrudEntityHelper(mapper); this repository = repository; } }
- Author:
- Jeff Fischer, Nathan Moore (nathandmoore)
-
Constructor Summary
ConstructorDescriptionCrudEntityHelper
(DomainMapperManager mapper, List<SortTransformer> sortTransformers, EntityValidatorManager validator, TrackableBehaviorUtil trackableBehaviorUtil) -
Method Summary
Modifier and TypeMethodDescriptionprotected <P> Trackable
applyReplace
(String entityToReplaceId, P replacement, Map<String, Trackable> foundEntitiesByContextId, List<BulkPersistenceResponse.PersistenceFailure<P>> failures, ContextInfo contextInfo) protected <P> org.springframework.data.util.Pair<P,
Trackable> applyUpdate
(String entityToUpdateId, P change, Map<String, Trackable> foundEntitiesByContextId, List<BulkPersistenceResponse.PersistenceFailure<P>> failures, ContextInfo contextInfo) <P> P
convertFromPersistentDomain
(Trackable domain, ContextInfo contextInfo) Convenience method to use themapper
to convert a persistent domain instance to its business equivalent.<P> Trackable
convertToPersistentDomain
(P businessInstance, Class<Trackable> persistentType, ContextInfo context) Convenience method to use themapper
to convert a business domain instance to its persistent equivalent.<P> P
create
(P businessInstance, ContextInfo context, TrackableRepository<Trackable> repository) Create an instance of an entity based on a business instance containing relevant property values.<P> List<P>
createAll
(List<P> businessInstances, ContextInfo context, TrackableRepository<Trackable> repository) <P> BulkPersistenceResponse<P>
createAllAllowingPartialSuccess
(List<P> businessInstances, ContextInfo context, TrackableRepository<Trackable> repository) void
delete
(String id, ContextInfo context, TrackableRepository<Trackable> repository) Perform a delete operation on the entity identified by the context id.Provides access to the internalDomainMapperManager
protected com.broadleafcommerce.common.messaging.notification.NotificationManager
protected PropagationHelperUtility
protected SingleIndexRequestMessageFactory
protected List<SortTransformer>
protected TrackableBehaviorUtil
protected EntityValidatorManager
void
notify
(Trackable domain, ContextInfo context, @NonNull com.broadleafcommerce.common.messaging.notification.NotificationStateRepository repository) Notify the system of the change.prepare
(Trackable updated, ContextInfo context, @NonNull OperationType operationType, SlimPropagationTracking slimPropagationTracking) Prepare aTrackable
entity for propagation, if applicable.void
propagateIfApplicable
(Trackable updated, ContextInfo context, @NonNull OperationType operationType, @NonNull TrackableRepository<Trackable> repository, String propagationId, SlimPropagationTracking slimPropagationTracking) Initiate a catalog propagation for the change.<P> List<P>
readAll
(ContextInfo context, TrackableRepository<Trackable> repository) Read a list of narrowed instances in the form of the business instance.<P> org.springframework.data.domain.Page<P>
readAll
(org.springframework.data.domain.Pageable pageable, ContextInfo context, TrackableRepository<Trackable> repository) Read a page of narrowed instances in the form of the business instance.<P> List<P>
readAll
(org.springframework.data.domain.Sort sort, ContextInfo context, TrackableRepository<Trackable> repository) Read a list of narrowed instances in the form of the business instance.<P> Iterable<P>
readAllByContextId
(Iterable<String> ids, ContextInfo context, TrackableRepository<Trackable> repository) Retrieve all business instances based on a list of context ids.<P> P
readByContextId
(String id, ContextInfo context, TrackableRepository<Trackable> repository) Read a single instance of an entity in the form of a business domain.<P> P
replace
(String id, P businessInstance, ContextInfo context, TrackableRepository<Trackable> repository) Replace a single, narrowed instance of an entity based on a business instance containing relavant property values.<P> List<P>
replaceAll
(List<Update<P>> replacements, ContextInfo context, TrackableRepository<Trackable> repository) <P> BulkPersistenceResponse<P>
replaceAllAllowingPartialSuccess
(List<Update<P>> replacements, ContextInfo context, TrackableRepository<Trackable> repository) void
setApplicationEventPublisher
(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) void
setNotificationManager
(com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager) void
setPropagationHelperUtility
(PropagationHelperUtility propagationHelperUtility) void
setPropagationManager
(PropagationManager propagationManager) void
setSingleIndexRequestMessageFactory
(com.broadleafcommerce.common.messaging.notification.MessageFactory<SingleIndexRequest<Identifiable>> singleIndexRequestMessageFactory) void
setTypeFactory
(com.broadleafcommerce.common.extension.TypeFactory typeFactory) protected boolean
shouldValidateForEntityUpdate
(boolean isCreate) org.springframework.data.domain.Sort
transform
(org.springframework.data.domain.Sort sort, TrackableRepository<Trackable> repository) Transforms the givensort
from properties targeting the projection layer into aSort
that targets properties at the domain layerorg.springframework.data.domain.Pageable
transformSort
(org.springframework.data.domain.Pageable pageable, TrackableRepository<Trackable> repository) Transforms the sort inside of aPageable
(if applicable).<P> P
update
(String id, P businessInstance, ContextInfo context, TrackableRepository<Trackable> repository) Update a single, narrowed instance of an entity based on a business instance containing relevant property values.<P> List<P>
updateAll
(List<Update<P>> updates, ContextInfo context, TrackableRepository<Trackable> repository) <P> BulkPersistenceResponse<P>
updateAllAllowingPartialSuccess
(List<Update<P>> updates, ContextInfo context, TrackableRepository<Trackable> repository) <P> P
updateSort
(SortPositionRequest sortPositionRequest, ContextInfo context, TrackableRepository<Trackable> repository, SortPositionStrategy<P> sortPositionStrategy) Apply a sort field value changeprotected <P> void
validateAllForCreate
(List<P> businessInstancesToValidate, ContextInfo contextInfo, List<P> valid, List<BulkPersistenceResponse.PersistenceFailure<P>> failed) Validates each of the given business instances for creation.protected <P> void
validateAllForCreateAndThrowIfError
(Iterable<P> businessInstances, ContextInfo contextInfo) protected <P> void
validateAllForReplace
(List<Update<P>> businessInstancesToValidate, ContextInfo contextInfo, List<Update<P>> valid, List<BulkPersistenceResponse.PersistenceFailure<P>> failed) Validates the business instance within eachUpdate
for replacement.protected <P> void
validateAllForReplaceAndThrowIfError
(Iterable<P> businessInstances, ContextInfo contextInfo) protected <P> void
validateAllForUpdate
(List<org.springframework.data.util.Pair<P, Trackable>> businessInstancesToValidate, ContextInfo contextInfo, List<org.springframework.data.util.Pair<P, Trackable>> valid, List<BulkPersistenceResponse.PersistenceFailure<P>> failed) Validates the business instance within each pair for update.protected <P> void
validateAllForUpdateAndThrowIfError
(Iterable<P> businessInstances, ContextInfo contextInfo)
-
Constructor Details
-
CrudEntityHelper
public CrudEntityHelper(DomainMapperManager mapper, List<SortTransformer> sortTransformers, EntityValidatorManager validator, TrackableBehaviorUtil trackableBehaviorUtil)
-
-
Method Details
-
setNotificationManager
@Autowired(required=false) public void setNotificationManager(@Nullable com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager) -
setSingleIndexRequestMessageFactory
@Autowired(required=false) public void setSingleIndexRequestMessageFactory(@Nullable com.broadleafcommerce.common.messaging.notification.MessageFactory<SingleIndexRequest<Identifiable>> singleIndexRequestMessageFactory) -
notify
public void notify(@Nullable Trackable domain, @Nullable ContextInfo context, @NonNull @NonNull @NonNull com.broadleafcommerce.common.messaging.notification.NotificationStateRepository repository) Notify the system of the change. The default implementation invokesNotificationManager.handle(NotificationStateRepository, NotificationStateAware, String)
for the following:PersistenceProducer.TYPE
in all casesChangeSummaryProducer.TYPE
if the given instance is a sandbox recordSingleIndexRequestProducer.TYPE
if the given instance isIndexable
- Specified by:
notify
in interfaceChangeNotifier
- Parameters:
domain
- TheTrackable
repository domain instance that was changed. May also wrap with a proxy exposing theMessageAdditionalInformationAware
interface to engage message creation atMessageFactory.createMessage(Object, Map)
.context
- context information around sandbox and authorrepository
- The service responsible for making the state change. Usually aRepository
instance.
-
propagateIfApplicable
public void propagateIfApplicable(@Nullable Trackable updated, @Nullable ContextInfo context, @NonNull @NonNull @NonNull OperationType operationType, @NonNull @NonNull @NonNull TrackableRepository<Trackable> repository, @Nullable String propagationId, @Nullable SlimPropagationTracking slimPropagationTracking) Description copied from interface:PropagationIntegrator
Initiate a catalog propagation for the change. This is a limited use case forTrackable
domain that useTrackableBehavior.CATALOG
, but explicitly omitTrackableBehavior.SANDBOX
. This can also apply to catalog behavior supporting domain that also supports sandbox behavior, but has explicitly omitted the sandbox identification in theContextRequest
in theContextInfo
. This is a special case, and normally propagation is automatically performed for catalog and sandbox behavior domain duringWorkflowTransitionHelper.deploy(WorkflowDeployRequest)
.- Specified by:
propagateIfApplicable
in interfacePropagationIntegrator
- Parameters:
updated
- TheTrackable
repository domain instance that was changedcontext
- context information around sandbox and authoroperationType
- The type of change operation performedrepository
- The service responsible for making the state change. Usually aRepository
instance.propagationId
- The unique id identifying this propagation. Usually returned from a call toPropagationIntegrator.prepare(Trackable, ContextInfo, OperationType, SlimPropagationTracking)
slimPropagationTracking
- ASlimPropagationTracking
instance with a subset of originalTracking
's information
-
prepare
@Nullable public String prepare(@Nullable Trackable updated, @Nullable ContextInfo context, @NonNull @NonNull @NonNull OperationType operationType, @Nullable SlimPropagationTracking slimPropagationTracking) Description copied from interface:PropagationIntegrator
Prepare aTrackable
entity for propagation, if applicable. Usually involves preparingChangeDetail
instances andFieldOverride
instances contained therein.- Specified by:
prepare
in interfacePropagationIntegrator
- Parameters:
updated
- TheTrackable
repository domain instance that was changedcontext
- Context information around sandbox and authoroperationType
- The type of change operation performedslimPropagationTracking
- ASlimPropagationTracking
instance with a subset of originalTracking
's information- Returns:
- The propagationId, or null if not applicable
-
readByContextId
public <P> P readByContextId(@NonNull String id, @Nullable ContextInfo context, @NonNull TrackableRepository<Trackable> repository) Read a single instance of an entity in the form of a business domain.- Parameters:
id
- The context id for the entity. This is the id by which the business recognizes the item.context
- Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.repository
- ATrackableRepository
to perform the persistence operation- Returns:
- The narrowed entity instance in the form of a business instance, or
EntityMissingException
if not available.
-
readAllByContextId
public <P> Iterable<P> readAllByContextId(@NonNull Iterable<String> ids, @Nullable ContextInfo context, @NonNull TrackableRepository<Trackable> repository) Retrieve all business instances based on a list of context ids.- Parameters:
ids
- A list of context ids for the entitys. This is the id by which the business recognizes the item.context
- Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.repository
- ATrackableRepository
to perform the persistence operation- Returns:
- The narrowed iterable collection of data in the form of business instances
-
readAll
public <P> org.springframework.data.domain.Page<P> readAll(@NonNull org.springframework.data.domain.Pageable pageable, @Nullable ContextInfo context, @NonNull TrackableRepository<Trackable> repository) Read a page of narrowed instances in the form of the business instance.- Parameters:
pageable
- The current page informationcontext
- Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.repository
- ATrackableRepository
to perform the persistence operation- Returns:
- The narrowed page of data in the form of business instances
-
readAll
public <P> List<P> readAll(@Nullable ContextInfo context, @NonNull TrackableRepository<Trackable> repository) Read a list of narrowed instances in the form of the business instance.- Parameters:
context
- Context information used to discriminate the correct version of an entity by context id when multiple versions may be available across sandboxes, catalogs and applications.repository
- ATrackableRepository
to perform the persistence operation- Returns:
- The narrowed list of data in the form of business instances
-
readAll
public <P> List<P> readAll(@NonNull org.springframework.data.domain.Sort sort, @Nullable ContextInfo context, @NonNull TrackableRepository<Trackable> repository) Read a list of narrowed instances in the form of the business instance. Also apply the given sort.- Parameters:
sort
- The sort to be performed on the resultscontext
- Context information used to discriminate the correct version of an entity by context id when multiple versions may be available across sandboxes, catalogs and applications.repository
- ATrackableRepository
to perform the persistence operation- Returns:
- The narrowed list of sorted data in the form of business instances
-
update
public <P> P update(@NonNull String id, @NonNull P businessInstance, @Nullable ContextInfo context, @NonNull TrackableRepository<Trackable> repository) Update a single, narrowed instance of an entity based on a business instance containing relevant property values. SeeTrackableRepository
for more information on entity persistence behavior in light of sandboxing and multitenant concerns.- Parameters:
id
- The context id for the entity. This is the id by which the business recognizes the item.businessInstance
- The payload type that domain class should be converted to. In general, the payload is what the rest API responds with.context
- Context information used to discriminate the correct version of an entity by context id when multiple versions may be available across sandboxes, catalogs and applications.repository
- ATrackableRepository
to perform the persistence operation- Returns:
- The updated, narrowed entity instance in the form of a payload instance, or
EntityMissingException
if not available. - Throws:
com.broadleafcommerce.common.error.validation.ValidationException
- if the businessInstance failed validationEntityMissingException
- if a managed instance corresponding to the given id could not be found
-
updateAll
public <P> List<P> updateAll(@NonNull List<Update<P>> updates, @Nullable ContextInfo context, @NonNull TrackableRepository<Trackable> repository) -
validateAllForUpdateAndThrowIfError
protected <P> void validateAllForUpdateAndThrowIfError(Iterable<P> businessInstances, ContextInfo contextInfo) -
updateAllAllowingPartialSuccess
public <P> BulkPersistenceResponse<P> updateAllAllowingPartialSuccess(@NonNull List<Update<P>> updates, @Nullable ContextInfo context, @NonNull TrackableRepository<Trackable> repository) -
shouldValidateForEntityUpdate
protected boolean shouldValidateForEntityUpdate(boolean isCreate) -
applyUpdate
@Nullable protected <P> org.springframework.data.util.Pair<P,Trackable> applyUpdate(String entityToUpdateId, P change, Map<String, Trackable> foundEntitiesByContextId, List<BulkPersistenceResponse.PersistenceFailure<P>> failures, @Nullable ContextInfo contextInfo) - Parameters:
entityToUpdateId
- the context ID of the entity to which the change should be appliedchange
- the changes to apply to the entity (only non-null values from this object will be applied)foundEntitiesByContextId
- a map of entities by context ID. This will be used to get the entity to which the change will be applied.failures
- if the update cannot be applied for whatever reason, the details of the failure will be added to this listcontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- a pair of the business-domain and trackable representations of the entity after
successfully applying the update. If the entity to update could not be found in
foundEntitiesByContextId
or if there was some error in mapping the updates, the return value will benull
and the failure details will be added tofailures
.
-
validateAllForUpdate
protected <P> void validateAllForUpdate(List<org.springframework.data.util.Pair<P, Trackable>> businessInstancesToValidate, ContextInfo contextInfo, List<org.springframework.data.util.Pair<P, Trackable>> valid, List<BulkPersistenceResponse.PersistenceFailure<P>> failed) Validates the business instance within each pair for update. If it passes validation, the pair is added to thevalid
list. If it fails validation, aBulkPersistenceResponse.PersistenceFailure
is created with the business instance and that failure is added to thefailed
list.- Parameters:
businessInstancesToValidate
- a list of pairs containing the business instances to validate for update, and the trackable representation of the same instancecontextInfo
- the sandboxing/multitenant context for the persistence operationvalid
- the list to which successfully validated entities should be addedfailed
- the list to which entities that failed validation should be added
-
replace
public <P> P replace(@NonNull String id, @NonNull P businessInstance, @Nullable ContextInfo context, TrackableRepository<Trackable> repository) Replace a single, narrowed instance of an entity based on a business instance containing relavant property values.- Parameters:
id
- The context id for the entity. This is the id by which the business recognizes the item.businessInstance
- The payload type that domain class should be converted to. In general, the payload is what the rest API responds with.context
- Context information used to discriminate the correct version of an entity by context id when multiple versions may be available across sandboxes, catalogs and applications.repository
- ATrackableRepository
to perform the persistence operation- Returns:
- The replaced, narrowed entity instance in the form of a payload instance, or
EntityMissingException
if not available. - Throws:
com.broadleafcommerce.common.error.validation.ValidationException
- if the given businessInstance failed validation on replacementEntityMissingException
- if a managed instance corresponding to the given id could not be found
-
replaceAll
public <P> List<P> replaceAll(@NonNull List<Update<P>> replacements, @Nullable ContextInfo context, @NonNull TrackableRepository<Trackable> repository) -
validateAllForReplaceAndThrowIfError
protected <P> void validateAllForReplaceAndThrowIfError(Iterable<P> businessInstances, ContextInfo contextInfo) -
replaceAllAllowingPartialSuccess
public <P> BulkPersistenceResponse<P> replaceAllAllowingPartialSuccess(@NonNull List<Update<P>> replacements, @Nullable ContextInfo context, @NonNull TrackableRepository<Trackable> repository) -
applyReplace
@Nullable protected <P> Trackable applyReplace(String entityToReplaceId, P replacement, Map<String, Trackable> foundEntitiesByContextId, List<BulkPersistenceResponse.PersistenceFailure<P>> failures, @Nullable ContextInfo contextInfo) - Parameters:
entityToReplaceId
- the context ID of the entity which needs to be replacedreplacement
- the replacement entityfoundEntitiesByContextId
- a map of entities by context ID. This will be used to get the entity to which the change will be applied.failures
- if the update cannot be applied for whatever reason, the details of the failure will be added to this listcontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- the trackable representation of the entity after successfully applying the
replacement. If the entity to replace could not be found in
foundEntitiesByContextId
or if there was some error in mapping the change, the return value will benull
and the failure details will be added tofailures
.
-
validateAllForReplace
protected <P> void validateAllForReplace(List<Update<P>> businessInstancesToValidate, ContextInfo contextInfo, List<Update<P>> valid, List<BulkPersistenceResponse.PersistenceFailure<P>> failed) Validates the business instance within eachUpdate
for replacement. If it passes validation, the update is added to thevalid
list. If it fails validation, aBulkPersistenceResponse.PersistenceFailure
is created with the business instance and that failure is added to thefailed
list.- Parameters:
businessInstancesToValidate
- a list of updates containing the business instances to validate for replacecontextInfo
- the sandboxing/multitenant context for the persistence operationvalid
- the list to which successfully validated entities should be addedfailed
- the list to which entities that failed validation should be added
-
create
public <P> P create(@NonNull P businessInstance, @Nullable ContextInfo context, @NonNull TrackableRepository<Trackable> repository) Create an instance of an entity based on a business instance containing relevant property values.- Parameters:
businessInstance
- The business domain instance. In general, theDomainMapperManager
is responsible for converting to a repository platform type for persistence.context
- Context information used to discriminate the correct version of an entity by context id when multiple versions may be available across sandboxes, catalogs and applications.repository
- ATrackableRepository
to perform the persistence operation- Returns:
- The new entity instance in the form of a business type instance.
- Throws:
com.broadleafcommerce.common.error.validation.ValidationException
- if the given businessInstance could not be created
-
createAll
public <P> List<P> createAll(@NonNull List<P> businessInstances, @Nullable ContextInfo context, @NonNull TrackableRepository<Trackable> repository) -
validateAllForCreateAndThrowIfError
protected <P> void validateAllForCreateAndThrowIfError(Iterable<P> businessInstances, ContextInfo contextInfo) -
createAllAllowingPartialSuccess
public <P> BulkPersistenceResponse<P> createAllAllowingPartialSuccess(@NonNull List<P> businessInstances, @Nullable ContextInfo context, @NonNull TrackableRepository<Trackable> repository) -
validateAllForCreate
protected <P> void validateAllForCreate(List<P> businessInstancesToValidate, ContextInfo contextInfo, List<P> valid, List<BulkPersistenceResponse.PersistenceFailure<P>> failed) Validates each of the given business instances for creation. If it passes validation, it is added to thevalid
list. If it fails validation, aBulkPersistenceResponse.PersistenceFailure
is created for it and that failure is added to thefailed
list.- Parameters:
businessInstancesToValidate
- the business instances to validate for creationcontextInfo
- the sandboxing/multitenant context for the persistence operationvalid
- the list to which successfully validated entities should be addedfailed
- the list to which entities that failed validation should be added
-
delete
public void delete(@NonNull String id, @Nullable ContextInfo context, @NonNull TrackableRepository<Trackable> repository) Perform a delete operation on the entity identified by the context id. This could result in an archival, or a raw delete, depending on the result of processing throughDomainMapper.deleteMap(Object, ContextInfo)
.- Parameters:
id
- The context id for the entity. This is the id by which the business recognizes the item.context
- Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.repository
- ATrackableRepository
to perform the persistence operation- Throws:
EntityMissingException
- if no instance was found in the backing store corresponding to id
-
updateSort
public <P> P updateSort(@NonNull SortPositionRequest sortPositionRequest, @Nullable ContextInfo context, @NonNull TrackableRepository<Trackable> repository, @NonNull SortPositionStrategy<P> sortPositionStrategy) Apply a sort field value change- Parameters:
sortPositionRequest
- Information about the item being moved and the position to which it's movingcontext
- context information used to discriminate the correct version of an entity by context id when multiple versions may be available across sandboxes, catalogs and applications.repository
- ATrackableRepository
to perform the persistence operationsortPositionStrategy
- TheSortPositionStrategy
to use when updating the sort- Returns:
- The updated business domain
-
transform
@NonNull public org.springframework.data.domain.Sort transform(@Nullable org.springframework.data.domain.Sort sort, @NonNull TrackableRepository<Trackable> repository) Transforms the givensort
from properties targeting the projection layer into aSort
that targets properties at the domain layer- Parameters:
sort
- the projection-targeted sort, can be nullrepository
- ATrackableRepository
form which to get information about the entity's type- Returns:
- null if
sort
is null, otherwise aSort
targeting the repository provider domain - See Also:
-
transformSort
@NonNull public org.springframework.data.domain.Pageable transformSort(@NonNull org.springframework.data.domain.Pageable pageable, @NonNull TrackableRepository<Trackable> repository) Transforms the sort inside of aPageable
(if applicable). Convert thesort
from properties targeting the projection layer into aSort
that targets properties at the domain layer- Parameters:
pageable
- ThePageable
containing theSort
instance to convertrepository
- ATrackableRepository
from which to get information about the entity's type- Returns:
- The
Pageable
exposing the convertedSort
instance
-
convertToPersistentDomain
public <P> Trackable convertToPersistentDomain(P businessInstance, Class<Trackable> persistentType, ContextInfo context) Convenience method to use themapper
to convert a business domain instance to its persistent equivalent.- Type Parameters:
P
- The business domain type- Parameters:
businessInstance
- The business domain instancepersistentType
- The persistent domain typecontext
- Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.- Returns:
- The persistent domain instance equivalent to the given business instance.
- Throws:
IllegalArgumentException
- Thrown if the business type could not be determined
-
convertFromPersistentDomain
Convenience method to use themapper
to convert a persistent domain instance to its business equivalent.- Parameters:
domain
- The persistent domain instance- Returns:
- The business domain instance equivalent to the given persistent instance.
-
getMapper
Provides access to the internalDomainMapperManager
- Returns:
- the internal
DomainMapperManager
-
getSortTransformers
-
getValidator
-
getNotificationManager
@Nullable protected com.broadleafcommerce.common.messaging.notification.NotificationManager getNotificationManager() -
getTrackableBehaviorUtil
-
getSingleIndexRequestMessageFactory
-
setPropagationManager
-
getPropagationHelperUtility
-
setPropagationHelperUtility
@Autowired public void setPropagationHelperUtility(@Nullable PropagationHelperUtility propagationHelperUtility) -
setTypeFactory
@Autowired public void setTypeFactory(@Nullable com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
setApplicationEventPublisher
@Autowired public void setApplicationEventPublisher(@Nullable org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
-