mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
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:
@@ -17,6 +17,22 @@ system.config_check.err.fix_dir_root=Ensure that the ''dir.root'' property is po
|
|||||||
system.config_check.msg.howto_index_recover=You may set 'index.recovery.mode=FULL' if you need to rebuild the indexes.
|
system.config_check.msg.howto_index_recover=You may set 'index.recovery.mode=FULL' if you need to rebuild the indexes.
|
||||||
system.config_check.warn.starting_with_errors=Alfresco is starting with errors.
|
system.config_check.warn.starting_with_errors=Alfresco is starting with errors.
|
||||||
|
|
||||||
|
# Schema comparator messages
|
||||||
|
# Log messages...
|
||||||
|
system.schema_comp.debug.no_ref_file=No reference schema file, expected: {0}
|
||||||
|
system.schema_comp.debug.time_taken=Schema validation took {0} ms
|
||||||
|
system.schema_comp.info.all_ok=Compared database schema with reference schema (all OK): {0}
|
||||||
|
system.schema_comp.warn.problems_found=Schema validation found {0} potential problems, results written to: {1}
|
||||||
|
# Generic differencing, validation and redundancy messages...
|
||||||
|
system.schema_comp.diff=Difference: {0}, reference path:{1} (value: {2}), target path:{3} (value: {4})
|
||||||
|
system.schema_comp.diff.ref_only=Difference: {0}, reference path:{1} (value: {2})
|
||||||
|
system.schema_comp.diff.target_only=Difference: {0}, target path:{1} (value: {2})
|
||||||
|
system.schema_comp.redundant_obj={0} redundant items? reference: {1}, matches: {2}
|
||||||
|
system.schema_comp.redundant_obj.many_matches={0} redundant items? reference: {1}, matches: {2} and {3} more...
|
||||||
|
system.schema_comp.validation=Validation: target path:{0} (value: {1}, rule: {2})
|
||||||
|
# Specific validator (implementations) messages...
|
||||||
|
system.schema_comp.name_validator=name must match pattern ''{0}''
|
||||||
|
|
||||||
# OpenOffice
|
# OpenOffice
|
||||||
system.openoffice.info.connection_verified=The connection to OpenOffice has been established.
|
system.openoffice.info.connection_verified=The connection to OpenOffice has been established.
|
||||||
system.openoffice.err.connection_failed=An initial OpenOffice connection could not be established.
|
system.openoffice.err.connection_failed=An initial OpenOffice connection could not be established.
|
||||||
|
@@ -154,11 +154,19 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
|||||||
private static final String ERR_STATEMENT_VAR_ASSIGNMENT_BEFORE_SQL = "schema.update.err.statement_var_assignment_before_sql";
|
private static final String ERR_STATEMENT_VAR_ASSIGNMENT_BEFORE_SQL = "schema.update.err.statement_var_assignment_before_sql";
|
||||||
private static final String ERR_STATEMENT_VAR_ASSIGNMENT_FORMAT = "schema.update.err.statement_var_assignment_format";
|
private static final String ERR_STATEMENT_VAR_ASSIGNMENT_FORMAT = "schema.update.err.statement_var_assignment_format";
|
||||||
private static final String ERR_STATEMENT_TERMINATOR = "schema.update.err.statement_terminator";
|
private static final String ERR_STATEMENT_TERMINATOR = "schema.update.err.statement_terminator";
|
||||||
|
private static final String DEBUG_SCHEMA_COMP_NO_REF_FILE = "system.schema_comp.debug.no_ref_file";
|
||||||
|
private static final String INFO_SCHEMA_COMP_ALL_OK = "system.schema_comp.info.all_ok";
|
||||||
|
private static final String WARN_SCHEMA_COMP_PROBLEMS_FOUND = "system.schema_comp.warn.problems_found";
|
||||||
|
private static final String DEBUG_SCHEMA_COMP_TIME_TAKEN = "system.schema_comp.debug.time_taken";
|
||||||
|
|
||||||
public static final int DEFAULT_LOCK_RETRY_COUNT = 24;
|
public static final int DEFAULT_LOCK_RETRY_COUNT = 24;
|
||||||
public static final int DEFAULT_LOCK_RETRY_WAIT_SECONDS = 5;
|
public static final int DEFAULT_LOCK_RETRY_WAIT_SECONDS = 5;
|
||||||
|
|
||||||
public static final int DEFAULT_MAX_STRING_LENGTH = 1024;
|
public static final int DEFAULT_MAX_STRING_LENGTH = 1024;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static volatile int maxStringLength = DEFAULT_MAX_STRING_LENGTH;
|
private static volatile int maxStringLength = DEFAULT_MAX_STRING_LENGTH;
|
||||||
private Dialect dialect;
|
private Dialect dialect;
|
||||||
|
|
||||||
@@ -1638,7 +1646,8 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
|||||||
Resource referenceResource = getDialectResource(dialect.getClass(), schemaReferenceUrl);
|
Resource referenceResource = getDialectResource(dialect.getClass(), schemaReferenceUrl);
|
||||||
if (referenceResource == null || !referenceResource.exists())
|
if (referenceResource == null || !referenceResource.exists())
|
||||||
{
|
{
|
||||||
logger.debug("No reference schema file, expected: " + referenceResource);
|
String resourceUrl = schemaReferenceUrl.replaceAll(PLACEHOLDER_DIALECT, dialect.getClass().getName());
|
||||||
|
LogUtil.debug(logger, DEBUG_SCHEMA_COMP_NO_REF_FILE, resourceUrl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1697,18 +1706,16 @@ public class SchemaBootstrap extends AbstractLifecycleBean
|
|||||||
|
|
||||||
if (results.size() == 0)
|
if (results.size() == 0)
|
||||||
{
|
{
|
||||||
logger.info("Compared database schema with reference schema (all OK): " + referenceResource);
|
LogUtil.info(logger, INFO_SCHEMA_COMP_ALL_OK, referenceResource);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int numProblems = results.size();
|
int numProblems = results.size();
|
||||||
logger.warn("Schema validation found " + numProblems +
|
LogUtil.warn(logger, WARN_SCHEMA_COMP_PROBLEMS_FOUND, numProblems, outputFile);
|
||||||
" potential problems, results written to: "
|
|
||||||
+ outputFile);
|
|
||||||
}
|
}
|
||||||
Date endTime = new Date();
|
Date endTime = new Date();
|
||||||
long durationMillis = endTime.getTime() - startTime.getTime();
|
long durationMillis = endTime.getTime() - startTime.getTime();
|
||||||
logger.debug("Schema validation took " + durationMillis + "ms");
|
LogUtil.debug(logger, DEBUG_SCHEMA_COMP_TIME_TAKEN, durationMillis);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -18,6 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.util.schemacomp;
|
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)
|
public Difference(Where where, DbProperty left, DbProperty right, Strength strength)
|
||||||
{
|
{
|
||||||
super(null);
|
super(null);
|
||||||
|
|
||||||
|
// Sanity check parameters
|
||||||
|
if (left == null && right == null)
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException("DbProperty parameters cannot BOTH be null.");
|
||||||
|
}
|
||||||
|
|
||||||
this.where = where;
|
this.where = where;
|
||||||
this.left = left;
|
this.left = left;
|
||||||
this.right = right;
|
this.right = right;
|
||||||
@@ -75,37 +84,30 @@ public final class Difference extends Result
|
|||||||
@Override
|
@Override
|
||||||
public String describe()
|
public String describe()
|
||||||
{
|
{
|
||||||
StringBuffer sb = new StringBuffer();
|
if (getLeft() == null)
|
||||||
sb.append("Difference: ")
|
|
||||||
.append(getWhere());
|
|
||||||
|
|
||||||
sb.append(" reference path:");
|
|
||||||
if (getLeft() != null)
|
|
||||||
{
|
{
|
||||||
sb.append(getLeft().getPath());
|
return I18NUtil.getMessage(
|
||||||
sb.append(" (value: ")
|
"system.schema_comp.diff.target_only",
|
||||||
.append(getLeft().getPropertyValue())
|
getWhere(),
|
||||||
.append(")");
|
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:");
|
return I18NUtil.getMessage(
|
||||||
if (getRight() != null)
|
"system.schema_comp.diff",
|
||||||
{
|
getWhere(),
|
||||||
sb.append(getRight().getPath());
|
getLeft().getPath(),
|
||||||
sb.append(" (value: ")
|
getLeft().getPropertyValue(),
|
||||||
.append(getRight().getPropertyValue())
|
getRight().getPath(),
|
||||||
.append(")");
|
getRight().getPropertyValue());
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sb.append("null");
|
|
||||||
}
|
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -24,7 +24,9 @@ import static org.mockito.Mockito.mock;
|
|||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import org.alfresco.util.schemacomp.Difference.Where;
|
import org.alfresco.util.schemacomp.Difference.Where;
|
||||||
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the {@link Difference} class.
|
* Tests for the {@link Difference} class.
|
||||||
@@ -33,9 +35,16 @@ import org.junit.Test;
|
|||||||
*/
|
*/
|
||||||
public class DifferenceTest
|
public class DifferenceTest
|
||||||
{
|
{
|
||||||
|
@Before
|
||||||
|
public void setUp()
|
||||||
|
{
|
||||||
|
I18NUtil.registerResourceBundle("alfresco.messages.system-messages");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void describe()
|
public void describe()
|
||||||
{
|
{
|
||||||
|
|
||||||
DbProperty refDbProp = mock(DbProperty.class);
|
DbProperty refDbProp = mock(DbProperty.class);
|
||||||
when(refDbProp.getPath()).thenReturn("alfresco.some_table.some_column.name");
|
when(refDbProp.getPath()).thenReturn("alfresco.some_table.some_column.name");
|
||||||
when(refDbProp.getPropertyValue()).thenReturn("node_ref");
|
when(refDbProp.getPropertyValue()).thenReturn("node_ref");
|
||||||
@@ -43,9 +52,38 @@ public class DifferenceTest
|
|||||||
DbProperty targetDbProp = mock(DbProperty.class);
|
DbProperty targetDbProp = mock(DbProperty.class);
|
||||||
when(targetDbProp.getPath()).thenReturn("alfresco.some_table.some_column.name");
|
when(targetDbProp.getPath()).thenReturn("alfresco.some_table.some_column.name");
|
||||||
when(targetDbProp.getPropertyValue()).thenReturn("nood_ref");
|
when(targetDbProp.getPropertyValue()).thenReturn("nood_ref");
|
||||||
Difference diff = new Difference(Where.ONLY_IN_REFERENCE, refDbProp, targetDbProp);
|
Difference diff = new Difference(Where.IN_BOTH_BUT_DIFFERENCE, refDbProp, targetDbProp);
|
||||||
|
|
||||||
assertEquals("Difference: ONLY_IN_REFERENCE reference path:alfresco.some_table.some_column.name (value: node_ref) " +
|
assertEquals("Difference: IN_BOTH_BUT_DIFFERENCE, reference path:alfresco.some_table.some_column.name " +
|
||||||
"target path:alfresco.some_table.some_column.name (value: nood_ref)", diff.describe());
|
"(value: node_ref), target path:alfresco.some_table.some_column.name (value: nood_ref)",
|
||||||
|
diff.describe());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void describeRefOnly()
|
||||||
|
{
|
||||||
|
DbProperty refDbProp = mock(DbProperty.class);
|
||||||
|
when(refDbProp.getPath()).thenReturn("alfresco.some_table.some_column.name");
|
||||||
|
when(refDbProp.getPropertyValue()).thenReturn("node_ref");
|
||||||
|
|
||||||
|
Difference diff = new Difference(Where.ONLY_IN_REFERENCE, refDbProp, null);
|
||||||
|
|
||||||
|
assertEquals("Difference: ONLY_IN_REFERENCE, reference path:alfresco.some_table.some_column.name " +
|
||||||
|
"(value: node_ref)",
|
||||||
|
diff.describe());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void describeTargetOnly()
|
||||||
|
{
|
||||||
|
DbProperty targetDbProp = mock(DbProperty.class);
|
||||||
|
when(targetDbProp.getPath()).thenReturn("alfresco.some_table.some_column.name");
|
||||||
|
when(targetDbProp.getPropertyValue()).thenReturn("node_ref");
|
||||||
|
|
||||||
|
Difference diff = new Difference(Where.ONLY_IN_TARGET, null, targetDbProp);
|
||||||
|
|
||||||
|
assertEquals("Difference: ONLY_IN_TARGET, target path:alfresco.some_table.some_column.name " +
|
||||||
|
"(value: node_ref)",
|
||||||
|
diff.describe());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,6 +21,7 @@ package org.alfresco.util.schemacomp;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.util.schemacomp.model.DbObject;
|
import org.alfresco.util.schemacomp.model.DbObject;
|
||||||
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If more than one DB item in the target schema matches a reference DB item
|
* If more than one DB item in the target schema matches a reference DB item
|
||||||
@@ -44,12 +45,37 @@ public class RedundantDbObject extends Result
|
|||||||
@Override
|
@Override
|
||||||
public String describe()
|
public String describe()
|
||||||
{
|
{
|
||||||
StringBuffer sb = new StringBuffer();
|
if (matches.size() > SHOW_MAX_MATCHES)
|
||||||
sb.append(matches.size())
|
{
|
||||||
.append(" redundant items? reference: ")
|
return I18NUtil.getMessage(
|
||||||
.append(dbObject)
|
"system.schema_comp.redundant_obj.many_matches",
|
||||||
.append(", matches: ");
|
matches.size(),
|
||||||
|
dbObject,
|
||||||
|
describeMatches(),
|
||||||
|
matches.size() - SHOW_MAX_MATCHES);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return I18NUtil.getMessage(
|
||||||
|
"system.schema_comp.redundant_obj",
|
||||||
|
matches.size(),
|
||||||
|
dbObject,
|
||||||
|
describeMatches());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Produces a comma separated list of matching redundant database objects. For example:
|
||||||
|
* <pre>
|
||||||
|
* MyDbObject[name=match1], MyDbObject[name=match2], MyDbObject[name=match3]
|
||||||
|
* </pre>
|
||||||
|
* At most {@link #SHOW_MAX_MATCHES} will be included.
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
private String describeMatches()
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
for (int i = 0; i < matches.size() && i < SHOW_MAX_MATCHES; i++)
|
for (int i = 0; i < matches.size() && i < SHOW_MAX_MATCHES; i++)
|
||||||
{
|
{
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
@@ -58,13 +84,6 @@ public class RedundantDbObject extends Result
|
|||||||
}
|
}
|
||||||
sb.append(matches.get(i));
|
sb.append(matches.get(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matches.size() > SHOW_MAX_MATCHES)
|
|
||||||
{
|
|
||||||
sb.append(" and ")
|
|
||||||
.append(matches.size() - SHOW_MAX_MATCHES).append(" more...");
|
|
||||||
|
|
||||||
}
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -26,7 +26,9 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.alfresco.util.schemacomp.model.AbstractDbObject;
|
import org.alfresco.util.schemacomp.model.AbstractDbObject;
|
||||||
import org.alfresco.util.schemacomp.model.DbObject;
|
import org.alfresco.util.schemacomp.model.DbObject;
|
||||||
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the {@link RedundantDbObject} class.
|
* Tests for the {@link RedundantDbObject} class.
|
||||||
@@ -35,6 +37,11 @@ import org.junit.Test;
|
|||||||
*/
|
*/
|
||||||
public class RedundantDbObjectTest
|
public class RedundantDbObjectTest
|
||||||
{
|
{
|
||||||
|
@Before
|
||||||
|
public void setUp()
|
||||||
|
{
|
||||||
|
I18NUtil.registerResourceBundle("alfresco.messages.system-messages");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void describe()
|
public void describe()
|
||||||
|
@@ -18,6 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.util.schemacomp;
|
package org.alfresco.util.schemacomp;
|
||||||
|
|
||||||
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Results of a validation operation.
|
* Results of a validation operation.
|
||||||
*
|
*
|
||||||
@@ -26,17 +28,19 @@ package org.alfresco.util.schemacomp;
|
|||||||
public class ValidationResult extends Result
|
public class ValidationResult extends Result
|
||||||
{
|
{
|
||||||
private DbProperty dbProperty;
|
private DbProperty dbProperty;
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
|
||||||
public ValidationResult(DbProperty dbProperty)
|
public ValidationResult(DbProperty dbProperty, String message)
|
||||||
{
|
{
|
||||||
this(dbProperty, null);
|
this(dbProperty, null, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValidationResult(DbProperty dbProperty, Strength strength)
|
public ValidationResult(DbProperty dbProperty, Strength strength, String message)
|
||||||
{
|
{
|
||||||
super(strength);
|
super(strength);
|
||||||
this.dbProperty = dbProperty;
|
this.dbProperty = dbProperty;
|
||||||
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -60,15 +64,11 @@ public class ValidationResult extends Result
|
|||||||
@Override
|
@Override
|
||||||
public String describe()
|
public String describe()
|
||||||
{
|
{
|
||||||
StringBuffer sb = new StringBuffer();
|
return I18NUtil.getMessage(
|
||||||
sb.append("Validation ")
|
"system.schema_comp.validation",
|
||||||
.append("target path:")
|
getDbProperty().getPath(),
|
||||||
.append(getDbProperty().getPath())
|
getValue(),
|
||||||
.append(" (value: ")
|
message);
|
||||||
.append(getValue())
|
|
||||||
.append(")");
|
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -23,7 +23,9 @@ import static org.junit.Assert.assertEquals;
|
|||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,6 +35,12 @@ import org.junit.Test;
|
|||||||
*/
|
*/
|
||||||
public class ValidationResultTest
|
public class ValidationResultTest
|
||||||
{
|
{
|
||||||
|
@Before
|
||||||
|
public void setUp()
|
||||||
|
{
|
||||||
|
I18NUtil.registerResourceBundle("alfresco.messages.system-messages");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void describe()
|
public void describe()
|
||||||
{
|
{
|
||||||
@@ -40,9 +48,9 @@ public class ValidationResultTest
|
|||||||
when(targetDbProp.getPath()).thenReturn("alfresco.some_table.some_index.name");
|
when(targetDbProp.getPath()).thenReturn("alfresco.some_table.some_index.name");
|
||||||
when(targetDbProp.getPropertyValue()).thenReturn("ibx_my_index");
|
when(targetDbProp.getPropertyValue()).thenReturn("ibx_my_index");
|
||||||
|
|
||||||
ValidationResult validation = new ValidationResult(targetDbProp);
|
ValidationResult validation = new ValidationResult(targetDbProp, "value must be 'xyz'");
|
||||||
|
|
||||||
assertEquals("Validation target path:alfresco.some_table.some_index.name (value: ibx_my_index)",
|
assertEquals("Validation: target path:alfresco.some_table.some_index.name (value: ibx_my_index, rule: value must be 'xyz')",
|
||||||
validation.describe());
|
validation.describe());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,6 +27,7 @@ import org.alfresco.util.schemacomp.DiffContext;
|
|||||||
import org.alfresco.util.schemacomp.ValidationResult;
|
import org.alfresco.util.schemacomp.ValidationResult;
|
||||||
import org.alfresco.util.schemacomp.model.DbObject;
|
import org.alfresco.util.schemacomp.model.DbObject;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates the name of a DbObject using a regular expression. A regular expression
|
* Validates the name of a DbObject using a regular expression. A regular expression
|
||||||
@@ -45,10 +46,10 @@ public class NameValidator implements DbValidator
|
|||||||
{
|
{
|
||||||
String name = target.getName();
|
String name = target.getName();
|
||||||
|
|
||||||
ValidationResult result = new ValidationResult(new DbProperty(target, "name"));
|
|
||||||
|
|
||||||
if (pattern != null && !pattern.matcher(name).matches())
|
if (pattern != null && !pattern.matcher(name).matches())
|
||||||
{
|
{
|
||||||
|
String message = I18NUtil.getMessage("system.schema_comp.name_validator", pattern);
|
||||||
|
ValidationResult result = new ValidationResult(new DbProperty(target, "name"), message);
|
||||||
ctx.getComparisonResults().add(result);
|
ctx.getComparisonResults().add(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user