Package com.tnsai.coordination.workflow
Record Class WorkflowResult
java.lang.Object
java.lang.Record
com.tnsai.coordination.workflow.WorkflowResult
- Record Components:
workflowId- the workflow identifiersuccess- whether all steps completed successfullystepResults- results for each executed steptotalDurationMs- total workflow execution timeerror- error message if workflow failed
public record WorkflowResult(String workflowId, boolean success, List<WorkflowContext.StepResult> stepResults, long totalDurationMs, String error)
extends Record
Result of a complete workflow execution.
-
Constructor Summary
ConstructorsConstructorDescriptionWorkflowResult(String workflowId, boolean success, List<WorkflowContext.StepResult> stepResults, long totalDurationMs, String error) Creates an instance of aWorkflowResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the number of successfully completed steps.final booleanIndicates whether some other object is "equal to" this one.error()Returns the value of theerrorrecord component.longReturns the number of failed steps.static WorkflowResultfailure(String workflowId, List<WorkflowContext.StepResult> results, long durationMs, String error) final inthashCode()Returns a hash code value for this object.Returns the value of thestepResultsrecord component.booleansuccess()Returns the value of thesuccessrecord component.static WorkflowResultsuccess(String workflowId, List<WorkflowContext.StepResult> results, long durationMs) final StringtoString()Returns a string representation of this record class.longReturns the value of thetotalDurationMsrecord component.Returns the value of theworkflowIdrecord component.
-
Constructor Details
-
WorkflowResult
public WorkflowResult(String workflowId, boolean success, List<WorkflowContext.StepResult> stepResults, long totalDurationMs, String error) Creates an instance of aWorkflowResultrecord class.- Parameters:
workflowId- the value for theworkflowIdrecord componentsuccess- the value for thesuccessrecord componentstepResults- the value for thestepResultsrecord componenttotalDurationMs- the value for thetotalDurationMsrecord componenterror- the value for theerrorrecord component
-
-
Method Details
-
success
public static WorkflowResult success(String workflowId, List<WorkflowContext.StepResult> results, long durationMs) -
failure
public static WorkflowResult failure(String workflowId, List<WorkflowContext.StepResult> results, long durationMs, String error) -
completedCount
public long completedCount()Returns the number of successfully completed steps. -
failedCount
public long failedCount()Returns the number of failed steps. -
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
workflowId
Returns the value of theworkflowIdrecord component.- Returns:
- the value of the
workflowIdrecord component
-
success
public boolean success()Returns the value of thesuccessrecord component.- Returns:
- the value of the
successrecord component
-
stepResults
Returns the value of thestepResultsrecord component.- Returns:
- the value of the
stepResultsrecord component
-
totalDurationMs
public long totalDurationMs()Returns the value of thetotalDurationMsrecord component.- Returns:
- the value of the
totalDurationMsrecord component
-
error
Returns the value of theerrorrecord component.- Returns:
- the value of the
errorrecord component
-