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:
Matt Ward
2011-10-25 16:03:31 +00:00
parent 4ef52e4e72
commit 9b4cd0ab0e
23 changed files with 183 additions and 76 deletions

View File

@@ -55,8 +55,9 @@ public class DefaultComparisonUtils implements ComparisonUtils
@Override
public void compareSimpleCollections(Collection<? extends Object> leftCollection,
Collection<? extends Object> rightCollection, Differences differences, Strength strength)
Collection<? extends Object> rightCollection, DiffContext ctx, Strength strength)
{
Differences differences = ctx.getDifferences();
for (Object leftObj : leftCollection)
{
if (rightCollection.contains(leftObj))
@@ -92,9 +93,9 @@ public class DefaultComparisonUtils implements ComparisonUtils
*/
@Override
public void compareCollections(Collection<? extends DbObject> leftCollection,
Collection<? extends DbObject> rightCollection, Differences differences)
Collection<? extends DbObject> rightCollection, DiffContext ctx)
{
compareCollections(leftCollection, rightCollection, differences, null);
compareCollections(leftCollection, rightCollection, ctx, null);
}
/**
@@ -108,8 +109,9 @@ public class DefaultComparisonUtils implements ComparisonUtils
*/
@Override
public void compareCollections(Collection<? extends DbObject> leftCollection,
Collection<? extends DbObject> rightCollection, Differences differences, Strength strength)
Collection<? extends DbObject> rightCollection, DiffContext ctx, Strength strength)
{
Differences differences = ctx.getDifferences();
for (DbObject leftObj : leftCollection)
{
DbObject rightObj = findSameObjectAs(rightCollection, leftObj);
@@ -118,7 +120,7 @@ public class DefaultComparisonUtils implements ComparisonUtils
{
// There is an equivalent object in the right hand collection as
// in the left.
leftObj.diff(rightObj, differences, strength);
leftObj.diff(rightObj, ctx, strength);
}
else
{
@@ -144,9 +146,9 @@ public class DefaultComparisonUtils implements ComparisonUtils
* @see #compareSimple(Object, Object, Differences, Strength)
*/
@Override
public void compareSimple(Object left, Object right, Differences differences)
public void compareSimple(Object left, Object right, DiffContext ctx)
{
compareSimple(left, right, differences, null);
compareSimple(left, right, ctx, null);
}
/**
@@ -159,7 +161,7 @@ public class DefaultComparisonUtils implements ComparisonUtils
* @param strength
*/
@Override
public void compareSimple(Object left, Object right, Differences differences, Strength strength)
public void compareSimple(Object left, Object right, DiffContext ctx, Strength strength)
{
Where where = null;
@@ -192,6 +194,6 @@ public class DefaultComparisonUtils implements ComparisonUtils
}
}
differences.add(where, left, right, strength);
ctx.getDifferences().add(where, left, right, strength);
}
}