All Downloads are FREE. Search and download functionalities are using the official Maven repository.

liquibase.changelog.visitor.ExpectedChangesVisitor Maven / Gradle / Ivy

There is a newer version: 3.6.2.5.inovus
Show newest version
package liquibase.changelog.visitor;

import liquibase.changelog.ChangeSet;
import liquibase.changelog.DatabaseChangeLog;
import liquibase.changelog.RanChangeSet;
import liquibase.changelog.filter.ChangeSetFilterResult;
import liquibase.database.Database;
import liquibase.exception.LiquibaseException;

import java.util.*;

public class ExpectedChangesVisitor implements ChangeSetVisitor {
    private final LinkedHashSet unexpectedChangeSets;

    public ExpectedChangesVisitor(List ranChangeSetList) {
        this.unexpectedChangeSets = new LinkedHashSet<>(ranChangeSetList);
    }

    @Override
    public Direction getDirection() {
        return ChangeSetVisitor.Direction.FORWARD;
    }

    @Override
    public void visit(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database, Set filterResults) throws LiquibaseException {
        for (Iterator i = unexpectedChangeSets.iterator(); i.hasNext(); ) {
            RanChangeSet ranChangeSet = i.next();
            if (ranChangeSet.isSameAs(changeSet)) {
                i.remove();
            }
        }
    }

    public Collection getUnexpectedChangeSets() {
        return unexpectedChangeSets;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy