ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilPluginNode Class Reference

PhpIncludeInspection More...

+ Inheritance diagram for ilPluginNode:
+ Collaboration diagram for ilPluginNode:

Public Member Functions

 __construct (ilWorkflow $context)
 Default constructor. More...
 
 activate ()
 Activates the node. More...
 
 deactivate ()
 Deactivates the node. More...
 
 trigger ($a_type, $a_params=null)
 Passes a trigger to attached detectors. More...
 
 checkTransitionPreconditions ()
 Checks, if the preconditions of the node to transit are met. More...
 
 attemptTransition ()
 Attempts to transit the node. More...
 
 executeTransition ()
 Executes the 'then'-transition of the node. More...
 
 addEmitter (ilEmitter $emitter, $else_emitter=false)
 Adds an emitter to one of the lists attached to the node. More...
 
 addActivity (ilActivity $activity, $else_activity=false)
 Adds an activity to one of the lists attached to the node. More...
 
 setEvaluationExpression ($a_expression)
 
 notifyDetectorSatisfaction (ilDetector $detector)
 This method is called by detectors, that just switched to being satisfied. More...
 
 getActivities ($else=false)
 Returns all currently set activites. More...
 
 getEmitters ($else=false)
 Returns all currently set emitters. More...
 
- Public Member Functions inherited from ilBaseNode
 addDetector (ilDetector $detector)
 Adds a detector to the list of detectors. More...
 
 getDetectors ()
 Returns all currently set detectors. More...
 
 addEmitter (ilEmitter $emitter)
 Adds an emitter to the list of emitters. More...
 
 getEmitters ()
 Returns all currently set emitters. More...
 
 addActivity (ilActivity $activity)
 Adds an activity to the list of activities. More...
 
 getActivities ()
 Returns all currently set activities. More...
 
 getContext ()
 Returns a reference to the parent workflow object. More...
 
 setName ($name)
 
 getName ()
 
 getRuntimeVars ()
 
 setRuntimeVars ($runtime_vars)
 
 getRuntimeVar ($name)
 
 setRuntimeVar ($name, $value)
 
 onActivate ()
 Method called on activation of the node. More...
 
 onDeactivate ()
 Method calles on deactivation of the node. More...
 
 isActive ()
 Returns the activation status of the node. More...
 
 attemptTransition ()
 
 checkTransitionPreconditions ()
 
 executeTransition ()
 
 activate ()
 
 deactivate ()
 
 notifyDetectorSatisfaction (ilDetector $detector)
 

Private Member Functions

 executeActivities ()
 Executes all 'then'-activities attached to the node. More...
 
 executeEmitters ()
 Executes all 'then'-emitters attached to the node. More...
 

Private Attributes

 $else_emitters
 
 $else_activities
 
 $evaluation_expression = "return null;"
 

Additional Inherited Members

- Protected Attributes inherited from ilBaseNode
 $context
 
 $detectors
 
 $emitters
 
 $activities
 
 $active = false
 
 $name
 
 $runtime_vars
 

Detailed Description

PhpIncludeInspection

Plugin node of the petri net based workflow engine.

The plugin node is a deciding node. It features a multiple set of emitters and activities.

Author
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

/

Definition at line 18 of file class.ilPluginNode.php.

Constructor & Destructor Documentation

◆ __construct()

ilPluginNode::__construct ( ilWorkflow  $context)

Default constructor.

Parameters
ilWorkflow$contextReference to the parent workflow.

Definition at line 49 of file class.ilPluginNode.php.

References ilBaseNode\$context, and array.

50  {
51  $this->context = $context;
52  $this->detectors = array();
53  $this->emitters = array();
54  $this->else_emitters = array();
55  $this->activities = array();
56  $this->else_activities = array();
57  }
Create styles array
The data for the language used.

Member Function Documentation

◆ activate()

ilPluginNode::activate ( )

Activates the node.

Implements ilNode.

Definition at line 62 of file class.ilPluginNode.php.

