當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。