|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectliquibase.change.AbstractChange
public abstract class AbstractChange
Standard superclass to simplify Change implementations. You can implement Change directly, this class is purely for convenience but recommended.
DatabaseChange and DatabaseChangeProperty
and delegating logic to the SqlGenerator objects created to do the actual change work.
Place the @DatabaseChangeProperty annotations on the read "get" methods to control property metadata.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface liquibase.serializer.LiquibaseSerializable |
|---|
LiquibaseSerializable.SerializationType |
| Constructor Summary | |
|---|---|
AbstractChange()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface liquibase.change.Change |
|---|
generateStatements, getConfirmationMessage |
| Constructor Detail |
|---|
public AbstractChange()
| Method Detail |
|---|
public void finishInitialization()
throws SetupException
finishInitialization in interface ChangeSetupExceptionpublic ChangeMetaData createChangeMetaData()
DatabaseChange annotation
and calls out to createChangeParameterMetadata(String) for each property.
createChangeMetaData in interface ChangeUnexpectedLiquibaseException - if no @DatabaseChange annotation on this Change classprotected ChangeParameterMetaData createChangeParameterMetadata(String parameterName)
createChangeMetaData() to create metadata for a given parameter. It finds the method that corresponds to the parameter
and calls the corresponding create*MetaData methods such as createRequiredDatabasesMetaData(String, DatabaseChangeProperty) to determine the
correct values for the ChangeParameterMetaData fields.
UnexpectedLiquibaseException - if the passed parameter does not exist
protected String createSinceMetaData(String parameterName,
DatabaseChangeProperty changePropertyAnnotation)
ChangeParameterMetaData "since" value. Uses the value on the DatabaseChangeProperty annotation or returns null as a default.
protected String createDescriptionMetaData(String parameterName,
DatabaseChangeProperty changePropertyAnnotation)
ChangeParameterMetaData "description" value. Uses the value on the DatabaseChangeProperty annotation or returns null as a default.
protected LiquibaseSerializable.SerializationType createSerializationTypeMetaData(String parameterName,
DatabaseChangeProperty changePropertyAnnotation)
ChangeParameterMetaData "serializationType" value. Uses the value on the DatabaseChangeProperty annotation or returns SerializationType.NAMED_FIELD as a default.
protected String createMustEqualExistingMetaData(String parameterName,
DatabaseChangeProperty changePropertyAnnotation)
ChangeParameterMetaData "mustEqual" value. Uses the value on the DatabaseChangeProperty annotation or returns null as a default.
protected String createExampleValueMetaData(String parameterName,
DatabaseChangeProperty changePropertyAnnotation)
ChangeParameterMetaData "example" value. Uses the value on the DatabaseChangeProperty annotation or returns null as a default.
protected String[] createRequiredDatabasesMetaData(String parameterName,
DatabaseChangeProperty changePropertyAnnotation)
ChangeParameterMetaData "requiredDatabases" value.
Uses the value on the DatabaseChangeProperty annotation or returns an array containing the string "COMPUTE" as a default.
"COMPUTE" will cause ChangeParameterMetaData to attempt to determine the required databases based on the generated Statements
protected String[] createSupportedDatabasesMetaData(String parameterName,
DatabaseChangeProperty changePropertyAnnotation)
ChangeParameterMetaData "supportedDatabase" value.
Uses the value on the DatabaseChangeProperty annotation or returns an array containing the string "COMPUTE" as a default.
"COMPUTE" will cause ChangeParameterMetaData to attempt to determine the required databases based on the generated Statements
public ChangeSet getChangeSet()
getChangeSet in interface Changepublic void setChangeSet(ChangeSet changeSet)
setChangeSet in interface Changepublic boolean generateStatementsVolatile(Database database)
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 Changepublic boolean generateRollbackStatementsVolatile(Database database)
SqlGenerator.generateRollbackStatementsIsVolatile(Database) method on the SqlStatement objects returned by Change.generateStatements(liquibase.database.Database)
If no or null SqlStatements are returned by generateRollbackStatements then this method returns false.
generateRollbackStatementsVolatile in interface Changepublic boolean supports(Database database)
SqlGenerator.supports(liquibase.statement.SqlStatement, liquibase.database.Database) method on the SqlStatement objects returned by Change.generateStatements(liquibase.database.Database).
If no or null SqlStatements are returned by generateStatements then this method returns true.
If generateStatementsVolatile(liquibase.database.Database) returns true, we cannot call generateStatements and so assume true.
supports in interface Changepublic Warnings warn(Database database)
SqlGenerator.warn(liquibase.statement.SqlStatement, liquibase.database.Database, liquibase.sqlgenerator.SqlGeneratorChain) method on the SqlStatement objects returned by Change.generateStatements(liquibase.database.Database).
If a generated statement is not supported for the given database, no warning will be added since that is a validation error.
If no or null SqlStatements are returned by generateStatements then this method returns no warnings.
warn in interface Changepublic ValidationErrors validate(Database database)
SqlGenerator.validate(liquibase.statement.SqlStatement, liquibase.database.Database, liquibase.sqlgenerator.SqlGeneratorChain) method on the SqlStatement objects returned by Change.generateStatements(liquibase.database.Database).
If no or null SqlStatements are returned by generateStatements then this method returns no errors.
If there are no parameters than this method returns no errors
validate in interface Change
public SqlStatement[] generateRollbackStatements(Database database)
throws RollbackImpossibleException
createInverses().
generateRollbackStatements in interface ChangeRollbackImpossibleException - if rollback is not supported for this changepublic boolean supportsRollback(Database database)
createInverses() returns a non-null value.
supportsRollback in interface Changepublic CheckSum generateCheckSum()
StringChangeLogSerializer
generateCheckSum in interface Changeprotected Change[] createInverses()
generateRollbackStatements(liquibase.database.Database) is overridden, this method may not be called.
public void setResourceAccessor(ResourceAccessor resourceAccessor)
ResourceAccessor that should be used for any file and/or resource loading needed by this Change.
Called automatically by Liquibase during the changelog parsing process.
setResourceAccessor in interface Changepublic ResourceAccessor getResourceAccessor()
public Set<DatabaseObject> getAffectedDatabaseObjects(Database database)
SqlGeneratorFactory.getAffectedDatabaseObjects(liquibase.statement.SqlStatement, liquibase.database.Database) method on the SqlStatement objects returned by Change.generateStatements(liquibase.database.Database)
Returns empty set if change is not supported for the passed database
getAffectedDatabaseObjects in interface Changepublic Set<String> getSerializableFields()
getSerializableFields in interface LiquibaseSerializablepublic Object getSerializableFieldValue(String field)
getSerializableFieldValue in interface LiquibaseSerializablepublic String getSerializedObjectName()
getSerializedObjectName in interface LiquibaseSerializablepublic LiquibaseSerializable.SerializationType getSerializableFieldType(String field)
getSerializableFieldType in interface LiquibaseSerializable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||