-
1. Re: how to programatically list actitities from one activity
rams.rapol Oct 20, 2009 1:43 PM (in response to kadrim)Take a Look at GetOutcomes.java
ExecutionImpl execution = (task != null ? task.getExecution() : null); ActivityImpl activity = (execution != null ? execution.getActivity() : null); List<Transition> outgoingTransitions = (activity != null ? activity.getOutgoingTransitions() : null); if (outgoingTransitions != null) { for (Transition transition : outgoingTransitions) { //transition.getName() is transition name (name on arrow) //transition.getDestination().getName() is final end node where } }
-
2. Re: how to programatically list actitities from one activity
kadrim Oct 20, 2009 4:05 PM (in response to kadrim)Interesting.... Thanks rams.rapo for your time...
But this means I have to use some classes of internal pvm, for instance :
org.jbpm.pvm.internal.cmd.GetOutcomes.java , and GetOutComes needs an instance of Environment in its execute method...
"...
public Set execute(Environment environment) {
..."
I've been looking at the code of org.jbpm.pvm.internal.cmd and it seems simple to use. Besides, I've been reading the developer's guide and this enlightment came to me:
"...
JbpmConfiguration jbpmcfg = new JbpmConfiguration();
ProcessEngine proceng = jbpmcfg.buildProcessEngine();
EnvironmentImpl envimpl = jbpmcfg.openEnvironment();
GetOutcomes goc = new GetOutcomes( )
Set outcome = goc.execute( envimpl );
..."
Is this what you've tried to tell me?
Also, I've got some questions about this:
1) Is the order of statements correct? I mean :
JbpmConfiguration jbpmcfg = new JbpmConfiguration();
ProcessEngine proceng = jbpmcfg.buildProcessEngine();
EnvironmentImpl envimpl = jbpmcfg.openEnvironment();
2) I'm supposing I can do the same with commands that make reads to the database like: GetStartActivityNamesCmd.java, is this right?
3) Will there be any problems in this way because I'm not using the User API directly? With problems I mean: exceptions, runtime exceptions, logic errors made by jbpm. It's obvious that this will change in future.
Any comments would be appreciated. -
3. Re: how to programatically list actitities from one activity
kadrim Oct 20, 2009 4:10 PM (in response to kadrim)The code is wrong when instanciating the GetOutcomes class.
It is supposed that, by using ProcessEngine I'll get the taskid, and then I pass it to GetOutcomes on its constructor like this:
GetOutcomes goc = new GetOutcomes( taskid ) ; -
4. Re: how to programatically list actitities from one activity
rams.rapol Oct 22, 2009 3:57 AM (in response to kadrim)You would need to extend few jbpm classes and override the GetOutcomes behaviour.
At a very high level:
a) Extend WireDescriptorBinding, implement corresponding descriptor by extending ObjectDescriptor, etc
b) Add entry for extended WireDescriptorBinding class in jbpm.wire.bindings.xml.
c) Extend jbpm springconfiguration class, override the buildProcessEngine, getTaskService methods.
getTaskService should return the class which you extend from TaskService.
d) Extend AbstractCommand and pass in custom taskservice class created in above step. Here you override the behaviour...
p.s: search the forum, i remember few threads explaining more in detail on this implementation. -
5. Re: how to programatically list actitities from one activity
kadrim Oct 22, 2009 10:37 AM (in response to kadrim)thanks!!!
-
6. Re: how to programatically list actitities from one activity
kukeltje Oct 22, 2009 5:21 PM (in response to kadrim)Would be a nice subject for a blog entry if you achieve this ;-)