当前位置: 首页>>代码示例>>Java>>正文


Java PreconditionErrorException类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:17,代码来源:AndPrecondition.java

示例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);
    }
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:17,代码来源:OrPrecondition.java

示例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);
        }
    }
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:16,代码来源:NotPrecondition.java

示例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);
    }
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:10,代码来源:RunningAsPrecondition.java

示例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);
    }
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:14,代码来源:ChangeLogPropertyDefinedPrecondition.java

示例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);
    }
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:13,代码来源:ChangeSetExecutedPrecondition.java

示例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; 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:2,代码来源:Precondition.java


注:本文中的liquibase.exception.PreconditionErrorException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。