-
1. Re: How to get a list of available transitions for an ActivityExecution
imjorge Jun 25, 2010 12:22 PM (in response to joegottman)1 of 1 people found this helpfulI do not know if that can be achieved with the public API. If there is a way with the public API you SHOULD prefer that solution to the one that I present below.
ActivityExecution execution = ...;
ExecutionImpl executionImpl = (ExecutionImpl) execution;
ActivityImpl activityImpl = executionImpl.getActivity();
Map<String, Transition> transitions = activityImpl.getOutgoingTransitionsMap(); // the leaving transitions, keyed by transition name
-
2. Re: How to get a list of available transitions for an ActivityExecution
joegottman Jun 28, 2010 2:17 PM (in response to imjorge)Unfortunately, this did not work for me. When I tried, this, a JbpmException was thrown by ExceptionImpl.getActivity(). It's message was "no environment to get org.jbpm.pvm.internal.session.RepositorySession".
-
3. Re: How to get a list of available transitions for an ActivityExecution
joegottman Jun 29, 2010 9:50 AM (in response to joegottman)I finally figured it out. Jorge's answer was almost correct, but I had to manually create an Environment variable for ExecutionImpl.getActivity() to succeed. So the final code was
EnvironmentFactory environmentFactory = (EnvironmentFactory)processEngine;
Execution execution = executionService.findExecutionById(executionID);
if (execution instanceof ExecutionImpl) {
ExecutionImpl executionImpl = (ExecutionImpl)execution;
EnvironmentImpl environment = environmentFactory.openEnvironment();
ActivityImpl activityImpl = null;
try {
activityImpl = executionImpl.getActivity();
} finally {
environment.close();
}if (activityImpl != null) {
return activityImpl.getOutgoingTransitionsMap().keySet();}
}return Collections.<String>emptySet();