From 84067dcb1858796826475df173fc8c01bf5cf16e Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Sat, 31 Jan 2015 12:27:54 +0000 Subject: [PATCH] Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud) 93587: Merged 5.0.N (5.0.1) to HEAD-BUG-FIX (5.1/Cloud) 93514: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.1) 93316: Merged DEV to V4.2-BUG-FIX (4.2.5) 93033 : MNT-13093 : Users cannot add Comments to any documents in Alfresco via Alfresco Mobile App. - Include subTypes of desired type to expectedTypes 93140 : MNT-13093 : Users cannot add Comments to any documents in Alfresco via Alfresco Mobile App. - TypeConstraint is changed to check for subClass on demand. Test for the fix git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@94974 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../org/alfresco/util/TypeConstraint.java | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/source/java/org/alfresco/util/TypeConstraint.java b/source/java/org/alfresco/util/TypeConstraint.java index b6320d15de..4529142551 100644 --- a/source/java/org/alfresco/util/TypeConstraint.java +++ b/source/java/org/alfresco/util/TypeConstraint.java @@ -24,6 +24,7 @@ import java.util.Set; import org.alfresco.repo.tenant.TenantUtil; import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork; +import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.namespace.QName; @@ -53,7 +54,8 @@ public class TypeConstraint private List excludedTypes; private NodeService nodeService; - + private DictionaryService dictionaryService; + public void setExpectedTypes(List expectedTypes) { // if(expectedTypes != null && expectedTypes.size() > 0) @@ -73,6 +75,11 @@ public class TypeConstraint { this.nodeService = nodeService; } + + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } public void setExcludedTypes(List excludedTypes) { @@ -139,7 +146,7 @@ public class TypeConstraint } else { - qNames.add(typeDef); // valid so add it to the list + qNames.add(typeDef); } } @@ -154,14 +161,19 @@ public class TypeConstraint private boolean matchesExpected(QName typeQName) { - boolean ret = false; - if(expectedQNames == null || expectedQNames.contains(typeQName) || expectedModels == null || expectedModels.contains(typeQName.getNamespaceURI())) { - ret = true; + return true; } - return ret; + for (QName expectedQName : expectedQNames) + { + if (dictionaryService.isSubClass(typeQName, expectedQName)) + { + return true; + } + } + return false; } /**