Package com.daml.ledger.javaapi.data
Class Transaction
java.lang.Object
com.daml.ledger.javaapi.data.Transaction
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A generic class that encapsulates a transaction tree along with a list of the wrapped root events of the tree. -
Constructor Summary
ConstructorsConstructorDescriptionTransaction
(@NonNull String updateId, @NonNull String commandId, @NonNull String workflowId, @NonNull Instant effectiveAt, @NonNull List<@NonNull Event> events, @NonNull Long offset, @NonNull String synchronizerId, @NonNull TraceContextOuterClass.TraceContext traceContext, @NonNull Instant recordTime) -
Method Summary
Modifier and TypeMethodDescriptionboolean
static Transaction
fromProto
(TransactionOuterClass.Transaction transaction) getChildNodeIds
(ExercisedEvent exercised) Computes the children nodes of an exercised event.@NonNull String
@NonNull Instant
Returns the events of the transaction by their (node) id.@NonNull Long
@NonNull Instant
Computes the node ids of the root nodes (i.e.@NonNull String
@NonNull TraceContextOuterClass.TraceContext
@NonNull String
@NonNull String
int
hashCode()
toProto()
toString()
<WrappedEvent>
Transaction.WrappedTransactionTree<WrappedEvent>toWrappedTree
(BiFunction<Event, List<WrappedEvent>, WrappedEvent> createWrappedEvent) Constructs a tree described by the transaction.
-
Constructor Details
-
Transaction
public Transaction(@NonNull String updateId, @NonNull String commandId, @NonNull String workflowId, @NonNull Instant effectiveAt, @NonNull List<@NonNull Event> events, @NonNull Long offset, @NonNull String synchronizerId, @NonNull TraceContextOuterClass.TraceContext traceContext, @NonNull Instant recordTime)
-
-
Method Details
-
getUpdateId
-
getCommandId
-
getWorkflowId
-
getEffectiveAt
-
getEvents
-
getOffset
-
getSynchronizerId
-
getTraceContext
-
getRecordTime
-
getEventsById
Returns the events of the transaction by their (node) id. -
getRootNodeIds
Computes the node ids of the root nodes (i.e. the nodes that do not have any ancestors). A node can be considered a root if there are not any ancestors of it. There is no guarantee that the root node was also a root in the original transaction (i.e. before filtering out events from the original transaction). In the case that the transaction is returned in AcsDelta shape all the events returned will trivially be root nodes.- Returns:
- the root node ids
-
getChildNodeIds
Computes the children nodes of an exercised event. It finds the candidate nodes that could be children of the event given (i.e. its descendants). Then it repeatedly finds from the candidates the one with the lowest id and adds it to its children and removes the child's descendants from the list with the candidates. A node can be considered a child of another node if there are not any intermediate descendants between its parent and itself. There is no guarantee that the child was a child of its parent in the original transaction (i.e. before filtering out events from the original transaction).- Parameters:
exercised
- the exercised event- Returns:
- the children's node ids
-
toWrappedTree
public <WrappedEvent> Transaction.WrappedTransactionTree<WrappedEvent> toWrappedTree(BiFunction<Event, List<WrappedEvent>, WrappedEvent> createWrappedEvent) Constructs a tree described by the transaction.- Type Parameters:
WrappedEvent
- the type of the wrapped events of the constructed tree- Parameters:
createWrappedEvent
- the function that constructs a WrappedEvent node of the tree given the current node and its converted children as a list of WrappedEvents nodes- Returns:
- the original transaction tree and the list of the wrapped root events
-
fromProto
-
toProto
-
toString
-
equals
-
hashCode
public int hashCode()
-