From a28bb52e5ca756afed98c5af11201490f9245299 Mon Sep 17 00:00:00 2001 From: j2blake Date: Wed, 18 Jun 2014 17:16:38 -0400 Subject: [PATCH] VIVO-801 Improved the prompts on the RDB migrator --- .../utilities/rdbmigration/RdbMigrator.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/utilities/rdbmigration/src/edu/cornell/mannlib/vivo/utilities/rdbmigration/RdbMigrator.java b/utilities/rdbmigration/src/edu/cornell/mannlib/vivo/utilities/rdbmigration/RdbMigrator.java index 0ab7b1c2..cf7ac861 100644 --- a/utilities/rdbmigration/src/edu/cornell/mannlib/vivo/utilities/rdbmigration/RdbMigrator.java +++ b/utilities/rdbmigration/src/edu/cornell/mannlib/vivo/utilities/rdbmigration/RdbMigrator.java @@ -209,12 +209,20 @@ public class RdbMigrator { return true; } - private void askMigrateAllModels() throws IOException { - try { - ask("Migrate all models? (y/n)"); - } catch (UserDeclinedException e) { - modelsToCopy = EXPECTED_MODELS; + private void askMigrateAllModels() throws IOException, UserDeclinedException { + System.out.println("Migrate all models, or only the required models?\n" + + " Enter 'all' or 'only', or anything else to quit."); + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + String s = br.readLine(); + if (s != null) { + if (s.trim().toLowerCase().equals("all")) { + return; + } else if (s.trim().toLowerCase().equals("only")) { + modelsToCopy = EXPECTED_MODELS; + return; + } } + throw new UserDeclinedException("Enter 'all' or 'only'."); } private void askApprovalForMigrationPlan() throws SQLException, @@ -334,6 +342,7 @@ public class RdbMigrator { // Main routine // ---------------------------------------------------------------------- + @SuppressWarnings("unused") public static void main(String[] args) { if (args.length != 4) { System.out.println("Usage: RdbMigrator vivoHomeDir, jdbcUrl, "