Class PendingChanges
java.lang.Object
org.apache.juneau.petstore.service.PendingChanges
The staging area for pet-detail inline edits: edits are staged here instead of mutating the pet, then applied
(perRow, with retry on failure) or discarded (aggregate) from the Pending changes page.
Obtained from PetStore.pendingChanges(). All methods are synchronized; the store is a demo, not a
transactional system.
Example:
PendingChanges
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordResult of an aggregate discard, mapped 1:1 onto the console'sBulkResultbyChangesRest.static final recordOne failed id in aPendingChanges.DiscardOutcome. -
Method Summary
-
Method Details
-
stage
Stages an edit without touching the pet.- Parameters:
petId- The pet id.field- One of"name","price","species","status"or"tags"(tags is a comma-separated list; blank clears).newValue- The new value (string form).author- Who staged it.- Returns:
- The new pending change.
- Throws:
PetstoreNotFoundException- If the pet does not exist.IllegalArgumentException- If the field is not stageable or the value is invalid.
-
list
- Returns:
- All changes, staging order. Immutable snapshot.
-
pending
- Returns:
- Only
PendingChange.State.PENDINGchanges, staging order. Immutable snapshot.
-
get
Returns one change.- Parameters:
id- The change id.- Returns:
- The change.
- Throws:
PetstoreNotFoundException- If it does not exist.
-
apply
Writes a pending change to its pet. If the pet is gone, the change becomesFAILEDinstead.- Parameters:
id- The change id.actor- The audit actor.- Returns:
- The change, now
APPLIEDorFAILED. - Throws:
PetstoreNotFoundException- If the change does not exist.PetstoreConflictException- If the change is not pending.
-
retry
Re-applies a failed change.- Parameters:
id- The change id.actor- The audit actor.- Returns:
- The change, now
APPLIEDor stillFAILED. - Throws:
PetstoreNotFoundException- If the change does not exist.PetstoreConflictException- If the change has not failed.
-
discard
Discards pending changes in one aggregate call.- Parameters:
ids- The change ids (string form, as sent by the bulk action).actor- The audit actor.- Returns:
- The per-id outcome.
-