Class ProcessDefinition<P,S extends Enum<S> & ProcessStepKey>

java.lang.Object
su.onno.process.ProcessDefinition<P,S>
Type Parameters:
P - process payload type
S - enum containing this process's stable step keys

public abstract class ProcessDefinition<P,S extends Enum<S> & ProcessStepKey> extends Object
Typed definition of one business-process route.
  • Constructor Details

    • ProcessDefinition

      protected ProcessDefinition(String key, Class<P> payloadType)
    • ProcessDefinition

      protected ProcessDefinition(String key, int version, Class<P> payloadType)
  • Method Details

    • key

      public final String key()
      Stable persisted definition identity. Never derived from a display title or class name.
    • version

      public final int version()
      Persisted definition version used to resume and migrate durable instances safely.
    • payloadType

      public final Class<P> payloadType()
      Payload type used by the durable runtime's JSON codec.
    • fingerprint

      public final String fingerprint()
      Deterministic SHA-256 identity of this version's payload type and route structure.

      A durable runtime persists this value and rejects a same-key, same-version definition whose graph later changes. Bump version() and provide a migration instead.

    • title

      public String title()
      Human-facing process title.
    • startAssignment

      public abstract TaskAssignment startAssignment(P payload)
      Candidate users/roles allowed to start this process through a generic user-facing boundary. Ordinary trusted Java services may still call ProcessEngine.start(su.onno.process.ProcessDefinition<P, S>, P, su.onno.process.ProcessActor) directly.
    • cancellationAssignment

      public TaskAssignment cancellationAssignment(P payload)
      Users/roles allowed to cancel an active instance.

      By default the same audience that can start the process may cancel it. Definitions may narrow or broaden that audience independently.

    • define

      protected abstract void define(ProcessGraph<P,S> graph)
      Declare tasks, endings, and typed transitions. Called once on first graph access.
    • graph

      public final ProcessGraph<P,S> graph()
      Validated immutable graph for this definition.