Mozart.BpmProcess (Mozart v1.0.1)

This module implements a BPM Domain Specific Language (DSL) framework. To use, insert use Mozart.BpmProcess into your modules.

defmodule Mozart.MyBpmApplication do
  use Mozart.BpmProcess

  # Your process model definitions
end

Summary

Functions

Used to specify one of many alternate execution paths. The first argument is either a captured function or an atom corresponding to local function of arity 1. The second argument is a block of tasks.

Used to select one of many execution paths. Arguments are a task name and a list of cases.

Used to define a task that executes only when a condition (function) evaluates to true (a truthy value). When the condition evaluates to false, execution proceeds directly to the next task.

Used to define a BPM application. An BPM application is used to identity a top level business process implemented in a Elixir module. It's purpose is to facilitate external tool integration. A single Elixir module might have zero or one such definitions. Define a BPM application when you intend for users to start process instances from a Mozart GUI. It's parameters are as follows

Used to associate a single choice, enumerated type for a process data parameter. It's purpose is to facilitate interation with external tools, e.g. GUIs.

Used to associate a confirmational type for a process data parameter. It's purpose is to facilitate interation with external tools, e.g. GUIs. Intended to be associated with a check box that the user must check to complete a task.

Used to associate a multiple choice, enumerated type for a process data parameter. It's purpose is to facilitate interation with external tools, e.g. GUIs.

Used to associate a numerical type for a process data parameter. It's purpose is to facilitate interation with external tools, e.g. GUIs.

Used to implement a business process model. Arguments are a name followed by one or more task functions.

Used to define parallel execution paths. Arguments are the task name and a list of routes.

Used to specify a task that has no behavior. Used for prototyping. Has a single name argument

Used to suspend an execution path until receiving a specified PubSub event. Arguemnts are a task name and captured function

Used to a sequence of tasks that repeat as long as a condition evaluates to a truthy value.

Used to reroute a process flow off the typical execution path (off the 'happy path').

Used to set data properties based on evaluation of rules in a rule table. Arguments are a task name, a set of inputs and a rule table.

A task that send a PubSub event to a receiving receive_task. Arguments are a task name and a PubSub message.

Used to specify a task completed by calling an Elixir function. Arguments are a task name, a set of comma delitmited inputs a captured Elixir function.

Used to specify a task completed by spawning and completing a subprocess. Arguments are a task name and the name of the subprocess model.

Used to specify a timed delay in an execution path. Arguments are a task name and a duration in milliseconds.

Used to specify a task performed by a user belonging to a specified workgroup. Arguments are a task name and a set of comma delimited workgroups.

Functions

Link to this macro

case_i(expr, list)

(macro)

Used to specify one of many alternate execution paths. The first argument is either a captured function or an atom corresponding to local function of arity 1. The second argument is a block of tasks.

defprocess "two case process" do
  case_task "yes or no" do
    case_i :x_less_than_y do
      user_task("1", group: "admin")
      user_task("2", group: "admin")
    end
    case_i :x_greater_or_equal_y do
      user_task("3", group: "admin")
      user_task("4", group: "admin")
    end
  end
end
Link to this macro

case_task(name, list)

(macro)

Used to select one of many execution paths. Arguments are a task name and a list of cases.

defprocess "two case process" do
  case_task "yes or no" do
    case_i :x_less_than_y do
      user_task("1", group: "admin")
      user_task("2", group: "admin")
    end
    case_i :x_greater_or_equal_y do
      user_task("3", group: "admin")
      user_task("4", group: "admin")
    end
  end
end
Link to this macro

conditional_task(name, options, list)

(macro)

Used to define a task that executes only when a condition (function) evaluates to true (a truthy value). When the condition evaluates to false, execution proceeds directly to the next task.

Example:

defprocess "process with conditional task" do
  prototype_task("fast initial credit check")
  conditional_task "additional credit check", condition: :initial_check_inconclusive do
    prototype_task("extensive credit check")
  end
  prototype_task("report credit check results")
end
Link to this macro

def_bpm_application(process, options \\ [])

(macro)

Used to define a BPM application. An BPM application is used to identity a top level business process implemented in a Elixir module. It's purpose is to facilitate external tool integration. A single Elixir module might have zero or one such definitions. Define a BPM application when you intend for users to start process instances from a Mozart GUI. It's parameters are as follows:

  • process: The name of the top level process defintion.
  • data: A keyword argument for a comma separated list of input parameters that the busines process should be initialized with.
  • bk_prefix: A keyword argument for a set of data values to use as the process instances business key prefix.

Example: def_bpm_application("Home Loan", data: "Customer Name,Income,Debt", bk_prefix: "Customer Name")

Link to this macro

def_choice_type(param_name, list)

(macro)

Used to associate a single choice, enumerated type for a process data parameter. It's purpose is to facilitate interation with external tools, e.g. GUIs.

