mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.2 to HEAD
18023: RM: groundwork for custom metadata delete 18071: MT - fix ETHREEOH-3730 (reject invitation shows "Invitation not found" instead of Yes / No options) 18078: MT - fix ETHREEOH-3892 (it is not possible to create or manage any Tenants once the DOD5015 RM AMP is installed) 18903: RM Caveats - fix ALF-1894 (improvement for ESC - remove hardcoded "rmc" model/namespace) 19046: Improve dictionary debug logging (ALF-587) 19096: Merging PATCHES/V3.2.r to V3.2 19075: Merging DEV/BELARUS/V3.2-2010_02_24 to PATCHES/V3.2.r 18881: ALF-587: MT Upgrades to 3.2r fail unable to find Alfresco content types 19085: ALF-587 - test/build fix (follow on for r18881->r19075) 19145: Dynamic Models - follow-on for ALF-587 (& ALFCOM-2977) + additional unit tests 19176: Remove Java 6'ism 19198: Build/test fix (follow-on to r19145 - do not validate model delete of version nodes) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19260 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
package org.alfresco.repo.dictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint;
|
||||
@@ -31,6 +33,7 @@ import org.alfresco.service.cmr.dictionary.DictionaryException;
|
||||
import org.alfresco.service.cmr.dictionary.ModelDefinition;
|
||||
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.EqualsHelper;
|
||||
import org.springframework.beans.BeanWrapper;
|
||||
import org.springframework.beans.BeanWrapperImpl;
|
||||
import org.springframework.beans.InvalidPropertyException;
|
||||
@@ -39,7 +42,7 @@ import org.springframework.beans.PropertyAccessException;
|
||||
/**
|
||||
* Compiled Property Constraint
|
||||
*
|
||||
* @author Derek Hulley
|
||||
* @author Derek Hulley. janv
|
||||
*/
|
||||
/* package */class M2ConstraintDefinition implements ConstraintDefinition
|
||||
{
|
||||
@@ -319,7 +322,18 @@ import org.springframework.beans.PropertyAccessException;
|
||||
{
|
||||
return constraint;
|
||||
}
|
||||
|
||||
|
||||
public QName getRef()
|
||||
{
|
||||
QName refQName = null;
|
||||
String ref = m2Constraint.getRef();
|
||||
if (ref != null)
|
||||
{
|
||||
refQName = QName.createQName(ref, prefixResolver);
|
||||
}
|
||||
return refQName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Well-known constraint types
|
||||
*/
|
||||
@@ -365,10 +379,106 @@ import org.springframework.beans.PropertyAccessException;
|
||||
return new ListOfValuesConstraint();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return Returns the constraint implementation
|
||||
*/
|
||||
protected abstract Constraint newInstance();
|
||||
}
|
||||
|
||||
/* package */ M2ModelDiff diffConstraint(ConstraintDefinition conDef)
|
||||
{
|
||||
M2ModelDiff modelDiff = null;
|
||||
boolean isUpdated = false;
|
||||
boolean isUpdatedIncrementally = false;
|
||||
|
||||
if (this == conDef)
|
||||
{
|
||||
modelDiff = new M2ModelDiff(name, M2ModelDiff.TYPE_CONSTRAINT, M2ModelDiff.DIFF_UNCHANGED);
|
||||
return modelDiff;
|
||||
}
|
||||
|
||||
// check name - cannot be null
|
||||
if (! name.equals(conDef.getName()))
|
||||
{
|
||||
isUpdated = true;
|
||||
}
|
||||
|
||||
// check title
|
||||
if (! EqualsHelper.nullSafeEquals(getTitle(), conDef.getTitle(), false))
|
||||
{
|
||||
isUpdatedIncrementally = true;
|
||||
}
|
||||
|
||||
// check description
|
||||
if (! EqualsHelper.nullSafeEquals(getDescription(), conDef.getDescription(), false))
|
||||
{
|
||||
isUpdatedIncrementally = true;
|
||||
}
|
||||
|
||||
// check type string
|
||||
if (! EqualsHelper.nullSafeEquals(getConstraint().getType(), conDef.getConstraint().getType()))
|
||||
{
|
||||
isUpdated = true;
|
||||
}
|
||||
|
||||
if (isUpdated)
|
||||
{
|
||||
modelDiff = new M2ModelDiff(name, M2ModelDiff.TYPE_CONSTRAINT, M2ModelDiff.DIFF_UPDATED);
|
||||
}
|
||||
else if (isUpdatedIncrementally)
|
||||
{
|
||||
modelDiff = new M2ModelDiff(name, M2ModelDiff.TYPE_CONSTRAINT, M2ModelDiff.DIFF_UPDATED_INC);
|
||||
}
|
||||
else
|
||||
{
|
||||
modelDiff = new M2ModelDiff(name, M2ModelDiff.TYPE_CONSTRAINT, M2ModelDiff.DIFF_UNCHANGED);
|
||||
}
|
||||
|
||||
return modelDiff;
|
||||
}
|
||||
|
||||
/*package*/ static Collection<M2ModelDiff> diffConstraintLists(Collection<ConstraintDefinition> previousConstraints, Collection<ConstraintDefinition> newConstraints)
|
||||
{
|
||||
List<M2ModelDiff> modelDiffs = new ArrayList<M2ModelDiff>();
|
||||
|
||||
for (ConstraintDefinition previousConstraint : previousConstraints)
|
||||
{
|
||||
boolean found = false;
|
||||
for (ConstraintDefinition newConstraint : newConstraints)
|
||||
{
|
||||
if (newConstraint.getName().equals(previousConstraint.getName()))
|
||||
{
|
||||
modelDiffs.add(((M2ConstraintDefinition)previousConstraint).diffConstraint(previousConstraint));
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! found)
|
||||
{
|
||||
modelDiffs.add(new M2ModelDiff(previousConstraint.getName(), M2ModelDiff.TYPE_CONSTRAINT, M2ModelDiff.DIFF_DELETED));
|
||||
}
|
||||
}
|
||||
|
||||
for (ConstraintDefinition newConstraint : newConstraints)
|
||||
{
|
||||
boolean found = false;
|
||||
for (ConstraintDefinition previousConstraint : previousConstraints)
|
||||
{
|
||||
if (newConstraint.getName().equals(previousConstraint.getName()))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! found)
|
||||
{
|
||||
modelDiffs.add(new M2ModelDiff(newConstraint.getName(), M2ModelDiff.TYPE_CONSTRAINT, M2ModelDiff.DIFF_CREATED));
|
||||
}
|
||||
}
|
||||
|
||||
return modelDiffs;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user