Step Overview Page

1
0
-1

I have an overview page where i use a table which shows the following : Date ,Activity, Task Status, Actor.
Used the following code which worked in the previous version but used the same in version 7.1 with minor changes and it gives me errors.

  1. import org.bonitasoft.engine.api.APIAccessor;
  2. import org.bonitasoft.engine.bpm.flownode.ActivityStates;
  3. import org.bonitasoft.engine.api.IdentityAPI;
  4. import org.bonitasoft.engine.bpm.process.ProcessInstance;
  5.  
  6. import java.text.DateFormat;
  7. import java.util.Date;
  8. import java.text.SimpleDateFormat;
  9.  
  10. def tasks = ProcessInstance.getTasks()
  11. //def tasks = queryRuntimeAPI.getLightTaskInstancesFromRoot(processInstanceId);
  12. def List list = []
  13. DateFormat format = new SimpleDateFormat("yyyy-MM-dd-kk:mm");
  14. //Arrays array = new Arrays();
  15. for( task in tasks ) {
  16.  
  17. List line = []
  18. Date date = task.getReadyDate();
  19. line.add(format.format(date));
  20. line.add( task.getActivityLabel().toString());
  21. line.add( task.getState().toString() )
  22. if(task.getState().equals(ActivityStates.READY)){
  23. String candidates = task.getTaskCandidates().toString();
  24. //String candidates = task.getTaskUser();
  25. line.add(candidates.substring(1,candidates.length()-1 ));
  26. }
  27. else if(task.getState().equals(ActivityStates.FINISHED)){
  28. line.add(task.getEndedBy());
  29. }
  30. else {
  31. line.add("");
  32. }
  33.  
  34. list.add( line )
  35. }
  36. //def activities = queryRuntimeAPI.getLightActivityInstancesFromRoot(processInstance.getUUID());
  37. def activities = ProcessInstance.getActivities()
  38. for (activity in activities){
  39. if(activity.getActivityName().equals("End")){
  40. List line = []
  41.  
  42. Date date = activity.getReadyDate();
  43. line.add(format.format(date))
  44. line.add( "END" )
  45. line.add( "COMPLETE" )
  46. line.add("");
  47. list.add( line )
  48. }
  49. }
  50. def list_tri = list;
  51. def list_sorted = [] ;
  52. String temp ="";
  53. int indice = -1;
  54. while(!list_tri.isEmpty()){
  55. indice = 0;
  56. temp = list_tri.get(indice).get(0);
  57. for(int i=0;i<list_tri.size();i++){
  58. if(list_tri.get(i).get(0).compareTo(temp)>0){
  59. temp = list_tri.get(i).get(0);
  60. indice = i;
  61. }
  62. }
  63. list_sorted.add(list_tri.get(indice));
  64. list_tri.remove(indice);
  65. }
  66. return list_sorted;

The error is get is ::
groovy.lang.MissingMethodException: No signature of method: static org.bonitasoft.engine.bpm.process.ProcessInstance.getTasks() is applicable for argument types: () values: []
Possible solutions: getClass(), getAt(java.lang.String)

I guess a few apis like activity label have all been deprecated. Is there any way i can use the same code with changes to all the deprecated apis?

Any help would be appreciated.
Regards,
A.

Comments

Submitted by Sean McP on Fri, 03/10/2017 - 00:18

A Tip on displaying CODE/LOGS correctly in Posts:

Do not use the Supplied Buttons above, for some reason they refuse to work correctly, and despite bringing it to Bonitasofts attention, it's low priority.

To Show Code/Logs correctly use

< code >
your code/log
< /code >

removing the spaces to allow the showing of code/logs correctly as here:

  1. your code/log

You should still be able to edit your post to ensure the correct formatting of the code to help us understand it easier.

Thanks and regards
Seán

Submitted by anandages841 on Fri, 03/10/2017 - 08:03

Edited my post as mentioned.
Thanks.

1 answer

1
0
-1

Yo man, that's like 5.6 stuff...ancient, dinosaur like, :) a couple of years on Bonitasoft and it seems like 5 was so long ago.

You're actually failing on

  1. def tasks = ProcessInstance.getTasks()

you'll really have to update some of this to get it working...

It looks like you're going from 5.x straight to 7. That will not be easy, the recommended way is to go through 6 which will tell you all the problems/issues which you can then fix and then go to 7.

See here: http://documentation.bonitasoft.com/?page=_migration

and more importantly here for 5 to go to 6/7.
http://documentation.bonitasoft.com/?page=migrate-a-process-from-bonita-...

Yes API's have changed and some of them quite a bit...

regards
Seán

PS: While you may not like the answer, it gives the correct answer, please mark as resolved.

Testing
Notifications