本文整理汇总了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;