You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by je...@apache.org on 2013/08/02 16:16:06 UTC

svn commit: r1509723 [1/3] - in /chemistry/opencmis/branches/inmemory-refactoring/src: main/java/org/apache/chemistry/opencmis/inmemory/ main/java/org/apache/chemistry/opencmis/inmemory/server/ main/java/org/apache/chemistry/opencmis/inmemory/storedobj...

Author: jens
Date: Fri Aug  2 14:16:05 2013
New Revision: 1509723

URL: http://svn.apache.org/r1509723
Log:
InMemory: remove Type creation classes and use TypeFactory, merge some lost changes from refactoring

Removed:
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryDocumentTypeDefinition.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryFolderTypeDefinition.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryItemTypeDefinition.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryPolicyTypeDefinition.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemoryRelationshipTypeDefinition.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/InMemorySecondaryTypeDefinition.java
Modified:
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeValidator.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AtomLinkInfoProvider.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Children.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStoreFiling.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/TypeManagerCreatable.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DefaultTypeSystemCreator.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java
    chemistry/opencmis/branches/inmemory-refactoring/src/main/webapp/WEB-INF/classes/repository.properties
    chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/AclServiceTest.java
    chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/FolderTest.java
    chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/MultiFilingTest.java
    chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/NavigationServiceTest.java
    chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
    chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/RepositoryServiceMutabilityTest.java
    chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/RepositoryServiceTest.java
    chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/TypeValidationTest.java
    chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/UnitTestTypeSystemCreator.java
    chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/VersionTestTypeSystemCreator.java
    chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/VersioningTest.java
    chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/query/AbstractQueryTest.java
    chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/query/ProcessQueryTest.java
    chemistry/opencmis/branches/inmemory-refactoring/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryTypesTest.java

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.java Fri Aug  2 14:16:05 2013
@@ -34,12 +34,6 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.TypeDefinitionContainerImpl;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.TypeManagerCreatable;
 import org.apache.chemistry.opencmis.inmemory.types.DocumentTypeCreationHelper;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryDocumentTypeDefinition;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryFolderTypeDefinition;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryItemTypeDefinition;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryPolicyTypeDefinition;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryRelationshipTypeDefinition;
-import org.apache.chemistry.opencmis.inmemory.types.InMemorySecondaryTypeDefinition;
 import org.apache.chemistry.opencmis.inmemory.types.TypeUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -124,7 +118,7 @@ public class TypeManagerImpl implements 
         // and property lists
         if (null != typesList) {
             for (TypeDefinition typeDef : typesList) {
-                addTypeDefinition(typeDef);
+                addTypeDefinition(typeDef, false);
             }
         }
 
@@ -140,7 +134,7 @@ public class TypeManagerImpl implements 
      *            new type to add
      */
     @Override
