public abstract class OperationAwarePersistenceHandler extends AuthDataUpdatePersistenceHandler
Constructor and Description |
---|
OperationAwarePersistenceHandler(com.fasterxml.jackson.databind.ObjectMapper mapper) |
Modifier and Type | Method and Description |
---|---|
protected Instant |
getChangeTimestamp(com.fasterxml.jackson.databind.JsonNode persistenceMessage) |
protected String |
getEntityIdOrThrow(com.fasterxml.jackson.databind.JsonNode persistenceMessage) |
protected Optional<com.fasterxml.jackson.databind.JsonNode> |
getNonNullField(String fieldName,
com.fasterxml.jackson.databind.JsonNode json)
Gets the field with the given name from the json and returns an optional containing it if not
null.
|
protected com.broadleafcommerce.data.tracking.core.type.OperationType |
getValidOperationTypeOrThrow(com.fasterxml.jackson.databind.JsonNode persistenceMessage) |
protected abstract void |
processCreateOperation(String entityId,
Instant changeTimestamp,
com.fasterxml.jackson.databind.JsonNode entityJson)
Invoked if the persistence message had an
OperationType of
OperationType.CREATE . |
protected abstract void |
processDeleteOperation(String entityId,
Instant changeTimestamp,
com.fasterxml.jackson.databind.JsonNode entityJson)
Invoked if the persistence message had an
OperationType of
OperationType.DELETE . |
void |
processStateChange(com.fasterxml.jackson.databind.JsonNode entityJson) |
protected void |
processStateChange(@NonNull String entityId,
@NonNull com.broadleafcommerce.data.tracking.core.type.OperationType operationType,
@NonNull Instant changeTimestamp,
@NonNull com.fasterxml.jackson.databind.JsonNode entityJson) |
protected abstract void |
processUpdateOperation(String entityId,
Instant changeTimestamp,
com.fasterxml.jackson.databind.JsonNode entityJson)
Invoked if the persistence message had an
OperationType of
OperationType.UPDATE . |
getObjectMapper, handle, isNodeNull, isValidType
public OperationAwarePersistenceHandler(com.fasterxml.jackson.databind.ObjectMapper mapper)
public void processStateChange(com.fasterxml.jackson.databind.JsonNode entityJson)
protected com.broadleafcommerce.data.tracking.core.type.OperationType getValidOperationTypeOrThrow(com.fasterxml.jackson.databind.JsonNode persistenceMessage)
protected Optional<com.fasterxml.jackson.databind.JsonNode> getNonNullField(String fieldName, com.fasterxml.jackson.databind.JsonNode json)
fieldName
- the name of the field to get from the jsonjson
- the json from which the field should be retrievedOptional
containing the JsonNode
of the field if found and not
null, Optional.empty()
otherwiseprotected Instant getChangeTimestamp(com.fasterxml.jackson.databind.JsonNode persistenceMessage)
protected String getEntityIdOrThrow(com.fasterxml.jackson.databind.JsonNode persistenceMessage)
protected void processStateChange(@NonNull @NonNull String entityId, @NonNull @NonNull com.broadleafcommerce.data.tracking.core.type.OperationType operationType, @NonNull @NonNull Instant changeTimestamp, @NonNull @NonNull com.fasterxml.jackson.databind.JsonNode entityJson) throws IOException
IOException
protected abstract void processCreateOperation(String entityId, Instant changeTimestamp, com.fasterxml.jackson.databind.JsonNode entityJson) throws IOException
OperationType
of
OperationType.CREATE
.entityId
- 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.IOException
protected abstract void processUpdateOperation(String entityId, Instant changeTimestamp, com.fasterxml.jackson.databind.JsonNode entityJson) throws IOException
OperationType
of
OperationType.UPDATE
.entityId
- 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.IOException
protected abstract void processDeleteOperation(String entityId, Instant changeTimestamp, com.fasterxml.jackson.databind.JsonNode entityJson) throws IOException
OperationType
of
OperationType.DELETE
.entityId
- 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.IOException
Copyright © 2021. All rights reserved.