Class Transaction

java.lang.Object
com.daml.ledger.javaapi.data.Transaction

public final class Transaction extends Object
  • Constructor Details

  • Method Details

    • getUpdateId

      public @NonNull String getUpdateId()
    • getCommandId

      public @NonNull String getCommandId()
    • getWorkflowId

      public @NonNull String getWorkflowId()
    • getEffectiveAt

      public @NonNull Instant getEffectiveAt()
    • getEvents

      public @NonNull List<Event> getEvents()
    • getOffset

      public @NonNull Long getOffset()
    • getSynchronizerId

      public @NonNull String getSynchronizerId()
    • getTraceContext

      public @NonNull TraceContextOuterClass.TraceContext getTraceContext()
    • getRecordTime

      public @NonNull Instant getRecordTime()
    • getEventsById

      public @NonNull Map<Integer,Event> getEventsById()
      Returns the events of the transaction by their (node) id.
    • getRootNodeIds

      public @NonNull List<Integer> 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

      public @NonNull List<@NonNull Integer> getChildNodeIds(ExercisedEvent exercised)
      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

      public static Transaction fromProto(TransactionOuterClass.Transaction transaction)
    • toProto

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object