Class WorkflowInstanceId

java.lang.Object
com.yworkflow.instance.model.value.WorkflowInstanceId
All Implemented Interfaces:
Comparable<WorkflowInstanceId>

public class WorkflowInstanceId extends Object implements Comparable<WorkflowInstanceId>
Represents a unique identifier for a workflow instance. WorkflowInstanceId is an immutable value object that serves as the primary key for workflow instances within the yWorkflow engine.
Since:
1.0
  • Field Details

    • EMPTY

      public static final WorkflowInstanceId EMPTY
      An empty WorkflowInstanceId instance with an empty string value.
  • Method Details

    • getValue

      public String getValue()
      Returns the string value of this workflow instance ID.
      Returns:
      the workflow instance ID value
    • workflowInstanceId

      public static WorkflowInstanceId workflowInstanceId(String value)
      Creates a new WorkflowInstanceId instance with the specified value. The value is validated to ensure it meets the requirements for workflow instance IDs.
      Parameters:
      value - the string value for the workflow instance ID
      Returns:
      a new WorkflowInstanceId instance
      Throws:
      IllegalArgumentException - if the value is invalid
    • compareTo

      public int compareTo(WorkflowInstanceId o)
      Compares this WorkflowInstanceId with another WorkflowInstanceId for ordering. Comparison is based on the string value of the workflow instance ID.
      Specified by:
      compareTo in interface Comparable<WorkflowInstanceId>
      Parameters:
      o - the WorkflowInstanceId to compare with
      Returns:
      a negative integer, zero, or a positive integer as this WorkflowInstanceId is less than, equal to, or greater than the specified WorkflowInstanceId
    • equals

      public boolean equals(Object object)
      Compares this WorkflowInstanceId with the specified object for equality. Two WorkflowInstanceId instances are equal if they have the same value.
      Overrides:
      equals in class Object
      Parameters:
      object - the object to compare with
      Returns:
      true if the objects are equal, false otherwise
    • hashCode

      public int hashCode()
      Returns the hash code for this WorkflowInstanceId.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code
    • toString

      public String toString()
      Returns a string representation of this WorkflowInstanceId.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the WorkflowInstanceId
    • asLong

      public Long asLong()
      Converts this WorkflowInstanceId to a Long value. This is useful for database operations where numeric primary keys are required.
      Returns:
      the Long representation of this workflow instance ID
      Throws:
      NumberFormatException - if the value cannot be parsed as a Long