public class AdminPermissionPersistenceHandler extends OperationAwarePersistenceHandler
AdminPermission data to update
UserPermission. This is designed to perform a replacement of existing data within this
service from the admin user service.| Constructor and Description |
|---|
AdminPermissionPersistenceHandler(UserPermissionService<UserPermission> userPermissionService,
com.fasterxml.jackson.databind.ObjectMapper mapper,
com.broadleafcommerce.common.extension.TypeFactory typeFactory) |
| Modifier and Type | Method and Description |
|---|---|
protected UserPermission |
buildUserPermissionForCreate(String id,
AdminPermission request,
Instant lastUpdated) |
protected AdminPermission |
deserialize(com.fasterxml.jackson.databind.JsonNode jsonNode) |
String[] |
getSupportedSimpleTypeNames() |
protected com.broadleafcommerce.common.extension.TypeFactory |
getTypeFactory() |
protected UserPermissionService<UserPermission> |
getUserPermissionService() |
void |
hook(String entityJson) |
protected void |
mapUpdatesFromRequest(AdminPermission request,
UserPermission target) |
protected void |
modifyForArchival(UserPermission target)
Mimic what
UserPermissionService.archive(String) would do to mark this record as
archived. |
protected void |
performArchivalReplacementIfEligible(@NonNull String entityId,
@NonNull UserPermission existing,
@NonNull Instant changeTimestamp) |
protected void |
performReplacementIfEligible(@NonNull String entityId,
@NonNull UserPermission existing,
@NonNull AdminPermission request,
@NonNull Instant changeTimestamp) |
protected void |
processCreateOperation(@NonNull String entityId,
@NonNull Instant changeTimestamp,
@NonNull com.fasterxml.jackson.databind.JsonNode entityJson)
Invoked if the persistence message had an
OperationType of
OperationType.CREATE. |
protected void |
processDeleteOperation(@NonNull String entityId,
@NonNull Instant changeTimestamp,
@NonNull com.fasterxml.jackson.databind.JsonNode entityJson)
Archives the given entity.
|
protected void |
processUpdateOperation(@NonNull String entityId,
@NonNull Instant changeTimestamp,
@NonNull com.fasterxml.jackson.databind.JsonNode entityJson)
Invoked if the persistence message had an
OperationType of
OperationType.UPDATE. |
protected void |
updatePermissionInfo(AdminPermission request,
UserPermission permission) |
protected void |
updatePermissionTenantRestrictions(AdminPermission request,
UserPermission permission) |
getChangeTimestamp, getEntityIdOrThrow, getNonNullField, getValidOperationTypeOrThrow, processStateChange, processStateChangegetObjectMapper, handle, isNodeNull, isValidTypepublic AdminPermissionPersistenceHandler(UserPermissionService<UserPermission> userPermissionService, com.fasterxml.jackson.databind.ObjectMapper mapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
@StreamListener(value="persistenceInputAdminPermission") public void hook(String entityJson)
protected void processCreateOperation(@NonNull
@NonNull String entityId,
@NonNull
@NonNull Instant changeTimestamp,
@NonNull
@NonNull com.fasterxml.jackson.databind.JsonNode entityJson)
throws IOException
OperationAwarePersistenceHandlerOperationType of
OperationType.CREATE.processCreateOperation in class OperationAwarePersistenceHandlerentityId - the ID found on the persistence message. Guaranteed non-empty.changeTimestamp - the timestamp found on the persistence message. Guaranteed non-null.entityJson - the persistence message json itself. Guaranteed non-null.IOExceptionprotected UserPermission buildUserPermissionForCreate(String id, AdminPermission request, Instant lastUpdated)
protected void mapUpdatesFromRequest(AdminPermission request, UserPermission target)
protected AdminPermission deserialize(com.fasterxml.jackson.databind.JsonNode jsonNode) throws IOException
IOExceptionprotected void processUpdateOperation(@NonNull
@NonNull String entityId,
@NonNull
@NonNull Instant changeTimestamp,
@NonNull
@NonNull com.fasterxml.jackson.databind.JsonNode entityJson)
throws IOException
OperationAwarePersistenceHandlerOperationType of
OperationType.UPDATE.processUpdateOperation in class OperationAwarePersistenceHandlerentityId - the entity ID found on the persistence message. Guaranteed non-empty.changeTimestamp - the timestamp found on the persistence message. Guaranteed non-null.entityJson - the persistence message json itself. Guaranteed non-null.IOExceptionprotected void performReplacementIfEligible(@NonNull
@NonNull String entityId,
@NonNull
@NonNull UserPermission existing,
@NonNull
@NonNull AdminPermission request,
@NonNull
@NonNull Instant changeTimestamp)
protected void processDeleteOperation(@NonNull
@NonNull String entityId,
@NonNull
@NonNull Instant changeTimestamp,
@NonNull
@NonNull com.fasterxml.jackson.databind.JsonNode entityJson)
throws IOException
Note that if an existing record is not found, one will be created in an archived state. The motivation for this is to protect against out-of-order messages (ex: "Delete" message on an entity arrives before the "Create"). By establishing a pre-existing record in an archived state with a timestamp, any subsequent persistence message received can be compared against this record's timestamp and appropriately discarded as outdated rather than triggering creation of a new record.
processDeleteOperation in class OperationAwarePersistenceHandlerentityId - the entity ID found on the persistence message. Guaranteed non-empty.changeTimestamp - the timestamp found on the persistence message. Guaranteed non-null.entityJson - the persistence message json itself. Guaranteed non-null.IOExceptionprotected void performArchivalReplacementIfEligible(@NonNull
@NonNull String entityId,
@NonNull
@NonNull UserPermission existing,
@NonNull
@NonNull Instant changeTimestamp)
protected void modifyForArchival(UserPermission target)
UserPermissionService.archive(String) would do to mark this record as
archived.target - the instance to modifyprotected void updatePermissionInfo(AdminPermission request, UserPermission permission)
protected void updatePermissionTenantRestrictions(AdminPermission request, UserPermission permission)
public String[] getSupportedSimpleTypeNames()
protected UserPermissionService<UserPermission> getUserPermissionService()
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
Copyright © 2021. All rights reserved.