AnsweredAssumed Answered

how to override ServiceTaskDelegateExpressionActivityBehavio

Question asked by workflowuser2 on Jul 17, 2012
Latest reply on Jul 18, 2012 by workflowuser2
Hi

I need to override ServiceTaskDelegateExpressionActivityBehavior:

public class CustomServiceTaskDelegateExpressionActivityBehavior extends ServiceTaskDelegateExpressionActivityBehavior {

public CustomServiceTaskDelegateExpressionActivityBehavior(Expression expression) {
       super(expression);
}
public void execute(ActivityExecution execution) throws Exception {

  // i need to change classloading behavior here.
  /
}

}

As mentioned above, I just want to change behavior of execute method and keep rest of the behavior.

What's the best way to do this?

I tried hooking up new behavior class using custom pre parser listener:

public class CustomParserListener implements BpmnParserListener {

public void parseServiceTask(Element serviceTaskElement, ScopeImpl scope, ActivityImpl activity) {

       if (activity.getActivityBehavior() instanceof ServiceTaskDelegateExpressionActivityBehavior) {
           // QUESTION: How to create CustomServiceTaskDelegateExpressionActivityBehavior object from activity.getActivityBehavior()?
                //e.g. activity.setActivityBehavior(new CustomServiceTaskDelegateExpressionActivityBehavior (????));
                // ServiceTaskDelegateExpressionActivityBehavior members do not have getter methods (e.g no getExpression())
       }
     }
}

Forgive me for asking trivial question, if it is.

Activiti Newbie

Outcomes