-	public void addTypeDefinition(TypeDefinition cmisType) {
+	public void addTypeDefinition(TypeDefinition cmisType, boolean addInheritedProperties) {
         
         LOG.info("Adding type definition with name " + cmisType.getLocalName() + " and id " 
                 + cmisType.getId() + " to repository.");
@@ -151,9 +145,11 @@ public class TypeManagerImpl implements 
             TypeDefinitionContainer parentTypeContainer = fTypesMap.get(cmisType.getParentTypeId());
             parentTypeContainer.getChildren().add(typeContainer);
 
+            if (addInheritedProperties) {
             // recursively add inherited properties
-            Map<String, PropertyDefinition<?>> propDefs = typeContainer.getTypeDefinition().getPropertyDefinitions();
-            addInheritedProperties(propDefs, parentTypeContainer.getTypeDefinition());
+                Map<String, PropertyDefinition<?>> propDefs = typeContainer.getTypeDefinition().getPropertyDefinitions();
+                addInheritedProperties(propDefs, parentTypeContainer.getTypeDefinition());
+            }
         }
         // add type to type map
         fTypesMap.put(cmisType.getId(), typeContainer);

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeValidator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeValidator.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeValidator.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeValidator.java Fri Aug  2 14:16:05 2013
@@ -199,19 +199,21 @@ public class TypeValidator {
             
             for (TypeDefinitionContainer tdc : tdl) {
                 TypeDefinition td = tdc.getTypeDefinition();
-                for (PropertyDefinition<?> pd1 : td.getPropertyDefinitions().values()) {
-                    // check if id is used
-                    if (pd1.getId().equals(pd2.getId()))
-                        throw new CmisConstraintException("Property id " + pd2.getId() + " already in use in type "
-                                + td.getId());
-                    // check if query name is used
-                    if (pd1.getQueryName().equals(pd2.getQueryName()))
-                        throw new CmisConstraintException("Property query name " + pd2.getQueryName() + " already in use in type "
-                                + td.getQueryName());
-                    // check if local name is used
-                    if (pd1.getLocalName().equals(pd2.getLocalName()))
-                        throw new CmisConstraintException("Property local name " + pd2.getLocalName() + " already in use in type "
-                                + td.getId());
+                if (null != td.getPropertyDefinitions()) {
+                    for (PropertyDefinition<?> pd1 : td.getPropertyDefinitions().values()) {
+                        // check if id is used
+                        if (pd1.getId().equals(pd2.getId()))
+                            throw new CmisConstraintException("Property id " + pd2.getId() + " already in use in type "
+                                    + td.getId());
+                        // check if query name is used
+                        if (pd1.getQueryName().equals(pd2.getQueryName()))
+                            throw new CmisConstraintException("Property query name " + pd2.getQueryName() + " already in use in type "
+                                    + td.getQueryName());
+                        // check if local name is used
+                        if (pd1.getLocalName().equals(pd2.getLocalName()))
+                            throw new CmisConstraintException("Property local name " + pd2.getLocalName() + " already in use in type "
+                                    + td.getId());
+                    }
                 }
             }
         }        

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AtomLinkInfoProvider.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AtomLinkInfoProvider.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AtomLinkInfoProvider.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AtomLinkInfoProvider.java Fri Aug  2 14:16:05 2013
@@ -96,7 +96,8 @@ public class AtomLinkInfoProvider {
             objInfo.setIsCurrentVersion(ver == ver.getParentDocument().getLatestVersion(false));
             objInfo.setVersionSeriesId(ver.getParentDocument().getId());
             objInfo.setWorkingCopyId(pwc == null ? null : pwc.getId());
-            objInfo.setWorkingCopyOriginalId(pwc == ver ? ver.getParentDocument().getLatestVersion(false).getId()
+            objInfo.setWorkingCopyOriginalId(pwc == ver && ver.getParentDocument().getLatestVersion(false) != null ?
+                    ver.getParentDocument().getLatestVersion(false).getId()
                     : null);
         } else if (so instanceof VersionedDocument) {
             VersionedDocument doc = (VersionedDocument) so;

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java Fri Aug  2 14:16:05 2013
@@ -100,8 +100,8 @@ public class InMemoryNavigationServiceIm
         } else {
             LOG.debug("getting checked-out documents for folder: " + folderId);
             ObjectInFolderList children = getChildrenIntern(repositoryId, folderId, filter, orderBy,
-                    includeAllowableActions, includeRelationships, renditionFilter, false, -1, -1, false, context
-                            .isObjectInfoRequired() ? objectInfos : null, user);
+                   includeAllowableActions, includeRelationships, renditionFilter, false, -1, -1, false, true,
+                   context.isObjectInfoRequired() ? objectInfos : null, user);
             for (ObjectInFolderData child : children.getObjects()) {
                 ObjectData obj = child.getObject();
                 StoredObject so = fStoreManager.getObjectStore(repositoryId).getObjectById(obj.getId());
@@ -137,7 +137,7 @@ public class InMemoryNavigationServiceIm
         int skipCountInt = skipCount == null ? 0 : skipCount.intValue();
         String user = context.getUsername();
         ObjectInFolderList res = getChildrenIntern(repositoryId, folderId, filter, orderBy, includeAllowableActions,
-                includeRelationships, renditionFilter, includePathSegment, maxItemsInt, skipCountInt, false,
+                includeRelationships, renditionFilter, includePathSegment, maxItemsInt, skipCountInt, false, false,
                 context.isObjectInfoRequired() ? objectInfos : null, user);
         LOG.debug("stop getChildren()");
         return res;
@@ -269,7 +269,7 @@ public class InMemoryNavigationServiceIm
 
     private ObjectInFolderList getChildrenIntern(String repositoryId, String folderId, String filter, String orderBy,
             Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
-            Boolean includePathSegments, int maxItems, int skipCount, boolean folderOnly, ObjectInfoHandler objectInfos,
+            Boolean includePathSegments, int maxItems, int skipCount, boolean folderOnly, boolean includePwc, ObjectInfoHandler objectInfos,
             String user) {
 
         ObjectInFolderListImpl result = new ObjectInFolderListImpl();
@@ -288,12 +288,12 @@ public class InMemoryNavigationServiceIm
         }
 
         ObjectStoreFiling.ChildrenResult children = folderOnly ? objStoreFiling.getFolderChildren((Folder)so, maxItems, skipCount, user) : objStoreFiling
-                .getChildren((Folder)so, maxItems, skipCount, user);
-
+                .getChildren((Folder)so, maxItems, skipCount, user, includePwc);
+        
         for (Fileable child : children.getChildren()) {
 
             if (!cmis11 && child instanceof Item)
-                continue; // ignore items for CMIS 1.1‚
+                continue; // ignore items for CMIS 1.0 
             
             ObjectInFolderDataImpl oifd = new ObjectInFolderDataImpl();
             if (includePathSegments != null && includePathSegments) {
@@ -338,8 +338,7 @@ public class InMemoryNavigationServiceIm
             String orderBy = PropertyIds.NAME;
             ObjectInFolderList children = getChildrenIntern(repositoryId, folderId, filter, orderBy,
                     includeAllowableActions, includeRelationships, renditionFilter, includePathSegments, 1000, 0,
-                    folderOnly, objectInfos, user);
-
+                    folderOnly, false, objectInfos, user);
             childrenOfFolderId = new ArrayList<ObjectInFolderContainer>();
             if (null != children) {
 

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java Fri Aug  2 14:16:05 2013
@@ -80,11 +80,7 @@ import org.apache.chemistry.opencmis.inm
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoreManager;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoredObject;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.VersionedDocument;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryDocumentTypeDefinition;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryFolderTypeDefinition;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryItemTypeDefinition;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryPolicyTypeDefinition;
-import org.apache.chemistry.opencmis.inmemory.types.InMemoryRelationshipTypeDefinition;
+import org.apache.chemistry.opencmis.inmemory.types.DocumentTypeCreationHelper;
 import org.apache.chemistry.opencmis.inmemory.types.PropertyCreationHelper;
 import org.apache.chemistry.opencmis.server.support.TypeManager;
 import org.apache.chemistry.opencmis.server.support.TypeValidator;
@@ -216,16 +212,16 @@ public class InMemoryObjectServiceImpl e
         StoredObject so = null;
         ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
 
-        if (typeBaseId.equals(InMemoryDocumentTypeDefinition.getRootDocumentType().getBaseTypeId())) {
+        if (typeBaseId.equals(DocumentTypeCreationHelper.getCmisDocumentType().getBaseTypeId())) {
             so = createDocumentIntern(context, repositoryId, properties, folderId, contentStream, versioningState,
                     null, null, null, null);
-        } else if (typeBaseId.equals(InMemoryFolderTypeDefinition.getRootFolderType().getBaseTypeId())) {
+        } else if (typeBaseId.equals(DocumentTypeCreationHelper.getCmisFolderType().getBaseTypeId())) {
             so = createFolderIntern(context, repositoryId, properties, folderId, null, null, null, null);
-        } else if (typeBaseId.equals(InMemoryPolicyTypeDefinition.getRootPolicyType().getBaseTypeId())) {
+        } else if (typeBaseId.equals(DocumentTypeCreationHelper.getCmisPolicyType().getBaseTypeId())) {
             so = createPolicyIntern(context, repositoryId, properties, folderId, null, null, null, null);
-        } else if (typeBaseId.equals(InMemoryRelationshipTypeDefinition.getRootRelationshipType().getBaseTypeId())) {
+        } else if (typeBaseId.equals(DocumentTypeCreationHelper.getCmisRelationshipType().getBaseTypeId())) {
             so = createRelationshipIntern(context, repositoryId, properties, null, null, null, null);
-        } else if (typeBaseId.equals(InMemoryItemTypeDefinition.getRootItemType().getBaseTypeId())) {
+        } else if (typeBaseId.equals(DocumentTypeCreationHelper.getCmisItemType().getBaseTypeId())) {
             so = createItemIntern(context, repositoryId, properties, folderId, null, null, null, null);
         } else {
             LOG.error("The type contains an unknown base object id, object can't be created");
@@ -609,6 +605,7 @@ public class InMemoryObjectServiceImpl e
         }
 
         content.setContent(contentStream, true);
+        so.updateSystemBasePropertiesWhenModified(null, context.getUsername());
         LOG.debug("stop setContentStream()");
     }
 
@@ -813,7 +810,7 @@ public class InMemoryObjectServiceImpl e
         }
 
         content.appendContent(contentStream);
-    }
+        so.updateSystemBasePropertiesWhenModified(null, context.getUsername());    }
 
     public List<BulkUpdateObjectIdAndChangeToken> bulkUpdateProperties(CallContext context, String repositoryId,
             List<BulkUpdateObjectIdAndChangeToken> objectIdAndChangeToken, Properties properties,
@@ -1221,7 +1218,7 @@ public class InMemoryObjectServiceImpl e
             boolean allVersions, List<String> failedToDeleteIds, String user) {
         
         ObjectStoreFiling filingStore = (ObjectStoreFiling) objStore;
-        ChildrenResult childrenResult = filingStore.getChildren(parentFolder, -1, -1, "Admin");
+        ChildrenResult childrenResult = filingStore.getChildren(parentFolder, -1, -1, "Admin", true);
         List<Fileable> children = childrenResult.getChildren();
 
         if (null == children) {

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.java Fri Aug  2 14:16:05 2013
@@ -156,7 +156,7 @@ public class InMemoryRepositoryServiceIm
         AbstractTypeDefinition newType = TypeValidator.completeType(type);
         TypeValidator.adjustTypeNamesAndId(newType);
         TypeValidator.checkType(typeManager, newType);
-        typeManager.addTypeDefinition(newType);
+        typeManager.addTypeDefinition(newType, true);
         return newType;
     }
 

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java Fri Aug  2 14:16:05 2013
@@ -279,7 +279,7 @@ public class InMemoryServiceFactoryImpl 
                             ((AbstractTypeDefinition) typeDef)
                                     .setPropertyDefinitions(new LinkedHashMap<String, PropertyDefinition<?>>());
                         }
-                        tmc.addTypeDefinition(typeDef);
+                        tmc.addTypeDefinition(typeDef, false);
                     } 
                     XMLUtils.next(parser);
                 } else if (event == XMLStreamReader.END_ELEMENT) {

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java Fri Aug  2 14:16:05 2013
@@ -101,7 +101,8 @@ public class InMemoryVersioningServiceIm
             major = true;
         
         verDoc.checkIn(major, properties, contentStream, checkinComment, policies, user);
-
+        verDoc.updateSystemBasePropertiesWhenModified(null, context.getUsername());
+        
         // To be able to provide all Atom links in the response we need
         // additional information:
         if (context.isObjectInfoRequired()) {

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Children.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Children.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Children.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Children.java Fri Aug  2 14:16:05 2013
@@ -55,13 +55,17 @@ public interface Children {
      * @param skipCount
      *            initial offset where to start fetching
      * @param user 
+     *             user to determine visible children
+     * @param usePwc 
+     *             if true return private working copy otherwise return latest version; 
+     * 
      * @return list of children objects
      */
-    ChildrenResult getChildren(int maxItems, int skipCount, String user );
-
+    ChildrenResult getChildren(int maxItems, int skipCount, String user, boolean usePwc);
+    
     /**
      * get all the children of this folder which are folders. To support paging
-     * an initial offset and a maximum number of childrent to retrieve can be
+     * an initial offset and a maximum number of children to retrieve can be
      * passed.
      * 
      * @param maxItems

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStoreFiling.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStoreFiling.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStoreFiling.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStoreFiling.java Fri Aug  2 14:16:05 2013
@@ -53,7 +53,7 @@ public interface ObjectStoreFiling {
      * @param user 
      * @return list of children objects
      */
-    ChildrenResult getChildren(Folder folder, int maxItems, int skipCount, String user );
+    ChildrenResult getChildren(Folder folder, int maxItems, int skipCount, String user, boolean usePwc);
 
     /**
      * get all the children of this folder which are folders. To support paging

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/TypeManagerCreatable.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/TypeManagerCreatable.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/TypeManagerCreatable.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/TypeManagerCreatable.java Fri Aug  2 14:16:05 2013
@@ -30,8 +30,10 @@ public interface TypeManagerCreatable ex
      * 
      * @param cmisType
      *            new type to add
+     * @param addInheritedProperties
+     *            add properties from supertype to type definition
      */
-    void addTypeDefinition(TypeDefinition typeDefinition);
+    void addTypeDefinition(TypeDefinition typeDefinition, boolean addInheritedProperties);
     
     /**
      * Modify an existing type definition

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java Fri Aug  2 14:16:05 2013
@@ -167,8 +167,15 @@ public class DocumentVersionImpl extends
 
     private boolean isLatestVersion() {
         List<DocumentVersion> allVers = fContainer.getAllVersions();
+        boolean hasPwc = null != fContainer.getPwc();
         boolean isLatestVersion;
         isLatestVersion = allVers.get(allVers.size() - 1).equals(this);
+        if (hasPwc) {
+            // CMIS 1.1 forbids it for PWC
+            isLatestVersion = allVers.size() > 1 && allVers.get(allVers.size() - 2).equals(this);          
+        } else {
+            isLatestVersion = allVers.get(allVers.size() - 1).equals(this);            
+        }
         return isLatestVersion;
     }
 

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java Fri Aug  2 14:16:05 2013
@@ -587,7 +587,7 @@ public class ObjectStoreImpl implements 
         }
 
         // check if children exist
-        List<Fileable> children = getChildren((Folder) folder, -1, -1, user).getChildren();
+        List<Fileable> children = getChildren((Folder) folder, -1, -1, user, true).getChildren();
         if (children != null && !children.isEmpty()) {
             throw new CmisConstraintException("Cannot delete folder with id:  " + folderId + ". Folder is not empty.");
         }
@@ -596,8 +596,8 @@ public class ObjectStoreImpl implements 
     }
 
     @Override
-    public ChildrenResult getChildren(Folder folder, int maxItems, int skipCount, String user) {
-        List<Fileable> children = getChildren(folder, user);
+    public ChildrenResult getChildren(Folder folder, int maxItems, int skipCount, String user, boolean usePwc) {
+        List<Fileable> children = getChildren(folder, user, usePwc);
         sortFolderList(children);
 
         if (maxItems < 0) {
@@ -616,10 +616,10 @@ public class ObjectStoreImpl implements 
     }
 
     private List<Fileable> getChildren(Folder folder) {
-        return getChildren(folder, null);
+        return getChildren(folder, null, false);
     }
 
-    private List<Fileable> getChildren(Folder folder, String user) {
+    private List<Fileable> getChildren(Folder folder, String user, boolean usePwc) {
         List<Fileable> children = new ArrayList<Fileable>();
         for (String id : getIds()) {
             StoredObject obj = getObject(id);
@@ -627,8 +627,15 @@ public class ObjectStoreImpl implements 
                 Fileable pathObj = (Fileable) obj;
                 if ((null == user || hasReadAccess(user, obj)) && pathObj.getParentIds().contains(folder.getId())) {
                     if (pathObj instanceof VersionedDocument) {
-                        DocumentVersion ver = ((VersionedDocument) pathObj).getLatestVersion(false);
-                        children.add(ver);
+                         DocumentVersion ver;
+                        if (usePwc) {
+                            ver = ((VersionedDocument) pathObj).getPwc();
+                            if (null == ver)
+                                ver = ((VersionedDocument) pathObj).getLatestVersion(false);
+                        } else {
+                            ver = ((VersionedDocument) pathObj).getLatestVersion(false);
+                        }
+                        children.add(ver);                        
                     } else if (!(pathObj instanceof DocumentVersion)) { // ignore
                                                                         // DocumentVersion
                         children.add(pathObj);
@@ -826,7 +833,8 @@ public class ObjectStoreImpl implements 
     }
 
     private Acl applyAclRecursive(Folder folder, Acl addAces, Acl removeAces, String principalId) {
-        List<Fileable> children = getChildren(folder, -1, -1, ADMIN_PRINCIPAL_ID).getChildren();
+        List<Fileable> children = getChildren(folder, -1, -1, ADMIN_PRINCIPAL_ID, false).getChildren();
+        
         Acl result = applyAcl(folder, addAces, removeAces);
 
         if (null == children) {
@@ -847,8 +855,8 @@ public class ObjectStoreImpl implements 
     }
 
     private Acl applyAclRecursive(Folder folder, Acl acl, String principalId) {
-        List<Fileable> children = getChildren(folder, -1, -1, ADMIN_PRINCIPAL_ID).getChildren();
-
+        List<Fileable> children = getChildren(folder, -1, -1, ADMIN_PRINCIPAL_ID, false).getChildren();
+        
         Acl result = applyAcl(folder, acl);
 
         if (null == children) {

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java Fri Aug  2 14:16:05 2013
@@ -340,20 +340,23 @@ public class StoredObjectImpl implements
         // Note that initial creation and modification date is set in
         // constructor.
         setModifiedBy(user);
-        if (null != properties.get(PropertyIds.DESCRIPTION))
-            setDescription((String) properties.get(PropertyIds.DESCRIPTION).getFirstValue());
-
-        if (null != properties.get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS)) {
-            secondaryTypeIds.clear();
-            secondaryTypeIds.addAll((List<String>) properties.get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS).getValues());
-        }
+        if (null != properties) {
+           if (null != properties.get(PropertyIds.DESCRIPTION))
+               setDescription((String) properties.get(PropertyIds.DESCRIPTION)
+                       .getFirstValue());
+
+           if (null != properties.get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS)) {
+               secondaryTypeIds.clear();
+               secondaryTypeIds.addAll((List<String>) properties.get(
+                       PropertyIds.SECONDARY_OBJECT_TYPE_IDS).getValues());
+           }
+       }
 
         if (isCreated) {
             setCreatedBy(user);
             setName((String) properties.get(PropertyIds.NAME).getFirstValue());
             setTypeId((String) properties.get(PropertyIds.OBJECT_TYPE_ID).getFirstValue());
         } else {
-            setModifiedBy(user);
             setModifiedAtNow();
         }
     }

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java Fri Aug  2 14:16:05 2013
@@ -148,12 +148,19 @@ public class VersionedDocumentImpl exten
 
         if (major) {
             for (DocumentVersion ver : fVersions) {
-                if (ver.isMajor()) {
+                if (ver.isMajor() && !ver.isPwc()) {
                     latest = ver;
                 }
             }
         } else {
             latest = fVersions.get(fVersions.size() - 1);
+            if (null == getPwc()) {
+                latest = fVersions.get(fVersions.size() - 1);
+            } else if (fVersions.size() > 1) {
+                latest = fVersions.get(fVersions.size() - 2);
+            } else {
+                latest = null;
+            }
         }
         return latest;
     }

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DefaultTypeSystemCreator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DefaultTypeSystemCreator.java?rev=1509723&r1=1509722&r2=1509723&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DefaultTypeSystemCreator.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DefaultTypeSystemCreator.java Fri Aug  2 14:16:05 2013
@@ -20,16 +20,20 @@ package org.apache.chemistry.opencmis.in
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.chemistry.opencmis.commons.definitions.Choice;
-import org.apache.chemistry.opencmis.commons.definitions.DocumentTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutableDocumentTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutableItemTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutablePolicyTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutableRelationshipTypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.MutableSecondaryTypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.enums.Updatability;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.ChoiceImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDateTimeDefinitionImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDecimalDefinitionImpl;
@@ -39,6 +43,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringDefinitionImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyUriDefinitionImpl;
 import org.apache.chemistry.opencmis.inmemory.TypeCreator;
+import org.apache.chemistry.opencmis.server.support.TypeDefinitionFactory;
 
 public class DefaultTypeSystemCreator implements TypeCreator {
     public static final List<TypeDefinition> singletonTypes = buildTypesList();
@@ -79,273 +84,337 @@ public class DefaultTypeSystemCreator im
      */
     private static List<TypeDefinition> buildTypesList() {
         // always add CMIS default types
+        TypeDefinitionFactory typeFactory =  DocumentTypeCreationHelper.getTypeDefinitionFactory();
+
         List<TypeDefinition> typesList = new LinkedList<TypeDefinition>();
 
-        InMemoryDocumentTypeDefinition cmisType1 = new InMemoryDocumentTypeDefinition("MyDocType1",
-                "My Type 1 Level 1", InMemoryDocumentTypeDefinition.getRootDocumentType());
-        typesList.add(cmisType1);
-
-        InMemoryDocumentTypeDefinition cmisType2 = new InMemoryDocumentTypeDefinition("MyDocType2",
-                "My Type 2 Level 1", InMemoryDocumentTypeDefinition.getRootDocumentType());
-        typesList.add(cmisType2);
-
-        InMemoryDocumentTypeDefinition cmisType11 = new InMemoryDocumentTypeDefinition("MyDocType1.1",
-                "My Type 3 Level 2", cmisType1);
-        typesList.add(cmisType11);
-
-        InMemoryDocumentTypeDefinition cmisType111 = new InMemoryDocumentTypeDefinition("MyDocType1.1.1",
-                "My Type 4 Level 3", cmisType11);
-        typesList.add(cmisType111);
-
-        InMemoryDocumentTypeDefinition cmisType112 = new InMemoryDocumentTypeDefinition("MyDocType1.1.2",
-                "My Type 5 Level 3", cmisType11);
-        typesList.add(cmisType112);
-
-        InMemoryDocumentTypeDefinition cmisType12 = new InMemoryDocumentTypeDefinition("MyDocType1.2",
-                "My Type 6 Level 2", cmisType1);
-        typesList.add(cmisType12);
-
-        InMemoryDocumentTypeDefinition cmisType21 = new InMemoryDocumentTypeDefinition("MyDocType2.1",
-                "My Type 7 Level 2", cmisType2);
-        typesList.add(cmisType21);
-
-        InMemoryDocumentTypeDefinition cmisType22 = new InMemoryDocumentTypeDefinition("MyDocType2.2",
-                "My Type 8 Level 2", cmisType2);
-        typesList.add(cmisType22);
-        InMemoryDocumentTypeDefinition cmisType23 = new InMemoryDocumentTypeDefinition("MyDocType2.3",
-                "My Type 9 Level 2", cmisType2);
-        typesList.add(cmisType23);
-        DocumentTypeDefinition cmisType24 = new InMemoryDocumentTypeDefinition("MyDocType2.4", "My Type 10 Level 2",
-                cmisType2);
-        typesList.add(cmisType24);
-        InMemoryDocumentTypeDefinition cmisType25 = new InMemoryDocumentTypeDefinition("MyDocType2.5",
-                "My Type 11 Level 2", cmisType2);
-        typesList.add(cmisType25);
-
-        InMemoryDocumentTypeDefinition cmisType26 = new InMemoryDocumentTypeDefinition("MyDocType2.6",
-                "My Type 12 Level 2", cmisType2);
-        typesList.add(cmisType26);
-        InMemoryDocumentTypeDefinition cmisType27 = new InMemoryDocumentTypeDefinition("MyDocType2.7",
-                "My Type 13 Level 2", cmisType2);
-        typesList.add(cmisType27);
-        InMemoryDocumentTypeDefinition cmisType28 = new InMemoryDocumentTypeDefinition("MyDocType2.8",
-                "My Type 14 Level 2", cmisType2);
-        typesList.add(cmisType28);
-        InMemoryDocumentTypeDefinition cmisType29 = new InMemoryDocumentTypeDefinition("MyDocType2.9",
-                "My Type 15 Level 2", cmisType2);
-        typesList.add(cmisType29);
-
-        // create a complex type with properties
-        InMemoryDocumentTypeDefinition cmisComplexType = new InMemoryDocumentTypeDefinition(COMPLEX_TYPE,
-                "Complex type with properties, Level 1", InMemoryDocumentTypeDefinition.getRootDocumentType());
-
-        // create a boolean property definition
-
-        Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-
-        PropertyDefinition<Boolean> prop = PropertyCreationHelper.createBooleanDefinition("BooleanProp",
-                "Sample Boolean Property", Updatability.READWRITE);
-        propertyDefinitions.put(prop.getId(), prop);
-
-        prop = PropertyCreationHelper.createBooleanMultiDefinition("BooleanPropMV",
-                "Sample Boolean multi-value Property", Updatability.READWRITE);
-        propertyDefinitions.put(prop.getId(), prop);
-
-        PropertyDateTimeDefinitionImpl prop2 = PropertyCreationHelper.createDateTimeDefinition("DateTimeProp",
-                "Sample DateTime Property", Updatability.READWRITE);
-        propertyDefinitions.put(prop2.getId(), prop2);
-
-        prop2 = PropertyCreationHelper.createDateTimeMultiDefinition("DateTimePropMV",
-                "Sample DateTime multi-value Property", Updatability.READWRITE);
-        propertyDefinitions.put(prop2.getId(), prop2);
-
-        PropertyDecimalDefinitionImpl prop3 = PropertyCreationHelper.createDecimalDefinition("DecimalProp",
-                "Sample Decimal Property", Updatability.READWRITE);
-        propertyDefinitions.put(prop3.getId(), prop3);
-
-        prop3 = PropertyCreationHelper.createDecimalMultiDefinition("DecimalPropMV",
-                "Sample Decimal multi-value Property", Updatability.READWRITE);
-        propertyDefinitions.put(prop3.getId(), prop3);
-
-        PropertyHtmlDefinitionImpl prop4 = PropertyCreationHelper.createHtmlDefinition("HtmlProp",
-                "Sample Html Property", Updatability.READWRITE);
-        propertyDefinitions.put(prop4.getId(), prop4);
-
-        prop4 = PropertyCreationHelper.createHtmlMultiDefinition("HtmlPropMV", "Sample Html multi-value Property",
-                Updatability.READWRITE);
-        propertyDefinitions.put(prop4.getId(), prop4);
-
-        PropertyIdDefinitionImpl prop5 = PropertyCreationHelper.createIdDefinition("IdProp", "Sample Id Property",
-                Updatability.READWRITE);
-        propertyDefinitions.put(prop5.getId(), prop5);
-
-        prop5 = PropertyCreationHelper.createIdMultiDefinition("IdPropMV", "Sample Id Html multi-value Property",
-                Updatability.READWRITE);
-        propertyDefinitions.put(prop5.getId(), prop5);
-
-        PropertyIntegerDefinitionImpl prop6 = PropertyCreationHelper.createIntegerDefinition("IntProp",
-                "Sample Int Property", Updatability.READWRITE);
-        propertyDefinitions.put(prop6.getId(), prop6);
-
-        prop6 = PropertyCreationHelper.createIntegerMultiDefinition("IntPropMV", "Sample Int multi-value Property",
-                Updatability.READWRITE);
-        propertyDefinitions.put(prop6.getId(), prop6);
-
-        PropertyStringDefinitionImpl prop7 = PropertyCreationHelper.createStringDefinition("StringProp",
-                "Sample String Property", Updatability.READWRITE);
-        propertyDefinitions.put(prop7.getId(), prop7);
-
-        PropertyUriDefinitionImpl prop8 = PropertyCreationHelper.createUriDefinition("UriProp", "Sample Uri Property",
-                Updatability.READWRITE);
-        propertyDefinitions.put(prop8.getId(), prop8);
-
-        prop8 = PropertyCreationHelper.createUriMultiDefinition("UriPropMV", "Sample Uri multi-value Property",
-                Updatability.READWRITE);
-        propertyDefinitions.put(prop8.getId(), prop8);
-
-        PropertyStringDefinitionImpl prop9 = PropertyCreationHelper.createStringDefinition("PickListProp",
-                "Sample Pick List Property", Updatability.READWRITE);
-        List<Choice<String>> choiceList = new ArrayList<Choice<String>>();
-        ChoiceImpl<String> elem = new ChoiceImpl<String>();
-        elem.setValue(Collections.singletonList("red"));
-        choiceList.add(elem);
-        elem = new ChoiceImpl<String>();
-        elem.setValue(Collections.singletonList("green"));
-        choiceList.add(elem);
-        elem = new ChoiceImpl<String>();
-        elem.setValue(Collections.singletonList("blue"));
-        choiceList.add(elem);
-        elem = new ChoiceImpl<String>();
-        elem.setValue(Collections.singletonList("black"));
-        choiceList.add(elem);
-        prop9.setChoices(choiceList);
-        prop9.setDefaultValue(Collections.singletonList("blue"));
-        propertyDefinitions.put(prop9.getId(), prop9);
-
-        /*
-         * try short form: / PropertyCreationHelper.addElemToPicklist(prop9,
-         * "red"); PropertyCreationHelper.addElemToPicklist(prop9, "green");
-         * PropertyCreationHelper.addElemToPicklist(prop9, "blue");
-         * PropertyCreationHelper.addElemToPicklist(prop9, "black");
-         * PropertyCreationHelper.setDefaultValue(prop9, "blue"); /
-         */
-
-        cmisComplexType.setPropertyDefinitions(propertyDefinitions);
-
-        // add type to types collection
-        typesList.add(cmisComplexType);
-
-        // create a type hierarchy with inherited properties
-        InMemoryDocumentTypeDefinition cmisDocTypeTopLevel = new InMemoryDocumentTypeDefinition(TOPLEVEL_TYPE,
-                "Document type with properties, Level 1", InMemoryDocumentTypeDefinition.getRootDocumentType());
-
-        InMemoryDocumentTypeDefinition cmisDocTypeLevel1 = new InMemoryDocumentTypeDefinition(LEVEL1_TYPE,
-                "Document type with inherited properties, Level 2", cmisDocTypeTopLevel);
-
-        InMemoryDocumentTypeDefinition cmisDocTypeLevel2 = new InMemoryDocumentTypeDefinition(LEVEL2_TYPE,
-                "Document type with inherited properties, Level 3", cmisDocTypeLevel1);
-
-        propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-        PropertyStringDefinitionImpl propTop = PropertyCreationHelper.createStringDefinition("StringPropTopLevel",
-                "Sample String Property", Updatability.READWRITE);
-        propertyDefinitions.put(propTop.getId(), propTop);
-        cmisDocTypeTopLevel.setPropertyDefinitions(propertyDefinitions);
-
-        propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-        PropertyStringDefinitionImpl propLevel1 = PropertyCreationHelper.createStringDefinition("StringPropLevel1",
-                "String Property Level 1", Updatability.READWRITE);
-        propertyDefinitions.put(propLevel1.getId(), propLevel1);
-        cmisDocTypeLevel1.setPropertyDefinitions(propertyDefinitions);
-
-        propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-        PropertyStringDefinitionImpl propLevel2 = PropertyCreationHelper.createStringDefinition("StringPropLevel2",
-                "String Property Level 2", Updatability.READWRITE);
-        propertyDefinitions.put(propLevel2.getId(), propLevel2);
-        cmisDocTypeLevel2.setPropertyDefinitions(propertyDefinitions);
-
-        // add type to types collection
-        typesList.add(cmisDocTypeTopLevel);
-        typesList.add(cmisDocTypeLevel1);
-        typesList.add(cmisDocTypeLevel2);
-
-        // Create a type that is versionable
-        InMemoryDocumentTypeDefinition cmisVersionedType = new InMemoryDocumentTypeDefinition(VERSIONED_TYPE,
-                "VersionedType", InMemoryDocumentTypeDefinition.getRootDocumentType());
-
-        // create a single String property definition
-
-        propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-
-        PropertyStringDefinitionImpl prop1 = PropertyCreationHelper.createStringDefinition("VersionedStringProp",
-                "Sample String Property", Updatability.WHENCHECKEDOUT);
-        propertyDefinitions.put(prop1.getId(), prop1);
-
-        cmisVersionedType.addCustomPropertyDefinitions(propertyDefinitions);
-        cmisVersionedType.setIsVersionable(true); // make it a versionable type;
-
-        // add type to types collection
-        typesList.add(cmisVersionedType);
-        
-        //CMIS 1.1 create an item item type
-
-        InMemoryItemTypeDefinition cmisItemType = new InMemoryItemTypeDefinition(ITEM_TYPE, "MyItemType");
-
-        // create a single String property definition
-
-        propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-
-        prop1 = PropertyCreationHelper.createStringDefinition("ItemStringProp",
-                "Item String Property", Updatability.READWRITE);
-        propertyDefinitions.put(prop1.getId(), prop1);
-        cmisItemType.addCustomPropertyDefinitions(propertyDefinitions);
-        // add type to types collection
-        typesList.add(cmisItemType);
-        
-
-        InMemorySecondaryTypeDefinition cmisSecondaryType = new InMemorySecondaryTypeDefinition(SECONDARY_TYPE_ID, 
-                "MySecondaryType");
-        // create a single String property definition
-        Map<String, PropertyDefinition<?>> secondaryPropertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-        PropertyStringDefinitionImpl propS1 = PropertyCreationHelper.createStringDefinition("SecondaryStringProp",
-                "Secondary String Property", Updatability.READWRITE);
-        secondaryPropertyDefinitions.put(propS1.getId(), propS1);
-        PropertyIntegerDefinitionImpl propS2 = PropertyCreationHelper.createIntegerDefinition("SecondaryIntegerProp",
-                "Secondary Integer Property", Updatability.READWRITE);
-        propS2.setIsRequired(true);
-        secondaryPropertyDefinitions.put(propS2.getId(), propS2);
-        cmisSecondaryType.addCustomPropertyDefinitions(secondaryPropertyDefinitions);
-        // add type to types collection
-        typesList.add(cmisSecondaryType);
-
-        // add relationship type
-        InMemoryRelationshipTypeDefinition cmisRelType = new InMemoryRelationshipTypeDefinition(
-                "CrossReferenceType", "CrossReferenceRelationshipType");
-        // create a single String property definition
-
-        propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-        propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-        prop1 = PropertyCreationHelper.createStringDefinition("CrossReferenceKind",
-                "CrossReferenceType", Updatability.READWRITE);
-        propertyDefinitions.put(prop1.getId(), prop1);
-        cmisRelType.addCustomPropertyDefinitions(propertyDefinitions);
-        typesList.add(cmisRelType);            
-
-        // add a policy type
-        InMemoryPolicyTypeDefinition polType = new InMemoryPolicyTypeDefinition(
-                "AuditPolicy", "Audit Policy", InMemoryPolicyTypeDefinition.getRootPolicyType());
-
-        // create a String property definition
-
-        propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
-
-        prop1 = PropertyCreationHelper.createStringDefinition("AuditSettings",
-                "Audit Kind Property", Updatability.READWRITE);
-        propertyDefinitions.put(prop1.getId(), prop1);
-
-        polType.addCustomPropertyDefinitions(propertyDefinitions);
-        typesList.add(polType);            
-        
-        return typesList;
+        MutableDocumentTypeDefinition cmisType1;        
+        try {
+            cmisType1 = typeFactory.createDocumentTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisDocumentType().getId());
+            cmisType1.setId("MyDocType1");
+            cmisType1.setDisplayName("My Type 1 Level 1");
+            cmisType1.setDescription("Builtin InMemory type definition MyDocType1");
+            typesList.add(cmisType1);
+
+            MutableDocumentTypeDefinition cmisType2;        
+            cmisType2 = typeFactory.createDocumentTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisDocumentType().getId());
+            cmisType2.setId("MyDocType2");
+            cmisType2.setDisplayName("My Type 2 Level 1");
+            cmisType2.setDescription("Builtin InMemory type definition MyDocType2");
+            typesList.add(cmisType2);
+
+            MutableDocumentTypeDefinition cmisType11;        
+            cmisType11 = typeFactory.createChildDocumentTypeDefinition(cmisType1, null);
+            cmisType11.setId("MyDocType1.1");
+            cmisType11.setDisplayName("My Type 3 Level 2");
+            cmisType11.setDescription("Builtin InMemory type definition MyDocType1.1");
+            typesList.add(cmisType11);
+
+            MutableDocumentTypeDefinition cmisType111;        
+            cmisType111 = typeFactory.createChildDocumentTypeDefinition(cmisType11, null);
+            cmisType111.setId("MyDocType1.1.1");
+            cmisType111.setDisplayName("My Type 4 Level 3");
+            cmisType111.setDescription("Builtin InMemory type definition MyDocType1.1.1");
+            typesList.add(cmisType111);
+
+            MutableDocumentTypeDefinition cmisType112;        
+            cmisType112 = typeFactory.createChildDocumentTypeDefinition(cmisType11, null);
+            cmisType112.setId("MyDocType1.1.2");
+            cmisType112.setDisplayName("My Type 5 Level 3");
+            cmisType112.setDescription("Builtin InMemory type definition MyDocType1.1.2");
+            typesList.add(cmisType112);
+
+            MutableDocumentTypeDefinition cmisType12;        
+            cmisType12 = typeFactory.createChildDocumentTypeDefinition(cmisType1, null);
+            cmisType12.setId("MyDocType1.2");
+            cmisType12.setDisplayName("My Type 6 Level 2");
+            cmisType12.setDescription("Builtin InMemory type definition MyDocType1.2");
+            typesList.add(cmisType12);
+
+            MutableDocumentTypeDefinition cmisType21;        
+            cmisType21 = typeFactory.createChildDocumentTypeDefinition(cmisType2, null);
+            cmisType21.setId("MyDocType2.1");
+            cmisType21.setDisplayName("My Type 7 Level 2");
+            cmisType21.setDescription("Builtin InMemory type definition MyDocType2.1");
+            typesList.add(cmisType21);
+
+            MutableDocumentTypeDefinition cmisType22;        
+            cmisType22 = typeFactory.createChildDocumentTypeDefinition(cmisType2, null);
+            cmisType22.setId("MyDocType2.2");
+            cmisType22.setDisplayName("My Type 8 Level 2");
+            cmisType22.setDescription("Builtin InMemory type definition MyDocType2.2");
+            typesList.add(cmisType22);
+
+            MutableDocumentTypeDefinition cmisType23;        
+            cmisType23 = typeFactory.createChildDocumentTypeDefinition(cmisType2, null);
+            cmisType23.setId("MyDocType2.3");
+            cmisType23.setDisplayName("My Type 9 Level 2");
+            cmisType23.setDescription("Builtin InMemory type definition MyDocType2.3");
+            typesList.add(cmisType23);
+
+            MutableDocumentTypeDefinition cmisType24;        
+            cmisType24 = typeFactory.createChildDocumentTypeDefinition(cmisType2, null);
+            cmisType24.setId("MyDocType2.4");
+            cmisType24.setDisplayName("My Type 10 Level 2");
+            cmisType24.setDescription("Builtin InMemory type definition MyDocType2.4");
+            typesList.add(cmisType24);
+
+            MutableDocumentTypeDefinition cmisType25;        
+            cmisType25 = typeFactory.createChildDocumentTypeDefinition(cmisType2, null);
+            cmisType25.setId("MyDocType2.5");
+            cmisType25.setDisplayName("My Type 11 Level 2");
+            cmisType25.setDescription("Builtin InMemory type definition MyDocType2.5");
+            typesList.add(cmisType25);
+
+            MutableDocumentTypeDefinition cmisType26;        
+            cmisType26 = typeFactory.createChildDocumentTypeDefinition(cmisType2, null);
+            cmisType26.setId("MyDocType2.6");
+            cmisType26.setDisplayName("My Type 12 Level 2");
+            cmisType26.setDescription("Builtin InMemory type definition MyDocType2.6");
+            typesList.add(cmisType26);
+
+            MutableDocumentTypeDefinition cmisType27;        
+            cmisType27 = typeFactory.createChildDocumentTypeDefinition(cmisType2, null);
+            cmisType27.setId("MyDocType2.7");
+            cmisType27.setDisplayName("My Type 13 Level 2");
+            cmisType27.setDescription("Builtin InMemory type definition MyDocType2.7");
+            typesList.add(cmisType27);
+
+            MutableDocumentTypeDefinition cmisType28;        
+            cmisType28 = typeFactory.createChildDocumentTypeDefinition(cmisType2, null);
+            cmisType28.setId("MyDocType2.8");
+            cmisType28.setDisplayName("My Type 14 Level 2");
+            cmisType28.setDescription("Builtin InMemory type definition MyDocType2.8");
+            typesList.add(cmisType28);
+
+            MutableDocumentTypeDefinition cmisType29;        
+            cmisType29 = typeFactory.createChildDocumentTypeDefinition(cmisType2, null);
+            cmisType29.setId("MyDocType2.9");
+            cmisType29.setDisplayName("My Type 15 Level 2");
+            cmisType29.setDescription("Builtin InMemory type definition MyDocType2.9");
+            typesList.add(cmisType29);
+
+            // create a complex type with properties
+            MutableDocumentTypeDefinition cmisComplexType;        
+            cmisComplexType = typeFactory.createDocumentTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisDocumentType().getId());
+            cmisComplexType.setId(COMPLEX_TYPE);
+            cmisComplexType.setDisplayName("Complex type with properties, Level 1");
+            cmisComplexType.setDescription("Builtin InMemory type definition ComplexType");
+
+            PropertyDefinition<Boolean> prop = PropertyCreationHelper.createBooleanDefinition("BooleanProp",
+                    "Sample Boolean Property", Updatability.READWRITE);
+            cmisComplexType.addPropertyDefinition(prop);
+
+            prop = PropertyCreationHelper.createBooleanMultiDefinition("BooleanPropMV",
+                    "Sample Boolean multi-value Property", Updatability.READWRITE);
+            cmisComplexType.addPropertyDefinition(prop);
+
+            PropertyDateTimeDefinitionImpl prop2 = PropertyCreationHelper.createDateTimeDefinition("DateTimeProp",
+                    "Sample DateTime Property", Updatability.READWRITE);
+            cmisComplexType.addPropertyDefinition(prop2);
+
+            prop2 = PropertyCreationHelper.createDateTimeMultiDefinition("DateTimePropMV",
+                    "Sample DateTime multi-value Property", Updatability.READWRITE);
+            cmisComplexType.addPropertyDefinition(prop2);
+
+            PropertyDecimalDefinitionImpl prop3 = PropertyCreationHelper.createDecimalDefinition("DecimalProp",
+                    "Sample Decimal Property", Updatability.READWRITE);
+            cmisComplexType.addPropertyDefinition(prop3);
+
+            prop3 = PropertyCreationHelper.createDecimalMultiDefinition("DecimalPropMV",
+                    "Sample Decimal multi-value Property", Updatability.READWRITE);
+            cmisComplexType.addPropertyDefinition(prop3);
+
+            PropertyHtmlDefinitionImpl prop4 = PropertyCreationHelper.createHtmlDefinition("HtmlProp",
+                    "Sample Html Property", Updatability.READWRITE);
+            cmisComplexType.addPropertyDefinition(prop4);
+
+            prop4 = PropertyCreationHelper.createHtmlMultiDefinition("HtmlPropMV", "Sample Html multi-value Property",
+                    Updatability.READWRITE);
+            cmisComplexType.addPropertyDefinition(prop4);
+
+            PropertyIdDefinitionImpl prop5 = PropertyCreationHelper.createIdDefinition("IdProp", "Sample Id Property",
+                    Updatability.READWRITE);
+            cmisComplexType.addPropertyDefinition(prop5);
+
+            prop5 = PropertyCreationHelper.createIdMultiDefinition("IdPropMV", "Sample Id Html multi-value Property",
+                    Updatability.READWRITE);
+            cmisComplexType.addPropertyDefinition(prop5);
+
+            PropertyIntegerDefinitionImpl prop6 = PropertyCreationHelper.createIntegerDefinition("IntProp",
+                    "Sample Int Property", Updatability.READWRITE);
+            cmisComplexType.addPropertyDefinition(prop6);
+
+            prop6 = PropertyCreationHelper.createIntegerMultiDefinition("IntPropMV", "Sample Int multi-value Property",
+                    Updatability.READWRITE);
+            cmisComplexType.addPropertyDefinition(prop6);
+
+            PropertyStringDefinitionImpl prop7 = PropertyCreationHelper.createStringDefinition("StringProp",
+                    "Sample String Property", Updatability.READWRITE);
+            cmisComplexType.addPropertyDefinition(prop7);
+
+            PropertyUriDefinitionImpl prop8 = PropertyCreationHelper.createUriDefinition("UriProp", "Sample Uri Property",
+                    Updatability.READWRITE);
+            cmisComplexType.addPropertyDefinition(prop8);
+
+            prop8 = PropertyCreationHelper.createUriMultiDefinition("UriPropMV", "Sample Uri multi-value Property",
+                    Updatability.READWRITE);
+            cmisComplexType.addPropertyDefinition(prop8);
+
+            PropertyStringDefinitionImpl prop9 = PropertyCreationHelper.createStringDefinition("PickListProp",
+                    "Sample Pick List Property", Updatability.READWRITE);
+            List<Choice<String>> choiceList = new ArrayList<Choice<String>>();
+            ChoiceImpl<String> elem = new ChoiceImpl<String>();
+            elem.setValue(Collections.singletonList("red"));
+            choiceList.add(elem);
+            elem = new ChoiceImpl<String>();
+            elem.setValue(Collections.singletonList("green"));
+            choiceList.add(elem);
+            elem = new ChoiceImpl<String>();
+            elem.setValue(Collections.singletonList("blue"));
+            choiceList.add(elem);
+            elem = new ChoiceImpl<String>();
+            elem.setValue(Collections.singletonList("black"));
+            choiceList.add(elem);
+            prop9.setChoices(choiceList);
+            prop9.setDefaultValue(Collections.singletonList("blue"));
+            cmisComplexType.addPropertyDefinition(prop9);
+
+            /*
+             * try short form: / PropertyCreationHelper.addElemToPicklist(prop9,
+             * "red"); PropertyCreationHelper.addElemToPicklist(prop9, "green");
+             * PropertyCreationHelper.addElemToPicklist(prop9, "blue");
+             * PropertyCreationHelper.addElemToPicklist(prop9, "black");
+             * PropertyCreationHelper.setDefaultValue(prop9, "blue"); /
+             */
+
+            // add type to types collection
+            typesList.add(cmisComplexType);
+
+            // create a type hierarchy with inherited properties
+            MutableDocumentTypeDefinition cmisDocTypeTopLevel;        
+            cmisDocTypeTopLevel = typeFactory.createDocumentTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisDocumentType().getId());
+            cmisDocTypeTopLevel.setId(TOPLEVEL_TYPE);
+            cmisDocTypeTopLevel.setDisplayName("Document type with properties, Level 1");
+            cmisDocTypeTopLevel.setDescription("Builtin InMemory type definition " + TOPLEVEL_TYPE);
+
+            MutableDocumentTypeDefinition cmisDocTypeLevel1;        
+            cmisDocTypeLevel1 = typeFactory.createChildDocumentTypeDefinition(cmisDocTypeTopLevel, null);
+            cmisDocTypeLevel1.setId(LEVEL1_TYPE);
+            cmisDocTypeLevel1.setDisplayName("Document type with inherited properties, Level 2");
+            cmisDocTypeLevel1 .setDescription("Builtin InMemory type definition " + LEVEL1_TYPE);
+
+            MutableDocumentTypeDefinition cmisDocTypeLevel2;        
+            cmisDocTypeLevel2 = typeFactory.createChildDocumentTypeDefinition(cmisDocTypeLevel1, null);
+            cmisDocTypeLevel2.setId(LEVEL2_TYPE);
+            cmisDocTypeLevel2.setDisplayName("Document type with inherited properties, Level 3");
+            cmisDocTypeLevel2.setDescription("Builtin InMemory type definition " + LEVEL2_TYPE);
+
+            PropertyStringDefinitionImpl propTop = PropertyCreationHelper.createStringDefinition("StringPropTopLevel",
+                    "Sample String Property", Updatability.READWRITE);
+            cmisDocTypeTopLevel.addPropertyDefinition(propTop);
+
+            PropertyStringDefinitionImpl propLevel1 = PropertyCreationHelper.createStringDefinition("StringPropLevel1",
+                    "String Property Level 1", Updatability.READWRITE);
+            cmisDocTypeLevel1.addPropertyDefinition(propLevel1);
+
+            PropertyStringDefinitionImpl propLevel2 = PropertyCreationHelper.createStringDefinition("StringPropLevel2",
+                    "String Property Level 2", Updatability.READWRITE);
+            cmisDocTypeLevel2.addPropertyDefinition(propLevel2);
+
+            // add type to types collection
+            typesList.add(cmisDocTypeTopLevel);
+            typesList.add(cmisDocTypeLevel1);
+            typesList.add(cmisDocTypeLevel2);
+
+            // Create a type that is versionable
+            MutableDocumentTypeDefinition cmisVersionedType;        
+            cmisVersionedType = typeFactory.createDocumentTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisDocumentType().getId());
+            cmisVersionedType.setId(VERSIONED_TYPE);
+            cmisVersionedType.setDisplayName("Versioned Type");
+            cmisVersionedType.setDescription("Builtin InMemory type definition " + VERSIONED_TYPE);
+            cmisVersionedType.setIsVersionable(true); // make it a versionable type;
+
+            // create a single String property definition
+            PropertyStringDefinitionImpl prop1 = PropertyCreationHelper.createStringDefinition("VersionedStringProp",
+                    "Sample String Property", Updatability.WHENCHECKEDOUT);
+            cmisVersionedType.addPropertyDefinition(prop1);
+
+            // add type to types collection
+            typesList.add(cmisVersionedType);
+
+            // CMIS 1.1 create an item item type
+
+            MutableItemTypeDefinition itemType;        
+            itemType = typeFactory.createItemTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisItemType().getId()); // ??? DocumentTypeCreationHelper.getCmisItemType());
+            itemType.setId(ITEM_TYPE);
+            itemType.setDisplayName("MyItemType");
+            itemType.setDescription("Builtin InMemory type definition " + ITEM_TYPE);
+            DocumentTypeCreationHelper.setDefaultTypeCapabilities(itemType);
+
+            // create a single String property definition
+
+            prop1 = PropertyCreationHelper.createStringDefinition("ItemStringProp",
+                    "Item String Property", Updatability.READWRITE);
+            itemType.addPropertyDefinition(prop1);
+            // add type to types collection
+            typesList.add(itemType);
+
+
+            MutableSecondaryTypeDefinition cmisSecondaryType;        
+            cmisSecondaryType = typeFactory.createSecondaryTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisSecondaryType().getId());
+            cmisSecondaryType.setId(SECONDARY_TYPE_ID);
+            cmisSecondaryType.setDisplayName("MySecondaryType");
+            cmisSecondaryType.setDescription("Builtin InMemory type definition " + SECONDARY_TYPE_ID);
+            DocumentTypeCreationHelper.setDefaultTypeCapabilities(cmisSecondaryType);
+            cmisSecondaryType.setIsFileable(false);
+            
+            // create a single String property definition
+            PropertyStringDefinitionImpl propS1 = PropertyCreationHelper.createStringDefinition("SecondaryStringProp",
+                    "Secondary String Property", Updatability.READWRITE);
+            cmisSecondaryType.addPropertyDefinition(propS1);
+            PropertyIntegerDefinitionImpl propS2 = PropertyCreationHelper.createIntegerDefinition("SecondaryIntegerProp",
+                    "Secondary Integer Property", Updatability.READWRITE);
+            propS2.setIsRequired(true);
+            cmisSecondaryType.addPropertyDefinition(propS2);
+            // add type to types collection
+            typesList.add(cmisSecondaryType);
+
+            // add relationship type
+            MutableRelationshipTypeDefinition relType;        
+            relType = typeFactory.createRelationshipTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisRelationshipType().getId());
+            relType.setId("CrossReferenceType");
+            relType.setDisplayName("CrossReferenceType");
+            relType.setDescription("Builtin InMemory type definition CrossReferenceType");
+            DocumentTypeCreationHelper.setDefaultTypeCapabilities(relType);
+            relType.setIsFileable(false);
+
+            // create a single String property definition
+
+            prop1 = PropertyCreationHelper.createStringDefinition("CrossReferenceKind",
+                    "CrossReferenceType", Updatability.READWRITE);
+            relType.addPropertyDefinition(prop1);
+            typesList.add(relType);            
+
+            // add a policy type
+            MutablePolicyTypeDefinition polType;        
+            polType = typeFactory.createPolicyTypeDefinition(CmisVersion.CMIS_1_1, DocumentTypeCreationHelper.getCmisPolicyType().getId());
+            polType.setId("AuditPolicy");
+            polType.setDisplayName("Audit Policy");
+            polType.setDescription("Builtin InMemory type definition AuditPolicy");
+            DocumentTypeCreationHelper.setDefaultTypeCapabilities(polType);
+            polType.setIsFileable(false);
+
+            // create a String property definition
+            prop1 = PropertyCreationHelper.createStringDefinition("AuditSettings",
+                    "Audit Kind Property", Updatability.READWRITE);
+            polType.addPropertyDefinition(prop1);
+            typesList.add(polType);            
+
+            return typesList;
+        } catch (Exception e) {
+            throw new CmisRuntimeException("Error when creating built-in InMemory types.", e);
+        }
     }
 
 }