@Override public UpdateContainer doIt(Workspace workspace) throws CommandException { setRequestedInteractionType(InteractionType.importTable); UpdateContainer c = super.doIt(workspace); try { // Create a new Database Import Command. The interface allows the user to import // multiple tables ImportDatabaseTableCommand comm = new ImportDatabaseTableCommand(workspace.getFactory().getNewId("C"), model, dbType.name(), hostname, portnumber, username, password, dBorSIDName); workspace.getCommandHistory().addPreviewCommand(comm); NewDatabaseCommandUpdate upd = new NewDatabaseCommandUpdate(comm.getId()); c.add(upd); } catch (Throwable e) { String message = e.getMessage().replaceAll("\n", "").replaceAll("\"", "\\\""); ErrorUpdate errUpdt = new ErrorUpdate(message); c.add(errUpdt); } return c; }
@Override public UpdateContainer doIt(Workspace workspace) throws CommandException { setRequestedInteractionType(InteractionType.importSQL); UpdateContainer c = super.doIt(workspace); try { // Create a new Database Import Command. The interface allows the user to import // multiple tables ImportSQLCommand comm = new ImportSQLCommand(workspace.getFactory().getNewId("C"), model, dbType.name(), hostname, portnumber, username, password, dBorSIDName, query); workspace.getCommandHistory().addPreviewCommand(comm); c.add(new InfoUpdate("Sucessfully imported data using SQL")); c.add(new SQLCommandUpdate(comm.getId())); } catch (Throwable e) { String message = e.getMessage().replaceAll("\n", "").replaceAll("\"", "\\\""); ErrorUpdate errUpdt = new ErrorUpdate(message); c.add(errUpdt); } return c; }