public static boolean valueExits(String arg, JSONArray json) throws JSONException { return getJSONObjectWithName(arg, json) != null; }
public static boolean setArgumentValue(String name, Object value, JSONArray inputJson) throws JSONException { JSONObject obj = getJSONObjectWithName(name, inputJson); if(obj != null) { obj.put(ClientJsonKeys.value.name(), value); return true; } return false; }
public static boolean getBooleanValue(String arg, JSONArray json) throws JSONException { return getJSONObjectWithName(arg, json).getBoolean(ClientJsonKeys.value.name()); }
public static String getStringValue(String arg, JSONArray json) throws JSONException { return getJSONObjectWithName(arg, json).get(ClientJsonKeys.value.name()).toString(); }
public static JSONArray getJSONArrayValue(String arg, JSONArray json) throws JSONException { JSONObject obj = getJSONObjectWithName(arg, json); if(obj.has(ClientJsonKeys.value.name())) return obj.getJSONArray(ClientJsonKeys.value.name()); else return new JSONArray(); }
String model = newCommand.getModel(); JSONArray inputParams = new JSONArray(newCommand.getInputParameterJson()); JSONObject newEdge = HistoryJsonUtil.getJSONObjectWithName( Arguments.edge.name(), inputParams).getJSONObject("value"); String edgeSourceId = newEdge.getString(LinkJsonKeys.edgeSourceId.name()); && (tmp instanceof AddLinkCommand)) { JSONArray tmpParams = new JSONArray(tmp.getInputParameterJson()); JSONObject tmpEdge = HistoryJsonUtil.getJSONObjectWithName( Arguments.edge.name(), tmpParams).getJSONObject("value"); String tmpSourceId = tmpEdge.getString(LinkJsonKeys.edgeSourceId.name());
String model = newCommand.getModel(); JSONArray inputParams = new JSONArray(newCommand.getInputParameterJson()); JSONObject newEdge = HistoryJsonUtil.getJSONObjectWithName( Arguments.edge.name(), inputParams).getJSONObject("value"); String edgeSourceId = newEdge.getString(LinkJsonKeys.edgeSourceId.name()); && (tmp instanceof AddLinkCommand)) { JSONArray tmpParams = new JSONArray(tmp.getInputParameterJson()); JSONObject tmpEdge = HistoryJsonUtil.getJSONObjectWithName( Arguments.edge.name(), tmpParams).getJSONObject("value"); String tmpSourceId = tmpEdge.getString(LinkJsonKeys.edgeSourceId.name());
@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { String worksheetId = HistoryJsonUtil.getStringValue( Arguments.worksheetId.name(), inputJson); String alignmentId = AlignmentManager.Instance().constructAlignmentId( workspace.getId(), worksheetId); JSONObject newEdge = HistoryJsonUtil.getJSONObjectWithName( Arguments.edge.name(), inputJson).getJSONObject("value"); AddLinkCommand cmd = new AddLinkCommand( getNewId(workspace), model, worksheetId, alignmentId, newEdge); cmd.setInputParameterJson(inputJson.toString()); return cmd; }
@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { String worksheetId = HistoryJsonUtil.getStringValue( Arguments.worksheetId.name(), inputJson); String alignmentId = AlignmentManager.Instance().constructAlignmentId( workspace.getId(), worksheetId); JSONObject edge = HistoryJsonUtil.getJSONObjectWithName( Arguments.edge.name(), inputJson).getJSONObject("value");; DeleteLinkCommand cmd = new DeleteLinkCommand( getNewId(workspace), model, worksheetId, alignmentId, edge); cmd.setInputParameterJson(inputJson.toString()); return cmd; }
inputArray.put(obj1); JSONObject obj = HistoryJsonUtil.getJSONObjectWithName("inputColumns", inputArr); if (obj == null) { obj = new JSONObject(); outputArray.put(obj1); obj = HistoryJsonUtil.getJSONObjectWithName("outputColumns", inputArr); if (obj == null) { obj = new JSONObject();