ALF-7260: schema comparator

* replace path/push/pop mechanism as it doesn't work well at reporting where differences/validation errors occur.
* add getParent() to DbObject - so that a path-style identifier can be deduced for a DbObject when needed
* add DbProperty to specify a specific DbObject's property and value -- acts as a schema location pointer
* refactored Result code (need difference result and validation error result)





git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31527 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2011-10-27 18:07:06 +00:00
parent 385003c6c9
commit 723fe98cf2
37 changed files with 1022 additions and 613 deletions

View File

@@ -18,77 +18,24 @@
*/
package org.alfresco.util.schemacomp;
/**
* Result of a comparison between two database objects.
*
* Base class for the result of a differencing or validation operation.
*
* @author Matt Ward
*/
public final class Result
public class Result
{
/** Specifies the type of differences */
public enum Where { ONLY_IN_LEFT, ONLY_IN_RIGHT, IN_BOTH_NO_DIFFERENCE, IN_BOTH_BUT_DIFFERENCE };
public enum Strength { WARN, ERROR };
private final Where where;
private final Object left;
private final Object right;
private final String path;
private final Strength strength;
protected final Strength strength;
public Result(Where where, Object left, Object right, String path)
/**
* @param strength
*/
public Result(Strength strength)
{
this(where, left, right, path, null);
}
public Result(Where where, Object left, Object right, String path, Strength strength)
{
this.where = where;
this.left = left;
this.right = right;
this.path = path;
this.strength = (strength != null ? strength : Strength.ERROR);
}
/**
* @return the where
*/
public Where getWhere()
{
return this.where;
}
/**
* @return the left
*/
public Object getLeft()
{
return this.left;
}
/**
* @return the right
*/
public Object getRight()
{
return this.right;
}
/**
* @return the path
*/
public String getPath()
{
return this.path;
}
/**
* @return the strength
*/
@@ -96,13 +43,4 @@ public final class Result
{
return this.strength;
}
@Override
public String toString()
{
return "Result [where=" + this.where + ", left=" + this.left + ", right=" + this.right
+ ", path=" + this.path + ", strength=" + this.strength + "]";
}
}