@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { String worksheetId = CommandInputJSONUtil.getStringValue(Arguments.worksheetId.name(), inputJson); String hNodeId = CommandInputJSONUtil.getStringValue(Arguments.hNodeId.name(), inputJson); String type = CommandInputJSONUtil.getStringValue(Arguments.type.name(), inputJson); String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson); Command cmd = new ClearSelectionCommand(getNewId(workspace), model, worksheetId, selectionName, hNodeId, type); cmd.setInputParameterJson(inputJson.toString()); return cmd; }
@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { String worksheetId = CommandInputJSONUtil.getStringValue(Arguments.worksheetId.name(), inputJson); String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson); String hNodeId = CommandInputJSONUtil.getStringValue(Arguments.hNodeId.name(), inputJson); String operation = CommandInputJSONUtil.getStringValue(Arguments.operation.name(), inputJson); String pythonCode = CommandInputJSONUtil.getStringValue(Arguments.pythonCode.name(), inputJson); boolean onError = Boolean.parseBoolean(CommandInputJSONUtil.getStringValue(Arguments.onError.name(), inputJson)); Command cmd = new OperateSelectionCommand(getNewId(workspace), model, worksheetId, selectionName, hNodeId, operation, pythonCode, onError); cmd.setInputParameterJson(inputJson.toString()); return cmd; }
@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { String worksheetId = CommandInputJSONUtil.getStringValue(Arguments.worksheetId.name(), inputJson); String commandList = CommandInputJSONUtil.getStringValue(Arguments.commandList.name(), inputJson); boolean isDelete = Boolean.parseBoolean(CommandInputJSONUtil.getStringValue(Arguments.isDelete.name(), inputJson)); this.normalizeSelectionId(worksheetId, inputJson, workspace); String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson); Command command = new ExportOrDeleteHistoryCommand(getNewId(workspace), model, worksheetId, selectionName, commandList, isDelete); command.setInputParameterJson(inputJson.toString()); return command; } }
@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { String worksheetId = CommandInputJSONUtil.getStringValue(Arguments.worksheetId.name(), inputJson); String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson); String hNodeId = CommandInputJSONUtil.getStringValue(Arguments.hNodeId.name(), inputJson); Command cmd = new RefreshSelectionCommand(getNewId(workspace), model, worksheetId, selectionName, hNodeId); cmd.setInputParameterJson(inputJson.toString()); return cmd; }
@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { String hNodeId = CommandInputJSONUtil.getStringValue(Arguments.hNodeId.name(), inputJson); String worksheetId = CommandInputJSONUtil.getStringValue(Arguments.worksheetId.name(), inputJson); String hNodeIdList = CommandInputJSONUtil.getStringValue(Arguments.values.name(), inputJson); String implMethod = CommandInputJSONUtil.getStringValue(Arguments.ImplMethod.name(), inputJson); this.normalizeSelectionId(worksheetId, inputJson, workspace); String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson); GlueCommand glueCmd = new GlueCommand(getNewId(workspace), model, worksheetId, hNodeId, selectionName, hNodeIdList, implMethod); glueCmd.setInputParameterJson(inputJson.toString()); return glueCmd; }
@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { String hNodeID = CommandInputJSONUtil.getStringValue(Arguments.hNodeId.name(), inputJson); String worksheetId = CommandInputJSONUtil.getStringValue(Arguments.worksheetId.name(), inputJson); String hTableId = CommandInputJSONUtil.getStringValue(Arguments.hTableId.name(), inputJson); this.normalizeSelectionId(worksheetId, inputJson, workspace); String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson); AddValuesCommand valCmd = new AddValuesCommand(getNewId(workspace), model, worksheetId, hTableId, hNodeID, HNodeType.Transformation, selectionName); valCmd.setInputParameterJson(inputJson.toString()); return valCmd; }
@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { /** Parse the input arguments and create proper data structures to be passed to the command **/ String hNodeId = CommandInputJSONUtil.getStringValue(Arguments.hNodeId.name(), inputJson); String worksheetId = CommandInputJSONUtil.getStringValue(Arguments.worksheetId.name(), inputJson); AddRowCommand rowCmd = new AddRowCommand(getNewId(workspace), model, worksheetId, hNodeId); rowCmd.setInputParameterJson(inputJson.toString()); return rowCmd; }
@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { String worksheetId = CommandInputJSONUtil.getStringValue(Arguments.worksheetId.name(), inputJson); String currentSelectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson); Command cmd = new RefreshSuperSelectionCommand(getNewId(workspace), model, worksheetId, currentSelectionName); cmd.setInputParameterJson(inputJson.toString()); return cmd; }
public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { /** Parse the input arguments and create proper data structues to be passed to the command **/ String hNodeID = CommandInputJSONUtil.getStringValue(Arguments.hNodeID.name(), inputJson); String worksheetId = CommandInputJSONUtil.getStringValue(Arguments.worksheetId.name(), inputJson); JSONArray rows = CommandInputJSONUtil.getJSONArrayValue(Arguments.rows.name(), inputJson); Map<String, String> rowValueMap = new HashMap<>(); for (int i=0; i<rows.length(); i++) { JSONObject rowObj = rows.getJSONObject(i); rowValueMap.put(rowObj.getString(Arguments.rowID.name()), rowObj.getString(Arguments.value.name())); } return new MultipleValueEditColumnCommand(getNewId(workspace), model, worksheetId, hNodeID, rowValueMap); }
@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { /** Parse the input arguments and create proper data structures to be passed to the command **/ String hNodeID = CommandInputJSONUtil.getStringValue(Arguments.hNodeId.name(), inputJson); String worksheetId = CommandInputJSONUtil.getStringValue(Arguments.worksheetId.name(), inputJson); this.normalizeSelectionId(worksheetId, inputJson, workspace); String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson); FoldCommand foldCmd = new FoldCommand(getNewId(workspace), model, worksheetId, "", hNodeID, selectionName); foldCmd.setInputParameterJson(inputJson.toString()); return foldCmd; }
@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { String worksheetId = CommandInputJSONUtil.getStringValue(Arguments.worksheetId.name() , inputJson); this.normalizeSelectionId(worksheetId, inputJson, workspace); String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson); return new PopulateCommand(getNewId(workspace), model, worksheetId, selectionName); }
@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { String worksheetId = CommandInputJSONUtil.getStringValue(Arguments.worksheetId.name(), inputJson); this.normalizeSelectionId(worksheetId, inputJson, workspace); String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson); Command command = new RefreshHistoryCommand(getNewId(workspace), model, worksheetId, selectionName); command.setInputParameterJson(inputJson.toString()); return command; }
@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { String worksheetId = CommandInputJSONUtil.getStringValue( Arguments.worksheetId.name(), inputJson); JSONArray orderedColumns = (JSONArray) JSONUtil.createJson(CommandInputJSONUtil.getStringValue( Arguments.orderedColumns.name(), inputJson)); OrganizeColumnsCommand cmd = new OrganizeColumnsCommand( getNewId(workspace), model, workspace.getId(), worksheetId, orderedColumns); 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 alignmentNodeId = HistoryJsonUtil.getStringValue(Arguments.alignmentNodeId.name(), inputJson); String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson); ExportAvroCommand comm = new ExportAvroCommand( getNewId(workspace), model, alignmentNodeId, worksheetId, selectionName); comm.setInputParameterJson(inputJson.toString()); return comm; }
protected void normalizeSelectionId(String worksheetId, JSONArray inputJson, Workspace workspace) { Worksheet worksheet = workspace.getWorksheet(worksheetId); String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson); if (worksheet == null) return; SuperSelection sel = worksheet.getSuperSelectionManager().getSuperSelection(selectionName); JSONObject obj = CommandInputJSONUtil.getJSONObjectWithName(selectionName, inputJson); if (obj != null) obj.put("value", sel.getName()); else CommandInputJSONUtil.createJsonObject(Arguments.selectionName.name(), sel.getName(), ParameterType.other); } }
@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { String hNodeId = HistoryJsonUtil.getStringValue( Arguments.hNodeId.name(), inputJson); String worksheetId = HistoryJsonUtil.getStringValue( Arguments.worksheetId.name(), inputJson); this.normalizeSelectionId(worksheetId, inputJson, workspace); String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson); GenerateClusterValuesCommand comm = new GenerateClusterValuesCommand( getNewId(workspace), model, hNodeId, worksheetId, selectionName); comm.setInputParameterJson(inputJson.toString()); return comm; }
@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { String hNodeId = HistoryJsonUtil.getStringValue( Arguments.hNodeId.name(), inputJson); String worksheetId = HistoryJsonUtil.getStringValue( Arguments.worksheetId.name(), inputJson); this.normalizeSelectionId(worksheetId, inputJson, workspace); String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson); MergeClusterValuesCommand comm = new MergeClusterValuesCommand( getNewId(workspace), model, hNodeId, worksheetId, selectionName); comm.setInputParameterJson(inputJson.toString()); return comm; }
@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { String hNodeId = HistoryJsonUtil.getStringValue(Arguments.hNodeId.name(), inputJson); String worksheetId = HistoryJsonUtil.getStringValue(Arguments.worksheetId.name(), inputJson); this.normalizeSelectionId(worksheetId, inputJson, workspace); String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson); return new GetLinkSuggestionsCommand(getNewId(workspace), model, worksheetId, hNodeId, selectionName); }
public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { String worksheetId = HistoryJsonUtil.getStringValue(Arguments.worksheetId.name(), inputJson); this.normalizeSelectionId(worksheetId, inputJson, workspace); String hNodeId = HistoryJsonUtil.getStringValue(Arguments.hNodeId.name(), inputJson); String delimiter = HistoryJsonUtil.getStringValue(Arguments.delimiter.name(), inputJson); String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson); SplitByCommaCommand comm = new SplitByCommaCommand(getNewId(workspace), model, worksheetId, hNodeId, delimiter, selectionName); comm.setInputParameterJson(inputJson.toString()); return comm; }
@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { String hNodeId = HistoryJsonUtil.getStringValue(Arguments.hNodeId.name(), inputJson); String worksheetId = HistoryJsonUtil.getStringValue(Arguments.worksheetId.name(), inputJson); this.normalizeSelectionId(worksheetId, inputJson, workspace); String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson); String classUri = null; if(HistoryJsonUtil.valueExits(Arguments.classUri.name(), inputJson)) classUri = HistoryJsonUtil.getStringValue(Arguments.classUri.name(), inputJson); return new GetSemanticSuggestionsCommand(getNewId(workspace), model, worksheetId, hNodeId, classUri, selectionName); }