Skip to content

Commit 4a13b6b

Browse files
committed
fix parameter type bug
1 parent cf763c6 commit 4a13b6b

2 files changed

Lines changed: 20 additions & 10 deletions

File tree

server/src/main/java/org/diskproject/server/repository/DiskRepository.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ private void initializeDataAdapters() {
313313
System.out.println("Error: Data adapter type not found: '" + curType + "'");
314314
break;
315315
}
316-
if (curType != null) {
316+
if (curType != null && curAdapter != null) {
317317
if (curNamespace != null && curPrefix != null) {
318318
curAdapter.setPrefix(curPrefix, curNamespace);
319319
}
@@ -1706,9 +1706,10 @@ public Boolean runAllHypotheses(String username) throws Exception {
17061706
* Narratives
17071707
*/
17081708

1709-
public Map<String, String> getNarratives(String username, String tloid) {
1709+
public Map<String, String> getNarratives(String username, String tloiId) {
1710+
// DEPRECATED!
17101711
Map<String, String> narratives = new HashMap<String, String>();
1711-
TriggeredLOI tloi = this.getTriggeredLOI(username, tloid);
1712+
TriggeredLOI tloi = this.getTriggeredLOI(username, tloiId);
17121713
if (tloi != null) {
17131714
String hypId = tloi.getParentHypothesisId();
17141715
String loiId = tloi.getParentLoiId();
@@ -1723,14 +1724,15 @@ public Map<String, String> getNarratives(String username, String tloid) {
17231724
// Assuming each tloi only has a workflow or metaworkdflow:
17241725
WorkflowBindings wf = null;
17251726
List<WorkflowBindings> wfs = tloi.getWorkflows();
1726-
List<WorkflowBindings> mwfs = tloi.getMetaWorkflows();
1727+
List<WorkflowBindings> metaWfs = tloi.getMetaWorkflows();
17271728

1728-
if (mwfs != null && mwfs.size() > 0) {
1729-
wf = mwfs.get(0);
1729+
if (metaWfs != null && metaWfs.size() > 0) {
1730+
wf = metaWfs.get(0);
17301731
} else if (wfs != null && wfs.size() > 0) {
17311732
wf = wfs.get(0);
17321733
} else {
1733-
System.out.println("TLOID: " + tloid + " has does not have any workflow.");
1734+
System.out.println("TLO ID: " + tloiId + " has does not have any workflow.");
1735+
return null;
17341736
}
17351737

17361738
// List of data used.

server/src/main/java/org/diskproject/server/repository/WingsAdapter.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,8 @@ public String runWorkflow(String wflowname, List<VariableBinding> vbindings, Map
654654
formdata.add(new BasicNameValuePair("seed_json", jsonSeed));
655655
formdata.add(new BasicNameValuePair("seed_constraints_json", jsonSeedConstraints));
656656
String pageid = "users/" + getUsername() + "/" + domain + "/executions/runWorkflow";
657+
System.out.println(pageid);
658+
System.out.println(formdata);
657659
return post(pageid, formdata);
658660
//} catch (Exception e) {
659661
// e.printStackTrace();
@@ -835,7 +837,6 @@ public String addRemoteDataToWings(String url, String name, String dType) throws
835837
try {
836838
HttpGet securedResource = new HttpGet(url);
837839
CloseableHttpResponse httpResponse = client.execute(securedResource);
838-
839840
try {
840841
HttpEntity responseEntity = httpResponse.getEntity();
841842
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -856,6 +857,9 @@ public String addRemoteDataToWings(String url, String name, String dType) throws
856857
} catch (IOException e) {
857858
}
858859
}
860+
if (bytes == null) {
861+
return null;
862+
}
859863

860864
System.out.println("Content downloaded [" + bytes.length + "] ");
861865
String dataid = addDataToWingsAsFile(name, bytes, dType);
@@ -1104,8 +1108,12 @@ private String toPlanAcceptableFormat(String wfname, List<VariableBinding> vbl,
11041108
// Set Parameter Types
11051109
String paramTypes = "";
11061110
for (String key : ivm.keySet()) {
1107-
if (ivm.get(key).isParam())
1108-
paramTypes += "\"" + wfname + key + "\":\"" + ivm.get(key).getType() + "\",";
1111+
Variable var = ivm.get(key);
1112+
if (var.isParam()) {
1113+
List<String> types = var.getType();
1114+
String type = types != null && types.size() > 0 ? types.get(0) : KBConstants.XSD_NS + "string";
1115+
paramTypes += "\"" + wfname + key + "\":\"" + type + "\",";
1116+
}
11091117
}
11101118
if (paramTypes.length() > 0)
11111119
paramTypes = paramTypes.substring(0, paramTypes.length() - 1);

0 commit comments

Comments
 (0)