public class CustomChangeWrapper extends AbstractChange
CustomSqlChange
,
CustomTaskChange
LiquibaseSerializable.SerializationType
NODENAME_COLUMN
GENERIC_CHANGELOG_EXTENSION_NAMESPACE, GENERIC_SNAPSHOT_EXTENSION_NAMESPACE, STANDARD_CHANGELOG_NAMESPACE, STANDARD_SNAPSHOT_NAMESPACE
Constructor and Description |
---|
CustomChangeWrapper() |
checkStatus, createChangeMetaData, createChangeParameterMetadata, createDescriptionMetaData, createEmptyColumnConfig, createExampleValueMetaData, createInverses, createMustEqualExistingMetaData, createRequiredDatabasesMetaData, createSerializationTypeMetaData, createSinceMetaData, createSupportedDatabasesMetaData, finishInitialization, generateCheckSum, generateRollbackStatementsVolatile, getAffectedDatabaseObjects, getChangeSet, getDescription, getResourceAccessor, getSerializableFieldNamespace, getSerializedObjectName, isInvalidProperty, serialize, serializeValue, setChangeSet, setResourceAccessor, supports, toString
public boolean generateStatementsVolatile(Database database)
AbstractChange
SqlGenerator.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 Change
generateStatementsVolatile
in class AbstractChange
public CustomChange getCustomChange()
setClass(String)
.public ClassLoader getClassLoader()
setClass(String)
.public void setClassLoader(ClassLoader classLoader)
public CustomChangeWrapper setClass(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)
CustomChangeException
public String getClassName()
setClass(String)
public void setParam(String name, 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 SortedSet<String> getParams()
setParam(String, String)
. If no parameters are set, an empty set will be returnedpublic String getParamValue(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 Change
validate
in class AbstractChange
public Warnings warn(Database database)
warn
in interface Change
warn
in class AbstractChange
public 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 Change
generateRollbackStatements
in class AbstractChange
RollbackImpossibleException
- 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 CustomSqlRollback
supportsRollback
in interface Change
supportsRollback
in class AbstractChange
public String getConfirmationMessage()
CustomChange.getConfirmationMessage()
message as the Change's message.public LiquibaseSerializable.SerializationType getSerializableFieldType(String field)
getSerializableFieldType
in interface LiquibaseSerializable
getSerializableFieldType
in class AbstractChange
public Object getSerializableFieldValue(String field)
getSerializableFieldValue
in interface LiquibaseSerializable
getSerializableFieldValue
in class AbstractChange
public Set<String> getSerializableFields()
AbstractChange
getSerializableFields
in interface LiquibaseSerializable
getSerializableFields
in class AbstractChange
public String getSerializedObjectNamespace()
getSerializedObjectNamespace
in interface LiquibaseSerializable
getSerializedObjectNamespace
in class AbstractChange
public void load(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException
load
in interface LiquibaseSerializable
load
in class AbstractChange
ParsedNodeException
public void customLoadLogic(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException
customLoadLogic
in class AbstractChange
ParsedNodeException
Copyright © 2019 Liquibase.org. All rights reserved.