Maintainer: Daniel Hahn This document is incomplete See also Technical Specs

Using Work Flow in Talia

This document explains how the work flow options work in Talia, and how the work flow API is used in building Talia applications

Defining a workflow

This is still open -> We will probably use a DSL/definition language to describe the workflow, similar to describing a state machine. We could also extend existing plugins, like the Statemachine library for Ruby.

The workflow will have the following elements:

  • Workflow state: This is the current state of the workflow (like "SUBMITTED")
  • Workflow action: Actions are similar to transitions in state machines. By sending an action to a workflow, one can attempt to change the workflow state. Samples would be "promote to next step" or "vote for submission". Actions can be re-used in multiple workflows. Actions may also add an internal state to the workflow (for example, the number of votes for a submission). Actions can be limited to certain user typpes
  • Transition rules. These define how the workflow state changes in reaction to workflow actions. Transitions can be conditional depending on the result of an action (e.g. vote is "accept/reject/inconclusive").

Sources and workflows

Each Source object has workflow and a current workflow state. These properties are read-only, the only way to change the workflow state is through workflow actions. The source objects provide a "workflow" accessor, which returns the current workflow as an object. The user may send workflow actions to that object. The workflow object is specific to one source.

# Example for using a workflow of a source
src = Source.new("http://newsource/")
src.workflow.state # => NEW_CREATED
src.workflow.class # => DefaultWorkflow
src.workflow.action(current_user, :promote, :accept) # => The current_user tries to accept the source

Sending workflow actions

The Workflow#action method sends an action to a workflow object. The method method has the following paramers: action(<user_credential>, <action>, <*options>).

  • user_credentials is an object identifying the current user
  • action is a symbol identifying the action to take on the workflow
  • options are any optional parameters that are passed to the action