[
http://jira.jboss.com/jira/browse/JBPM-1335?page=comments#action_12419933 ]
Thomas Diesler commented on JBPM-1335:
--------------------------------------
Done for jBPM3. Please add support for this in jBPM4
Running org.jboss.bpm.samples.context.ExecutionContextTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.818 sec
Execution Context Variables
----------------------------
Key: JBPM-1335
URL:
http://jira.jboss.com/jira/browse/JBPM-1335
Project: JBoss jBPM
Issue Type: Task
Security Level: Public(Everyone can see)
Components: API
Reporter: Thomas Diesler
Assigned To: Thomas Diesler
Fix For: API 1.0.0.Alpha
Support execution context variables like this
public class ContextActivity implements Activity
{
public void execute(Node node, Context ctx)
{
String name = node.getName();
ctx.addAttachment(String.class, "ActivityMessage", "Activity on
'" + name + "' has: " + ctx.getAttachments());
ctx.addAttachment(ContextValue.class, "ActivityAttachment", new
ContextValue("bar"));
}
}
public void testTransientValues() throws Exception
{
// Create an Execution through the ProcessDefinition
ProcessDefinitionManager pdm =
ProcessDefinitionManager.locateProcessDefinitionManager();
ProcessDefinition pd = pdm.createProcessDefinition(jpdl);
Execution ex = pd.createExecution();
// Set a context variable
ex.getContext().addAttachment(ContextValue.class, new
ContextValue("foo"));
// Signal the execution
ex.signal();
// Verify context variables
String msg = ex.getContext().getAttachment(String.class,
"ActivityMessage");
assertEquals("Activity on 'stateA' has:
[[org.jboss.bpm.samples.context.ContextValue,null]]", msg);
// Validate original attachement
ContextValue att1 = ex.getContext().getAttachment(ContextValue.class);
assertEquals("foo", att1.getMsg());
// Validate activity attachement
ContextValue att2 = ex.getContext().getAttachment(ContextValue.class,
"ActivityAttachment");
assertEquals("bar", att2.getMsg());
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira