@Override public Command createCommand(HttpServletRequest request, Workspace workspace) { String hNodeId = request.getParameter(Arguments.hNodeId.name()); String worksheetId = request.getParameter(Arguments.worksheetId.name()); String delimiter = request.getParameter(Arguments.delimiter.name()); String newColName = request.getParameter(Arguments.newColName.name()); String newHNodeId = request.getParameter(Arguments.newHNodeId.name()); String selectionName = request.getParameter(Arguments.selectionName.name()); return new SplitValuesCommand(getNewId(workspace), Command.NEW_MODEL, worksheetId, hNodeId, delimiter, newColName, newHNodeId, selectionName); }
protected SplitValuesCommand(String id, String model, String worksheetId, String hNodeId, String delimiter, String newColName, String newHNodeId, String selectionId) { super(id, model, worksheetId, selectionId); this.hNodeId = hNodeId; this.delimiter = delimiter; this.newColName = newColName; this.newHNodeId = newHNodeId; addTag(CommandTag.Transformation); }
Worksheet wk = workspace.getWorksheet(worksheetId); UpdateContainer c = new UpdateContainer(); SuperSelection selection = getSuperSelection(wk); c.append(computeAlignmentAndSemanticTypesAndCreateUpdates(workspace));
@Override public UpdateContainer undoIt(Workspace workspace) { Worksheet wk = workspace.getWorksheet(worksheetId); SuperSelection selection = getSuperSelection(wk); if (splitCommaCommand != null) return splitCommaCommand.undoIt(workspace); RepFactory factory = workspace.getFactory(); HNode hNode = factory.getHNode(newHNodeId); HTable hTable = factory.getHTable(hNode.getHTableId()); hTable.removeHNode(newHNodeId, factory.getWorksheet(worksheetId)); hNode.removeNestedTable(); return WorksheetUpdateFactory.createRegenerateWorksheetUpdates(worksheetId, selection, workspace.getContextId()); } }
public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { String worksheetId = HistoryJsonUtil.getStringValue(Arguments.worksheetId.name(), inputJson); String hNodeId = HistoryJsonUtil.getStringValue(Arguments.hNodeId.name(), inputJson); String delimiter = HistoryJsonUtil.getStringValue(Arguments.delimiter.name(), inputJson); String newColName = HistoryJsonUtil.getStringValue(Arguments.newColName.name(), inputJson); String newHNodeId = null; if(HistoryJsonUtil.valueExits(Arguments.newHNodeId.name(), inputJson)) newHNodeId = HistoryJsonUtil.getStringValue(Arguments.newHNodeId.name(), inputJson); String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson); Command comm = new SplitValuesCommand(getNewId(workspace), model, worksheetId, hNodeId, delimiter, newColName, newHNodeId, selectionName); comm.setInputParameterJson(inputJson.toString()); return comm; }