Class ChangeLogParameters
DatabaseChangeLog
.
In general, the end behavior of defined parameters is "the first set value wins". For example, if you set a parameter "x" to "1" and then set it to "2", the value will remain "1". This immutable property behavior allows users to easily set default values, knowing that any "upstream" overrides will take priority.
In determining which property value is actually "first set", context, label, and dbms filtering is taken into account.
Properties can be defined as "system", "global" or "local". Global and system properties span all change logs. A global setting configured in an included changelog is still available to all changesets. System properties such as environment variables are set up to not be filterable. This implies that they will ignore any label, context or dbms filters that are requested on the given execution. This is different from globals set up inside a changelog which can and will be filtered if they have a label, context or dbms associated with the property.
Local properties are only available in the change log that they are defined in -- not even in changelogs "included" by the file that defines the property.
-
Constructor Summary
ConstructorDescriptionCallsChangeLogParameters(Database)
with a null database.ChangeLogParameters
(Database database) Creates a new ChangeLogParameters instance, populated with a set of "database.*" global parameters based on the passed database configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add default-file properties to changelog parametersvoid
Add java property arguments to changelog parametersexpandExpressions
(String string, DatabaseChangeLog changeLog) Expand any expressions in the given string, taking into account parameters local to the given changelog file as well as contexts, labels, and database configured in this instance.Gets the contexts to filter calls togetValue(String, DatabaseChangeLog)
etc. with.Sets the database to filter calls togetValue(String, DatabaseChangeLog)
etc. with.Gets the labels to filter calls togetValue(String, DatabaseChangeLog)
etc. with.getValue
(String key, DatabaseChangeLog changeLog) Get the value of the given parameter, taking into account parameters local to the given changelog file and values configured ingetContexts()
andgetLabels()
and the database.boolean
hasValue
(String key, DatabaseChangeLog changeLog) Return whether the given parameters is defined, taking into account parameters local to the given changelog file as well as contexts, labels, and database configured on this instancevoid
Sets a global changelog parameter with no context/label/database filters on it.void
set
(String key, Object value, String contexts, String labels, String databases, boolean globalParam, DatabaseChangeLog changeLog) Convenience version ofset(String, Object, ContextExpression, Labels, String, boolean, DatabaseChangeLog)
.void
Sets a global changelog parameter.void
set
(String key, Object value, ContextExpression contexts, Labels labels, String databases, boolean globalParam, DatabaseChangeLog changeLog) Calls eitherset(String, Object, ContextExpression, Labels, String...)
orsetLocal(String, Object, DatabaseChangeLog, ContextExpression, Labels, String...)
depending on the value of globalParam.void
setContexts
(Contexts contexts) Sets the contexts to filter calls togetValue(String, DatabaseChangeLog)
etc. with.void
setDatabase
(String filterDatabase) Sets the database to filter calls togetValue(String, DatabaseChangeLog)
etc. with.void
setLabels
(LabelExpression labels) Sets the labels to filter calls togetValue(String, DatabaseChangeLog)
etc. with.void
setLocal
(String parameter, Object value, DatabaseChangeLog changeLog) Sets a local changelog parameter with no context/label/database filters on it.void
setLocal
(String key, Object value, DatabaseChangeLog changeLog, ContextExpression contexts, Labels labels, String... databases) Sets a changelog parameter local to the given changeLog file.
-
Constructor Details
-
ChangeLogParameters
public ChangeLogParameters()CallsChangeLogParameters(Database)
with a null database. -
ChangeLogParameters
Creates a new ChangeLogParameters instance, populated with a set of "database.*" global parameters based on the passed database configuration. If the database is null, no global parameters are added.The passed database is used as a default value for
getDatabase()
-
-
Method Details
-
set
Sets a global changelog parameter with no context/label/database filters on it. Convenience version ofset(String, Object, ContextExpression, Labels, String...)
. -
setLocal
Sets a local changelog parameter with no context/label/database filters on it. Convenience version ofsetLocal(String, Object, DatabaseChangeLog, ContextExpression, Labels, String...)
. -
set
public void set(String key, Object value, ContextExpression contexts, Labels labels, String databases, boolean globalParam, DatabaseChangeLog changeLog) Calls eitherset(String, Object, ContextExpression, Labels, String...)
orsetLocal(String, Object, DatabaseChangeLog, ContextExpression, Labels, String...)
depending on the value of globalParam. -
set
public void set(String key, Object value, String contexts, String labels, String databases, boolean globalParam, DatabaseChangeLog changeLog) Convenience version ofset(String, Object, ContextExpression, Labels, String, boolean, DatabaseChangeLog)
. -
set
public void set(String key, Object value, ContextExpression contexts, Labels labels, String... databases) Sets a global changelog parameter. Just because you call this with a particular key, does not mean it will override the existing value. See the class description for more details on how values act as if they are immutable. -
setLocal
public void setLocal(String key, Object value, DatabaseChangeLog changeLog, ContextExpression contexts, Labels labels, String... databases) Sets a changelog parameter local to the given changeLog file. Just because you call this with a particular key, does not mean it will override the existing value. See the class description for more details on how values act as if they are immutable.- Parameters:
changeLog
- required for local parameters, ignored for global parameters
-
getValue
Get the value of the given parameter, taking into account parameters local to the given changelog file and values configured ingetContexts()
andgetLabels()
and the database. -
hasValue
Return whether the given parameters is defined, taking into account parameters local to the given changelog file as well as contexts, labels, and database configured on this instance -
expandExpressions
public String expandExpressions(String string, DatabaseChangeLog changeLog) throws UnknownChangeLogParameterException Expand any expressions in the given string, taking into account parameters local to the given changelog file as well as contexts, labels, and database configured in this instance. -
getContexts
Gets the contexts to filter calls togetValue(String, DatabaseChangeLog)
etc. with. -
setContexts
Sets the contexts to filter calls togetValue(String, DatabaseChangeLog)
etc. with. -
getLabels
Gets the labels to filter calls togetValue(String, DatabaseChangeLog)
etc. with. -
setLabels
Sets the labels to filter calls togetValue(String, DatabaseChangeLog)
etc. with. -
getDatabase
Sets the database to filter calls togetValue(String, DatabaseChangeLog)
etc. with. -
setDatabase
Sets the database to filter calls togetValue(String, DatabaseChangeLog)
etc. with. -
addJavaProperties
public void addJavaProperties()Add java property arguments to changelog parameters -
addDefaultFileProperties
public void addDefaultFileProperties()Add default-file properties to changelog parameters
-