08-04-2015 04:12 PM
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet getRequest = new HttpGet(
"http://localhost:8081/alfresco/service/api/login?u=admin&pw=admin");
getRequest.addHeader("accept", "application/json");
HttpResponse response = httpClient.execute(getRequest);
if (response.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("Failed : HTTP error code : " + response.getStatusLine().getStatusCode());
}
BufferedReader br = new BufferedReader(new InputStreamReader((response.getEntity().getContent())));
String output,saida="";
while ((output = br.readLine()) != null) {
saida = saida + output;
}
ticket = saida.substring(53, 93);
httpClient.getConnectionManager().shutdown();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
String url,urlScript;
String encodeUrl = null;
idCSV = idCSV.substring(0,36);
String nodeRefId = idCSV;
System.out.println(nodeRefId);
String workflowType = "activiti$customComplement";
String assignTo = "operadorAlfresco";
String workflowDueDateDay = "10";
String workflowDueDateMonth = "10";
String workflowDueDateYear = "2015";
String description = "teste";
String workflowPriority = "2";
urlScript = "http://localhost:8081/alfresco/service/workflow/start-workflow?";
url = "alfTicket=TICKET_" + ticket;
url = url + "&workflowType=" + workflowType;
url = url + "&assignTo=" + assignTo;
url = url + "&workflowDueDateDay=" + workflowDueDateDay;
url = url + "&workflowDueDateMonth=" + workflowDueDateMonth;
url = url + "&workflowDueDateYear=" + workflowDueDateYear;
url = url + "&description=" + description;
url = url + "&nodeRefId=" + nodeRefId;
//url = url + "&guest=true";
url = urlScript + url;
System.out.println(url);
HttpGet getRequest = new HttpGet(url);
getRequest.addHeader("accept", "application/json");
HttpResponse response = httpClient.execute(getRequest);
if (response.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("Failed : HTTP error code : " + response.getStatusLine().getStatusCode());
}
BufferedReader br = new BufferedReader(new InputStreamReader((response.getEntity().getContent())));
String output;
System.out.println("Output from Server …. \n");
while ((output = br.readLine()) != null) {
}
httpClient.getConnectionManager().shutdown();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
08-04-2015 06:06 PM
08-05-2015 09:11 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.