Record Class TransactionContextSummary

java.lang.Object
java.lang.Record
org.j7m.middleware.api.saga.TransactionContextSummary
Record Components:
contextId - transaction context identifier
scope - transaction scope carried by the context
correlation - correlation and causal relationship metadata
deadline - effective deadline, or Instant.MAX when absent
cancellationRequested - whether cancellation was requested
participant - safe participant identity
metadata - redacted metadata
All Implemented Interfaces:
Serializable

public record TransactionContextSummary(TransactionContextId contextId, TransactionScope scope, TransactionCorrelation correlation, Instant deadline, boolean cancellationRequested, TransactionParticipant participant, Map<String,String> metadata) extends Record implements Serializable
Status-safe transaction context summary.

The summary is not an ACID transaction handle. It is the preferred public status representation for transaction context because it exposes correlation, deadline, cancellation, participant, and redacted metadata needed for saga audit/status views without exposing command payloads or credential-like metadata. The record is immutable, thread-safe, and value based.

See Also:
  • Constructor Details

    • TransactionContextSummary

      public TransactionContextSummary(TransactionContextId contextId, TransactionScope scope, TransactionCorrelation correlation, Instant deadline, boolean cancellationRequested, TransactionParticipant participant, Map<String,String> metadata)
      Creates a validated status-safe transaction context summary.

      Missing values are replaced with safe defaults. Metadata is defensively copied and redacted, so the summary can be returned from service status, evidence, recovery reports, and demo output.

      Parameters:
      contextId - transaction context identifier
      scope - transaction scope
      correlation - correlation metadata
      deadline - deadline for the context
      cancellationRequested - cancellation flag
      participant - safe participant identity
      metadata - redacted metadata
  • Method Details

    • from

      public static TransactionContextSummary from(TransactionContext context)
      Builds a redacted summary from a full execution context.

      The returned value intentionally drops idempotency and dedupe objects that are not needed for public status. It preserves non-sensitive correlation, participant, deadline, and cancellation metadata.

      Parameters:
      context - full internal transaction context
      Returns:
      safe public summary
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • contextId

      public TransactionContextId contextId()
      Returns the value of the contextId record component.
      Returns:
      the value of the contextId record component
    • scope

      public TransactionScope scope()
      Returns the value of the scope record component.
      Returns:
      the value of the scope record component
    • correlation

      public TransactionCorrelation correlation()
      Returns the value of the correlation record component.
      Returns:
      the value of the correlation record component
    • deadline

      public Instant deadline()
      Returns the value of the deadline record component.
      Returns:
      the value of the deadline record component
    • cancellationRequested

      public boolean cancellationRequested()
      Returns the value of the cancellationRequested record component.
      Returns:
      the value of the cancellationRequested record component
    • participant

      public TransactionParticipant participant()
      Returns the value of the participant record component.
      Returns:
      the value of the participant record component
    • metadata

      public Map<String,String> metadata()
      Returns the value of the metadata record component.
      Returns:
      the value of the metadata record component