james.maes 544febfc41
QRun-IO/ci-policy: ci / fork-guard (push) Skipped
QRun-IO/ci-policy: native / fork-deny (push) Skipped
QRun-IO/ci-policy: native / dotnet-0 (push) Skipped
QRun-IO/ci-policy: ci / Scoped workflow [workflow 1e25bb5a243dfdcd95d4b9a4f780200ff8c8778a] (push) Successful in 14s
QRun-IO/ci-policy: ci / head-profile (push) Skipped
QRun-IO/ci-policy: ci / repository-policy (push) Skipped
QRun-IO/ci-policy: ci / application-template-0 (push) Skipped
QRun-IO/ci-policy: ci / gradle-1 (push) Skipped
QRun-IO/ci-policy: ci / java-core-2-head (push) Skipped
QRun-IO/ci-policy: ci / java-docker-3 (push) Skipped
QRun-IO/ci-policy: ci / java-docker-3-head (push) Skipped
QRun-IO/ci-policy: ci / java-docker-4 (push) Skipped
QRun-IO/ci-policy: ci / java-frontend-browser-5 (push) Skipped
QRun-IO/ci-policy: ci / java-maven-6 (push) Skipped
QRun-IO/ci-policy: ci / java-maven-6-head (push) Skipped
QRun-IO/ci-policy: ci / java-maven-7 (push) Skipped
QRun-IO/ci-policy: ci / java-maven-7-head (push) Skipped
QRun-IO/ci-policy: ci / node-8 (push) Skipped
QRun-IO/ci-policy: ci / node-9 (push) Skipped
QRun-IO/ci-policy: ci / node-10 (push) Skipped
QRun-IO/ci-policy: ci / node-playwright-11 (push) Skipped
QRun-IO/ci-policy: ci / repository-policy-12 (push) Skipped
QRun-IO/ci-policy: ci / source-config-13 (push) Skipped
QRun-IO/ci-policy: ci / source-config-14 (push) Skipped
QRun-IO/ci-policy: ci / android-0 (push) Skipped
QRun-IO/ci-policy: ci / original-business (push) Skipped
QRun-IO/ci-policy: ci / original-mcp (push) Skipped
QRun-IO/ci-policy: ci / original-voyage (push) Skipped
QRun-IO/ci-policy: ci / original-cli (push) Skipped
QRun-IO/ci-policy: ci / not-enrolled (push) Skipped
QRun-IO/ci-policy: ci / shared-pipeline (push) Skipped
QRun-IO/ci-policy: ci / ci-result (push) Successful in 16s
QRun-IO/ci-policy: native / native-result (push) Successful in 8s
maven / build (push) Successful in 3m0s
build / maven (push) Successful in 3m0s
Merge pull request 'ci: pin shared workflow to v1' (#30) from ci/pin-v1-main into main
2026-11-06 16:12:57 +00:00
2025-06-02 10:23:35 -05:00
2025-06-02 10:23:35 -05:00

qbit-workflows

State machine workflows for QQQ applications.

For: QQQ developers building approval flows, order pipelines, or any multi-step business processes
Status: Stable

Why This Exists

Business processes have states. Orders go from pending to approved to shipped. Support tickets move through triage, investigation, and resolution. Building these flows means tracking state, validating transitions, and triggering actions at each step.

This QBit provides a declarative workflow engine. Define states and transitions, and the system enforces valid paths, runs actions on transitions, and tracks history automatically.

Features

  • State Definitions - Define allowed states for any entity
  • Transition Rules - Control which states can move to which other states
  • Transition Actions - Execute code when moving between states
  • Role-Based Transitions - Restrict who can trigger which transitions
  • Transition History - Automatic audit log of all state changes
  • Dashboard Integration - Status badges and transition buttons in the UI

Quick Start

Prerequisites

  • QQQ application (v4.1.0+)
  • Database backend configured

Installation

Add to your pom.xml:

<dependency>
    <groupId>com.kingsrook.qbits</groupId>
    <artifactId>qbit-workflows</artifactId>
    <version>0.4.0</version>
</dependency>

Register the QBit

public class AppMetaProvider extends QMetaProvider {
    @Override
    public void configure(QInstance qInstance) {
        new WorkflowsQBit().configure(qInstance);
    }
}

Define a Workflow

new QWorkflowMetaData()
    .withName("orderWorkflow")
    .withTable("order")
    .withStatusField("status")
    .withStates(
        new QWorkflowState("pending", "Pending"),
        new QWorkflowState("approved", "Approved"),
        new QWorkflowState("shipped", "Shipped"),
        new QWorkflowState("cancelled", "Cancelled")
    )
    .withTransitions(
        new QWorkflowTransition("pending", "approved"),
        new QWorkflowTransition("pending", "cancelled"),
        new QWorkflowTransition("approved", "shipped"),
        new QWorkflowTransition("approved", "cancelled")
    );

Usage

Transition Actions

new QWorkflowTransition("approved", "shipped")
    .withAction(new ShipOrderAction());

public class ShipOrderAction implements WorkflowTransitionAction {
    @Override
    public void execute(WorkflowTransitionContext context) {
        // Send shipping notification
        // Update inventory
        // Generate tracking number
    }
}

Role-Based Transitions

// Only managers can approve
new QWorkflowTransition("pending", "approved")
    .withAllowedRoles("manager", "admin");

Transition Validation

new QWorkflowTransition("approved", "shipped")
    .withValidator((context) -> {
        if (context.getRecord().getValue("shippingAddress") == null) {
            throw new WorkflowException("Shipping address required");
        }
    });

Querying by State

// Find all pending orders
QueryInput query = new QueryInput()
    .withTableName("order")
    .withFilter(new QQueryFilter()
        .withCriteria("status", Operator.EQUALS, "pending"));

Configuration

The QBit creates a transition history table automatically:

Table Purpose
workflow_transition_log Audit trail of all state changes

Each log entry records: record ID, from state, to state, user, timestamp, and optional comments.

Project Status

Stable and production-ready.

Roadmap

  • Parallel state support (multiple active states)
  • Scheduled transitions (auto-expire after N days)
  • Workflow visualization in dashboard

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Run tests: mvn clean verify
  4. Submit a pull request

License

Proprietary - QRun.IO

S
Description
QBit for workflow automation. User-defined conditional logic and state machines.
Readme Apache-2.0
2.4 MiB
0 Stars 3 Watchers 0 Forks
2025-12-28 22:44:41 +00:00
Languages
Java 100%