ALF-11591: Externalise diff/validation messages

system-messages.properties now contains log messages and diff/validation output messages.



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32236 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2011-11-23 13:16:27 +00:00
parent 9be594eee2
commit f495a69ba9
9 changed files with 165 additions and 67 deletions

View File

@@ -18,6 +18,8 @@
*/
package org.alfresco.util.schemacomp;
import org.springframework.extensions.surf.util.I18NUtil;
/**
@@ -42,6 +44,13 @@ public final class Difference extends Result
public Difference(Where where, DbProperty left, DbProperty right, Strength strength)
{
super(null);
// Sanity check parameters
if (left == null && right == null)
{
throw new IllegalArgumentException("DbProperty parameters cannot BOTH be null.");
}
this.where = where;
this.left = left;
this.right = right;
@@ -75,37 +84,30 @@ public final class Difference extends Result
@Override
public String describe()
{
StringBuffer sb = new StringBuffer();
sb.append("Difference: ")
.append(getWhere());
sb.append(" reference path:");
if (getLeft() != null)
if (getLeft() == null)
{
sb.append(getLeft().getPath());
sb.append(" (value: ")
.append(getLeft().getPropertyValue())
.append(")");
return I18NUtil.getMessage(
"system.schema_comp.diff.target_only",
getWhere(),
getRight().getPath(),
getRight().getPropertyValue());
}
else
if (getRight() == null)
{
sb.append("null");
return I18NUtil.getMessage(
"system.schema_comp.diff.ref_only",
getWhere(),
getLeft().getPath(),
getLeft().getPropertyValue());
}
sb.append(" target path:");
if (getRight() != null)
{
sb.append(getRight().getPath());
sb.append(" (value: ")
.append(getRight().getPropertyValue())
.append(")");
}
else
{
sb.append("null");
}
return sb.toString();
return I18NUtil.getMessage(
"system.schema_comp.diff",
getWhere(),
getLeft().getPath(),
getLeft().getPropertyValue(),
getRight().getPath(),
getRight().getPropertyValue());
}
@Override