From 38eaf4f41901013ea02af8f3bc38cb47f6ec7609 Mon Sep 17 00:00:00 2001 From: Dipsy Kapoor Date: Thu, 18 Sep 2014 12:44:28 -0700 Subject: [PATCH] Patch for Glue Command --- .../isi/karma/controller/history/CommandHistory.java | 11 +++++++---- .../history/WorksheetCommandHistoryExecutor.java | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/karma-common/src/main/java/edu/isi/karma/controller/history/CommandHistory.java b/karma-common/src/main/java/edu/isi/karma/controller/history/CommandHistory.java index 8b61049dc..7f448fd75 100644 --- a/karma-common/src/main/java/edu/isi/karma/controller/history/CommandHistory.java +++ b/karma-common/src/main/java/edu/isi/karma/controller/history/CommandHistory.java @@ -212,10 +212,13 @@ public JSONObject getCommandJSON(Workspace workspace, ICommand comm) { JSONArray hnodes = (JSONArray) JSONUtil.createJson(inpP.getString(ClientJsonKeys.value.name())); for (int j = 0; j < hnodes.length(); j++) { JSONObject obj = (JSONObject)hnodes.get(j); - String hNodeId = obj.getString(ClientJsonKeys.value.name()); - HNode node = workspace.getFactory().getHNode(hNodeId); - JSONArray hNodeRepresentation = node.getJSONArrayRepresentation(workspace.getFactory()); - obj.put(ClientJsonKeys.value.name(), hNodeRepresentation); + Object value = obj.get(ClientJsonKeys.value.name()); + if (value instanceof String) { + String hNodeId = (String) value; + HNode node = workspace.getFactory().getHNode(hNodeId); + JSONArray hNodeRepresentation = node.getJSONArrayRepresentation(workspace.getFactory()); + obj.put(ClientJsonKeys.value.name(), hNodeRepresentation); + } } inpP.put(ClientJsonKeys.value.name(), hnodes); } else if(HistoryJsonUtil.getParameterType(inpP) == ParameterType.orderedColumns) { diff --git a/karma-common/src/main/java/edu/isi/karma/controller/history/WorksheetCommandHistoryExecutor.java b/karma-common/src/main/java/edu/isi/karma/controller/history/WorksheetCommandHistoryExecutor.java index c182cd546..0a4597873 100644 --- a/karma-common/src/main/java/edu/isi/karma/controller/history/WorksheetCommandHistoryExecutor.java +++ b/karma-common/src/main/java/edu/isi/karma/controller/history/WorksheetCommandHistoryExecutor.java @@ -151,7 +151,8 @@ public UpdateContainer normalizeCommandHistoryJsonInput(Workspace workspace, Str HTable hTable = workspace.getWorksheet(worksheetId).getHeaders(); for (int i = 0; i < inputArr.length(); i++) { JSONObject inpP = inputArr.getJSONObject(i); - + if (inpP.getString(ClientJsonKeys.name.name()).equals("outputColumns") || inpP.getString(ClientJsonKeys.name.name()).equals("inputColumns")) + continue; /*** Check the input parameter type and accordingly make changes ***/ if(HistoryJsonUtil.getParameterType(inpP) == ParameterType.hNodeId) { JSONArray hNodeJSONRep = new JSONArray(inpP.get(ClientJsonKeys.value.name()).toString());