07-08-2013 09:37 AM
public static ClientResource getClientResource(String uri,String userName,String password) {
System.out.println("in getClientResource password:"+password);
ClientResource clientResource = new ClientResource(uri);
clientResource.setChallengeResponse(ChallengeScheme.HTTP_BASIC,userName, password);
return clientResource;
}
public static String startRequestedProcess(HashMap<String,Object> param,String userName,String password)
throws Exception {
String uri = "http://localhost:9090/activiti-rest/service/runtime/process-instances";
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");
}
public static void main(String args[]) throws Exception{
try{
HashMap<String, Object> param = new HashMap<>();
param.put("processDefinitionKey", "testRestProcess");
startRequestedProcess(param,"caadmin","P@ssw0rd");
}catch(ResourceException e){
System.out.println("===== > "+e.getMessage());
System.out.println("===== >"+e.getStatus());
}
07-09-2013 03:29 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.