References attemptTransition(), and ilBaseNode\onActivate().

63  {
64  $this->active = true;
65  foreach($this->detectors as $detector)
66  {
67  $detector->onActivate();
68  }
69  $this->onActivate();
70  $this->attemptTransition();
71  }
attemptTransition()
Attempts to transit the node.
onActivate()
Method called on activation of the node.
+ Here is the call graph for this function:

◆ addActivity()

ilPluginNode::addActivity ( ilActivity  $activity,
  $else_activity = false 
)

Adds an activity to one of the lists attached to the node.

Parameters
ilActivity$activity
boolean$else_activityTrue, if the activity should be an 'else'-activity.

Definition at line 229 of file class.ilPluginNode.php.

230  {
231  if (!$else_activity)
232  {
233  $this->activities[] = $activity;
234  }
235  else
236  {
237  $this->else_activities[] = $activity;
238  }
239  }

◆ addEmitter()

ilPluginNode::addEmitter ( ilEmitter  $emitter,
  $else_emitter = false 
)

Adds an emitter to one of the lists attached to the node.

Parameters
ilEmitter$emitter
boolean$else_emitterTrue, if the emitter should be an 'else'-emitter.

Definition at line 211 of file class.ilPluginNode.php.

212  {
213  if (!$else_emitter)
214  {
215  $this->emitters[] = $emitter;
216  }
217  else
218  {
219  $this->else_emitters[] = $emitter;
220  }
221  }

◆ attemptTransition()

ilPluginNode::attemptTransition ( )

Attempts to transit the node.

Basically, this checks for preconditions and transits, returning true or false if preconditions are not met, aka detectors are not fully satisfied.

Returns
boolean True, if transition succeeded.

Implements ilNode.

Definition at line 145 of file class.ilPluginNode.php.

References executeTransition().

Referenced by activate(), notifyDetectorSatisfaction(), and trigger().

146  {
147  // TODO Call Plugin here.
148  $eval_function = create_function('$detectors', $this->evaluation_expression);
149 
150  if ($eval_function($this->detectors) === null)
151  {
152  return false;
153  }
154 
155  if ($eval_function($this->detectors) === true)
156  {
157  $this->executeTransition();
158  return true;
159  }
160  else
161  {
162  $this->executeElseTransition();
163  return true;
164  }
165  }
executeTransition()
Executes the 'then'-transition of the node.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkTransitionPreconditions()

ilPluginNode::checkTransitionPreconditions ( )

Checks, if the preconditions of the node to transit are met.

Please note, that in a conditional node, this means the node can transit to one or another outcome. This method only returns false, if the return value of the method is neither true nor false.

Returns
boolean True, if node is ready to transit.

Implements ilNode.

Definition at line 117 of file class.ilPluginNode.php.

118  {
119  // TODO Call Plugin here.
120  $eval_function = create_function('$detectors', $this->evaluation_expression);
121 
122  if ($eval_function($this->detectors) === null)
123  {
124  return false;
125  }
126 
127  if ($eval_function($this->detectors) === true)
128  {
129  return true;
130  }
131  else
132  {
133  return true;
134  }
135  }

◆ deactivate()

ilPluginNode::deactivate ( )

Deactivates the node.

Implements ilNode.

Definition at line 76 of file class.ilPluginNode.php.

References ilBaseNode\onDeactivate().

Referenced by executeTransition().

77  {
78  $this->active = false;
79  foreach($this->detectors as $detector)
80  {
81  $detector->onDeactivate();
82  }
83  $this->onDeactivate();
84  }
onDeactivate()
Method calles on deactivation of the node.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeActivities()

ilPluginNode::executeActivities ( )
private

Executes all 'then'-activities attached to the node.

Definition at line 170 of file class.ilPluginNode.php.

Referenced by executeTransition().

171  {
172  if (count($this->activities) != 0)
173  {
174  foreach ($this->activities as $activity)
175  {
176  $activity->execute();
177  }
178  }
179  }
+ Here is the caller graph for this function:

