P
- Business domain typepublic interface MappableCrudEntityService<P>
Repository
instance. Instances are intended to manage domain that
is NOT Trackable
, but still require mapping between projection and repository domain.
Instances generally perform mapping between a projection object and repository domain object via
the DomainMapperManager
.Modifier and Type | Method and Description |
---|---|
<D,R extends org.springframework.data.repository.CrudRepository<D,String> & com.broadleafcommerce.common.extension.DomainTypeAware> |
create(P businessInstance)
Create an instance of an entity based on a business instance containing relevant property
values.
|
<D,R extends org.springframework.data.repository.CrudRepository<D,String> & com.broadleafcommerce.common.extension.DomainTypeAware> |
createAll(List<P> businessInstances)
Create multiple instances of an entity at once based on the business instances containing
relevant property values.
|
<D,R extends org.springframework.data.repository.CrudRepository<D,String> & com.broadleafcommerce.common.extension.DomainTypeAware> |
createAllAllowingPartialSuccess(List<P> businessInstances)
Creates multiple instances of an entity at once based on the business instances containing
relevant property values.
|
void |
delete(String id)
Perform a delete operation on the entity identified by the id.
|
List<P> |
readAll()
Read a list of instances in the form of the business instance.
|
org.springframework.data.domain.Page<P> |
readAll(org.springframework.data.domain.Pageable pageable)
Read a page of entity instances in the form of business instances.
|
List<P> |
readAll(org.springframework.data.domain.Sort sort)
Read a list of instances in the form of the business instance.
|
List<P> |
readAllByIds(Iterable<String> ids)
Reads all entity instances matching the provided ids.
|
P |
readById(String id)
Read a single instance of an entity in the form of a business domain.
|
P |
replace(String id,
P businessInstance)
Replace a single instance of an entity based on a business instance containing relavant
property values.
|
List<P> |
replaceAll(List<Update<P>> replacements)
Replace multiple instances of an entity at once based on the business instance containing
relevant property values.
|
BulkPersistenceResponse<P> |
replaceAllAllowingPartialSuccess(List<Update<P>> replacements)
Replace multiple instances of an entity at once based on the business instances containing
relevant property values.
|
P |
update(String id,
P businessInstance)
Update a single instance of an entity based on a business instance containing relevant
property values.
|
List<P> |
updateAll(List<Update<P>> updates)
A bulk operation that updates all of the items managed by the backing repository in the form
of the business entity containing property values.
|
BulkPersistenceResponse<P> |
updateAllAllowingPartialSuccess(List<Update<P>> updates)
Updates all of the items managed by the backing repository in the form of the business
instances containing property values.
|
P readById(@NonNull String id)
id
- The id for the entity.EntityMissingException
- if not foundorg.springframework.data.domain.Page<P> readAll(@NonNull org.springframework.data.domain.Pageable pageable)
pageable
- information about which page of results to return. May be
Pageable.unpaged()
, may not be null
.@NonNull List<P> readAllByIds(@NonNull Iterable<String> ids)
List<P> readAll()
List<P> readAll(@NonNull org.springframework.data.domain.Sort sort)
sort
- The sort to be performed on the resultsP update(@NonNull String id, @NonNull P businessInstance)
id
- The id for the entity.businessInstance
- The payload type that domain class should be converted to. In
general, the payload is what the rest API responds with.EntityMissingException
if not available.com.broadleafcommerce.common.error.validation.ValidationException
- if the businessInstance failed validationEntityMissingException
- if a managed instance corresponding to the given id
could not be foundupdateAll(List)
,
updateAllAllowingPartialSuccess(List)
List<P> updateAll(@NonNull List<Update<P>> updates)
All items contained within updates
must exist in the backing repository and pass
validation, else the entire batch will fail
For an alternative that allows partial success, see
updateAllAllowingPartialSuccess(List)
.
updates
- each update to the repository domainEntityMissingException
if not available.UnsupportedOperationException
- if the persisted entity type from the repository is not
Identifiable
com.broadleafcommerce.common.error.validation.BulkValidationException
- if any of the instances within the updates
fail
validationEntityMissingException
- if any managed instances corresponding to the given
Update.getId()
could not be foundupdate(String, Object)
,
updateAllAllowingPartialSuccess(List)
BulkPersistenceResponse<P> updateAllAllowingPartialSuccess(@NonNull List<Update<P>> updates)
Each item contained within updates
must exist in the backing repository and pass
validation, or it will be added to the failed list in the response and not persisted. All
successfully found and validated items will be persisted.
For an alternative that does not allow partial success, see updateAll(List)
.
updates
- each update to the repository domainUnsupportedOperationException
- if the persisted entity type from the repository is not
Identifiable
updateAll(List)
P replace(@NonNull String id, @NonNull P businessInstance)
id
- The id for the entity.businessInstance
- The payload type that domain class should be converted to. In
general, the payload is what the rest API responds with.EntityMissingException
if not available.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 foundreplaceAll(List)
,
replaceAllAllowingPartialSuccess(List)
List<P> replaceAll(@NonNull List<Update<P>> replacements)
All items contained within replacements
must exist in the backing repository and pass
validation, else the entire batch will fail
See replaceAllAllowingPartialSuccess(List)
for an alternative that allows partial
success.
replacements
- all replacements to the repository domainEntityMissingException
if any of the items were not foundUnsupportedOperationException
- if the persisted entity type from the repository is not
Identifiable
com.broadleafcommerce.common.error.validation.BulkValidationException
- if any of the the given replacements
failed
validation on replacementEntityMissingException
- if any of the managed instances corresponding to the given
Update.getId()
could not be foundreplaceAllAllowingPartialSuccess(List)
BulkPersistenceResponse<P> replaceAllAllowingPartialSuccess(@NonNull List<Update<P>> replacements)
Each item contained within replacements
must exist in the backing repository and pass
validation, or it will be added to the failed list in the response and not persisted. All
successfully found and validated items will be persisted.
See replaceAll(List)
for an alternative that does not allow partial success.
replacements
- all replacements to the repository domainUnsupportedOperationException
- if the persisted entity type from the repository is not
Identifiable
replaceAll(List)
<D,R extends org.springframework.data.repository.CrudRepository<D,String> & com.broadleafcommerce.common.extension.DomainTypeAware> P create(P businessInstance)
DomainTypeAware
interface.businessInstance
- The business domain instance. In general, the
DomainMapperManager
is responsible for converting to a repository platform
type for persistence.com.broadleafcommerce.common.error.validation.ValidationException
- if the given businessInstance could not be createdcreateAll(List)
,
createAllAllowingPartialSuccess(List)
<D,R extends org.springframework.data.repository.CrudRepository<D,String> & com.broadleafcommerce.common.extension.DomainTypeAware> List<P> createAll(@NonNull List<P> businessInstances)
All items contained within businessInstances
must pass validation, else the entire
batch will fail.
See createAllAllowingPartialSuccess(List)
for an alternative where partial success
is allowed.
businessInstances
- all instances to create in the data storecom.broadleafcommerce.common.error.validation.BulkValidationException
- if any of the the given businessInstances
failed
validationcreateAllAllowingPartialSuccess(List)
<D,R extends org.springframework.data.repository.CrudRepository<D,String> & com.broadleafcommerce.common.extension.DomainTypeAware> BulkPersistenceResponse<P> createAllAllowingPartialSuccess(@NonNull List<P> businessInstances)
Each item contained within businessInstances
will be validated, and if it fails
validation, it will be added to the failed list in the response and not persisted. All
successfully validated items will be persisted.
See createAll(List)
for an alternative that does not allow partial success.
businessInstances
- all instances to create in the data storecreateAll(List)
void delete(@NonNull String id)
id
- The id for the entity.EntityMissingException
- if no instance was found in the backing store corresponding to
idCopyright © 2021. All rights reserved.