From 872192b0d8ea533dff0392956ed1bac8f576917d Mon Sep 17 00:00:00 2001 From: Rob Bygrave Date: Thu, 2 Nov 2023 18:05:23 +1300 Subject: [PATCH] Refactor rename internal method names only --- .../io/ebean/migration/MigrationConfig.java | 52 +++++++++---------- .../io/ebean/migration/MigrationRunner.java | 6 +-- .../migration/runner/MigrationEngine.java | 4 +- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/ebean-migration/src/main/java/io/ebean/migration/MigrationConfig.java b/ebean-migration/src/main/java/io/ebean/migration/MigrationConfig.java index 4f89396..a969376 100644 --- a/ebean-migration/src/main/java/io/ebean/migration/MigrationConfig.java +++ b/ebean-migration/src/main/java/io/ebean/migration/MigrationConfig.java @@ -464,48 +464,48 @@ public void load(Properties props) { return; } this.properties = props; - dbUsername = getProperty("username", dbUsername); - dbPassword = getProperty("password", dbPassword); - dbUrl = getProperty("url", dbUrl); - dbSchema = getProperty("schema", dbSchema); - skipMigrationRun = getBool("skipMigrationRun", skipMigrationRun); - skipChecksum = getBool("skipChecksum", skipChecksum); - earlyChecksumMode = getBool("earlyChecksumMode", earlyChecksumMode); - createSchemaIfNotExists = getBool("createSchemaIfNotExists", createSchemaIfNotExists); - setCurrentSchema = getBool("setCurrentSchema", setCurrentSchema); - basePlatform = getProperty("basePlatform", basePlatform); - platform = getProperty("platform", getProperty("platformName", platform)); - metaTable = getProperty("metaTable", metaTable); - migrationPath = getProperty("migrationPath", migrationPath); - migrationInitPath = getProperty("migrationInitPath", migrationInitPath); - runPlaceholders = getProperty("placeholders", runPlaceholders); - minVersion = getProperty("minVersion", minVersion); - minVersionFailMessage = getProperty("minVersionFailMessage", minVersionFailMessage); - - String patchInsertOn = getProperty("patchInsertOn"); + dbUsername = property("username", dbUsername); + dbPassword = property("password", dbPassword); + dbUrl = property("url", dbUrl); + dbSchema = property("schema", dbSchema); + skipMigrationRun = property("skipMigrationRun", skipMigrationRun); + skipChecksum = property("skipChecksum", skipChecksum); + earlyChecksumMode = property("earlyChecksumMode", earlyChecksumMode); + createSchemaIfNotExists = property("createSchemaIfNotExists", createSchemaIfNotExists); + setCurrentSchema = property("setCurrentSchema", setCurrentSchema); + basePlatform = property("basePlatform", basePlatform); + platform = property("platform", property("platformName", platform)); + metaTable = property("metaTable", metaTable); + migrationPath = property("migrationPath", migrationPath); + migrationInitPath = property("migrationInitPath", migrationInitPath); + runPlaceholders = property("placeholders", runPlaceholders); + minVersion = property("minVersion", minVersion); + minVersionFailMessage = property("minVersionFailMessage", minVersionFailMessage); + + String patchInsertOn = property("patchInsertOn"); if (patchInsertOn != null) { setPatchInsertOn(patchInsertOn); } - String patchResetChecksumOn = getProperty("patchResetChecksumOn"); + String patchResetChecksumOn = property("patchResetChecksumOn"); if (patchResetChecksumOn != null) { setPatchResetChecksumOn(patchResetChecksumOn); } - String runPlaceholders = getProperty("runPlaceholders"); + String runPlaceholders = property("runPlaceholders"); if (runPlaceholders != null) { setRunPlaceholders(runPlaceholders); } } - private boolean getBool(String key, boolean value) { - String val = getProperty(key); + private boolean property(String key, boolean value) { + String val = property(key); return val != null ? Boolean.parseBoolean(val) : value; } - private String getProperty(String key) { - return getProperty(key, null); + private String property(String key) { + return property(key, null); } - private String getProperty(String key, String defaultVal) { + private String property(String key, String defaultVal) { String val = properties.getProperty("ebean." + name + ".migration." + key); if (val != null) { return val; diff --git a/ebean-migration/src/main/java/io/ebean/migration/MigrationRunner.java b/ebean-migration/src/main/java/io/ebean/migration/MigrationRunner.java index a719658..165febf 100644 --- a/ebean-migration/src/main/java/io/ebean/migration/MigrationRunner.java +++ b/ebean-migration/src/main/java/io/ebean/migration/MigrationRunner.java @@ -34,7 +34,7 @@ public List checkState() { * Return the migrations that would be applied if the migration is run. */ public List checkState(DataSource dataSource) { - return checkState(getConnection(dataSource)); + return checkState(connection(dataSource)); } /** @@ -55,7 +55,7 @@ public void run() { * Run using the connection from the DataSource. */ public void run(DataSource dataSource) { - run(getConnection(dataSource)); + run(connection(dataSource)); } /** @@ -65,7 +65,7 @@ public void run(Connection connection) { run(connection, false); } - private Connection getConnection(DataSource dataSource) { + private Connection connection(DataSource dataSource) { String username = migrationConfig.getDbUsername(); try { if (username == null) { diff --git a/ebean-migration/src/main/java/io/ebean/migration/runner/MigrationEngine.java b/ebean-migration/src/main/java/io/ebean/migration/runner/MigrationEngine.java index 5e6a814..6948bb5 100644 --- a/ebean-migration/src/main/java/io/ebean/migration/runner/MigrationEngine.java +++ b/ebean-migration/src/main/java/io/ebean/migration/runner/MigrationEngine.java @@ -92,7 +92,7 @@ private MigrationTable initialiseMigrationTable(Connection connection) { private List runMigrations(List localVersions, MigrationTable table, boolean checkStateMode) throws SQLException { // get the migrations in version order if (table.isEmpty()) { - LocalMigrationResource initVersion = getInitVersion(); + LocalMigrationResource initVersion = lastInitVersion(); if (initVersion != null) { // run using a dbinit script log.log(INFO, "dbinit migration version:{0} local migrations:{1} checkState:{2}", initVersion, localVersions.size(), checkStateMode); @@ -105,7 +105,7 @@ private List runMigrations(List local /** * Return the last init migration. */ - private LocalMigrationResource getInitVersion() { + private LocalMigrationResource lastInitVersion() { LocalMigrationResources initResources = new LocalMigrationResources(migrationConfig); if (initResources.readInitResources()) { List initVersions = initResources.versions();