mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-10771: DiffContext is now passed around to provide the DB Dialect.
Instead of the Differences being passed around on their own, the DiffContext is able to provide more information -- at present just the Dialect. The dialect can be used to change the way database objects are validated or differenced. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31466 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -20,6 +20,7 @@ package org.alfresco.util.schemacomp;
|
||||
|
||||
import org.alfresco.util.schemacomp.Result.Strength;
|
||||
import org.alfresco.util.schemacomp.model.Schema;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
|
||||
/**
|
||||
* Compares two abstract database schemas, a 'left' schema and a 'right' schema. The left schema is the primary
|
||||
@@ -31,7 +32,7 @@ public class SchemaComparator
|
||||
{
|
||||
private final Schema leftSchema;
|
||||
private final Schema rightSchema;
|
||||
private final Differences differences = new Differences();
|
||||
private final DiffContext ctx;
|
||||
|
||||
/**
|
||||
* Construct a comparator to compare schemas left and right.
|
||||
@@ -39,17 +40,18 @@ public class SchemaComparator
|
||||
* @param left
|
||||
* @param right
|
||||
*/
|
||||
public SchemaComparator(Schema left, Schema right)
|
||||
public SchemaComparator(Schema left, Schema right, Dialect dialect)
|
||||
{
|
||||
this.leftSchema = left;
|
||||
this.rightSchema = right;
|
||||
this.ctx = new DiffContext(dialect, new Differences());
|
||||
}
|
||||
|
||||
|
||||
public void compare()
|
||||
{
|
||||
// Check the left schema against the right schema and record any differences.
|
||||
leftSchema.diff(rightSchema, differences, Strength.ERROR);
|
||||
leftSchema.diff(rightSchema, ctx, Strength.ERROR);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +60,6 @@ public class SchemaComparator
|
||||
*/
|
||||
public Differences getDifferences()
|
||||
{
|
||||
return this.differences;
|
||||
return this.ctx.getDifferences();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user