本文整理匯總了Java中liquibase.exception.PreconditionErrorException類的典型用法代碼示例。如果您正苦於以下問題:Java PreconditionErrorException類的具體用法?Java PreconditionErrorException怎麽用?Java PreconditionErrorException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PreconditionErrorException類屬於liquibase.exception包,在下文中一共展示了PreconditionErrorException類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: check
import liquibase.exception.PreconditionErrorException; //導入依賴的package包/類
public void check(Database database, DatabaseChangeLog changeLog, ChangeSet changeSet) throws PreconditionFailedException, PreconditionErrorException {
boolean allPassed = true;
List<FailedPrecondition> failures = new ArrayList<FailedPrecondition>();
for (Precondition precondition : getNestedPreconditions()) {
try {
precondition.check(database, changeLog, changeSet);
} catch (PreconditionFailedException e) {
failures.addAll(e.getFailedPreconditions());
allPassed = false;
break;
}
}
if (!allPassed) {
throw new PreconditionFailedException(failures);
}
}
示例2: check
import liquibase.exception.PreconditionErrorException; //導入依賴的package包/類
public void check(Database database, DatabaseChangeLog changeLog, ChangeSet changeSet) throws PreconditionFailedException, PreconditionErrorException {
boolean onePassed = false;
List<FailedPrecondition> failures = new ArrayList<FailedPrecondition>();
for (Precondition precondition : getNestedPreconditions()) {
try {
precondition.check(database, changeLog, changeSet);
onePassed = true;
break;
} catch (PreconditionFailedException e) {
failures.addAll(e.getFailedPreconditions());
}
}
if (!onePassed) {
throw new PreconditionFailedException(failures);
}
}
示例3: check
import liquibase.exception.PreconditionErrorException; //導入依賴的package包/類
public void check(Database database, DatabaseChangeLog changeLog, ChangeSet changeSet) throws PreconditionFailedException, PreconditionErrorException {
for (Precondition precondition : getNestedPreconditions()) {
boolean threwException = false;
try {
precondition.check(database, changeLog, changeSet);
} catch (PreconditionFailedException e) {
; //that's what we want with a Not precondition
threwException = true;
}
if (!threwException) {
throw new PreconditionFailedException("Not precondition failed", changeLog, this);
}
}
}
示例4: check
import liquibase.exception.PreconditionErrorException; //導入依賴的package包/類
public void check(Database database, DatabaseChangeLog changeLog, ChangeSet changeSet) throws PreconditionFailedException, PreconditionErrorException {
String loggedusername = database.getConnection().getConnectionUserName();
if (loggedusername.indexOf('@') >= 0) {
loggedusername = loggedusername.substring(0, loggedusername.indexOf('@'));
}
if (!username.equalsIgnoreCase(loggedusername)) {
throw new PreconditionFailedException("RunningAs Precondition failed: expected "+username+", was "+loggedusername, changeLog, this);
}
}
示例5: check
import liquibase.exception.PreconditionErrorException; //導入依賴的package包/類
public void check(Database database, DatabaseChangeLog changeLog, ChangeSet changeSet) throws PreconditionFailedException, PreconditionErrorException {
ChangeLogParameters changeLogParameters = changeLog.getChangeLogParameters();
if (changeLogParameters == null) {
throw new PreconditionFailedException("No Changelog properties were set", changeLog, this);
}
Object propertyValue = changeLogParameters.getValue(property);
if (propertyValue == null) {
throw new PreconditionFailedException("Changelog property '"+ property +"' was not set", changeLog, this);
}
if (value != null && !propertyValue.toString().equals(value)) {
throw new PreconditionFailedException("Expected changelog property '"+ property +"' to have a value of '"+value+"'. Got '"+propertyValue+"'", changeLog, this);
}
}
示例6: check
import liquibase.exception.PreconditionErrorException; //導入依賴的package包/類
public void check(Database database, DatabaseChangeLog changeLog, ChangeSet changeSet) throws PreconditionFailedException, PreconditionErrorException {
ChangeSet interestedChangeSet = new ChangeSet(getId(), getAuthor(), false, false, getChangeLogFile(), null, null, false);
RanChangeSet ranChangeSet;
try {
ranChangeSet = database.getRanChangeSet(interestedChangeSet);
} catch (Exception e) {
throw new PreconditionErrorException(e, changeLog, this);
}
if (ranChangeSet == null || ranChangeSet.getExecType() == null || !ranChangeSet.getExecType().ran) {
throw new PreconditionFailedException("Change Set '"+interestedChangeSet.toString(false)+"' has not been run", changeLog, this);
}
}
示例7: check
import liquibase.exception.PreconditionErrorException; //導入依賴的package包/類
public void check( Database database, DatabaseChangeLog changeLog, ChangeSet changeSet ) throws PreconditionFailedException, PreconditionErrorException {
if ( ! check( database ) ) {
throw new PreconditionFailedException( String.format( "The view '%s.%s' was not found.", database.getLiquibaseSchemaName(), getViewName() ), changeLog, this );
}
}
開發者ID:mrswadge,項目名稱:liquibase-oracle-preconditions,代碼行數:6,代碼來源:OracleMaterializedViewExistsPrecondition.java
示例8: check
import liquibase.exception.PreconditionErrorException; //導入依賴的package包/類
public void check(Database database, DatabaseChangeLog changeLog, ChangeSet changeSet) throws PreconditionFailedException, PreconditionErrorException;