org.camunda.bpm.engine.impl.bpmn.helper
Class ClassDelegate

java.lang.Object
  extended by org.camunda.bpm.engine.impl.bpmn.behavior.FlowNodeActivityBehavior
      extended by org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior
          extended by org.camunda.bpm.engine.impl.bpmn.helper.ClassDelegate
All Implemented Interfaces:
ExecutionListener, TaskListener, ActivityBehavior, SignallableActivityBehavior

public class ClassDelegate
extends AbstractBpmnActivityBehavior
implements TaskListener, ExecutionListener

Helper class for bpmn constructs that allow class delegation. This class will lazily instantiate the referenced classes when needed at runtime.

Author:
Joram Barrez, Falko Menge

Field Summary
protected  String className
           
protected  List<FieldDeclaration> fieldDeclarations
           
 
Fields inherited from class org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior
multiInstanceActivityBehavior
 
Fields inherited from class org.camunda.bpm.engine.impl.bpmn.behavior.FlowNodeActivityBehavior
bpmnActivityBehavior
 
Fields inherited from interface org.camunda.bpm.engine.delegate.TaskListener
EVENTNAME_ASSIGNMENT, EVENTNAME_COMPLETE, EVENTNAME_CREATE
 
Fields inherited from interface org.camunda.bpm.engine.delegate.ExecutionListener
EVENTNAME_END, EVENTNAME_START, EVENTNAME_TAKE
 
Constructor Summary
ClassDelegate(Class<?> clazz, List<FieldDeclaration> fieldDeclarations)
           
ClassDelegate(String className, List<FieldDeclaration> fieldDeclarations)
           
 
Method Summary
static void applyFieldDeclaration(FieldDeclaration declaration, Object target)
           
static void applyFieldDeclaration(List<FieldDeclaration> fieldDeclarations, Object target)
           
protected  ActivityBehavior determineBehaviour(ActivityBehavior delegateInstance, ActivityExecution execution)
           
 void execute(ActivityExecution execution)
          Default behaviour: just leave the activity with no extra functionality.
static boolean fieldTypeCompatible(FieldDeclaration declaration, Field field)
           
protected  ActivityBehavior getActivityBehaviorInstance(ActivityExecution execution)
           
 String getClassName()
          returns the class name this ClassDelegate is configured to.
protected  ExecutionListener getExecutionListenerInstance()
           
protected  TaskListener getTaskListenerInstance()
           
static Object instantiateDelegate(Class<?> clazz, List<FieldDeclaration> fieldDeclarations)
           
static Object instantiateDelegate(String className, List<FieldDeclaration> fieldDeclarations)
           
 void notify(DelegateExecution execution)
           
 void notify(DelegateTask delegateTask)
           
 void signal(ActivityExecution execution, String signalName, Object signalData)
           
 
Methods inherited from class org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior
createCompensateEventSubscription, getMultiInstanceActivityBehavior, hasCompensationHandler, hasLoopCharacteristics, hasMultiInstanceCharacteristics, leave, setMultiInstanceActivityBehavior, signalCompensationDone
 
Methods inherited from class org.camunda.bpm.engine.impl.bpmn.behavior.FlowNodeActivityBehavior
leaveIgnoreConditions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

className

protected String className

fieldDeclarations

protected List<FieldDeclaration> fieldDeclarations
Constructor Detail

ClassDelegate

public ClassDelegate(String className,
                     List<FieldDeclaration> fieldDeclarations)

ClassDelegate

public ClassDelegate(Class<?> clazz,
                     List<FieldDeclaration> fieldDeclarations)
Method Detail

notify

public void notify(DelegateExecution execution)
            throws Exception
Specified by:
notify in interface ExecutionListener
Throws:
Exception

getExecutionListenerInstance

protected ExecutionListener getExecutionListenerInstance()

notify

public void notify(DelegateTask delegateTask)
Specified by:
notify in interface TaskListener

getTaskListenerInstance

protected TaskListener getTaskListenerInstance()

execute

public void execute(ActivityExecution execution)
             throws Exception
Description copied from class: FlowNodeActivityBehavior
Default behaviour: just leave the activity with no extra functionality.

Specified by:
execute in interface ActivityBehavior
Overrides:
execute in class FlowNodeActivityBehavior
Throws:
Exception

signal

public void signal(ActivityExecution execution,
                   String signalName,
                   Object signalData)
            throws Exception
Specified by:
signal in interface SignallableActivityBehavior
Overrides:
signal in class AbstractBpmnActivityBehavior
Throws:
Exception

getActivityBehaviorInstance

protected ActivityBehavior getActivityBehaviorInstance(ActivityExecution execution)

determineBehaviour

protected ActivityBehavior determineBehaviour(ActivityBehavior delegateInstance,
                                              ActivityExecution execution)

instantiateDelegate

public static Object instantiateDelegate(Class<?> clazz,
                                         List<FieldDeclaration> fieldDeclarations)

instantiateDelegate

public static Object instantiateDelegate(String className,
                                         List<FieldDeclaration> fieldDeclarations)

applyFieldDeclaration

public static void applyFieldDeclaration(List<FieldDeclaration> fieldDeclarations,
                                         Object target)

applyFieldDeclaration

public static void applyFieldDeclaration(FieldDeclaration declaration,
                                         Object target)

fieldTypeCompatible

public static boolean fieldTypeCompatible(FieldDeclaration declaration,
                                          Field field)

getClassName

public String getClassName()
returns the class name this ClassDelegate is configured to. Comes in handy if you want to check which delegates you already have e.g. in a list of listeners



Copyright © 2014 camunda services GmbH. All Rights Reserved.