public class CustomChangeWrapper extends AbstractChange
CustomSqlChange,
CustomTaskChangeLiquibaseSerializable.SerializationType| Constructor and Description |
|---|
CustomChangeWrapper() |
| Modifier and Type | Method and Description |
|---|---|
SqlStatement[] |
generateRollbackStatements(Database database)
Finishes configuring the CustomChange based on the values passed to
setParam(String, String) then calls CustomSqlRollback.generateRollbackStatements(liquibase.database.Database)
or CustomTaskRollback.rollback(liquibase.database.Database) depending on the CustomChange implementation. |
SqlStatement[] |
generateStatements(Database database)
Finishes configuring the CustomChange based on the values passed to
setParam(String, String) then calls CustomSqlChange.generateStatements(liquibase.database.Database)
or CustomTaskChange.execute(liquibase.database.Database) depending on the CustomChange implementation. |
boolean |
generateStatementsVolatile(Database database)
Implementation delegates logic to the
SqlGenerator.generateStatementsIsVolatile(Database) method on the SqlStatement objects returned by Change.generateStatements(liquibase.database.Database). |
java.lang.ClassLoader |
getClassLoader()
Returns the classloader to use when creating the CustomChange instance in
setClass(String). |
java.lang.String |
getClassName()
Return the name of the custom class set in
setClass(String) |
java.lang.String |
getConfirmationMessage()
Return the customChange's
CustomChange.getConfirmationMessage() message as the Change's message. |
CustomChange |
getCustomChange()
Return the CustomChange instance created by the call to
setClass(String). |
java.util.SortedSet<java.lang.String> |
getParams()
Returns the parameters set by
setParam(String, String). |
java.lang.String |
getParamValue(java.lang.String key)
Get the value of a parameter set by
setParam(String, String). |
java.util.Set<java.lang.String> |
getSerializableFields()
Returns the fields on this change that are serializable.
|
LiquibaseSerializable.SerializationType |
getSerializableFieldType(java.lang.String field) |
java.lang.Object |
getSerializableFieldValue(java.lang.String field) |
CustomChangeWrapper |
setClass(java.lang.String className)
Specify the name of the class to use as the CustomChange.
|
void |
setClassLoader(java.lang.ClassLoader classLoader) |
void |
setParam(java.lang.String name,
java.lang.String value)
Specify a parameter on the CustomChange object to set before executing
Change.generateStatements(liquibase.database.Database) or generateRollbackStatements(liquibase.database.Database) on it. |
boolean |
supportsRollback(Database database)
Returns true if the customChange supports rolling back.
|
ValidationErrors |
validate(Database database)
Call the
CustomChange.validate(liquibase.database.Database) method and return the result. |
Warnings |
warn(Database database)
Required for the Change interface, but not supported by CustomChanges.
|
createChangeMetaData, createChangeParameterMetadata, createDescriptionMetaData, createExampleValueMetaData, createInverses, createMustEqualExistingMetaData, createRequiredDatabasesMetaData, createSerializationTypeMetaData, createSinceMetaData, createSupportedDatabasesMetaData, finishInitialization, generateCheckSum, generateRollbackStatementsVolatile, getAffectedDatabaseObjects, getChangeSet, getResourceAccessor, getSerializedObjectName, setChangeSet, setResourceAccessor, supportspublic boolean generateStatementsVolatile(Database database)
AbstractChangeSqlGenerator.generateStatementsIsVolatile(Database) method on the SqlStatement objects returned by Change.generateStatements(liquibase.database.Database).
If zero or null SqlStatements are returned by generateStatements then this method returns false.generateStatementsVolatile in interface ChangegenerateStatementsVolatile in class AbstractChangepublic CustomChange getCustomChange()
setClass(String).public java.lang.ClassLoader getClassLoader()
setClass(String).public void setClassLoader(java.lang.ClassLoader classLoader)
public CustomChangeWrapper setClass(java.lang.String className) throws CustomChangeException
getClassLoader() or fallback methods
and assigns it to getCustomChange().
setClassLoader(ClassLoader) must be called before this method. The passed class is constructed, but no parameters are set. They are set in Change.generateStatements(liquibase.database.Database)CustomChangeExceptionpublic java.lang.String getClassName()
setClass(String)public void setParam(java.lang.String name,
java.lang.String value)
Change.generateStatements(liquibase.database.Database) or generateRollbackStatements(liquibase.database.Database) on it.
The CustomChange class must have a set method for the given parameter. For example, to call setParam("lastName", "X") you must have a method setLastName(String val) on your class.public java.util.SortedSet<java.lang.String> getParams()
setParam(String, String). If no parameters are set, an empty set will be returnedpublic java.lang.String getParamValue(java.lang.String key)
setParam(String, String). If the parameter was not set, null will be returned.public ValidationErrors validate(Database database)
CustomChange.validate(liquibase.database.Database) method and return the result.validate in interface Changevalidate in class AbstractChangepublic Warnings warn(Database database)
warn in interface Changewarn in class AbstractChangepublic SqlStatement[] generateStatements(Database database)
setParam(String, String) then calls CustomSqlChange.generateStatements(liquibase.database.Database)
or CustomTaskChange.execute(liquibase.database.Database) depending on the CustomChange implementation.
If the CustomChange returns a null SqlStatement array, this method returns an empty array. If a CustomTaskChange is being used, this method will return an empty array.public SqlStatement[] generateRollbackStatements(Database database) throws RollbackImpossibleException
setParam(String, String) then calls CustomSqlRollback.generateRollbackStatements(liquibase.database.Database)
or CustomTaskRollback.rollback(liquibase.database.Database) depending on the CustomChange implementation.
If the CustomChange returns a null SqlStatement array, this method returns an empty array. If a CustomTaskChange is being used, this method will return an empty array.
Any RollbackImpossibleException exceptions thrown by the CustomChange will thrown by this method.generateRollbackStatements in interface ChangegenerateRollbackStatements in class AbstractChangeRollbackImpossibleException - if rollback is not supported for this changepublic boolean supportsRollback(Database database)
generateRollbackStatements(liquibase.database.Database) may still trow a RollbackImpossibleException when it is actually exectued, even if this method returns true.
Currently only checks if the customChange implements CustomSqlRollbacksupportsRollback in interface ChangesupportsRollback in class AbstractChangepublic java.lang.String getConfirmationMessage()
CustomChange.getConfirmationMessage() message as the Change's message.public LiquibaseSerializable.SerializationType getSerializableFieldType(java.lang.String field)
getSerializableFieldType in interface LiquibaseSerializablegetSerializableFieldType in class AbstractChangepublic java.lang.Object getSerializableFieldValue(java.lang.String field)
getSerializableFieldValue in interface LiquibaseSerializablegetSerializableFieldValue in class AbstractChangepublic java.util.Set<java.lang.String> getSerializableFields()
AbstractChangegetSerializableFields in interface LiquibaseSerializablegetSerializableFields in class AbstractChange