◆ executeEmitters()

ilPluginNode::executeEmitters ( )
private

Executes all 'then'-emitters attached to the node.

Definition at line 184 of file class.ilPluginNode.php.

Referenced by executeTransition().

185  {
186  if (count($this->emitters) != 0)
187  {
188  foreach ($this->emitters as $emitter)
189  {
190  $emitter->emit();
191  }
192  }
193  }
+ Here is the caller graph for this function:

◆ executeTransition()

ilPluginNode::executeTransition ( )

Executes the 'then'-transition of the node.

Implements ilNode.

Definition at line 198 of file class.ilPluginNode.php.

References deactivate(), executeActivities(), and executeEmitters().

Referenced by attemptTransition().

199  {
200  $this->deactivate();
201  $this->executeActivities();
202  $this->executeEmitters();
203  }
deactivate()
Deactivates the node.
executeActivities()
Executes all 'then'-activities attached to the node.
executeEmitters()
Executes all 'then'-emitters attached to the node.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActivities()

ilPluginNode::getActivities (   $else = false)

Returns all currently set activites.

Parameters
boolean$elseTrue, if else activities should be returned.
Returns
Array Array with objects of ilActivity

Definition at line 305 of file class.ilPluginNode.php.

References ilBaseNode\$activities, and $else_activities.

306  {
307  if ($else)
308  {
309  return $this->else_activities;
310  }
311  return $this->activities;
312  }

◆ getEmitters()

ilPluginNode::getEmitters (   $else = false)

Returns all currently set emitters.

Parameters
boolean$elseTrue, if else emitters should be returned.
Returns
Array Array with objects of ilEmitter

Definition at line 321 of file class.ilPluginNode.php.

References $else_emitters, and ilBaseNode\$emitters.

322  {
323  if ($else)
324  {
325  return $this->else_emitters;
326  }
327  return $this->emitters;
328  }

◆ notifyDetectorSatisfaction()

ilPluginNode::notifyDetectorSatisfaction ( ilDetector  $detector)

This method is called by detectors, that just switched to being satisfied.

Parameters
ilDetector$detectorilDetector which is now satisfied.
Returns
mixed|void

Implements ilNode.

Definition at line 290 of file class.ilPluginNode.php.

References attemptTransition(), and ilBaseNode\isActive().

291  {
292  if ($this->isActive())
293  {
294  $this->attemptTransition();
295  }
296  }
attemptTransition()
Attempts to transit the node.
isActive()
Returns the activation status of the node.
+ Here is the call graph for this function:

◆ setEvaluationExpression()

ilPluginNode::setEvaluationExpression (   $a_expression)

Definition at line 277 of file class.ilPluginNode.php.

278  {
279  // TODO Rework to use a Plugin here.
280  $this->evaluation_expression = $a_expression;
281  }

◆ trigger()

ilPluginNode::trigger (   $a_type,
  $a_params = null 
)

Passes a trigger to attached detectors.

Deprecated:
Parameters
type$a_type
type$a_params

Definition at line 93 of file class.ilPluginNode.php.

References $a_type, and attemptTransition().

94  {
95  if ($this->active == true && count($this->detectors) != 0)
96  {
97  foreach($this->detectors as $detector)
98  {
99  if (get_class($detector) == $a_type)
100  {
101  $detector->trigger($a_params);
102  }
103  }
104  }
105  $this->attemptTransition();
106  }
attemptTransition()
Attempts to transit the node.
$a_type
Definition: workflow.php:93
+ Here is the call graph for this function:

Field Documentation

◆ $else_activities

ilPluginNode::$else_activities
private

Definition at line 34 of file class.ilPluginNode.php.

Referenced by getActivities().

◆ $else_emitters

ilPluginNode::$else_emitters
private

Definition at line 26 of file class.ilPluginNode.php.

Referenced by getEmitters().

◆ $evaluation_expression

ilPluginNode::$evaluation_expression = "return null;"
private

Definition at line 42 of file class.ilPluginNode.php.


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