CMIS Dictionary Refactor

- follows pattern of Alfresco Dictionary
- simplified and much reduced DictionaryService interface
- model now compiled and cached (no more lots of small continuous object creations)
- walk model via simple getters
- validated (no dangling references)
- fix up property inheritance
- fix up sub-types for all types
- implements strict mode only for now (i.e. doesn't go outside of CMIS doc, folder, rel and policy)
- abstract helper for building other CMIS dictionaries (e.g. mapping all types in Alfresco)

Alfresco Dictionary:
- add event for initialized or re-initialized

Fix up usage in CMIS REST, Web Services and query. Tests pass.

REST support for custom sub-types and properties now reliable as constrained by validated CMIS model.

TODO:
- hook property value accessors into CMIS Dictionary

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13768 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2009-03-27 23:13:29 +00:00
parent df3e143e1c
commit 8fcebdc7cf
51 changed files with 2937 additions and 2095 deletions

View File

@@ -28,99 +28,48 @@ public class CMISDictionaryTest extends BaseCMISTest
{
public void testBasicTypes()
{
cmisDictionaryService.setStrict(true);
for (CMISTypeId name : cmisDictionaryService.getAllObjectTypeIds())
for (CMISTypeDefinition type : cmisDictionaryService.getAllTypes())
{
System.out.println(name);
System.out.println(type);
}
assertEquals(3, cmisDictionaryService.getAllObjectTypeIds().size());
}
public void testBasicTypeDefinitions()
{
cmisDictionaryService.setStrict(false);
for (CMISTypeId name : cmisDictionaryService.getAllObjectTypeIds())
{
System.out.println(cmisDictionaryService.getType(name));
}
}
public void testSubTypes()
{
cmisDictionaryService.setStrict(true);
for (CMISTypeId name : cmisDictionaryService.getAllObjectTypeIds())
for (CMISTypeDefinition type : cmisDictionaryService.getAllTypes())
{
System.out.println(name + " children (strict)");
for (CMISTypeId subName :cmisDictionaryService.getChildTypeIds(name, false))
System.out.println(type.getTypeId() + " children:");
for (CMISTypeDefinition subType : type.getSubTypes(false))
{
System.out.println(" " + subName);
System.out.println(" " + subType.getTypeId());
}
System.out.println(name + " descendants (strict)");
for (CMISTypeId subName :cmisDictionaryService.getChildTypeIds(name, true))
System.out.println(type.getTypeId() + " descendants:");
for (CMISTypeDefinition subType : type.getSubTypes(true))
{
System.out.println(" " + subName);
}
}
cmisDictionaryService.setStrict(false);
for (CMISTypeId name : cmisDictionaryService.getAllObjectTypeIds())
{
System.out.println(name + " children");
for (CMISTypeId subName :cmisDictionaryService.getChildTypeIds(name, false))
{
System.out.println(" " + subName);
}
System.out.println(name + " descendants");
for (CMISTypeId subName :cmisDictionaryService.getChildTypeIds(name, true))
{
System.out.println(" " + subName);
System.out.println(" " + subType.getTypeId());
}
}
}
public void testTypeIds()
{
cmisDictionaryService.setStrict(false);
for (CMISTypeId name : cmisDictionaryService.getAllObjectTypeIds())
for (CMISTypeDefinition typeDef : cmisDictionaryService.getAllTypes())
{
String typeId = name.getTypeId();
CMISTypeId lookup = cmisMapping.getCmisTypeId(typeId);
assertEquals(name, lookup);
System.out.println(name + " => " + lookup);
CMISTypeDefinition type = cmisDictionaryService.getType(lookup);
assertNotNull(type);
assertEquals(lookup, type.getObjectTypeId());
CMISTypeId typeId = typeDef.getTypeId();
CMISTypeDefinition typeDefLookup = cmisDictionaryService.getType(typeId);
assertNotNull(typeDefLookup);
assertEquals(typeDef, typeDefLookup);
}
}
public void testBasicProperties()
{
cmisDictionaryService.setStrict(false);
for (CMISTypeId name : cmisDictionaryService.getAllObjectTypeIds())
{
for (String propertyName : cmisDictionaryService.getPropertyDefinitions(name).keySet())
{
System.out.println(name +" -> "+ propertyName);
}
}
}
public void testBasicPropertyDefinitions()
{
cmisDictionaryService.setStrict(true);
for (CMISTypeId name : cmisDictionaryService.getAllObjectTypeIds())
for (CMISTypeDefinition type : cmisDictionaryService.getAllTypes())
{
for (CMISPropertyDefinition proDef : cmisDictionaryService.getPropertyDefinitions(name).values())
System.out.println(type.getTypeId() + " properties:");
for (CMISPropertyDefinition proDef : type.getPropertyDefinitions().values())
{
System.out.println(proDef);
}
}
cmisDictionaryService.setStrict(false);
for (CMISTypeId name : cmisDictionaryService.getAllObjectTypeIds())
{
for (CMISPropertyDefinition proDef : cmisDictionaryService.getPropertyDefinitions(name).values())
{
System.out.println(proDef);
System.out.println(" " + proDef);
}
}
}