Package liquibase.snapshot
Class SnapshotControl
java.lang.Object
liquibase.snapshot.SnapshotControl
- All Implemented Interfaces:
LiquibaseSerializable
Allows the class user to influence various aspects of the database object snapshot generation, e.g.
what types of database objects they want.
-
Nested Class Summary
Nested classes/interfaces inherited from interface liquibase.serializer.LiquibaseSerializable
LiquibaseSerializable.SerializationType
-
Field Summary
Fields inherited from interface liquibase.serializer.LiquibaseSerializable
GENERIC_CHANGELOG_EXTENSION_NAMESPACE, GENERIC_SNAPSHOT_EXTENSION_NAMESPACE, STANDARD_CHANGELOG_NAMESPACE, STANDARD_SNAPSHOT_NAMESPACE
-
Constructor Summary
ConstructorDescriptionSnapshotControl
(Database database) Create a SnapshotControl for a given database and mark the database's standard types for inclusion.SnapshotControl
(Database database, boolean expandTypesIfNeeded, Class<? extends DatabaseObject>... types) SnapshotControl
(Database database, Class<? extends DatabaseObject>... types) Create a Snapshot control for a given database, but explicitly set the object types to be included in snapshots.SnapshotControl
(Database database, String types) Create a Snapshot control for a given database, but explicitly set the object types to be included in snapshots.SnapshotControl
(Database database, ObjectChangeFilter objectChangeFilter, Class<? extends DatabaseObject>... types) -
Method Summary
Modifier and TypeMethodDescriptionboolean
addType
(Class<? extends DatabaseObject> type, Database database) Adds a new DatabaseObject type to the list of object types to be included in snapshots.getSerializableFieldType
(String field) getSerializableFieldValue
(String field) Set<Class<? extends DatabaseObject>>
Return the types to be included in snapshotsboolean
Returns if the code should log a LogLevel.WARNING message if the object to be snapshotted could not be found.void
load
(ParsedNode parsedNode, ResourceAccessor resourceAccessor) void
setSnapshotListener
(SnapshotListener snapshotListener) setWarnIfObjectNotFound
(boolean warnIfObjectNotFound) Configures the code to log a LogLevel.WARNING message if the object to be snapshotted could not be found.boolean
shouldInclude
(Class<? extends DatabaseObject> type) Queries the currently registered list of types to be included and returns true if the given type is in that list<T extends DatabaseObject>
booleanshouldInclude
(T example) boolean
When searchNestedObjects is false this indicates to stop searching the snapshot the moment an example object has been found.
-
Constructor Details
-
SnapshotControl
Create a SnapshotControl for a given database and mark the database's standard types for inclusion.- Parameters:
database
- the DBMS for which snapshots should be generated
-
SnapshotControl
Create a Snapshot control for a given database, but explicitly set the object types to be included in snapshots.- Parameters:
database
- the DBMS for which snapshots should be generatedtypes
- the list of object types to be included in the snapshot
-
SnapshotControl
@SafeVarargs public SnapshotControl(Database database, boolean expandTypesIfNeeded, Class<? extends DatabaseObject>... types) -
SnapshotControl
Create a Snapshot control for a given database, but explicitly set the object types to be included in snapshots.- Parameters:
database
- the DBMS for which snapshots should be generatedtypes
- the list of object types to be included in the snapshot, separated by commas
-
SnapshotControl
public SnapshotControl(Database database, ObjectChangeFilter objectChangeFilter, Class<? extends DatabaseObject>... types)
-
-
Method Details
-
getSnapshotListener
-
setSnapshotListener
-
getSerializedObjectName
- Specified by:
getSerializedObjectName
in interfaceLiquibaseSerializable
-
getSerializableFields
- Specified by:
getSerializableFields
in interfaceLiquibaseSerializable
-
getSerializableFieldValue
- Specified by:
getSerializableFieldValue
in interfaceLiquibaseSerializable
-
getSerializableFieldType
- Specified by:
getSerializableFieldType
in interfaceLiquibaseSerializable
-
getSerializedObjectNamespace
- Specified by:
getSerializedObjectNamespace
in interfaceLiquibaseSerializable
-
getSerializableFieldNamespace
- Specified by:
getSerializableFieldNamespace
in interfaceLiquibaseSerializable
-
addType
Adds a new DatabaseObject type to the list of object types to be included in snapshots.- Parameters:
type
- The type to be addeddatabase
- The database to check for any dependent types that need to be included as well- Returns:
- true if the type was added to the list, false if it was already present.
-
getTypesToInclude
Return the types to be included in snapshots- Returns:
- the set of currently registered types
-
shouldInclude
Queries the currently registered list of types to be included and returns true if the given type is in that list- Parameters:
type
- the DatabaseObject type to be checked- Returns:
- true if that type is registered for inclusion, false if not
-
load
public void load(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException - Specified by:
load
in interfaceLiquibaseSerializable
- Throws:
ParsedNodeException
-
serialize
- Specified by:
serialize
in interfaceLiquibaseSerializable
-
isWarnIfObjectNotFound
public boolean isWarnIfObjectNotFound()Returns if the code should log a LogLevel.WARNING message if the object to be snapshotted could not be found.- Returns:
- true if WARNINGs should be emitted (default), false if not.
-
shouldSearchNestedObjects
public boolean shouldSearchNestedObjects()When searchNestedObjects is false this indicates to stop searching the snapshot the moment an example object has been found. With this disabled we will not search for nested objects.- Returns:
- the search nested objects configuration
-
setWarnIfObjectNotFound
Configures the code to log a LogLevel.WARNING message if the object to be snapshotted could not be found.- Parameters:
warnIfObjectNotFound
- true if a warning should emitted (default value), false if not.
-
shouldInclude
-