Actions can be used in different ways:
Actions have access to globals and the variables that are defined
for the process and the predefined variable context
. This
variable is of type
org.drools.runtime.process.ProcessContext
and can be used for
several tasks:
NodeInstance node = context.getNodeInstance(); String name = node.getNodeName();
WorkflowProcessInstance proc = context.getProcessInstance(); proc.signalEvent( type, eventObject );
Drools currently supports two dialects, Java and MVEL.
Java actions should be valid Java code. MVEL actions can use the business
scripting language MVEL to express the action. MVEL accepts any valid Java
code but additionally provides support for nested accesses of parameters
(e.g., person.name
instead of person.getName()
),
and many other scripting improvements. Thus, MVEL expressions are more
convenient for the business user. For example, an action that prints out
the name of the person in the "requester" variable of the process would
look like this:
// Java dialect System.out.println( person.getName() ); // MVEL dialect System.out.println( person.name );