public Set<String> generateInputColumns() { Map<Command, List<Command> > dag = generateGraph(); Set<String> inputColumns = new HashSet<>(); for (Command t : commands) { if (t.getCommandName().equals("SetSemanticTypeCommand") || t.getCommandName().equals("SetMetaPropertyCommand")) { inputColumns.addAll(getParents(t, dag)); } } return inputColumns; }
protected void logCommand(Logger logger, Workspace workspace) { try { logger.info("Executing command:" + getCommandName() + "\n" + getInputParameterJson()); } catch (JSONException e) { e.printStackTrace(); } }
public class MainMIDlet extends MIDlet implements ActionListener { Form form = new form(); ... ... public void actionPerformed(ActionEvent ae) { Command cmd = ae.getCommand(); String cmdname= cmd.getCommandName(); if (cmdname.equals("Aboutus")) { Aboutus aboutus = new Aboutus(form); // pass the current form aboutus.show(); } } }
public class Main { private static Map<String, Command> commands = new HashMap<String, Command>(); private static void init() { Command addCommand = new AddCommand(); commands.put(addCommand.getCommandName(), addCommand); } public static void main (String[] args) { init(); if (args[0] != null) { Command command = commands.get(args[0]); if (command != null) { System.out.println(command.doAction()); } else { System.out.println("Command not found"); } } }
public static void detectSelectionStatusChange(String worksheetId, Workspace workspace, Command command) { Worksheet worksheet = workspace.getWorksheet(worksheetId); for (Selection sel : worksheet.getSelectionManager().getAllDefinedSelection()) { Set<String> inputColumns = sel.getInputColumns(); inputColumns.retainAll(command.getOutputColumns()); if (!inputColumns.isEmpty() && !command.getCommandName().equals("OperateSelectionCommand") && !command.getCommandName().equals("ClearSelectionCommand")) sel.invalidateSelection(); if (sel.isSelectedRowsMethod() && checkSelection(sel, command, workspace.getFactory())) { sel.invalidateSelection(); } } }
logger.error("Error with this command: {}, Input params: {}", command.getCommandName(), command.getInputParameterJson());