public List<Command> consolidateCommand(List<Command> commands, Workspace workspace) { List<Command> refinedCommands = new ArrayList<Command>(); for (Command command : commands) { if (command instanceof UnassignSemanticTypeCommand) { Iterator<Command> itr = refinedCommands.iterator(); while (itr.hasNext()) { Command tmp = itr.next(); if (tmp.getOutputColumns().equals(command.getOutputColumns()) && (tmp instanceof SetSemanticTypeCommand || tmp instanceof SetMetaPropertyCommand)) { tmp.getOutputColumns().clear(); command.getOutputColumns().clear(); } } } refinedCommands.add(command); } return refinedCommands; }
public static void detectSelectionStatusChange( String worksheetId, Workspace workspace, Command command) { Worksheet worksheet = workspace.getWorksheet(worksheetId); for (Selection sel : worksheet.getSelectionManager().getAllDefinedSelection()) { Set<String> inputColumns = new HashSet<String>(sel.getInputColumns()); inputColumns.retainAll(command.getOutputColumns()); if (inputColumns.size() > 0) sel.invalidateSelection(); } }