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.

import org.bonitasoft.engine.api.APIAccessor;
import org.bonitasoft.engine.bpm.flownode.ActivityStates;
import org.bonitasoft.engine.api.IdentityAPI;
import org.bonitasoft.engine.bpm.process.ProcessInstance;

import java.text.DateFormat;
import java.util.Date;
import java.text.SimpleDateFormat;

def tasks = ProcessInstance.getTasks()
//def tasks = queryRuntimeAPI.getLightTaskInstancesFromRoot(processInstanceId);
def List list = []
DateFormat format = new SimpleDateFormat("yyyy-MM-dd-kk:mm");
//Arrays array = new Arrays();
for( task in tasks ) {

        List line = []
        Date date = task.getReadyDate();
        line.add(format.format(date));
        line.add( task.getActivityLabel().toString());
        line.add( task.getState().toString() )
        if(task.getState().equals(ActivityStates.READY)){
                String candidates = task.getTaskCandidates().toString();
                //String candidates = task.getTaskUser();
                line.add(candidates.substring(1,candidates.length()-1 ));
        }
        else if(task.getState().equals(ActivityStates.FINISHED)){
                line.add(task.getEndedBy());
        }
        else {
                line.add("");
        }
       
        list.add( line )
}
//def activities = queryRuntimeAPI.getLightActivityInstancesFromRoot(processInstance.getUUID());
def activities = ProcessInstance.getActivities()
for (activity in activities){
        if(activity.getActivityName().equals("End")){
                List line = []
               
                Date date = activity.getReadyDate();
                line.add(format.format(date))
                line.add( "END" )
                line.add( "COMPLETE" )
                line.add("");
                list.add( line )
        }
}
def list_tri = list;
def list_sorted = [] ;
String temp ="";
int indice = -1;
while(!list_tri.isEmpty()){
        indice = 0;
        temp = list_tri.get(indice).get(0);
        for(int i=0;i<list_tri.size();i++){
                if(list_tri.get(i).get(0).compareTo(temp)>0){
                        temp = list_tri.get(i).get(0);
                        indice = i;
                }
        }
        list_sorted.add(list_tri.get(indice));
        list_tri.remove(indice);
}
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:

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

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.

Notifications