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
This commit is contained in:
Alan Davis 2015-01-31 12:27:54 +00:00
parent cb4f8529ec
commit 84067dcb18

View File

@ -24,6 +24,7 @@ import java.util.Set;
import org.alfresco.repo.tenant.TenantUtil; import org.alfresco.repo.tenant.TenantUtil;
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork; 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.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
@ -53,6 +54,7 @@ public class TypeConstraint
private List<String> excludedTypes; private List<String> excludedTypes;
private NodeService nodeService; private NodeService nodeService;
private DictionaryService dictionaryService;
public void setExpectedTypes(List<String> expectedTypes) public void setExpectedTypes(List<String> expectedTypes)
{ {
@ -74,6 +76,11 @@ public class TypeConstraint
this.nodeService = nodeService; this.nodeService = nodeService;
} }
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
public void setExcludedTypes(List<String> excludedTypes) public void setExcludedTypes(List<String> excludedTypes)
{ {
this.excludedTypes = excludedTypes; this.excludedTypes = excludedTypes;
@ -139,7 +146,7 @@ public class TypeConstraint
} }
else 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) private boolean matchesExpected(QName typeQName)
{ {
boolean ret = false;
if(expectedQNames == null || expectedQNames.contains(typeQName) || expectedModels == null || expectedModels.contains(typeQName.getNamespaceURI())) 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;
} }
/** /**