Package liquibase.change.custom
Class CustomChangeWrapper
java.lang.Object
liquibase.AbstractExtensibleObject
liquibase.plugin.AbstractPlugin
liquibase.change.AbstractChange
liquibase.change.custom.CustomChangeWrapper
- All Implemented Interfaces:
Cloneable
,Change
,ExtensibleObject
,Plugin
,LiquibaseSerializable
Adapts CustomChange implementations to the standard change system used by Liquibase.
Custom change implementations should implement CustomSqlChange or CustomTaskChange
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface liquibase.serializer.LiquibaseSerializable
LiquibaseSerializable.SerializationType
-
Field Summary
Fields inherited from class liquibase.change.AbstractChange
NODENAME_COLUMN
Fields inherited from interface liquibase.change.Change
EMPTY_CHANGE, SHOULD_EXECUTE
Fields inherited from interface liquibase.serializer.LiquibaseSerializable
GENERIC_CHANGELOG_EXTENSION_NAMESPACE, GENERIC_SNAPSHOT_EXTENSION_NAMESPACE, STANDARD_CHANGELOG_NAMESPACE, STANDARD_SNAPSHOT_NAMESPACE
Fields inherited from interface liquibase.plugin.Plugin
PRIORITY_DATABASE, PRIORITY_DEFAULT, PRIORITY_NOT_APPLICABLE, PRIORITY_SPECIALIZED
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
customLoadLogic
(ParsedNode parsedNode, ResourceAccessor resourceAccessor) Implementation generates checksum by serializing the change withStringChangeLogSerializer
generateRollbackStatements
(Database database) Finishes configuring the CustomChange based on the values passed tosetParam(String, String)
then callsCustomSqlRollback.generateRollbackStatements(liquibase.database.Database)
orCustomTaskRollback.rollback(liquibase.database.Database)
depending on the CustomChange implementation.generateStatements
(Database database) Finishes configuring the CustomChange based on the values passed tosetParam(String, String)
then callsCustomSqlChange.generateStatements(liquibase.database.Database)
orCustomTaskChange.execute(liquibase.database.Database)
depending on the CustomChange implementation.boolean
generateStatementsVolatile
(Database database) Implementation delegates logic to theSqlGenerator.generateStatementsIsVolatile(Database)
method on theSqlStatement
objects returned byChange.generateStatements(liquibase.database.Database)
.Returns the name of the custom class set insetClass(String)
Return the customChange'sCustomChange.getConfirmationMessage()
message as the Change's message.Return the CustomChange instance created by the call tosetClass(String)
.Returns the parameters set bysetParam(String, String)
.getParamValue
(String key) Get the value of a parameter set bysetParam(String, String)
.Returns the fields on this change that are serializable.getSerializableFieldType
(String field) getSerializableFieldValue
(String field) void
load
(ParsedNode parsedNode, ResourceAccessor resourceAccessor) Specify the name of the class to use as the CustomChange and assigns it togetCustomChange()
.void
Specify a parameter on the CustomChange object to set before executingChange.generateStatements(liquibase.database.Database)
orgenerateRollbackStatements(liquibase.database.Database)
on it.boolean
supportsRollback
(Database database) Returns true if the customChange supports rolling back.Call theCustomChange.validate(liquibase.database.Database)
method and return the result.Required for the Change interface, but not supported by CustomChanges.Methods inherited from class liquibase.change.AbstractChange
checkStatus, createAlternateParameterNames, createChangeMetaData, createChangeParameterMetadata, createDescriptionMetaData, createEmptyColumnConfig, createExampleValueMetaData, createInverses, createMustEqualExistingMetaData, createRequiredDatabasesMetaData, createSerializationTypeMetaData, createSinceMetaData, createSupportedDatabasesMetaData, equals, finishInitialization, generateRollbackStatementsVolatile, getAffectedDatabaseObjects, getChangeSet, getDescription, getExcludedFieldFilters, getResourceAccessor, getSerializableFieldNamespace, getSerializedObjectName, hashCode, isInvalidProperty, modify, serialize, serializeValue, setChangeSet, setResourceAccessor, shouldExecuteChange, supports, toString
Methods inherited from class liquibase.AbstractExtensibleObject
clone, describe, get, get, get, getAttributes, getFieldValue, getObjectMetaData, getValuePath, has, set
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface liquibase.ExtensibleObject
clone, describe, get, get, getAttributes, getObjectMetaData, getValuePath, has, set
-
Constructor Details
-
CustomChangeWrapper
public CustomChangeWrapper()
-
-
Method Details
-
generateStatementsVolatile
Description copied from class:AbstractChange
Implementation delegates logic to theSqlGenerator.generateStatementsIsVolatile(Database)
method on theSqlStatement
objects returned byChange.generateStatements(liquibase.database.Database)
. If zero or null SqlStatements are returned by generateStatements then this method returns false.- Specified by:
generateStatementsVolatile
in interfaceChange
- Overrides:
generateStatementsVolatile
in classAbstractChange
-
getCustomChange
Return the CustomChange instance created by the call tosetClass(String)
. -
setClass
Specify the name of the class to use as the CustomChange and assigns it togetCustomChange()
.- Throws:
CustomChangeException
-
getClassName
Returns the name of the custom class set insetClass(String)
-
setParam
Specify a parameter on the CustomChange object to set before executingChange.generateStatements(liquibase.database.Database)
orgenerateRollbackStatements(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. -
getParams
Returns the parameters set bysetParam(String, String)
. If no parameters are set, an empty set will be returned -
getParamValue
Get the value of a parameter set bysetParam(String, String)
. If the parameter was not set, null will be returned. -
validate
Call theCustomChange.validate(liquibase.database.Database)
method and return the result.- Specified by:
validate
in interfaceChange
- Overrides:
validate
in classAbstractChange
-
warn
Required for the Change interface, but not supported by CustomChanges. Returns an empty Warnings object.- Specified by:
warn
in interfaceChange
- Overrides:
warn
in classAbstractChange
-
generateStatements
Finishes configuring the CustomChange based on the values passed tosetParam(String, String)
then callsCustomSqlChange.generateStatements(liquibase.database.Database)
orCustomTaskChange.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. -
generateRollbackStatements
public SqlStatement[] generateRollbackStatements(Database database) throws RollbackImpossibleException Finishes configuring the CustomChange based on the values passed tosetParam(String, String)
then callsCustomSqlRollback.generateRollbackStatements(liquibase.database.Database)
orCustomTaskRollback.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. AnyRollbackImpossibleException
exceptions thrown by the CustomChange will be thrown by this method.- Specified by:
generateRollbackStatements
in interfaceChange
- Overrides:
generateRollbackStatements
in classAbstractChange
- Throws:
RollbackImpossibleException
- if rollback is not supported for this change
-
generateCheckSum
Description copied from class:AbstractChange
Implementation generates checksum by serializing the change withStringChangeLogSerializer
- Specified by:
generateCheckSum
in interfaceChange
- Overrides:
generateCheckSum
in classAbstractChange
-
supportsRollback
Returns true if the customChange supports rolling back.generateRollbackStatements(liquibase.database.Database)
may still throw aRollbackImpossibleException
when it is actually executed, even if this method returns true. Currently only checks if the customChange implementsCustomSqlRollback
- Specified by:
supportsRollback
in interfaceChange
- Overrides:
supportsRollback
in classAbstractChange
-
getConfirmationMessage
Return the customChange'sCustomChange.getConfirmationMessage()
message as the Change's message. -
getSerializableFieldType
- Specified by:
getSerializableFieldType
in interfaceLiquibaseSerializable
- Overrides:
getSerializableFieldType
in classAbstractChange
-
getSerializableFieldValue
- Specified by:
getSerializableFieldValue
in interfaceLiquibaseSerializable
- Overrides:
getSerializableFieldValue
in classAbstractChange
-
getSerializableFields
Description copied from class:AbstractChange
Returns the fields on this change that are serializable.- Specified by:
getSerializableFields
in interfaceLiquibaseSerializable
- Overrides:
getSerializableFields
in classAbstractChange
-
getSerializedObjectNamespace
- Specified by:
getSerializedObjectNamespace
in interfaceLiquibaseSerializable
- Overrides:
getSerializedObjectNamespace
in classAbstractChange
-
load
public void load(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException - Specified by:
load
in interfaceLiquibaseSerializable
- Overrides:
load
in classAbstractChange
- Throws:
ParsedNodeException
-
customLoadLogic
public void customLoadLogic(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException - Overrides:
customLoadLogic
in classAbstractChange
- Throws:
ParsedNodeException
-