Class InterruptResult

java.lang.Object
com.tnsai.security.approval.InterruptResult

public final class InterruptResult extends Object
Result of an interrupt request.

Contains the outcome of waiting for human input on an interrupt, including whether it was approved, rejected, timed out, or cancelled.

  • Method Details

    • approved

      public static InterruptResult approved(String interruptId, Map<String,Object> payload)
      Creates an approved result.
      Parameters:
      interruptId - the interrupt ID
      payload - optional response payload from user
      Returns:
      approved result
    • rejected

      public static InterruptResult rejected(String interruptId, Map<String,Object> payload)
      Creates a rejected result.
      Parameters:
      interruptId - the interrupt ID
      payload - optional response payload (may include rejection reason)
      Returns:
      rejected result
    • timedOut

      public static InterruptResult timedOut(String interruptId)
      Creates a timed out result.
      Parameters:
      interruptId - the interrupt ID
      Returns:
      timed out result
    • cancelled

      public static InterruptResult cancelled(String interruptId)
      Creates a cancelled result.
      Parameters:
      interruptId - the interrupt ID
      Returns:
      cancelled result
    • error

      public static InterruptResult error(String interruptId, String errorMessage)
      Creates an error result.
      Parameters:
      interruptId - the interrupt ID
      errorMessage - the error message
      Returns:
      error result
    • getInterruptId

      public String getInterruptId()
      Gets the interrupt ID.
      Returns:
      interrupt ID
    • getOutcome

      public InterruptResult.Outcome getOutcome()
      Gets the outcome.
      Returns:
      outcome
    • getPayload

      public Map<String,Object> getPayload()
      Gets the response payload from user.
      Returns:
      payload map (never null, may be empty)
    • getErrorMessage

      public String getErrorMessage()
      Gets error message if outcome is ERROR.
      Returns:
      error message or null
    • isApproved

      public boolean isApproved()
      Checks if the interrupt was approved.
      Returns:
      true if approved
    • isRejected

      public boolean isRejected()
      Checks if the interrupt was rejected.
      Returns:
      true if rejected
    • isTimedOut

      public boolean isTimedOut()
      Checks if the interrupt timed out.
      Returns:
      true if timed out
    • isCancelled

      public boolean isCancelled()
      Checks if the interrupt was cancelled.
      Returns:
      true if cancelled
    • isError

      public boolean isError()
      Checks if there was an error.
      Returns:
      true if error
    • shouldProceed

      public boolean shouldProceed()
      Checks if the agent should proceed with the action.

      Returns true only if explicitly approved.

      Returns:
      true if should proceed
    • getRejectionReason

      public String getRejectionReason()
      Gets the rejection reason from payload if available.
      Returns:
      rejection reason or null
    • getApprover

      public String getApprover()
      Gets the approver from payload if available.
      Returns:
      approver or null
    • 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