Example:

def_choice_type("Pre Approval", choices: "Approved, Declined")

Link to this macro

def_confirm_type(param_name)

(macro)

Used to associate a confirmational type for a process data parameter. It's purpose is to facilitate interation with external tools, e.g. GUIs. Intended to be associated with a check box that the user must check to complete a task.

Example:

def_confirm_type("confirm param")

Link to this macro

def_multi_choice_type(param_name, list)

(macro)

Used to associate a multiple choice, enumerated type for a process data parameter. It's purpose is to facilitate interation with external tools, e.g. GUIs.

Example:

def_multi_choice_type("multi choice param", choices: "foo,bar,foobar")

Link to this macro

def_number_type(param_name, options)

(macro)

Used to associate a numerical type for a process data parameter. It's purpose is to facilitate interation with external tools, e.g. GUIs.

Example:

def_number_type("number param", min: 0, max: 5)

Link to this macro

defprocess(name, list)

(macro)

Used to implement a business process model. Arguments are a name followed by one or more task functions.

defprocess "two timer task process" do
  timer_task("one second timer task", duration: 1000)
  timer_task("two second timer task", duration: 2000)
end
Link to this macro

parallel_task(name, list)

(macro)

Used to define parallel execution paths. Arguments are the task name and a list of routes.

defprocess "two parallel routes process" do
  parallel_task "a parallel task" do
    route do
      user_task("1", group: "admin")
      user_task("2", group: "admin")
    end
    route do
      user_task("3", group: "admin")
      user_task("4", group: "admin")
    end
  end
end
Link to this macro

prototype_task(name, data \\ nil)

(macro)

Used to specify a task that has no behavior. Used for prototyping. Has a single name argument

defprocess "two prototype task process" do
  prototype_task("prototype task 1")
  prototype_task("prototype task 2")
end
Link to this macro

receive_task(name, options)

(macro)

Used to suspend an execution path until receiving a specified PubSub event. Arguemnts are a task name and captured function

def receive_loan_income(msg) do
  case msg do
    {:barrower_income, income} -> %{barrower_income: income}
    _ -> nil
  end
end

defprocess "receive barrower income process" do
  receive_task("receive barrower income", selector: :receive_loan_income)
end
Link to this macro

repeat_task(name, options, list)

(macro)

Used to a sequence of tasks that repeat as long as a condition evaluates to a truthy value.

Example:

defprocess "account overdue process" do
  repeat_task "notify customer", condition: :third_notice_sent do
    service_task("send overdue notice", function: :record_notifiction_sent)
  end
end
Link to this macro

reroute_task(name, options, list)

(macro)

Used to reroute a process flow off the typical execution path (off the 'happy path').

Example:

defprocess "act on one of multiple events" do
  prototype_task("create order")
  receive_task("receive payment details", selector: :receive_payment_details)
  reroute_task "payment period expired", condition: :payment_period_expired do
    prototype_task("cancel order due to timeout")
  end
  reroute_task "order canceled", condition: :order_canceled do
    prototype_task("cancel order due to order cancelation")
  end
  prototype_task("process payment")
end
Link to this macro

rule_task(name, list)

(macro)

Used to set data properties based on evaluation of rules in a rule table. Arguments are a task name, a set of inputs and a rule table.

rule_table = """
F     income      || status
1     > 50000     || approved
2     <= 49999    || declined
"""

defprocess "single rule task process" do
  rule_task("loan decision", inputs: "income", rule_table: rule_table)
end
Link to this macro

send_task(name, options)

(macro)

A task that send a PubSub event to a receiving receive_task. Arguments are a task name and a PubSub message.

defprocess "send barrower income process" do
  send_task("send barrower income", message: {:barrower_income, 100_000})
end
Link to this macro

service_task(name, options)

(macro)

Used to specify a task completed by calling an Elixir function. Arguments are a task name, a set of comma delitmited inputs a captured Elixir function.

def square(data) do
  Map.put(data, :square, data.x * data.x)
end

defprocess "one service task process" do
  service_task("a service task", function: :square, inputs: "x")
end
Link to this macro

subprocess_task(name, list)

(macro)

Used to specify a task completed by spawning and completing a subprocess. Arguments are a task name and the name of the subprocess model.

defprocess "subprocess task process" do
  subprocess_task("subprocess task", process: "two service tasks")
end
Link to this macro

timer_task(name, options)

(macro)

Used to specify a timed delay in an execution path. Arguments are a task name and a duration in milliseconds.

defprocess "two timer task process" do
  timer_task("one second timer task", duration: 1000)
  timer_task("two second timer task", duration: 2000)
end
Link to this macro

user_task(name, args)

(macro)

Used to specify a task performed by a user belonging to a specified workgroup. Arguments are a task name and a set of comma delimited workgroups.

defprocess "single user task process" do
  user_task("add one to x", group: "admin,customer_service")
end