Class LiquibaseRunnerContext


  • public class LiquibaseRunnerContext
    extends java.lang.Object
    Static context holder for shared data during a liquibase run. This class offers a static API so that filters instantiated by liquibase can access its state.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.sql.Connection getConnection()  
      static boolean isAcceptSnapshotVersion()  
      static boolean isAcceptUnstableVersion()  
      static boolean isEmptyDb()  
      static boolean isLiquibaseNeverRan()  
      static java.lang.String pluginLastRunScriptType​(java.lang.String pluginName)
      Looks the type of the last run script (create/init or update) in the DB.
      static fr.paris.lutece.utils.sql.PluginVersion pluginVersion​(java.lang.String pluginName)
      Looks the the plugin version in the DB.
      static void setPluginLastRunScriptType​(java.lang.String pluginName, java.lang.String strLastRunTypeScript)
      Sets the type of the last run script (create/init or update) in the datastore (later, when all SQL files have been executed)
      static void setPluginVersion​(java.lang.String pluginName, java.lang.String version)
      Sets the plugin version in the datastore (later, when all SQL files have been executed)
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LAST_RUN_SCRIPT_TYPE_CREATE

        public static final java.lang.String LAST_RUN_SCRIPT_TYPE_CREATE
        Last run script type (create/init)
        See Also:
        Constant Field Values
      • LAST_RUN_SCRIPT_TYPE_UPDATE

        public static final java.lang.String LAST_RUN_SCRIPT_TYPE_UPDATE
        Last run script type (update)
        See Also:
        Constant Field Values
    • Constructor Detail

      • LiquibaseRunnerContext

        public LiquibaseRunnerContext()
    • Method Detail

      • isEmptyDb

        public static boolean isEmptyDb()
      • isLiquibaseNeverRan

        public static boolean isLiquibaseNeverRan()
      • isAcceptSnapshotVersion

        public static boolean isAcceptSnapshotVersion()
      • isAcceptUnstableVersion

        public static boolean isAcceptUnstableVersion()
      • getConnection

        public static java.sql.Connection getConnection()
      • pluginVersion

        public static fr.paris.lutece.utils.sql.PluginVersion pluginVersion​(java.lang.String pluginName)
                                                                     throws java.sql.SQLException
        Looks the the plugin version in the DB. "core" is a special case and always has a version : Integer.MAX_VALUE if no true version can be found, which is newer than all other versions and ensures that no attempt to run any core scripts is attempted when running liquibase for the first time on a existing DB.
        Parameters:
        pluginName - a name such as 'forms'
        Returns:
        the version as a string (for example "1.0.1"), or null if not found
        Throws:
        java.sql.SQLException
      • pluginLastRunScriptType

        public static java.lang.String pluginLastRunScriptType​(java.lang.String pluginName)
        Looks the type of the last run script (create/init or update) in the DB.
        Parameters:
        pluginName - a name such as 'forms'
        Returns:
        the type of the last run script as a string ("create/init" or "update"), or null if not found
        Throws:
        java.sql.SQLException
      • setPluginVersion

        public static void setPluginVersion​(java.lang.String pluginName,
                                            java.lang.String version)
        Sets the plugin version in the datastore (later, when all SQL files have been executed)
        Parameters:
        pluginName -
        version -
      • setPluginLastRunScriptType

        public static void setPluginLastRunScriptType​(java.lang.String pluginName,
                                                      java.lang.String strLastRunTypeScript)
        Sets the type of the last run script (create/init or update) in the datastore (later, when all SQL files have been executed)
        Parameters:
        pluginName -
        version -