rename BaseTask constructor parameters

This commit is contained in:
Ken Stevens 2019-11-04 10:27:34 -05:00
parent 4e2806bea5
commit 53cedddcab
19 changed files with 45 additions and 56 deletions

View File

@ -31,14 +31,8 @@ public class AddColumnTask extends BaseTableColumnTypeTask<AddColumnTask> {
private static final Logger ourLog = LoggerFactory.getLogger(AddColumnTask.class);
/**
* Constructor
*
* @param theRelease
* @param theVersion
*/
public AddColumnTask(String theRelease, String theVersion) {
super(theRelease, theVersion);
public AddColumnTask(String theProductVersion, String theSchemaVersion) {
super(theProductVersion, theSchemaVersion);
}
@Override

View File

@ -39,8 +39,8 @@ public class AddForeignKeyTask extends BaseTableColumnTask<AddForeignKeyTask> {
private String myForeignTableName;
private String myForeignColumnName;
public AddForeignKeyTask(String theRelease, String theVersion) {
super(theRelease, theVersion);
public AddForeignKeyTask(String theProductVersion, String theSchemaVersion) {
super(theProductVersion, theSchemaVersion);
}
public void setConstraintName(String theConstraintName) {

View File

@ -38,8 +38,8 @@ public class AddIdGeneratorTask extends BaseTask<AddIdGeneratorTask> {
private static final Logger ourLog = LoggerFactory.getLogger(AddIdGeneratorTask.class);
private final String myGeneratorName;
public AddIdGeneratorTask(String theRelease, String theVersion, String theGeneratorName) {
super(theRelease, theVersion);
public AddIdGeneratorTask(String theProductVersion, String theSchemaVersion, String theGeneratorName) {
super(theProductVersion, theSchemaVersion);
myGeneratorName = theGeneratorName;
}

View File

@ -41,8 +41,8 @@ public class AddIndexTask extends BaseTableTask<AddIndexTask> {
private List<String> myColumns;
private Boolean myUnique;
public AddIndexTask(String theRelease, String theVersion) {
super(theRelease, theVersion);
public AddIndexTask(String theProductVersion, String theSchemaVersion) {
super(theProductVersion, theSchemaVersion);
}
public void setIndexName(String theIndexName) {

View File

@ -38,8 +38,8 @@ public class AddTableByColumnTask extends BaseTableTask<AddTableByColumnTask> {
private List<AddColumnTask> myAddColumnTasks = new ArrayList<>();
private String myPkColumn;
public AddTableByColumnTask(String theRelease, String theVersion) {
super(theRelease, theVersion);
public AddTableByColumnTask(String theProductVersion, String theSchemaVersion) {
super(theProductVersion, theSchemaVersion);
}
@Override

View File

@ -39,8 +39,8 @@ public class AddTableRawSqlTask extends BaseTableTask<AddTableRawSqlTask> {
private Map<DriverTypeEnum, List<String>> myDriverToSqls = new HashMap<>();
private List<String> myDriverNeutralSqls = new ArrayList<>();
public AddTableRawSqlTask(String theRelease, String theVersion) {
super(theRelease, theVersion);
public AddTableRawSqlTask(String theProductVersion, String theSchemaVersion) {
super(theProductVersion, theSchemaVersion);
}
@Override

View File

@ -31,8 +31,8 @@ public abstract class BaseTableColumnTask<T extends BaseTableTask> extends BaseT
private String myColumnName;
public BaseTableColumnTask(String theRelease, String theVersion) {
super(theRelease, theVersion);
public BaseTableColumnTask(String theProductVersion, String theSchemaVersion) {
super(theProductVersion, theSchemaVersion);
}
@SuppressWarnings("unchecked")

View File

@ -45,8 +45,8 @@ public abstract class BaseTableColumnTypeTask<T extends BaseTableTask> extends B
* Constructor
*/
public BaseTableColumnTypeTask(String theRelease, String theVersion) {
super(theRelease, theVersion);
public BaseTableColumnTypeTask(String theProductVersion, String theSchemaVersion) {
super(theProductVersion, theSchemaVersion);
setColumnType(ColumnTypeEnum.INT, DriverTypeEnum.H2_EMBEDDED, "integer");
setColumnType(ColumnTypeEnum.INT, DriverTypeEnum.DERBY_EMBEDDED, "integer");
setColumnType(ColumnTypeEnum.INT, DriverTypeEnum.MARIADB_10_1, "integer");

View File

@ -27,8 +27,8 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
public abstract class BaseTableTask<T extends BaseTableTask> extends BaseTask {
private String myTableName;
public BaseTableTask(String theRelease, String theVersion) {
super(theRelease, theVersion);
public BaseTableTask(String theProductVersion, String theSchemaVersion) {
super(theProductVersion, theSchemaVersion);
}
public String getTableName() {

View File

@ -47,12 +47,12 @@ public abstract class BaseTask<T extends BaseTask> {
private boolean myDryRun;
private List<ExecutedStatement> myExecutedStatements = new ArrayList<>();
private boolean myNoColumnShrink;
private final String myRelease;
private final String myVersion;
private final String myProductVersion;
private final String mySchemaVersion;
protected BaseTask(String theRelease, String theVersion) {
myRelease = theRelease;
myVersion = theVersion;
protected BaseTask(String theProductVersion, String theSchemaVersion) {
myProductVersion = theProductVersion;
mySchemaVersion = theSchemaVersion;
}
public boolean isNoColumnShrink() {
@ -146,11 +146,11 @@ public abstract class BaseTask<T extends BaseTask> {
public String getFlywayVersion() {
String retval = "";
String releasePart = myRelease;
String releasePart = myProductVersion;
if (releasePart.startsWith("V")) {
releasePart = releasePart.substring(1);
}
return releasePart + "." + myVersion;
return releasePart + "." + mySchemaVersion;
}
protected void logInfo(Logger theLog, String theFormattedMessage, Object... theArguments) {
@ -158,9 +158,9 @@ public abstract class BaseTask<T extends BaseTask> {
}
public void validateVersion() {
Matcher matcher = versionPattern.matcher(myVersion);
Matcher matcher = versionPattern.matcher(mySchemaVersion);
if (!matcher.matches()) {
throw new IllegalStateException("The version " + myVersion + " does not match the expected pattern " + MIGRATION_VERSION_PATTERN);
throw new IllegalStateException("The version " + mySchemaVersion + " does not match the expected pattern " + MIGRATION_VERSION_PATTERN);
}
}

View File

@ -32,8 +32,8 @@ public class DropColumnTask extends BaseTableColumnTask<DropColumnTask> {
private static final Logger ourLog = LoggerFactory.getLogger(DropColumnTask.class);
public DropColumnTask(String theRelease, String theVersion) {
super(theRelease, theVersion);
public DropColumnTask(String theProductVersion, String theSchemaVersion) {
super(theProductVersion, theSchemaVersion);
}
@Override

View File

@ -42,8 +42,8 @@ public class DropForeignKeyTask extends BaseTableTask<DropForeignKeyTask> {
private String myConstraintName;
private String myParentTableName;
public DropForeignKeyTask(String theRelease, String theVersion) {
super(theRelease, theVersion);
public DropForeignKeyTask(String theProductVersion, String theSchemaVersion) {
super(theProductVersion, theSchemaVersion);
}
public void setConstraintName(String theConstraintName) {

View File

@ -38,8 +38,8 @@ public class DropIdGeneratorTask extends BaseTask<DropIdGeneratorTask> {
private static final Logger ourLog = LoggerFactory.getLogger(DropIdGeneratorTask.class);
private final String myGeneratorName;
public DropIdGeneratorTask(String theRelease, String theVersion, String theGeneratorName) {
super(theRelease, theVersion);
public DropIdGeneratorTask(String theProductVersion, String theSchemaVersion, String theGeneratorName) {
super(theProductVersion, theSchemaVersion);
myGeneratorName = theGeneratorName;
}

View File

@ -40,8 +40,8 @@ public class DropIndexTask extends BaseTableTask<DropIndexTask> {
private static final Logger ourLog = LoggerFactory.getLogger(DropIndexTask.class);
private String myIndexName;
public DropIndexTask(String theRelease, String theVersion) {
super(theRelease, theVersion);
public DropIndexTask(String theProductVersion, String theSchemaVersion) {
super(theProductVersion, theSchemaVersion);
}
@Override

View File

@ -33,8 +33,8 @@ public class DropTableTask extends BaseTableTask<DropTableTask> {
private static final Logger ourLog = LoggerFactory.getLogger(DropTableTask.class);
public DropTableTask(String theRelease, String theVersion) {
super(theRelease, theVersion);
public DropTableTask(String theProductVersion, String theSchemaVersion) {
super(theProductVersion, theSchemaVersion);
}
@Override

View File

@ -39,8 +39,8 @@ public class ExecuteRawSqlTask extends BaseTask<ExecuteRawSqlTask> {
private Map<DriverTypeEnum, List<String>> myDriverToSqls = new HashMap<>();
private List<String> myDriverNeutralSqls = new ArrayList<>();
public ExecuteRawSqlTask(String theRelease, String theVersion) {
super(theRelease, theVersion);
public ExecuteRawSqlTask(String theProductVersion, String theSchemaVersion) {
super(theProductVersion, theSchemaVersion);
setDescription("Execute raw sql");
}

View File

@ -16,8 +16,8 @@ public class InitializeSchemaTask extends BaseTask<InitializeSchemaTask> {
private static final Logger ourLog = LoggerFactory.getLogger(InitializeSchemaTask.class);
private final ISchemaInitializationProvider mySchemaInitializationProvider;
public InitializeSchemaTask(String theRelease, String theVersion, ISchemaInitializationProvider theSchemaInitializationProvider) {
super(theRelease, theVersion);
public InitializeSchemaTask(String theProductVersion, String theSchemaVersion, ISchemaInitializationProvider theSchemaInitializationProvider) {
super(theProductVersion, theSchemaVersion);
mySchemaInitializationProvider = theSchemaInitializationProvider;
setDescription("Initialize schema");
}

View File

@ -32,13 +32,8 @@ public class ModifyColumnTask extends BaseTableColumnTypeTask<ModifyColumnTask>
private static final Logger ourLog = LoggerFactory.getLogger(ModifyColumnTask.class);
/**
* Constructor
*
* @param theVersion
*/
public ModifyColumnTask(String theRelease, String theVersion) {
super(theRelease, theVersion);
public ModifyColumnTask(String theProductVersion, String theSchemaVersion) {
super(theProductVersion, theSchemaVersion);
}
@Override

View File

@ -40,8 +40,8 @@ public class RenameColumnTask extends BaseTableTask<RenameColumnTask> {
private boolean myAllowNeitherColumnToExist;
private boolean myDeleteTargetColumnFirstIfBothExist;
public RenameColumnTask(String theRelease, String theVersion) {
super(theRelease, theVersion);
public RenameColumnTask(String theProductVersion, String theSchemaVersion) {
super(theProductVersion, theSchemaVersion);
}
public void setDeleteTargetColumnFirstIfBothExist(boolean theDeleteTargetColumnFirstIfBothExist) {