Package liquibase.snapshot
Class DatabaseSnapshot
java.lang.Object
liquibase.snapshot.DatabaseSnapshot
- All Implemented Interfaces:
LiquibaseSerializable
- Direct Known Subclasses:
EmptyDatabaseSnapshot
,JdbcDatabaseSnapshot
,RestoredDatabaseSnapshot
-
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
-
Method Summary
Modifier and TypeMethodDescriptionclone
(DatabaseObject[] examples) Searches the current snapshot content for the given examples.protected SnapshotGeneratorChain
createGeneratorChain
(Class<? extends DatabaseObject> databaseObjectType, Database database) <DatabaseObjectType extends DatabaseObject>
DatabaseObjectTypeget
(DatabaseObjectType example) Returns the object described by the passed example if it is already included in this snapshot.<DatabaseObjectType extends DatabaseObject>
Set<DatabaseObjectType>Returns all objects of the given type that are already included in this snapshot.getResultSetCache
(String key) getScratchData
(String key) Used to get and store misc data that should be scoped to the snapshot.getSerializableFieldType
(String field) getSerializableFieldValue
(String field) protected <T extends DatabaseObject>
Tinclude
(T example) Include the object described by the passed example object in this snapshot.protected void
init
(DatabaseObject[] examples) protected boolean
isWrongCatalog
(DatabaseObject fieldValue) protected boolean
isWrongSchema
(DatabaseObject fieldValue) void
load
(ParsedNode parsedNode, ResourceAccessor resourceAccessor) protected void
loadObjects
(Map<String, DatabaseObject> objectMap, Map<String, DatabaseObject> allObjects, ParsedNode node, ResourceAccessor resourceAccessor) merge
(DatabaseSnapshot snapshotToMerge) Method which merges two object snapshot models into onesetScratchData
(String key, Object data)
-
Field Details
-
ALL_CATALOGS_STRING_SCRATCH_KEY
- See Also:
-
-
Constructor Details
-
DatabaseSnapshot
public DatabaseSnapshot(DatabaseObject[] examples, Database database) throws DatabaseException, InvalidExampleException
-
-
Method Details
-
init
-
clone
Searches the current snapshot content for the given examples. Returns a new DatabaseSnapshot containing a clone of every object from the examples array that was found.- Parameters:
examples
- The array of snapshot objects to search and clone- Returns:
- a new DatabaseSnapshot object with the clones of the desired objects. If no object is found, an empty DatabaseSnapshot will be returned.
-
merge
Method which merges two object snapshot models into one- Parameters:
snapshotToMerge
- Another object snapshot model- Returns:
- DatabaseSnapshot Merged object model
-
getSnapshotControl
-
getSerializedObjectName
- Specified by:
getSerializedObjectName
in interfaceLiquibaseSerializable
-
getSerializedObjectNamespace
- Specified by:
getSerializedObjectNamespace
in interfaceLiquibaseSerializable
-
getSerializableFieldNamespace
- Specified by:
getSerializableFieldNamespace
in interfaceLiquibaseSerializable
-
getSerializableFields
- Specified by:
getSerializableFields
in interfaceLiquibaseSerializable
-
getSerializableFieldValue
- Specified by:
getSerializableFieldValue
in interfaceLiquibaseSerializable
-
getSerializableFieldType
- Specified by:
getSerializableFieldType
in interfaceLiquibaseSerializable
-
getDatabase
-
getResultSetCache
-
include
protected <T extends DatabaseObject> T include(T example) throws DatabaseException, InvalidExampleException Include the object described by the passed example object in this snapshot. Returns the object snapshot or null if the object does not exist in the database. If the same object was returned by an earlier include() call, the same object instance will be returned. -
isWrongSchema
-
isWrongCatalog
-
get
public <DatabaseObjectType extends DatabaseObject> DatabaseObjectType get(DatabaseObjectType example) Returns the object described by the passed example if it is already included in this snapshot. -
get
public <DatabaseObjectType extends DatabaseObject> Set<DatabaseObjectType> get(Class<DatabaseObjectType> type) Returns all objects of the given type that are already included in this snapshot. -
createGeneratorChain
protected SnapshotGeneratorChain createGeneratorChain(Class<? extends DatabaseObject> databaseObjectType, Database database) -
load
public void load(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException - Specified by:
load
in interfaceLiquibaseSerializable
- Throws:
ParsedNodeException
-
loadObjects
protected void loadObjects(Map<String, DatabaseObject> objectMap, Map<String, throws ReflectiveOperationException, ParsedNodeExceptionDatabaseObject> allObjects, ParsedNode node, ResourceAccessor resourceAccessor) -
serialize
- Specified by:
serialize
in interfaceLiquibaseSerializable
-
getScratchData
Used to get and store misc data that should be scoped to the snapshot. Helpful for caching snapshot results. -
setScratchData
-