Package com.tnsai.security.approval
Class InterruptResult
java.lang.Object
com.tnsai.security.approval.InterruptResult
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumPossible outcomes of an interrupt. -
Method Summary
Modifier and TypeMethodDescriptionstatic InterruptResultCreates an approved result.static InterruptResultCreates a cancelled result.booleanstatic InterruptResultCreates an error result.Gets the approver from payload if available.Gets error message if outcome is ERROR.Gets the interrupt ID.Gets the outcome.Gets the response payload from user.Gets the rejection reason from payload if available.inthashCode()booleanChecks if the interrupt was approved.booleanChecks if the interrupt was cancelled.booleanisError()Checks if there was an error.booleanChecks if the interrupt was rejected.booleanChecks if the interrupt timed out.static InterruptResultCreates a rejected result.booleanChecks if the agent should proceed with the action.static InterruptResultCreates a timed out result.toString()
-
Method Details
-
approved
Creates an approved result.- Parameters:
interruptId- the interrupt IDpayload- optional response payload from user- Returns:
- approved result
-
rejected
Creates a rejected result.- Parameters:
interruptId- the interrupt IDpayload- optional response payload (may include rejection reason)- Returns:
- rejected result
-
timedOut
Creates a timed out result.- Parameters:
interruptId- the interrupt ID- Returns:
- timed out result
-
cancelled
Creates a cancelled result.- Parameters:
interruptId- the interrupt ID- Returns:
- cancelled result
-
error
Creates an error result.- Parameters:
interruptId- the interrupt IDerrorMessage- the error message- Returns:
- error result
-
getInterruptId
Gets the interrupt ID.- Returns:
- interrupt ID
-
getOutcome
Gets the outcome.- Returns:
- outcome
-
getPayload
Gets the response payload from user.- Returns:
- payload map (never null, may be empty)
-
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
Gets the rejection reason from payload if available.- Returns:
- rejection reason or null
-
getApprover
Gets the approver from payload if available.- Returns:
- approver or null
-
toString
-
equals
-
hashCode
public int hashCode()
-