[jboss-user] [JBoss jBPM] - accessing context variable map outside of session?
simonbaker
do-not-reply at jboss.com
Wed Mar 19 11:54:37 EDT 2008
What is the correct way to get a processinstance context variable map if we only want to use it for "read-only" access to look up variable values outside of a jbpm session?
For example, here is an experimental method to retrieve a handle to a context variable map, but since the method opens and closes a session, is the handle still pointing to a valid map, or should we make a copy of the map to return from the method?
| public static Map getProcessVariableMap(long LprocessId) throws Exception
| {
| Map mapVariables;
|
| if (jbpmConfiguration == null)
| jbpmConfiguration = JbpmConfiguration.getInstance();
|
| JbpmContext jbpmContext = null;
|
| try
| {
| jbpmContext = jbpmConfiguration.createJbpmContext();
|
| ProcessInstance procinst = jbpmContext.getProcessInstance(LprocessId);
|
| mapVariables = procinst.getContextInstance().getVariables();
| }
| finally
| {
| if (jbpmContext != null) jbpmContext.close();
| }
|
| return mapVariables;
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4137816#4137816
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4137816
More information about the jboss-user
mailing list