cancel
Showing results for 
Search instead for 
Did you mean: 

Start Process by older process version number

sarkar92
Champ in-the-making
Champ in-the-making
in activiti if i deploy two process with same "Process" Id it will increment its version number +1.

I am using Rest API to start my process and manage all process.
I want to know is there a way to start a process by its any of older version in activiti.

e.g.

i have same process with two different version

"MyProcess" version - 1
"MyProcess" version - 2

if i try to start process with process id activiti automatically start the version 2.
But how can i start the process of version 1.


thanks
4 REPLIES 4

martin_grofcik
Confirmed Champ
Confirmed Champ
Is ProcessDefinitionId right param?

http://www.activiti.org/userguide/#N15F1D

sarkar92
Champ in-the-making
Champ in-the-making
yes the processDefinitionId is right…
But the process definition Id always return the latest version 2 id…

How can I change it to version 1???


thanks 

jbarrez
Star Contributor
Star Contributor
Could you post the java code you use to start the process instance?

sarkar92
Champ in-the-making
Champ in-the-making
here it is

<java>
public static ClientResource getClientResource(String uri,String userName,String password) throws Exception {
  System.out.println("in getClientResource password:"+password);
     ClientResource clientResource = new ClientResource(uri);
     ServiceUtil serviceUtil=new ServiceUtil();
     password=serviceUtil.decrypt(password);
     clientResource.setChallengeResponse(ChallengeScheme.HTTP_BASIC,userName, password);
     return clientResource;
}

public static String getRequestProcessId(String processKey,String userName,String password) throws ResourceException, Exception {
       String uri = REST_URI + "/process-definitions?size=100";
       System.out.println("key  "+processKey);
       Representation response = getClientResource(uri,userName,password).get(MediaType.APPLICATION_JSON);
       JSONObject object = new JSONObject(response.getText());
       if (object != null) {
         JSONArray arr = (JSONArray) object.get("data");
         for (int i = 0; i < arr.length(); i++) {
           JSONObject jsonObject = (JSONObject) arr.get(i);
           if (jsonObject.get("key").equals(processKey)) {
             logger.info("Returning processDefinitionId " + jsonObject.get("id"));
             return (String) jsonObject.get("id");
           }
         }
       }
    return null;
  }

public static String startRequestedProcess(HashMap<String,Object> param,String userName,String password)
      throws Exception {
      String uri = REST_URI + "/process-instance";
      JSONObject object=new JSONObject();
      Set s=param.keySet();
      Iterator<String> itr= s.iterator();
       while(itr.hasNext())
       {  String key=itr.next();
        object.put(key, param.get(key));
        System.out.println(key +" "+param.get(key));
       }
   
      Representation rep = new JsonRepresentation(object);
      rep.setMediaType(MediaType.APPLICATION_JSON);
      JSONObject jsObj = new JSONObject(getClientResource(uri,userName,password).post(rep).getText());
      logger.info("Returning processId " + jsObj.getString("id"));
      return jsObj.getString("id");
}


</java>