@Override public Pair<ICommand, Object> consolidateCommand(List<ICommand> commands, ICommand newCommand, Workspace workspace) { if (newCommand instanceof UnassignSemanticTypeCommand) { String model = newCommand.getModel(); Iterator<ICommand> itr = commands.iterator(); while(itr.hasNext()) { ICommand tmp = itr.next(); if (tmp.getModel().equals(model) && ((Command)tmp).getOutputColumns().equals(((Command)newCommand).getOutputColumns()) && (tmp instanceof SetSemanticTypeCommand || tmp instanceof SetMetaPropertyCommand)) { return new ImmutablePair<>(tmp, (Object)newCommand); } } } return null; }
@Override public Pair<ICommand, Object> consolidateCommand(List<ICommand> commands, ICommand newCommand, Workspace workspace) { if (newCommand instanceof OrganizeColumnsCommand) { String model = newCommand.getModel(); Iterator<ICommand> itr = commands.iterator(); while(itr.hasNext()) { ICommand tmp = itr.next(); if (tmp.getModel().equals(model) && ((Command)tmp).getOutputColumns().equals(((Command)newCommand).getOutputColumns()) && (tmp instanceof OrganizeColumnsCommand)) { return new ImmutablePair<>(tmp, (Object)newCommand); } } } return null; } }
@Override public Pair<ICommand, Object> consolidateCommand(List<ICommand> commands, ICommand newCommand, Workspace workspace) { if (newCommand instanceof SetSemanticTypeCommand || newCommand instanceof SetMetaPropertyCommand) { String model = newCommand.getModel(); Iterator<ICommand> itr = commands.iterator(); while(itr.hasNext()) { ICommand tmp = itr.next(); if (tmp.getModel().equals(model) && ((Command)tmp).getOutputColumns().equals(((Command)newCommand).getOutputColumns()) && (tmp instanceof SetSemanticTypeCommand)) { return new ImmutablePair<>(tmp, (Object)newCommand); } } } return null; } }
@Override public Pair<ICommand, Object> consolidateCommand(List<ICommand> commands, ICommand newCommand, Workspace workspace) { if (newCommand instanceof AddLiteralNodeCommand) { String nodeId = ((AddLiteralNodeCommand)newCommand).getNodeId(); if(nodeId != null) { String model = newCommand.getModel(); Iterator<ICommand> itr = commands.iterator(); while(itr.hasNext()) { ICommand tmp = itr.next(); if (tmp.getModel().equals(model) && ((Command)tmp).getOutputColumns().equals(((Command)newCommand).getOutputColumns()) && (tmp instanceof AddLiteralNodeCommand)) { String tmpNodeId = ((AddLiteralNodeCommand)tmp).getNodeId(); if(tmpNodeId != null && tmpNodeId.equals(nodeId)) return new ImmutablePair<>(tmp, (Object)newCommand); } } } } return null; }
@Override public Pair<ICommand, Object> consolidateCommand(List<ICommand> commands, ICommand newCommand, Workspace workspace) { if (newCommand instanceof DeleteNodeCommand) { String model = newCommand.getModel(); String nodeId = ((DeleteNodeCommand)newCommand).getNodeId(); if(nodeId != null) { Iterator<ICommand> itr = commands.iterator(); while(itr.hasNext()) { ICommand tmp = itr.next(); if (tmp.getModel().equals(model) && ((Command)tmp).getOutputColumns().equals(((Command)newCommand).getOutputColumns()) && (tmp instanceof AddLiteralNodeCommand || tmp instanceof AddNodeCommand)) { String tmpNodeId; if(tmp instanceof AddLiteralNodeCommand) { tmpNodeId = ((AddLiteralNodeCommand)tmp).getNodeId(); } else { tmpNodeId = ((AddNodeCommand)tmp).getNodeId(); } if(tmpNodeId != null && tmpNodeId.equals(nodeId)) return new ImmutablePair<>(tmp, (Object)newCommand); } } } } return null; }
@Override public Pair<ICommand, Object> consolidateCommand(List<ICommand> commands, ICommand newCommand, Workspace workspace) { if (newCommand instanceof SubmitPythonTransformationCommand) { String model = newCommand.getModel(); Iterator<ICommand> itr = commands.iterator(); while(itr.hasNext()) { ICommand tmp = itr.next(); if (((Command)tmp).getOutputColumns().equals(((Command)newCommand).getOutputColumns()) && tmp.getModel().equals(model) && (tmp instanceof AddColumnCommand)) { SubmitPythonTransformationCommand py = ((SubmitPythonTransformationCommand)newCommand); JSONArray inputJSON = new JSONArray(py.getInputParameterJson()); JSONArray tmpInputJSON = new JSONArray(tmp.getInputParameterJson()); String hNodeId = HistoryJsonUtil.getStringValue("hNodeId", tmpInputJSON); HistoryJsonUtil.setArgumentValue("hNodeId", hNodeId, inputJSON); py.setInputParameterJson(inputJSON.toString()); return new ImmutablePair<>(tmp, (Object)py); } } } return null; }
@Override public Pair<ICommand, Object> consolidateCommand(List<ICommand> commands, ICommand newCommand, Workspace workspace) { if (newCommand instanceof SubmitEditPythonTransformationCommand) { Iterator<ICommand> itr = commands.iterator(); String model = newCommand.getModel(); while(itr.hasNext()) { ICommand tmp = itr.next(); if (((Command)tmp).getOutputColumns().equals(((Command)newCommand).getOutputColumns()) && tmp instanceof SubmitPythonTransformationCommand && !(tmp instanceof SubmitEditPythonTransformationCommand) && model.equals(tmp.getModel())) { SubmitPythonTransformationCommand py = (SubmitPythonTransformationCommand)tmp; SubmitPythonTransformationCommand edit = (SubmitPythonTransformationCommand)newCommand; JSONArray inputJSON = new JSONArray(py.getInputParameterJson()); JSONArray oldInputJSON = new JSONArray(py.getInputParameterJson()); HistoryJsonUtil.setArgumentValue("transformationCode", edit.getTransformationCode(), inputJSON); py.setInputParameterJson(inputJSON.toString()); py.setTransformationCode(edit.getTransformationCode()); return new ImmutablePair<>(tmp, (Object)oldInputJSON); } } } return null; }
ICommand newCommand, Workspace workspace) { if (newCommand instanceof AddLinkCommand) { String model = newCommand.getModel(); JSONArray inputParams = new JSONArray(newCommand.getInputParameterJson()); JSONObject newEdge = HistoryJsonUtil.getJSONObjectWithName( while(itr.hasNext()) { ICommand tmp = itr.next(); if (tmp.getModel().equals(model) && (tmp instanceof AddLinkCommand)) { JSONArray tmpParams = new JSONArray(tmp.getInputParameterJson());
ICommand newCommand, Workspace workspace) { if (newCommand instanceof DeleteLinkCommand) { String model = newCommand.getModel(); JSONArray inputParams = new JSONArray(newCommand.getInputParameterJson()); JSONObject newEdge = HistoryJsonUtil.getJSONObjectWithName( while(itr.hasNext()) { ICommand tmp = itr.next(); if (tmp.getModel().equals(model) && (tmp instanceof AddLinkCommand)) { JSONArray tmpParams = new JSONArray(tmp.getInputParameterJson());
public JSONObject getCommandJSON(Workspace workspace, ICommand comm) { JSONObject commObj = new JSONObject(); commObj.put(HistoryArguments.commandName.name(), comm.getCommandName()); commObj.put(HistoryArguments.model.name(), comm.getModel());