implementing workflow run creation functionality
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/commit/e6642608 Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/tree/e6642608 Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/diff/e6642608 Branch: refs/heads/master Commit: e664260809804e9365ff7330727873a5c006ee2c Parents: 1d88f27 Author: larrytech7 <larrya...@gmail.com> Authored: Fri Jul 3 17:32:29 2015 +0100 Committer: larrytech7 <larrya...@gmail.com> Committed: Fri Jul 3 17:32:29 2015 +0100 ---------------------------------------------------------------------- .../taverna/mobile/adapters/WorkflowAdapter.java | 2 +- .../workflowdetails/WorkflowdetailFragment.java | 17 +++++++---------- .../mobile/utils/xmlparsers/WorkflowParser.java | 1 - 3 files changed, 8 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/e6642608/app/src/main/java/org/apache/taverna/mobile/adapters/WorkflowAdapter.java ---------------------------------------------------------------------- diff --git a/app/src/main/java/org/apache/taverna/mobile/adapters/WorkflowAdapter.java b/app/src/main/java/org/apache/taverna/mobile/adapters/WorkflowAdapter.java index d938230..2b40cc9 100644 --- a/app/src/main/java/org/apache/taverna/mobile/adapters/WorkflowAdapter.java +++ b/app/src/main/java/org/apache/taverna/mobile/adapters/WorkflowAdapter.java @@ -121,7 +121,7 @@ public class WorkflowAdapter extends RecyclerView.Adapter<WorkflowAdapter.ViewHo //save current workflow as favorite mfav.add(wid); mfav.add(author);mfav.add(title);mfav.add(desc_full); mfav.add(SimpleDateFormat.getDateTimeInstance().format(new Date()).toString()); mfav.add(uri); -// if(description.length() > 80) description = description.substring(0, 79); + if(description.length() > 80) description = description.substring(0, 79); viewHolder.author_name.setText(author); viewHolder.wk_title.setText(title); viewHolder.wk_description.setText( description+" ... "); http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/e6642608/app/src/main/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowdetailFragment.java ---------------------------------------------------------------------- diff --git a/app/src/main/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowdetailFragment.java b/app/src/main/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowdetailFragment.java index caa3bac..a1b42ab 100644 --- a/app/src/main/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowdetailFragment.java +++ b/app/src/main/java/org/apache/taverna/mobile/fragments/workflowdetails/WorkflowdetailFragment.java @@ -507,7 +507,6 @@ public class WorkflowdetailFragment extends Fragment implements View.OnClickList wconn.setRequestMethod("GET"); wconn.setDoOutput(true); wconn.setRequestProperty("Accept", "application/xml"); - //wconn.setConnectTimeout(60000); wconn.connect(); String user = "icep...@gmail.com" + ":" + "creationfox"; @@ -516,29 +515,26 @@ public class WorkflowdetailFragment extends Fragment implements View.OnClickList BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(wconn.getInputStream())); String str = ""; while ((str = bufferedReader.readLine()) != null) - sb.append(str); //in this string builder we have read the .t2flow or xml workflow from remote resource. Now we need to post that to the player. + sb.append(str); //in this string builder we have read the workflow( as .t2flow or .xml) workflow from remote resource. Now we need to post that to the player. bufferedReader.close(); + wconn.disconnect(); String data = "{\"document\":\"data:application/octet-stream;base64,"+Base64.encodeToString(sb.toString().getBytes(), Base64.DEFAULT)+"\"}"; -// String data = "{document:data:application/octet-stream;base64,"+Base64.encodeToString(sb.toString().getBytes(), Base64.DEFAULT)+"}"; - // datajson.put("document", "data:application/octet-stream;base64,"+Base64.encodeToString(sb.toString().getBytes(), Base64.DEFAULT)+""); String post = "{\"workflow\":"+data+"}"; - // postJson.put("workflow",datajson.toString()); //clear sb so that we can use it again to fetch results from this post request sb.delete(0,sb.length()-1); System.out.println("BODY=>"+post); -// System.out.println(postJson.toString(2)); connection.setRequestProperty("Authorization", basicAuth); - connection.setRequestProperty("Accept", "application/json"); + connection.setRequestProperty("Accept", "*/*"); connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestMethod("POST"); connection.connect(); //send request - DataOutputStream dos = new DataOutputStream(connection.getOutputStream()); + /* DataOutputStream dos = new DataOutputStream(connection.getOutputStream()); dos.writeBytes(post);//write post data which is a formatted json data representing body of workflow - //dos.writeUTF(""); + dos.flush(); - dos.close(); + dos.close();*/ /* InputStream dis = connection.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(dis)); @@ -546,6 +542,7 @@ public class WorkflowdetailFragment extends Fragment implements View.OnClickList sb.append(str);*/ System.out.println("Post Response Code: "+connection.getResponseCode()); System.out.println("Post response message: "+connection.getResponseMessage()); + connection.disconnect(); }catch (IOException e){ e.printStackTrace(); sb.append("Error reading remote workflow. Please try again later"); http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/e6642608/app/src/main/java/org/apache/taverna/mobile/utils/xmlparsers/WorkflowParser.java ---------------------------------------------------------------------- diff --git a/app/src/main/java/org/apache/taverna/mobile/utils/xmlparsers/WorkflowParser.java b/app/src/main/java/org/apache/taverna/mobile/utils/xmlparsers/WorkflowParser.java index a50bc41..f92837c 100644 --- a/app/src/main/java/org/apache/taverna/mobile/utils/xmlparsers/WorkflowParser.java +++ b/app/src/main/java/org/apache/taverna/mobile/utils/xmlparsers/WorkflowParser.java @@ -6,7 +6,6 @@ import com.thebuzzmedia.sjxp.rule.IRule; import org.apache.taverna.mobile.fragments.WorkflowItemFragment; import org.apache.taverna.mobile.tavernamobile.Workflow; -import org.apache.taverna.mobile.utils.WorkflowDataCallback; import java.util.List;