-
1. Re: process variables - how to acces
jdbertron Jan 18, 2008 2:01 PM (in response to pebbels)public class InitMyActionHandler implements ActionHandler {
public void execute(ExecutionContext executionContext) throws Exception {
executionContext.getContextInstance().setVariable("data", "value");
} -
2. Re: process variables - how to acces
pebbels Jan 21, 2008 2:43 AM (in response to pebbels)Thanks for your answer!
But doesn't setVariable("data", "value") store the variable into the database?
I am looking for how to get the value of the variable in the ActionHandler.
So when the xhtml-form asks for the date like this:<jbpm:datacell> <f:facet name="header"> <h:outputText value="Data"/> </f:facet> <h:inputText value="#{var['Data]}" /> </jbpm:datacell>
and the ActionHandler will store the variable and its value via:executionContext.getContextInstance().setVariable("data", "value");
I need a variable declared in the ActionHandler called
String data;
and the processdefinition-file has to pass the value of Data to the ActionHandler - correct?
But how to pass it?
Cheers,
Tina -
3. Re: process variables - how to acces
kukeltje Jan 21, 2008 3:00 AM (in response to pebbels)
I need a variable declared in the ActionHandler called
String data;
Have you tried looking at the docs?and the processdefinition-file has to pass the value of Data to the ActionHandler - correct?
But how to pass it?
Have you tried searching the forum (e.g. with google)
Regards, -
4. Re: process variables - how to acces
pebbels Jan 21, 2008 3:30 AM (in response to pebbels)Yes, I did...
I found the following not meaningful article:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=127575
So what meansyou have to store the variables in the process instance somehow
When not knowing how to do something somehow is not helpful.
Thx Tina -
5. Re: process variables - how to acces
mwohlf Jan 21, 2008 6:29 AM (in response to pebbels)Hey,
are you complaining about my post? ;-)
with 'somehow' I ment to use any of the following methods:ExecutionContext.setVariable(name, value) TaskInstance.setVariableLocally(name, value) // inherited from VariableContainer ContextInstance.createVariable(key, object, ooken);
as far as i understand setVariableLocally() creates a variable only visible
in the task instance, but i am still new to jBPM and try to figure out things...
Regards -
6. Re: process variables - how to acces
pebbels Jan 21, 2008 7:11 AM (in response to pebbels)I am not complaining because your help is friendly. But as I said to say somehow is not helpful when user reading this article want to know how it works.
ExecutionContext.setVariable(name, value) TaskInstance.setVariableLocally(name, value) // inherited from VariableContainer ContextInstance.createVariable(key, object, ooken);
is only usable in a java-file, e. g. an ActionHandler - right?
I am looking for the way to make the value accessable for the java-file because there is a xhtml-form belonging to my processdefinition which gets input from a user and this input I need accessable in the java-file.
Do you know how this works?
Cheers Tina -
7. Re: process variables - how to acces
kukeltje Jan 21, 2008 7:41 AM (in response to pebbels)Tina,
If you want to know in detail how it works, look at the sourcecode of jbpm. Look at the testcases etc...etc...etc.. so much to learn from those.
The example in the link you post could be augmented with using the EL parser in the actionhandler on the value of the 'text' variable and not use the value directly. But there are some other posts on how to statically (designtime) set a variable from a processdefinition. Using actionhandlers currently is the way to go.