public abstract class Traversal<BE,E extends AbstractElement<?,?>> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected TraversalContext<BE,E> |
context |
| Modifier | Constructor and Description |
|---|---|
protected |
Traversal(TraversalContext<BE,E> context) |
| Modifier and Type | Method and Description |
|---|---|
protected BE |
getSingle(Query query,
Class<? extends Entity<?,?>> entityType)
A helper method to retrieve a single result from the query or throw an exception if the query yields no results.
|
protected boolean |
isApplicable(AbstractElement<?,?> result)
If the inventory configuration provided a
ResultFilter, this calls it to tell whether provided element
is applicable. |
protected <R> R |
mutating(Util.PotentiallyCommittingPayload<R> payload)
Runs the payload in transaction.
|
protected <R> R |
readOnly(Supplier<R> payload)
A "shortcut" method for executing read-only payloads in transaction.
|
protected final TraversalContext<BE,E extends AbstractElement<?,?>> context
protected Traversal(TraversalContext<BE,E> context)
protected boolean isApplicable(AbstractElement<?,?> result)
ResultFilter, this calls it to tell whether provided element
is applicable. If the result filter is not provided by the configuration, true will always be returned.result - the potential result to be checked for applicability in the result setprotected BE getSingle(Query query, Class<? extends Entity<?,?>> entityType)
query - the query to runentityType - the expected type of the entity (used only for error reporting)EntityNotFoundException - if the query doesn't return any resultsprotected <R> R mutating(Util.PotentiallyCommittingPayload<R> payload)
WARNING: the payload might be called multiple times if the transaction it runs within fails. It is therefore dangerous to keep any mutable state outside of the payload function that the function depends on.
R - the return typepayload - the payload to execute in transactionprotected <R> R readOnly(Supplier<R> payload)
WARNING: the payload might be called multiple times if the transaction it runs within fails. It is therefore dangerous to keep any mutable state outside of the payload function that the function depends on.
R - the type of the return valuepayload - the read-only payload to executeCopyright © 2015 Red Hat, Inc.. All rights reserved.