Top Description Fields Constructors Methods
liquibase.snapshot

public Class SnapshotControl

extends Object
implements LiquibaseSerializable
Class Inheritance
All Implemented Interfaces
liquibase.serializer.LiquibaseSerializable
Imports
liquibase.database.Database, liquibase.diff.output.ObjectChangeFilter, liquibase.exception.UnexpectedLiquibaseException, liquibase.parser.core.ParsedNode, .ParsedNodeException, liquibase.resource.ResourceAccessor, liquibase.serializer.LiquibaseSerializable, liquibase.structure.DatabaseObject, liquibase.structure.core.DatabaseObjectFactory, java.util.*

Allows the class user to influence various aspects of the database object snapshot generation, e.g. what types of database objects they want.

Field Summary

Modifier and TypeField and Description
private ObjectChangeFilter
private SnapshotListener
private Set<Class<? extends DatabaseObject>>
private boolean

Constructor Summary

AccessConstructor and Description
public
SnapshotControl(Database
the DBMS for which snapshots should be generated
database
)

Create a SnapshotControl for a given database and mark the database's standard types for inclusion.

public
SnapshotControl(Database
the DBMS for which snapshots should be generated
database
,
Class<? extends DatabaseObject>...
the list of object types to be included in the snapshot
types
)

Create a Snapshot control for a given database, but explicitly set the object types to be included in snapshots.

public
SnapshotControl(Database database, boolean expandTypesIfNeeded, Class<? extends DatabaseObject>... types)

public
SnapshotControl(Database
the DBMS for which snapshots should be generated
database
,
String
the list of object types to be included in the snapshot, separated by commas
types
)

Create a Snapshot control for a given database, but explicitly set the object types to be included in snapshots.

public
SnapshotControl(Database database, ObjectChangeFilter objectChangeFilter, Class<? extends DatabaseObject>... types)

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the type was added to the list, false if it was already present.
addType
(Class<? extends DatabaseObject>
The type to be added
type
,
Database
The database to check for any dependent types that need to be included as well
database
)

Adds a new DatabaseObject type to the list of object types to be included in snapshots.

public String
public Set<String>
public LiquibaseSerializable.SerializationType
public Object
public String
public String
public SnapshotListener
public Set<Class<? extends DatabaseObject>>

Returns:

the set of currently registered types
getTypesToInclude
()

Return the types to be included in snapshots

public boolean

Returns:

true if WARNINGs should be emitted (default), false if not.
isWarnIfObjectNotFound
()

Returns if the code should log a LogLevel.WARNING message if the object to be snapshotted could not be found.

public void
public ParsedNode
public void
private void
setTypes(Set<Class<? extends DatabaseObject>> types, Database database)

public SnapshotControl
setWarnIfObjectNotFound(boolean
true if a warning should emitted (default value), false if not.
warnIfObjectNotFound
)

Configures the code to log a LogLevel.WARNING message if the object to be snapshotted could not be found.

public boolean

Returns:

true if that type is registered for inclusion, false if not
shouldInclude
(Class<? extends DatabaseObject>
the DatabaseObject type to be checked
type
)

Queries the currently registered list of types to be included and returns true if the given type is in that list

public <T extends DatabaseObject> boolean
shouldInclude(T example)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

objectChangeFilterback to summary
private ObjectChangeFilter objectChangeFilter
snapshotListenerback to summary
private SnapshotListener snapshotListener
typesback to summary
private Set<Class<? extends DatabaseObject>> types
warnIfObjectNotFoundback to summary
private boolean warnIfObjectNotFound

Constructor Detail

SnapshotControlback to summary
public SnapshotControl(Database database)

Create a SnapshotControl for a given database and mark the database's standard types for inclusion.

Parameters
database:Database

the DBMS for which snapshots should be generated

SnapshotControlback to summary
public 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.

Parameters
database:Database

the DBMS for which snapshots should be generated

types:Class<? extends DatabaseObject>[]

