FRED™  3.0
FRED™: Framework for Rapid and Easy Development
Workflow Class Reference
Inheritance diagram for Workflow:
Component Thing

Public Member Functions

 createItem ($workflow, $id, $data=null, $status='start')
 Create a new workflow item. More...
 
 loadItem ($id)
 Load an existing workflow item. More...
 
 lockItem ($id)
 Request a lock on a workflow item. More...
 
 unlockItem ($id)
 Release a lock on a workflow item. More...
 
 getItemData ($id)
 Get all data for an item. More...
 
 setItemData ($id, $data)
 Set (add) data for an item. More...
 
 getItemStatus ($id)
 Get current status for an item. More...
 
 setItemStatus ($id, $status, $remarks=null)
 Set the status for an item. More...
 
 getItemStatuses ($id)
 Get all possible (authorized) change statuses from the current status. More...
 
 push ($id, $data=null)
 Push an item into the queue (reschedule to execute as soon as possible). More...
 
 execute ($timeout=null)
 Process the queue. More...
 
- Public Member Functions inherited from Component
 __construct ($fred, $config=null)
 
 __destruct ()
 
 clientConfig ()
 Public configuration. More...
 
 config ($key, $default=null)
 Retrieve a config value. More...
 
 ping ()
 Ping function. More...
 
 filemtime ($filename)
 Filemtime with session cache. More...
 
 component ($name)
 Get a component (local or default). More...
 
 components (... $names)
 Get multiple components in an array. More...
 
- Public Member Functions inherited from Thing
 propertyExists ($property)
 Check if a property exists (public or published). More...
 
 constants ($prefix=null)
 Return all constants. More...
 
 get ($key)
 Get one or more properties. More...
 
 set ($key, $value=null)
 Set one or more properties. More...
 
 __get ($key)
 
 __set ($key, $value)
 

Protected Member Functions

 workflow ($id)
 Get workflow data. More...
 
 pause ($id)
 Pause an item (remove from queue). More...
 
 shift ($lock=false)
 Shift the first item from the queue. More...
 
 getWorkflows ()
 
- Protected Member Functions inherited from Component
 init ()
 
 done ()
 
 getSession ()
 
- Protected Member Functions inherited from Thing
 publish ($property, $visibility=self::READABLE)
 Publish a property (or hide it again). More...
 
 configure ($config)
 Configure the object. More...
 
 _get ($key)
 Default getter if no specific setter is defined, and the property is also not published (readable). More...
 
 _set ($key, $value)
 Default setter if no specific setter is defined, and the property is also not published (writeable). More...
 

Protected Attributes

 $_lockItem = 'workflow'
 
 $_workflows = null
 
- Protected Attributes inherited from Component
 $_fred = null
 
 $_config = null
 
 $_name = null
 
 $_components = []
 Local components (key = component name, value = component). More...
 
 $_session = null
 
- Protected Attributes inherited from Thing
 $_published = []
 Published properties (key = name of property, value = visibility). More...
 

Additional Inherited Members

- Data Fields inherited from Component
 $filemtimeTtl = 0
 
- Data Fields inherited from Thing
const HIDDEN = 0
 Property is hidden. More...
 
const READABLE = 1
 Property is readable. More...
 
const WRITEABLE = 2
 Property is writeable. More...
 
const READWRITE = 3
 Property is readable and writeable. More...
 

Detailed Description

Definition at line 5 of file Workflow.php.

Member Function Documentation

◆ createItem()

createItem (   $workflow,
  $id,
  $data = null,
  $status = 'start' 
)

Create a new workflow item.

Parameters
string$workflowWorkflow for this item.
string$idUnique ID for this item.
array$dataData for this item.
string$statusInitial status for this item.
Returns
Rsi\Ginger\Workflow\Item Item or false when not authorized.

Definition at line 28 of file Workflow.php.

◆ execute()

execute (   $timeout = null)

Process the queue.

Parameters
int$timeoutMaximum execution time (seconds).

Definition at line 121 of file Workflow.php.

◆ getItemData()

getItemData (   $id)

Get all data for an item.

Parameters
string$idItem ID.
Returns
array

Definition at line 60 of file Workflow.php.

◆ getItemStatus()

getItemStatus (   $id)

Get current status for an item.

Parameters
string$idItem ID.
Returns
string

Definition at line 75 of file Workflow.php.

◆ getItemStatuses()

getItemStatuses (   $id)

Get all possible (authorized) change statuses from the current status.

Parameters
string$idItem ID.
Returns
array Key = status ID, value = status data (array).

Definition at line 93 of file Workflow.php.

◆ getWorkflows()

getWorkflows ( )
protected

Definition at line 142 of file Workflow.php.

◆ loadItem()

loadItem (   $id)

Load an existing workflow item.

Parameters
string$idItem ID.
Returns
Rsi\Ginger\Workflow\Item Item or false when not found or not authorized.

Definition at line 36 of file Workflow.php.

◆ lockItem()

lockItem (   $id)

Request a lock on a workflow item.

Parameters
string$idItem ID.
Returns
bool True on success.

Definition at line 44 of file Workflow.php.

◆ pause()

pause (   $id)
protected

Pause an item (remove from queue).

Parameters
string$idItem ID.

Definition at line 107 of file Workflow.php.

◆ push()

push (   $id,
  $data = null 
)

Push an item into the queue (reschedule to execute as soon as possible).

Parameters
string$idItem ID.
array$dataData to add to the item.

Definition at line 101 of file Workflow.php.

◆ setItemData()

setItemData (   $id,
  $data 
)

Set (add) data for an item.

Parameters
string$idItem ID.
array$data

Definition at line 68 of file Workflow.php.

◆ setItemStatus()

setItemStatus (   $id,
  $status,
  $remarks = null 
)

Set the status for an item.

Parameters
string$idItem ID.
string$statusNew status.
string$remarks
Returns
bool True when successful, false when not possible or not authorized.

Definition at line 85 of file Workflow.php.

◆ shift()

shift (   $lock = false)
protected

Shift the first item from the queue.

Parameters
bool$lockLock the item (or skip if not lockable).
Returns
string ID or empty when the queue is empty.

Definition at line 114 of file Workflow.php.

◆ unlockItem()

unlockItem (   $id)

Release a lock on a workflow item.

Parameters
string$idItem ID.
Returns
bool True on success.

Definition at line 52 of file Workflow.php.

◆ workflow()

workflow (   $id)
protected

Get workflow data.

Parameters
string$idWorkflow ID.
Returns
array

Definition at line 16 of file Workflow.php.

Field Documentation

◆ $_lockItem

$_lockItem = 'workflow'
protected

Definition at line 7 of file Workflow.php.

◆ $_workflows

$_workflows = null
protected

Definition at line 9 of file Workflow.php.


The documentation for this class was generated from the following file: