use of liquibase.precondition.FailedPrecondition in project liquibase by liquibase.
the class OrPrecondition method check.
@Override
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);
}
}
use of liquibase.precondition.FailedPrecondition in project liquibase by liquibase.
the class OrPrecondition method check.
@Override
public void check(Database database, DatabaseChangeLog changeLog, ChangeSet changeSet, ChangeExecListener changeExecListener) throws PreconditionFailedException, PreconditionErrorException {
boolean onePassed = false;
List<FailedPrecondition> failures = new ArrayList<>();
for (Precondition precondition : getNestedPreconditions()) {
try {
precondition.check(database, changeLog, changeSet, changeExecListener);
onePassed = true;
break;
} catch (PreconditionFailedException e) {
failures.addAll(e.getFailedPreconditions());
}
}
if (!onePassed) {
throw new PreconditionFailedException(failures);
}
}
use of liquibase.precondition.FailedPrecondition in project liquibase by liquibase.
the class AndPrecondition method check.
@Override
public void check(Database database, DatabaseChangeLog changeLog, ChangeSet changeSet, ChangeExecListener changeExecListener) throws PreconditionFailedException, PreconditionErrorException {
boolean allPassed = true;
List<FailedPrecondition> failures = new ArrayList<>();
for (Precondition precondition : getNestedPreconditions()) {
try {
precondition.check(database, changeLog, changeSet, changeExecListener);
} catch (PreconditionFailedException e) {
failures.addAll(e.getFailedPreconditions());
allPassed = false;
break;
}
}
if (!allPassed) {
throw new PreconditionFailedException(failures);
}
}
Aggregations