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.