Search in sources :

Example 1 with DatabaseObjectComparatorFactory

use of liquibase.diff.compare.DatabaseObjectComparatorFactory in project liquibase by liquibase.

the class DiffResult method getChangedObject.

public ObjectDifferences getChangedObject(DatabaseObject example, CompareControl.SchemaComparison[] schemaComparisons) {
    Database accordingTo = this.getComparisonSnapshot().getDatabase();
    DatabaseObjectComparatorFactory comparator = DatabaseObjectComparatorFactory.getInstance();
    for (Map.Entry<? extends DatabaseObject, ObjectDifferences> entry : getChangedObjects(example.getClass()).entrySet()) {
        if (comparator.isSameObject(entry.getKey(), example, schemaComparisons, accordingTo)) {
            return entry.getValue();
        }
    }
    return null;
}
Also used : Database(liquibase.database.Database) DatabaseObjectComparatorFactory(liquibase.diff.compare.DatabaseObjectComparatorFactory)

Example 2 with DatabaseObjectComparatorFactory

use of liquibase.diff.compare.DatabaseObjectComparatorFactory in project liquibase by liquibase.

the class DiffResult method getUnexpectedObject.

public <T extends DatabaseObject> T getUnexpectedObject(T example, CompareControl.SchemaComparison[] schemaComparisons) {
    Database accordingTo = this.getComparisonSnapshot().getDatabase();
    DatabaseObjectComparatorFactory comparator = DatabaseObjectComparatorFactory.getInstance();
    for (T obj : (Set<T>) getUnexpectedObjects(example.getClass())) {
        if (comparator.isSameObject(obj, example, schemaComparisons, accordingTo)) {
            return obj;
        }
    }
    return null;
}
Also used : Database(liquibase.database.Database) DatabaseObjectComparatorFactory(liquibase.diff.compare.DatabaseObjectComparatorFactory)

Example 3 with DatabaseObjectComparatorFactory

use of liquibase.diff.compare.DatabaseObjectComparatorFactory in project liquibase by liquibase.

the class DiffResult method getMissingObject.

public <T extends DatabaseObject> T getMissingObject(T example, CompareControl.SchemaComparison[] schemaComparisons) {
    Database accordingTo = getComparisonSnapshot().getDatabase();
    DatabaseObjectComparatorFactory comparator = DatabaseObjectComparatorFactory.getInstance();
    for (T obj : (Set<T>) getMissingObjects(example.getClass())) {
        if (comparator.isSameObject(obj, example, schemaComparisons, accordingTo)) {
            return obj;
        }
    }
    return null;
}
Also used : Database(liquibase.database.Database) DatabaseObjectComparatorFactory(liquibase.diff.compare.DatabaseObjectComparatorFactory)

Aggregations

Database (liquibase.database.Database)3 DatabaseObjectComparatorFactory (liquibase.diff.compare.DatabaseObjectComparatorFactory)3