add task descriptions
This commit is contained in:
parent
30865588e3
commit
4e2806bea5
|
@ -31,11 +31,7 @@ public class FlywayMigration implements JavaMigration {
|
|||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
String retval = myTask.getDescription();
|
||||
if (retval == null) {
|
||||
retval = myTask.getClass().getSimpleName() + " " + getVersion();
|
||||
}
|
||||
return retval;
|
||||
return myTask.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,6 +41,12 @@ public class AddColumnTask extends BaseTableColumnTypeTask<AddColumnTask> {
|
|||
super(theRelease, theVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
setDescription("Add column " + getColumnName() + " on table " + getTableName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws SQLException {
|
||||
Set<String> columnNames = JdbcUtils.getColumnNames(getConnectionProperties(), getTableName());
|
||||
|
|
|
@ -62,6 +62,7 @@ public class AddForeignKeyTask extends BaseTableColumnTask<AddForeignKeyTask> {
|
|||
Validate.isTrue(isNotBlank(myConstraintName));
|
||||
Validate.isTrue(isNotBlank(myForeignTableName));
|
||||
Validate.isTrue(isNotBlank(myForeignColumnName));
|
||||
setDescription("Add foreign key " + myConstraintName + " from column " + getColumnName() + " of table " + getTableName() + " to column " + myForeignColumnName + " of table " + myForeignTableName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -46,6 +46,7 @@ public class AddIdGeneratorTask extends BaseTask<AddIdGeneratorTask> {
|
|||
@Override
|
||||
public void validate() {
|
||||
Validate.notBlank(myGeneratorName);
|
||||
setDescription("Add id generator " + myGeneratorName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -63,6 +63,7 @@ public class AddIndexTask extends BaseTableTask<AddIndexTask> {
|
|||
Validate.notBlank(myIndexName, "Index name not specified");
|
||||
Validate.isTrue(myColumns.size() > 0, "Columns not specified for AddIndexTask " + myIndexName + " on table " + getTableName());
|
||||
Validate.notNull(myUnique, "Uniqueness not specified");
|
||||
setDescription("Add " + myIndexName + " index to table " + getTableName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -42,6 +42,12 @@ public class AddTableByColumnTask extends BaseTableTask<AddTableByColumnTask> {
|
|||
super(theRelease, theVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
setDescription("Add table " + getTableName());
|
||||
}
|
||||
|
||||
public void addAddColumnTask(AddColumnTask theTask) {
|
||||
Validate.notNull(theTask);
|
||||
myAddColumnTasks.add(theTask);
|
||||
|
|
|
@ -43,6 +43,12 @@ public class AddTableRawSqlTask extends BaseTableTask<AddTableRawSqlTask> {
|
|||
super(theRelease, theVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
setDescription("Add table using raw sql");
|
||||
}
|
||||
|
||||
public void addSql(DriverTypeEnum theDriverType, @Language("SQL") String theSql) {
|
||||
Validate.notNull(theDriverType);
|
||||
Validate.notBlank(theSql);
|
||||
|
|
|
@ -120,6 +120,7 @@ public class ArbitrarySqlTask extends BaseTask<ArbitrarySqlTask> {
|
|||
mySql = theSql;
|
||||
myMode = theMode;
|
||||
myConsumer = theConsumer;
|
||||
setDescription("Execute raw sql");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -72,6 +72,9 @@ public abstract class BaseTask<T extends BaseTask> {
|
|||
}
|
||||
|
||||
public String getDescription() {
|
||||
if (myDescription == null) {
|
||||
return this.getClass().getSimpleName();
|
||||
}
|
||||
return myDescription;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ public class CalculateHashesTask extends BaseTableColumnTask<CalculateHashesTask
|
|||
*/
|
||||
public CalculateHashesTask(VersionEnum theRelease, String theVersion) {
|
||||
super(theRelease.toString(), theVersion);
|
||||
setDescription("Calculate resource search parameter index hashes");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -36,6 +36,12 @@ public class DropColumnTask extends BaseTableColumnTask<DropColumnTask> {
|
|||
super(theRelease, theVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
setDescription("Drop column " + getColumnName() + " from table " + getTableName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws SQLException {
|
||||
Set<String> columnNames = JdbcUtils.getColumnNames(getConnectionProperties(), getTableName());
|
||||
|
|
|
@ -60,6 +60,8 @@ public class DropForeignKeyTask extends BaseTableTask<DropForeignKeyTask> {
|
|||
|
||||
Validate.isTrue(isNotBlank(myConstraintName));
|
||||
Validate.isTrue(isNotBlank(myParentTableName));
|
||||
setDescription("Drop foreign key " + myConstraintName + " from table " + getTableName());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -46,6 +46,7 @@ public class DropIdGeneratorTask extends BaseTask<DropIdGeneratorTask> {
|
|||
@Override
|
||||
public void validate() {
|
||||
Validate.notBlank(myGeneratorName);
|
||||
setDescription("Drop id generator " + myGeneratorName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -49,9 +49,7 @@ public class DropIndexTask extends BaseTableTask<DropIndexTask> {
|
|||
super.validate();
|
||||
Validate.notBlank(myIndexName, "The index name must not be blank");
|
||||
|
||||
if (getDescription() == null) {
|
||||
setDescription("Drop index " + myIndexName + " on table " + getTableName());
|
||||
}
|
||||
setDescription("Drop index " + myIndexName + " from table " + getTableName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -37,6 +37,12 @@ public class DropTableTask extends BaseTableTask<DropTableTask> {
|
|||
super(theRelease, theVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
setDescription("Drop table " + getTableName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws SQLException {
|
||||
Set<String> tableNames = JdbcUtils.getTableNames(getConnectionProperties());
|
||||
|
|
|
@ -41,6 +41,7 @@ public class ExecuteRawSqlTask extends BaseTask<ExecuteRawSqlTask> {
|
|||
|
||||
public ExecuteRawSqlTask(String theRelease, String theVersion) {
|
||||
super(theRelease, theVersion);
|
||||
setDescription("Execute raw sql");
|
||||
}
|
||||
|
||||
public ExecuteRawSqlTask addSql(DriverTypeEnum theDriverType, @Language("SQL") String theSql) {
|
||||
|
|
|
@ -19,6 +19,7 @@ public class InitializeSchemaTask extends BaseTask<InitializeSchemaTask> {
|
|||
public InitializeSchemaTask(String theRelease, String theVersion, ISchemaInitializationProvider theSchemaInitializationProvider) {
|
||||
super(theRelease, theVersion);
|
||||
mySchemaInitializationProvider = theSchemaInitializationProvider;
|
||||
setDescription("Initialize schema");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,6 +41,12 @@ public class ModifyColumnTask extends BaseTableColumnTypeTask<ModifyColumnTask>
|
|||
super(theRelease, theVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
setDescription("Modify column " + getColumnName() + " on table " + getTableName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws SQLException {
|
||||
|
||||
|
|
|
@ -48,6 +48,12 @@ public class RenameColumnTask extends BaseTableTask<RenameColumnTask> {
|
|||
myDeleteTargetColumnFirstIfBothExist = theDeleteTargetColumnFirstIfBothExist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
setDescription("Rename column " + myOldName + " to " + myNewName + " on table " + getTableName());
|
||||
}
|
||||
|
||||
public void setOldName(String theOldName) {
|
||||
Validate.notBlank(theOldName);
|
||||
myOldName = theOldName;
|
||||
|
|
Loading…
Reference in New Issue