the list of object types to be included in the snapshot

Annotations
@SafeVarargs
SnapshotControlback to summary
public SnapshotControl(Database database, boolean expandTypesIfNeeded, Class<? extends DatabaseObject>... types)
Annotations
@SafeVarargs
SnapshotControlback to summary
public SnapshotControl(Database database, String types)

Create a Snapshot control for a given database, but explicitly set the object types to be included in snapshots.

Parameters
database:Database

the DBMS for which snapshots should be generated

types:String

the list of object types to be included in the snapshot, separated by commas

SnapshotControlback to summary
public SnapshotControl(Database database, ObjectChangeFilter objectChangeFilter, Class<? extends DatabaseObject>... types)

Method Detail

addTypeback to summary
public boolean addType(Class<? extends DatabaseObject> type, Database database)

Adds a new DatabaseObject type to the list of object types to be included in snapshots.

Parameters
type:Class<? extends DatabaseObject>

The type to be added

database:Database

The database to check for any dependent types that need to be included as well

Returns:boolean

true if the type was added to the list, false if it was already present.

getSerializableFieldNamespaceback to summary
public String getSerializableFieldNamespace(String field)

Implements liquibase.serializer.LiquibaseSerializable.getSerializableFieldNamespace.

Annotations
@Override
getSerializableFieldsback to summary
public Set<String> getSerializableFields()

Implements liquibase.serializer.LiquibaseSerializable.getSerializableFields.

Annotations
@Override
getSerializableFieldTypeback to summary
public LiquibaseSerializable.SerializationType getSerializableFieldType(String field)

Implements liquibase.serializer.LiquibaseSerializable.getSerializableFieldType.

Annotations
@Override
getSerializableFieldValueback to summary
public Object getSerializableFieldValue(String field)

Implements liquibase.serializer.LiquibaseSerializable.getSerializableFieldValue.

Annotations
@Override
getSerializedObjectNameback to summary
public String getSerializedObjectName()

Implements liquibase.serializer.LiquibaseSerializable.getSerializedObjectName.

Annotations
@Override
getSerializedObjectNamespaceback to summary
public String getSerializedObjectNamespace()

Implements liquibase.serializer.LiquibaseSerializable.getSerializedObjectNamespace.

Annotations
@Override
getSnapshotListenerback to summary
public SnapshotListener getSnapshotListener()
getTypesToIncludeback to summary
public Set<Class<? extends DatabaseObject>> getTypesToInclude()

Return the types to be included in snapshots

Returns:Set<Class<? extends DatabaseObject>>

the set of currently registered types

isWarnIfObjectNotFoundback to summary
public boolean isWarnIfObjectNotFound()

Returns if the code should log a LogLevel.WARNING message if the object to be snapshotted could not be found.

Returns:boolean

true if WARNINGs should be emitted (default), false if not.

loadback to summary
public void load(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException

Implements liquibase.serializer.LiquibaseSerializable.load.

Annotations
@Override
serializeback to summary
public ParsedNode serialize()

Implements liquibase.serializer.LiquibaseSerializable.serialize.

Annotations
@Override
setSnapshotListenerback to summary
public void setSnapshotListener(SnapshotListener snapshotListener)
setTypesback to summary
private void setTypes(Set<Class<? extends DatabaseObject>> types, Database database)
setWarnIfObjectNotFoundback to summary
public SnapshotControl setWarnIfObjectNotFound(boolean warnIfObjectNotFound)

Configures the code to log a LogLevel.WARNING message if the object to be snapshotted could not be found.

Parameters
warnIfObjectNotFound:boolean

true if a warning should emitted (default value), false if not.

shouldIncludeback to summary
public 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

Parameters
type:Class<? extends DatabaseObject>

the DatabaseObject type to be checked

Returns:boolean

true if that type is registered for inclusion, false if not

shouldIncludeback to summary
public <T extends DatabaseObject> boolean shouldInclude(T example)