]
Thomas Diesler resolved JBPM-1335.
----------------------------------
Resolution: Done
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: