@Component public class DefaultConflictHandler extends Object implements ConflictHandler
412 Precondition Failed responses by re-retrieving the latest state of the resource from the
repository, insuring the pre-condition for applying the update still holds, and then applying the update.| Constructor and Description |
|---|
DefaultConflictHandler(org.dataconservancy.pass.client.PassClient passClient) |
| Modifier and Type | Method and Description |
|---|---|
<T extends org.dataconservancy.pass.model.PassEntity,R> |
handleConflict(T conflictedResource,
Class<T> resourceClass,
Predicate<T> preCondition,
Function<T,R> criticalUpdate)
Invoked when a
412 Precondition Failed is returned from a PATCH request to the repository. |
public DefaultConflictHandler(org.dataconservancy.pass.client.PassClient passClient)
public <T extends org.dataconservancy.pass.model.PassEntity,R> R handleConflict(T conflictedResource,
Class<T> resourceClass,
Predicate<T> preCondition,
Function<T,R> criticalUpdate)
412 Precondition Failed is returned from a PATCH request to the repository.
Implementations are provided the the resource that includes the state to be updated, the function that performs the update, and the precondition that ought to be satisfied prior to invoking the update function.
Because this handler is being invoked in response to a 412, simply re-submitting the {PATCH} request with
the supplied resource will always fail. Implementations will need to re-retrieve the the latest
state of the resource, optionally apply the preCondition (insuring that the new state of the resource is
still valid with respect to the criticalUpdate to be applied), and invoke the criticalUpdate.
412 Precondition Failed responses by re-retrieving the latest state of the resource from the
repository, insuring the pre-condition for applying the update still holds, and then applying the update.handleConflict in interface ConflictHandlerT - the type of resourceR - the type of the response returned by the criticalUpdateconflictedResource - the resource with the state to be updatedresourceClass - the runtime class of the resourcepreCondition - the precondition that must be satisfied in order for the criticalUpdate to be appliedcriticalUpdate - the update to be applied to the resourcecriticalUpdateCopyright © 2019. All rights reserved.