mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
59337: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (4.3/Cloud) 59273: Merged DEV to V4.2-BUG-FIX (4.2.1) 58959, 59195 : MNT-10111 : MSSQL: JBPM: A plenty of schema differences are present after schema bootstrap on a clean start - Type names only validator added. Validate nvarchar(max) fields with it - TypeNameOnlyValidatorTest added for TypeNameOnlyValidator 59299: MNT-10111 : MSSQL: JBPM: A plenty of schema differences are present after schema bootstrap on a clean start - Additional commit of Schema-Reference-JBPM.xml, it was corrupted in r59273 59335: Fix errors introduced into mergeinfo in r59273 (MNT-10111) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62129 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package org.alfresco.util.schemacomp.validator;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.util.schemacomp.DbProperty;
|
||||
import org.alfresco.util.schemacomp.DiffContext;
|
||||
import org.alfresco.util.schemacomp.ValidationResult;
|
||||
import org.alfresco.util.schemacomp.model.DbObject;
|
||||
import org.alfresco.util.schemacomp.model.Column;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
|
||||
|
||||
/**
|
||||
* Validates columns types without column size.
|
||||
*
|
||||
* @author sergei.shcherbovich
|
||||
*/
|
||||
public class TypeNameOnlyValidator extends NameValidator
|
||||
{
|
||||
private static String TYPE_SIZE_SPLITTER = "(";
|
||||
|
||||
@Override
|
||||
public void validate(DbObject reference, DbObject target, DiffContext ctx)
|
||||
{
|
||||
if (!(target instanceof Column))
|
||||
{
|
||||
throw new AlfrescoRuntimeException("TypeNameOnlyValidator could be used only in context of column object but was: " + target.toString());
|
||||
}
|
||||
|
||||
String referenceTypeName = ((Column)reference).getType();
|
||||
String targetTypeName = ((Column)target).getType();
|
||||
|
||||
if (referenceTypeName.contains(TYPE_SIZE_SPLITTER))
|
||||
{
|
||||
referenceTypeName = referenceTypeName.substring(0, referenceTypeName.indexOf(TYPE_SIZE_SPLITTER));
|
||||
}
|
||||
if (targetTypeName.contains(TYPE_SIZE_SPLITTER))
|
||||
{
|
||||
targetTypeName = targetTypeName.substring(0, targetTypeName.indexOf(TYPE_SIZE_SPLITTER));
|
||||
}
|
||||
|
||||
if (!referenceTypeName.equals(targetTypeName))
|
||||
{
|
||||
String message = I18NUtil.getMessage("system.schema_comp.column_names_validator", targetTypeName, referenceTypeName);
|
||||
ValidationResult result = new ValidationResult(new DbProperty(target, "type"), message);
|
||||
ctx.getComparisonResults().add(result);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validatesFullObject()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user