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_COLUMNFields inherited from interface liquibase.change.Change
EMPTY_CHANGE, SHOULD_EXECUTEFields inherited from interface liquibase.serializer.LiquibaseSerializable
GENERIC_CHANGELOG_EXTENSION_NAMESPACE, GENERIC_SNAPSHOT_EXTENSION_NAMESPACE, STANDARD_CHANGELOG_NAMESPACE, STANDARD_SNAPSHOT_NAMESPACEFields inherited from interface liquibase.plugin.Plugin
PRIORITY_DATABASE, PRIORITY_DEFAULT, PRIORITY_NOT_APPLICABLE, PRIORITY_SPECIALIZED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcustomLoadLogic(ParsedNode parsedNode, ResourceAccessor resourceAccessor) Implementation generates checksum by serializing the change withStringChangeLogSerializergenerateRollbackStatements(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.booleangenerateStatementsVolatile(Database database) Implementation delegates logic to theSqlGenerator.generateStatementsIsVolatile(Database)method on theSqlStatementobjects 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) voidload(ParsedNode parsedNode, ResourceAccessor resourceAccessor) Specify the name of the class to use as the CustomChange and assigns it togetCustomChange().voidSpecify a parameter on the CustomChange object to set before executingChange.generateStatements(liquibase.database.Database)orgenerateRollbackStatements(liquibase.database.Database)on it.booleansupportsRollback(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, toStringMethods inherited from class liquibase.AbstractExtensibleObject
clone, describe, get, get, get, getAttributes, getFieldValue, getObjectMetaData, getValuePath, has, setMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface liquibase.change.Change
shouldRunOnOsMethods 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:AbstractChangeImplementation delegates logic to theSqlGenerator.generateStatementsIsVolatile(Database)method on theSqlStatementobjects returned byChange.generateStatements(liquibase.database.Database). If zero or null SqlStatements are returned by generateStatements then this method returns false.- Specified by:
generateStatementsVolatilein interfaceChange- Overrides:
generateStatementsVolatilein 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:
validatein interfaceChange- Overrides:
validatein classAbstractChange
-
warn
Required for the Change interface, but not supported by CustomChanges. Returns an empty Warnings object.- Specified by:
warnin interfaceChange- Overrides:
warnin 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. AnyRollbackImpossibleExceptionexceptions thrown by the CustomChange will be thrown by this method.- Specified by:
generateRollbackStatementsin interfaceChange- Overrides:
generateRollbackStatementsin classAbstractChange- Throws:
RollbackImpossibleException- if rollback is not supported for this change
-
generateCheckSum
Description copied from class:AbstractChangeImplementation generates checksum by serializing the change withStringChangeLogSerializer- Specified by:
generateCheckSumin interfaceChange- Overrides:
generateCheckSumin classAbstractChange
-
supportsRollback
Returns true if the customChange supports rolling back.generateRollbackStatements(liquibase.database.Database)may still throw aRollbackImpossibleExceptionwhen it is actually executed, even if this method returns true. Currently only checks if the customChange implementsCustomSqlRollback- Specified by:
supportsRollbackin interfaceChange- Overrides:
supportsRollbackin classAbstractChange
-
getConfirmationMessage
Return the customChange'sCustomChange.getConfirmationMessage()message as the Change's message. -
getSerializableFieldType
- Specified by:
getSerializableFieldTypein interfaceLiquibaseSerializable- Overrides:
getSerializableFieldTypein classAbstractChange
-
getSerializableFieldValue
- Specified by:
getSerializableFieldValuein interfaceLiquibaseSerializable- Overrides:
getSerializableFieldValuein classAbstractChange
-
getSerializableFields
Description copied from class:AbstractChangeReturns the fields on this change that are serializable.- Specified by:
getSerializableFieldsin interfaceLiquibaseSerializable- Overrides:
getSerializableFieldsin classAbstractChange
-
getSerializedObjectNamespace
- Specified by:
getSerializedObjectNamespacein interfaceLiquibaseSerializable- Overrides:
getSerializedObjectNamespacein classAbstractChange
-
load
public void load(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException - Specified by:
loadin interfaceLiquibaseSerializable- Overrides:
loadin classAbstractChange- Throws:
ParsedNodeException
-
customLoadLogic
public void customLoadLogic(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException - Overrides:
customLoadLogicin classAbstractChange- Throws:
ParsedNodeException
-