public interface CustomizedRoleRepository<D>
extends com.broadleafcommerce.common.extension.DomainTypeAware
RoleRepository
.Modifier and Type | Method and Description |
---|---|
D |
createOnlyIfDoesNotExist(D role,
Instant lastUpdated)
A specialized create operation for creating an entity with a pre-defined id with the minimum
guarantee that concurrent requests to this method for the same entity ID will fail.
|
D |
replaceOnlyIfLastUpdatedBefore(String entityId,
D role,
Instant lastUpdated)
A specialized replace operation that does not invoke the "save" create-or-update behavior.
|
@Nullable D createOnlyIfDoesNotExist(D role, Instant lastUpdated)
This is intended to be used in concurrent scenarios where only one operation should succeed.
Note that this method should create the record with the provided
UserRole.archived
value, even if it is true
.
role
- the role to create. Must have a non-null id present.lastUpdated
- the UserRole.lastUpdated
to set on the rolenull
otherwise@Nullable D replaceOnlyIfLastUpdatedBefore(String entityId, D role, Instant lastUpdated)
This is intended to be used in concurrent scenarios where only one operation should succeed.
Note that this update should succeed even if the existing record is
UserRole.archived
.
Note that this method should also set the provided UserRole.archived
value,
even if it is true
.
entityId
- the id of the entity to replacerole
- the replacement entitylastUpdated
- the timestamp of the current change. This will be compared to the
lastUpdated on the existing entity for determination of whether the replacement should
occur. Furthermore, the replacement will have its UserRole.lastUpdated
set to
this value.null
if the entity
was not found or could not be updated due to its lastUpdated value.Copyright © 2021. All rights reserved.