Expression Evaluation using activiti Expression packages

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2011 01:52 AM
I am looking for approach for using activiti's expression evaluation packages in my Custom JSF based web application (where I Activiti JARS). What is the best way to call the activiti expression evaluation classes (which interfaces to use?). If anyone have tried this please pass some pointers.
Thanks in advance
Krish
I was looking at the code and it looks like ExpressionManager Class in package org.activiti.engine.impl.el; package is used for runtime evaluation of expression (the code commenting says that

- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2011 02:53 AM
Have a look at org.activiti.engine.impl.el.JuelExpression and org.activiti.engine.impl.el.ExpressionManager. An expression is first created (parsed) using expression-manager and when needed it's evaluated against an VariableScope (eg. the delegateExecution).
To obtain the expression-manager, use
ExpressionManager expressionManager = processEngine.getProcessEngineConfiguration().getExpressionManager();
To parse an expression, use:
expressionManager.createExpression("${myVar + 1}");
You can plug in a custom ExpressionManager, example of this is in ProcessEngineFactoryBean and SpringExpressionManager.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2011 03:00 AM
Thanks a ton for the quick response.
Krish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2011 04:16 AM
It will be a big help if you can guide me regarding ..
In case of using a default process engine:
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
How to get expression manager–> create expression–> evaluate expression
Thank you
Krish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2011 04:24 AM
ExpressionManager expressionManager = ((ProcessEngineImpl)processEngine).getProcessEngineConfiguration().getExpressionManager();
Expression myEx = expressionManager.createExpression("${myVar + 1}");
Object result = myEx.getValue(variableScope);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2011 04:33 AM


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2011 07:34 AM
One more help ::
How to get an handle of DelegateExecution (or create it using API) from outside the Activiti Instance say from a Java class that will pass the parameters to Activiti.
Thank you


Krish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2011 07:45 AM
The activiti-expressions are designed to be evaluated in the process-context (DelegateExecution), so getting a hold of one through API is inpossible.
What's the point of using activiti-expression handling when you're not using it inside activiti process? If you want to resolve espressions based on non-process stuff, you should just use JUEL as a library for that or leverage the JUEL present in the activiti codebase. If you do this, you shouldn't use the ExpressionManager, but create your ow ELResolvers that access the data you want and use these to evaluate the expressions. a couple of pointers:
org.activiti.engine.impl.javax.el.ValueExpression
org.activiti.engine.impl.javax.el.ExpressionFactory
org.activiti.engine.impl.el.JuelExpression
org.activiti.engine.impl.el.ExpressionManager
ValueExpression valueExpression = expressionFactory.createValueExpression(parsingElContext, expression, Object.class);
valueExpression.getValue(elContext);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2011 08:26 AM
I wanted to use JSF EL along with custom EL (the one used in activiti); so that I will be able to populate the JSF based forms outside the activiti engine (albeit with activiti engine based process / task level values ).
In activiti Ftl based froms are used to generate HTML where the engine has an handle to the form at the execution time… however in a JSF based application Activiti engine will not have an handle to a form and hence the requirement of evaluating existing activiti based expression syntax in JSF from from activiti engine run time instance values.
Please suggest what is the best way forward.
Thank you
krish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2011 08:33 AM
runtimeService.getVariables(processInstance.getId());
taskService.getVariables(Local)(task.getId());
