howa to get varibales of completed instances using activiti-rest and j2ee

cancel
Showing results for 
Search instead for 
Did you mean: 
mobarkiyasmine
Active Member

howa to get varibales of completed instances using activiti-rest and j2ee

Hello i work with j2ee and activiti-rest i create this function to get the list of variables of a process intsance, the function returns all information to me but I want to have that the list of variables I do not need any other information how I can access the variable information that is between hook ,i want to have informations in  bold

 

this is the code :

public List<HistoricVariableInstance> ListVariableOfCompletedInstance() throws JSONException, IOException {
JSONArray VariablesArray = ProcessController.getService("/history/historic-variable-instances?processInstanceId="+idInstance);


try {
Gson gson = new Gson();

List<HistoricVariableInstance> listVariableOfinsatance = gson.fromJson(VariablesArray.toString(), List.class);
System.out.println(listVariableOfinsatance.size());

System.out.println("la liste des variables:" +listVariableOfinsatance);
return listVariableOfinsatance;


} catch (Exception e) {
}
return null;
}

 

 

 

 

 

the response :

{
"data": [
{
"id": "40406",
"processInstanceId": "40398",
"processInstanceUrl": "http://10.6.99.57:8888/activiti-rest/service/history/historic-process-instances/40398",
"taskId": null,
"variable": {
"name": "nbj",
"type": "string",
"value": "3",
"scope": null
}
},
{
"id": "40408",
"processInstanceId": "40398",
"processInstanceUrl": "http://10.6.99.57:8888/activiti-rest/service/history/historic-process-instances/40398",
"taskId": null,
"variable": {
"name": "nom",
"type": "string",
"value": "yasmine",
"scope": null
}
},
{
"id": "40404",
"processInstanceId": "40398",
"processInstanceUrl": "http://10.6.99.57:8888/activiti-rest/service/history/historic-process-instances/40398",
"taskId": null,
"variable": {
"name": "reponse",
"type": "string",
"value": "1",
"scope": null
}
}
],

6 Replies
savo
Active Member II

Re: howa to get varibales of completed instances using activiti-rest and j2ee

Variables of completed process instances get deleted automatically. I think.

mobarkiyasmine
Active Member

Re: howa  to get varibales of  completed instances using activiti-rest and j2ee

no they are saved in the history table,
savo
Active Member II

Re: howa  to get varibales of  completed instances using activiti-rest and j2ee

Using the api to get the variables of processes, you are able to do so only for unfinished ones. If a process is finished it would say something like "process not found". 

That's why I think they get deleted. But I could be wrong.

mobarkiyasmine
Active Member

Re: howa  to get varibales of  completed instances using activiti-rest and j2ee

I used this uri and he gave me what I was looking for

/history/historic-variable-instances?processInstanceId="+idInstance

mobarkiyasmine
Active Member

Re: howa  to get varibales of  completed instances using activiti-rest and j2ee

I used this uri and he gave me what I was looking for

history/historic-variable-instances?processInstanceId="+idInstance

savo
Active Member II

Re: howa to get varibales of completed instances using activiti-rest and j2ee

Now I know.