本文整理匯總了Java中liquibase.changelog.ChangeLogHistoryService類的典型用法代碼示例。如果您正苦於以下問題:Java ChangeLogHistoryService類的具體用法?Java ChangeLogHistoryService怎麽用?Java ChangeLogHistoryService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ChangeLogHistoryService類屬於liquibase.changelog包,在下文中一共展示了ChangeLogHistoryService類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: shouldUpdate
import liquibase.changelog.ChangeLogHistoryService; //導入依賴的package包/類
/**
* Returns {@code true} if the supplied {@link Liquibase} instance
* should in fact have its {@link Liquibase#update(String)} method
* called.
*
* <p>This implementation returns {@code true} if the {@code
* liquibase.should.run} system property is non-{@code null} and set
* to something other than {@code false} and if the supplied {@link
* Liquibase} instance is non-{@code null} and {@linkplain
* StandardChangeLogHistoryService#hasDatabaseChangeLogTable() is
* connected to a database that does not yet have a
* <code>DATABASECHANGELOG</code> table} in it.</p>
*
* @param liquibase the {@link Liquibase} instance to check; may be
* {@code null} in which case {@code false} will be returned
*
* @return {@code true} if the supplied {@link Liquibase} instance
* should in fact have its {@link Liquibase#update(String)} method
* called
*
* @exception LiquibaseException if there was a Liquibase-related
* error
*
* @exception SQLException if there was a database-related error
*
* @see Liquibase#update(String)
*/
protected boolean shouldUpdate(final Liquibase liquibase) throws LiquibaseException, SQLException {
this.logger.debug("Entering shouldUpdate(Liquibase); parameters: liquibase = " + liquibase);
boolean returnValue = liquibase != null && !"false".equals(System.getProperty("liquibase.should.run"));
if (returnValue) {
final Database database = liquibase.getDatabase();
if (database != null) {
final ChangeLogHistoryService changeLogHistoryService = ChangeLogHistoryServiceFactory.getInstance().getChangeLogService(database);
returnValue = !(changeLogHistoryService instanceof StandardChangeLogHistoryService) || !((StandardChangeLogHistoryService)changeLogHistoryService).hasDatabaseChangeLogTable();
}
}
this.logger.debug("Exiting shouldUpdate(Liquibase); returning: " + returnValue);
return returnValue;
}