@Override public Command createCommand(HttpServletRequest request, Workspace workspace) { return new GetR2RMLModelURLsCommand(getNewId(workspace), Command.NEW_MODEL); }
@Override public CommandTag getTagFromPriority() { for (CommandTag tag : commandTagPriority) { if (hasTag(tag)) { return tag; } } return CommandTag.Other; } // /////////////////////////////////////////////////////////////////////////////
@Override public Command createCommand(HttpServletRequest request, Workspace workspace) { String workspaceId = request.getParameter(Arguments.workspaceId.name()); return new CloseWorkspaceCommand(getNewId(workspace), Command.NEW_MODEL, workspaceId); }
protected void generateCommandJSONAttributes(String prefix, PrintWriter pw, VWorkspace vWorkspace, HistoryType historyType) { String newPref = prefix + " "; pw.println(newPref + JSONUtil.json(JsonKeys.commandId, getId())); pw.println(newPref + JSONUtil.json(JsonKeys.title, getTitle())); pw.println(newPref + JSONUtil.json(JsonKeys.description, getDescription())); pw.println(newPref + JSONUtil.json(JsonKeys.historyType, historyType.name())); pw.println(newPref + JSONUtil.jsonLast(JsonKeys.commandType, getCommandType() .name())); }
@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { boolean r2rml_export_superclass = false; if(HistoryJsonUtil.valueExits(Arguments.r2rml_export_superclass.name(), inputJson)) r2rml_export_superclass = Boolean.parseBoolean(HistoryJsonUtil.getStringValue(Arguments.r2rml_export_superclass.name(), inputJson)); UpdateModelConfigurationCommand cmd = new UpdateModelConfigurationCommand(getNewId(workspace), model, r2rml_export_superclass); cmd.setInputParameterJson(inputJson.toString()); return cmd; }
@Override public Command createCommand(JSONArray inputJson, String model, Workspace workspace) throws JSONException, KarmaException { boolean show_rdfs_label_first = false; if(HistoryJsonUtil.valueExits(Arguments.show_rdfs_label_first.name(), inputJson)) show_rdfs_label_first = Boolean.parseBoolean(HistoryJsonUtil.getStringValue(Arguments.show_rdfs_label_first.name(), inputJson)); boolean show_rdfs_id_first = false; if(HistoryJsonUtil.valueExits(Arguments.show_rdfs_id_first.name(), inputJson)) show_rdfs_id_first = Boolean.parseBoolean(HistoryJsonUtil.getStringValue(Arguments.show_rdfs_id_first.name(), inputJson)); UpdateUIConfigurationCommand cmd = new UpdateUIConfigurationCommand(getNewId(workspace), model, show_rdfs_label_first, show_rdfs_id_first); cmd.setInputParameterJson(inputJson.toString()); return cmd; }
@Override public Command createCommand(HttpServletRequest request, Workspace workspace) { FetchGraphsFromTripleStoreCommand comm = new FetchGraphsFromTripleStoreCommand(getNewId(workspace), Command.NEW_MODEL, request.getParameter(Arguments.tripleStoreUrl.name())); return comm; }
@Override public Command createCommand(HttpServletRequest request, Workspace workspace) { FetchPreferencesCommand comm = new FetchPreferencesCommand(getNewId(workspace), Command.NEW_MODEL, request.getParameter(Arguments.preferenceCommand.name())); return comm; }
@Override public Command createCommand(HttpServletRequest request, Workspace workspace) { TestSPARQLEndPointCommand comm = new TestSPARQLEndPointCommand(getNewId(workspace), Command.NEW_MODEL, request.getParameter(Arguments.tripleStoreUrl.name())); return comm; }
@Override public Command createCommand(HttpServletRequest request, Workspace workspace) { SetKarmaHomeCommand comm = new SetKarmaHomeCommand(getNewId(workspace), Command.NEW_MODEL, request.getParameter(Arguments.directory.name())); return comm; }
@Override public Command createCommand(HttpServletRequest request, Workspace workspace) { GetUniqueGraphUrlCommand comm = new GetUniqueGraphUrlCommand(getNewId(workspace), Command.NEW_MODEL, request.getParameter(Arguments.worksheetId.name()), request.getParameter(Arguments.tripleStoreUrl.name()), request.getParameter(Arguments.graphUri.name()) ); return comm; }
@Override public Command createCommand(HttpServletRequest request, Workspace workspace) { String commandId = request.getParameter(Arguments.commandId.name()); String worksheetId = request.getParameter(Arguments.worksheetId.name()); return new UndoRedoCommand(getNewId(workspace), Command.NEW_MODEL, commandId, worksheetId); }
@Override public Command createCommand(HttpServletRequest request, Workspace workspace) { boolean forgetSemanticTypes = Boolean.parseBoolean(request.getParameter(Arguments.forgetSemanticTypes.name())); boolean forgetModels = Boolean.parseBoolean(request.getParameter(Arguments.forgetModels.name())); boolean forgetAlignment = Boolean.parseBoolean(request.getParameter(Arguments.forgetAlignment.name())); return new ResetKarmaCommand(getNewId(workspace), Command.NEW_MODEL, forgetSemanticTypes, forgetModels, forgetAlignment); }
private boolean isCommandTag(JSONArray tags, CommandTag tag) { for (int i = 0; i < tags.length(); i++) { if (tags.getString(i).equals(tag.name())) return true; } return false; }
private void createShortcut(Command command){ Intent shortcutIntent = new Intent(this, FormActivity.class); // As binary because OS does not know type Command command.putToIntentAsXml(shortcutIntent); shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); Intent intent = new Intent(); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, command.getTitle()); Parcelable iconResource = Intent .ShortcutIconResource .fromContext(this, R.drawable.ic_launcher); intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource); intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); sendBroadcast(intent); }
public Command getPreviewCommand(String commandId) { if (previewCommand.getId().equals(commandId)) return previewCommand; return null; }
protected Workspace(String id, String cachedPreferencesId, String contextId) { super(id); this.commandPreferences = new CommandPreferences(cachedPreferencesId, contextId); this.commandPreferencesId = cachedPreferencesId; this.contextId = contextId; this.semTypeModelHandler = new HybridSTModelHandler(contextId); }
/** * @param prefix * @param pw * @param vWorkspace * @param historyType * of the lists where the command is, either undo or redo. */ @Override public void generateJson(String prefix, PrintWriter pw, VWorkspace vWorkspace, HistoryType historyType) { pw.println(prefix + "{"); generateCommandJSONAttributes(prefix, pw, vWorkspace, historyType); pw.println(prefix + "}"); }
public void removeCommandFromHistory(List<ICommand> commands) { for (ICommand.CommandTag tag : ICommand.CommandTag.values()) { commandTagListHashMap.get(tag).removeAll(commands); } } }
/** * In the future we may need to keep track of user info. */ protected Workspace(String id, String contextId) { super(id); commandPreferences = new CommandPreferences(this.getId(), contextId); commandPreferencesId=this.getId(); this.contextId = contextId; this.semTypeModelHandler = new LuceneBasedSTModelHandler(contextId); }