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/16 10:47:51 UTC

svn commit: r1514619 [2/4] - in /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory: ./ query/ server/ storedobj/api/ storedobj/impl/ types/

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java?rev=1514619&r1=1514618&r2=1514619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java Fri Aug 16 08:47:50 2013
@@ -84,15 +84,16 @@ public class InMemoryNavigationServiceIm
         String user = context.getUsername();
         ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
         if (null == folderId) {
-            List<StoredObject> checkedOuts = fStoreManager.getObjectStore(repositoryId).getCheckedOutDocuments(
-                    orderBy, context.getUsername(), includeRelationships);
+            List<StoredObject> checkedOuts = fStoreManager.getObjectStore(repositoryId).getCheckedOutDocuments(orderBy,
+                    context.getUsername(), includeRelationships);
             for (StoredObject checkedOut : checkedOuts) {
                 TypeManager tm = fStoreManager.getTypeManager(repositoryId);
                 ObjectData od = PropertyCreationHelper.getObjectData(tm, objStore, checkedOut, filter, user,
                         includeAllowableActions, includeRelationships, renditionFilter, false, false, extension);
                 if (context.isObjectInfoRequired()) {
                     ObjectInfoImpl objectInfo = new ObjectInfoImpl();
-                    fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, /* workingCopy */ checkedOut, objectInfo);
+                    fAtomLinkProvider
+                            .fillInformationForAtomLinks(repositoryId, /* workingCopy */checkedOut, objectInfo);
                     objectInfos.addObjectInfo(objectInfo);
                 }
                 odList.add(od);
@@ -100,8 +101,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, true,
-                   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());
@@ -131,7 +132,7 @@ public class InMemoryNavigationServiceIm
 
         LOG.debug("start getChildren()");
 
-        validator.getChildren(context,repositoryId, folderId, extension);
+        validator.getChildren(context, repositoryId, folderId, extension);
 
         int maxItemsInt = maxItems == null ? -1 : maxItems.intValue();
         int skipCountInt = skipCount == null ? 0 : skipCount.intValue();
@@ -186,8 +187,8 @@ public class InMemoryNavigationServiceIm
                     + folderId);
         }
 
-        ObjectData res = getFolderParentIntern(repositoryId, folder, filter, false, 
-        		IncludeRelationships.NONE, context.getUsername(), context.isObjectInfoRequired() ? objectInfos : null);
+        ObjectData res = getFolderParentIntern(repositoryId, folder, filter, false, IncludeRelationships.NONE,
+                context.getUsername(), context.isObjectInfoRequired() ? objectInfos : null);
         if (res == null) {
             throw new CmisInvalidArgumentException("Cannot get parent of a root folder");
         }
@@ -249,9 +250,9 @@ public class InMemoryNavigationServiceIm
             return Collections.emptyList();
         }
 
-        result = getObjectParentsIntern(repositoryId, spo, filter, 
-        		context.isObjectInfoRequired() ? objectInfos : null, includeAllowableActions, includeRelationships,
-				renditionFilter, includeRelativePathSegment, context.getUsername());
+        result = getObjectParentsIntern(repositoryId, spo, filter, context.isObjectInfoRequired() ? objectInfos : null,
+                includeAllowableActions, includeRelationships, renditionFilter, includeRelativePathSegment,
+                context.getUsername());
 
         // To be able to provide all Atom links in the response we need
         // additional information:
@@ -269,8 +270,8 @@ 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, boolean includePwc, ObjectInfoHandler objectInfos,
-            String user) {
+            Boolean includePathSegments, int maxItems, int skipCount, boolean folderOnly, boolean includePwc,
+            ObjectInfoHandler objectInfos, String user) {
 
         ObjectInFolderListImpl result = new ObjectInFolderListImpl();
         List<ObjectInFolderData> folderList = new ArrayList<ObjectInFolderData>();
@@ -278,7 +279,7 @@ public class InMemoryNavigationServiceIm
         StoredObject so = objStore.getObjectById(folderId);
         ObjectStoreFiling objStoreFiling = (ObjectStoreFiling) objStore;
         boolean cmis11 = InMemoryServiceContext.getCallContext().getCmisVersion() != CmisVersion.CMIS_1_0;
-        
+
         if (so == null) {
             throw new CmisObjectNotFoundException("Unknown object id: " + folderId);
         }
@@ -287,24 +288,24 @@ public class InMemoryNavigationServiceIm
             return null; // it is a document and has no children
         }
 
-        ObjectStoreFiling.ChildrenResult children = folderOnly ? objStoreFiling.getFolderChildren((Folder)so, maxItems, skipCount, user) : objStoreFiling
-                .getChildren((Folder)so, maxItems, skipCount, user, includePwc);
-        
+        ObjectStoreFiling.ChildrenResult children = folderOnly ? objStoreFiling.getFolderChildren((Folder) so,
+                maxItems, skipCount, user) : objStoreFiling.getChildren((Folder) so, maxItems, skipCount, user,
+                includePwc);
+
         for (Fileable child : children.getChildren()) {
 
-            if (!cmis11 && child instanceof Item)
-             {
-                continue; // ignore items for CMIS 1.0 
+            if (!cmis11 && child instanceof Item) {
+                continue; // ignore items for CMIS 1.0
             }
-            
+
             ObjectInFolderDataImpl oifd = new ObjectInFolderDataImpl();
             if (includePathSegments != null && includePathSegments) {
                 oifd.setPathSegment(child.getName());
             }
 
             TypeManager tm = fStoreManager.getTypeManager(repositoryId);
-            ObjectData objectData = PropertyCreationHelper.getObjectData(tm, objStore, child, filter, user, includeAllowableActions, 
-                    includeRelationships, renditionFilter, false, false, null);
+            ObjectData objectData = PropertyCreationHelper.getObjectData(tm, objStore, child, filter, user,
+                    includeAllowableActions, includeRelationships, renditionFilter, false, false, null);
 
             oifd.setObject(objectData);
             folderList.add(oifd);
@@ -360,20 +361,20 @@ public class InMemoryNavigationServiceIm
     }
 
     private List<ObjectParentData> getObjectParentsIntern(String repositoryId, Filing sop, String filter,
-            ObjectInfoHandler objectInfos, Boolean includeAllowableActions, 
-            IncludeRelationships includeRelationships, String renditionFilter, Boolean includeRelativePathSegment, String user) {
+            ObjectInfoHandler objectInfos, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+            String renditionFilter, Boolean includeRelativePathSegment, String user) {
 
-        List<ObjectParentData> result = null;        
+        List<ObjectParentData> result = null;
         result = new ArrayList<ObjectParentData>();
         ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
-        List<String> parentIds = ((ObjectStoreFiling)objStore).getParentIds(sop, user);
+        List<String> parentIds = ((ObjectStoreFiling) objStore).getParentIds(sop, user);
         if (null != parentIds) {
             for (String parentId : parentIds) {
                 ObjectParentDataImpl parentData = new ObjectParentDataImpl();
                 TypeManager tm = fStoreManager.getTypeManager(repositoryId);
                 Folder parent = (Folder) objStore.getObjectById(parentId);
-                ObjectData objData = PropertyCreationHelper.getObjectData(tm, objStore, parent, filter, user, includeAllowableActions, 
-                        includeRelationships, renditionFilter, false, true, null);
+                ObjectData objData = PropertyCreationHelper.getObjectData(tm, objStore, parent, filter, user,
+                        includeAllowableActions, includeRelationships, renditionFilter, false, true, null);
                 parentData.setObject(objData);
                 if (null != includeRelativePathSegment && includeRelativePathSegment) {
                     parentData.setRelativePathSegment(sop.getPathSegment());
@@ -386,18 +387,18 @@ public class InMemoryNavigationServiceIm
                 }
             }
         }
-        
+
         return result;
     }
 
     private ObjectData getFolderParentIntern(String repositoryId, Filing sop, String filter,
-    		Boolean includeAllowableActions, IncludeRelationships includeRelationships, 
-    		String user, ObjectInfoHandler objectInfos) {
+            Boolean includeAllowableActions, IncludeRelationships includeRelationships, String user,
+            ObjectInfoHandler objectInfos) {
 
         ObjectDataImpl parent = new ObjectDataImpl();
 
         ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
-        List<String> parents = ((ObjectStoreFiling)objStore).getParentIds(sop, user);
+        List<String> parents = ((ObjectStoreFiling) objStore).getParentIds(sop, user);
         if (null == parents || parents.isEmpty()) {
             return null;
         }
@@ -406,15 +407,16 @@ public class InMemoryNavigationServiceIm
         Folder parentFolder = (Folder) objStore.getObjectById(parentId);
 
         copyFilteredProperties(repositoryId, parentFolder, filter, parent);
-        
+
         TypeManager tm = fStoreManager.getTypeManager(repositoryId);
-        parent.setRelationships(DataObjectCreator.getRelationships(tm, objStore, includeRelationships, parentFolder, user));
-        
+        parent.setRelationships(DataObjectCreator.getRelationships(tm, objStore, includeRelationships, parentFolder,
+                user));
+
         if (includeAllowableActions != null && includeAllowableActions) {
-          	AllowableActions allowableActions = parentFolder.getAllowableActions(user);
-          	parent.setAllowableActions(allowableActions);
-          }
-        
+            AllowableActions allowableActions = parentFolder.getAllowableActions(user);
+            parent.setAllowableActions(allowableActions);
+        }
+
         if (objectInfos != null) {
             ObjectInfoImpl objectInfo = new ObjectInfoImpl();
             fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, parentFolder, objectInfo);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java?rev=1514619&r1=1514618&r2=1514619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java Fri Aug 16 08:47:50 2013
@@ -57,6 +57,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.BulkUpdateObjectIdAndChangeTokenImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.CmisExtensionElementImpl;
@@ -609,6 +610,9 @@ public class InMemoryObjectServiceImpl e
             ObjectInfoHandler objectInfos) {
 
         LOG.debug("start updateProperties()");
+        if (properties == null) {
+            throw new CmisRuntimeException("update properties: no properties given for object id: " + objectId.getValue());
+        }
         StoredObject so = validator.updateProperties(context, repositoryId, objectId, extension);
         String user = context.getUsername();
         ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
@@ -658,77 +662,75 @@ public class InMemoryObjectServiceImpl e
         }
 
         // update properties:
-        if (properties != null) {
-            for (String key : properties.getProperties().keySet()) {
-                if (key.equals(PropertyIds.NAME)) {
-                    continue; // ignore here
-                }
+        for (String key : properties.getProperties().keySet()) {
+            if (key.equals(PropertyIds.NAME)) {
+                continue; // ignore here
+            }
 
-                PropertyData<?> value = properties.getProperties().get(key);
-                PropertyDefinition<?> propDef = typeDef.getPropertyDefinitions().get(key);
-                if (cmis11 && null == propDef) {
-                    TypeDefinition typeDefSecondary = getSecondaryTypeDefinition(repositoryId, secondaryTypeIds, key);
-                    if (null == typeDefSecondary) {
-                        throw new CmisInvalidArgumentException("Cannot update property " + key
-                                + ": not contained in type");
-                    }
-                    propDef = typeDefSecondary.getPropertyDefinitions().get(key);
-                }
-                
-                if (null == propDef) {
-                    throw new CmisInvalidArgumentException("Unknown property " + key
-                            + ": not contained in type (or any secondary type)");                        
+            PropertyData<?> value = properties.getProperties().get(key);
+            PropertyDefinition<?> propDef = typeDef.getPropertyDefinitions().get(key);
+            if (cmis11 && null == propDef) {
+                TypeDefinition typeDefSecondary = getSecondaryTypeDefinition(repositoryId, secondaryTypeIds, key);
+                if (null == typeDefSecondary) {
+                    throw new CmisInvalidArgumentException("Cannot update property " + key
+                            + ": not contained in type");
                 }
+                propDef = typeDefSecondary.getPropertyDefinitions().get(key);
+            }
 
-                if (value.getValues() == null || value.getFirstValue() == null) {
-                    // delete property
-                    // check if a required a property
-                    if (propDef.isRequired()) {
-                        throw new CmisConstraintException(
-                                "updateProperties failed, following property can't be deleted, because it is required: "
-                                        + key);
-                    }
-                    oldProperties.remove(key);
-                    hasUpdatedProp = true;
-                } else {
-                    if (propDef.getUpdatability() == Updatability.WHENCHECKEDOUT) {
-                        if (!isCheckedOut) {
-                            throw new CmisUpdateConflictException(
-                                    "updateProperties failed, following property can't be updated, because it is not checked-out: "
-                                            + key);
-                        }
-                    } else if (propDef.getUpdatability() != Updatability.READWRITE) {
-                        throw new CmisConstraintException(
-                                "updateProperties failed, following property can't be updated, because it is not writable: "
-                                        + key);
-                    }
-                    oldProperties.put(key, value);
-                    hasUpdatedProp = true;
-                }
+            if (null == propDef) {
+                throw new CmisInvalidArgumentException("Unknown property " + key
+                        + ": not contained in type (or any secondary type)");                        
             }
 
-            // get name from properties and perform special rename to check if
-            // path already exists
-            PropertyData<?> pd = properties.getProperties().get(PropertyIds.NAME);
-            if (pd != null && so instanceof Filing) {
-                String newName = (String) pd.getFirstValue();
-                boolean hasParent = ((Filing) so).hasParent();
-                if (so instanceof Folder && !hasParent) {
-                    throw new CmisConstraintException("updateProperties failed, you cannot rename the root folder");
-                }
-                if (newName == null || newName.equals("")) {
-                    throw new CmisConstraintException("updateProperties failed, name must not be empty.");
+            if (value.getValues() == null || value.getFirstValue() == null) {
+                // delete property
+                // check if a required a property
+                if (propDef.isRequired()) {
+                    throw new CmisConstraintException(
+                            "updateProperties failed, following property can't be deleted, because it is required: "
+                                    + key);
                 }
-                if (!NameValidator.isValidName(newName)) {
-                    throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
+                oldProperties.remove(key);
+                hasUpdatedProp = true;
+            } else {
+                if (propDef.getUpdatability() == Updatability.WHENCHECKEDOUT) {
+                    if (!isCheckedOut) {
+                        throw new CmisUpdateConflictException(
+                                "updateProperties failed, following property can't be updated, because it is not checked-out: "
+                                        + key);
+                    }
+                } else if (propDef.getUpdatability() != Updatability.READWRITE) {
+                    throw new CmisConstraintException(
+                            "updateProperties failed, following property can't be updated, because it is not writable: "
+                                    + key);
                 }
-                // Note: the test for duplicated name in folder is left to the object store
-                ObjectStoreFiling objStoreFiling = (ObjectStoreFiling) objStore;
-                objStoreFiling.rename((Fileable)so, (String) pd.getFirstValue()); 
+                oldProperties.put(key, value);
                 hasUpdatedProp = true;
             }
         }
 
+        // get name from properties and perform special rename to check if
+        // path already exists
+        PropertyData<?> pd = properties.getProperties().get(PropertyIds.NAME);
+        if (pd != null && so instanceof Filing) {
+            String newName = (String) pd.getFirstValue();
+            boolean hasParent = ((Filing) so).hasParent();
+            if (so instanceof Folder && !hasParent) {
+                throw new CmisConstraintException("updateProperties failed, you cannot rename the root folder");
+            }
+            if (newName == null || newName.equals("")) {
+                throw new CmisConstraintException("updateProperties failed, name must not be empty.");
+            }
+            if (!NameValidator.isValidName(newName)) {
+                throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
+            }
+            // Note: the test for duplicated name in folder is left to the object store
+            ObjectStoreFiling objStoreFiling = (ObjectStoreFiling) objStore;
+            objStoreFiling.rename((Fileable)so, (String) pd.getFirstValue()); 
+            hasUpdatedProp = true;
+        }
+
         if (hasUpdatedProp) {
             // set user, creation date, etc.
             if (user == null) {
@@ -944,11 +946,11 @@ public class InMemoryObjectServiceImpl e
     }
 
     private Folder createFolderIntern(CallContext context, String repositoryId, Properties properties, String folderId,
-            List<String> policies, Acl addACEs, Acl removeACEs, ExtensionsData extension) {
+            List<String> policies, Acl addAces, Acl removeAces, ExtensionsData extension) {
 
-        addACEs = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(), addACEs);
-        removeACEs = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(),
-                removeACEs);
+        Acl aclAdd = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(), addAces);
+        Acl aclRemove = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(),
+                removeAces);
         Properties propertiesNew = properties;
         
         validator.createFolder(context, repositoryId, folderId, policies, extension);
@@ -987,7 +989,7 @@ public class InMemoryObjectServiceImpl e
         validateProperties(repositoryId, null, propertiesNew, false, cmis11);
 
         // validate ACL
-        TypeValidator.validateAcl(typeDef, addACEs, removeACEs);
+        TypeValidator.validateAcl(typeDef, aclAdd, aclRemove);
 
         StoredObject so = null;
         // create folder
@@ -1011,7 +1013,7 @@ public class InMemoryObjectServiceImpl e
 
         ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
         Folder newFolder = objStore.createFolder(folderName, propertiesNew.getProperties(), user, parent, policies,
-                addACEs, removeACEs);
+                aclAdd, aclRemove);
         LOG.debug("stop createFolder()");
         return newFolder;
     }
@@ -1037,7 +1039,7 @@ public class InMemoryObjectServiceImpl e
         String policyText = (String) pd.getFirstValue();
 
         ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
-        StoredObject storedObject = objStore.createPolicy(name, policyText, propMap, user);
+        StoredObject storedObject = objStore.createPolicy(name, policyText, propMap, user, aclAdd, aclRemove);
 
         return storedObject;
     }
@@ -1078,14 +1080,17 @@ public class InMemoryObjectServiceImpl e
                 policies, extension);
 
         // set default properties
+        Properties propertiesNew;
         Map<String, PropertyData<?>> propMap = properties.getProperties();
         Map<String, PropertyData<?>> propMapNew = setDefaultProperties(typeDef, propMap);
-        if (propMapNew != propMap) {
-            properties = new PropertiesImpl(propMapNew.values());
+        if (propMapNew != propMap) { // NOSONAR
+            propertiesNew = new PropertiesImpl(propMapNew.values());
+        } else {
+            propertiesNew = properties;
         }
 
         boolean cmis11 = context.getCmisVersion() != CmisVersion.CMIS_1_0;
-        validateProperties(repositoryId, null, properties, false, cmis11);
+        validateProperties(repositoryId, null, propertiesNew, false, cmis11);
 
         // validate ACL
         TypeValidator.validateAcl(typeDef, aclAdd, aclRemove);
@@ -1104,7 +1109,7 @@ public class InMemoryObjectServiceImpl e
         pd = propMap.get(PropertyIds.NAME);
         String name = (String) pd.getFirstValue();
 
-        StoredObject storedObject = objStore.createRelationship(name, relationObjects[0], relationObjects[1], propMap,
+        StoredObject storedObject = objStore.createRelationship(name, relationObjects[0], relationObjects[1], propMapNew,
                 user, aclAdd, aclRemove);
         return storedObject;
     }
@@ -1167,8 +1172,7 @@ public class InMemoryObjectServiceImpl e
         // set properties that are not set but have a default:
         Map<String, PropertyData<?>> propMapNew = setDefaultProperties(typeDef, propMap);
         if (propMapNew != propMap) { // NOSONAR
-            properties = new PropertiesImpl(propMapNew.values());
-            propMap = propMapNew;
+            propertiesNew = new PropertiesImpl(propMapNew.values());
         }
 
         boolean cmis11 = context.getCmisVersion() != CmisVersion.CMIS_1_0;
@@ -1182,7 +1186,7 @@ public class InMemoryObjectServiceImpl e
         StoredObject so = null;
 
         // Now we are sure to have document type definition:
-        so = objectStore.createItem(name, propMap, user, folder, policies, aclAdd, aclRemove);
+        so = objectStore.createItem(name, propMapNew, user, folder, policies, aclAdd, aclRemove);
         return so;
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceContext.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceContext.java?rev=1514619&r1=1514618&r2=1514619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceContext.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceContext.java Fri Aug 16 08:47:50 2013
@@ -27,7 +27,7 @@ import org.apache.chemistry.opencmis.ser
  */
 public final class InMemoryServiceContext {
     
-    private static class ContextHolder {
+    private static final class ContextHolder {
         private CmisServiceWrapper<InMemoryService> wrapper;
         private CallContext callContext;
 
@@ -50,6 +50,9 @@ public final class InMemoryServiceContex
     
     private static ThreadLocal<ContextHolder> threadLocalService = new ThreadLocal<ContextHolder>();
     
+    private InMemoryServiceContext() {
+    }
+    
     public static synchronized void setWrapperService(CmisServiceWrapper<InMemoryService> wrapperService) {
         threadLocalService.remove();
         if (null != wrapperService) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java?rev=1514619&r1=1514618&r2=1514619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java Fri Aug 16 08:47:50 2013
@@ -76,7 +76,6 @@ public class InMemoryServiceFactoryImpl 
     private static final BigInteger DEFAULT_DEPTH_TYPES = BigInteger.valueOf(-1);
     private static CallContext overrideCtx;
 
-    private Map<String, String> inMemoryServiceParameters;
     private boolean fUseOverrideCtx = false;
     private StoreManager storeManager; // singleton root of everything
     private CleanManager cleanManager = null;
@@ -91,9 +90,8 @@ public class InMemoryServiceFactoryImpl 
         LOG.info("Initializing in-memory repository...");
         LOG.debug("Init paramaters: " + parameters);
 
-        inMemoryServiceParameters = parameters;
-        String overrideCtx = parameters.get(ConfigConstants.OVERRIDE_CALL_CONTEXT);
-        if (null != overrideCtx) {
+        String overrideCtxParam = parameters.get(ConfigConstants.OVERRIDE_CALL_CONTEXT);
+        if (null != overrideCtxParam) {
             fUseOverrideCtx = true;
         }
 
@@ -120,7 +118,7 @@ public class InMemoryServiceFactoryImpl 
 
         String encryptTempFilesStr = parameters.get(ConfigConstants.ENCRYPT_TEMP_FILES);
         encrypt = (encryptTempFilesStr == null ? super.encryptTempFiles() : Boolean.parseBoolean(encryptTempFilesStr));
-        
+
         Date deploymentTime = new Date();
         String strDate = new SimpleDateFormat("EEE MMM dd hh:mm:ss a z yyyy", Locale.US).format(deploymentTime);
 
@@ -148,13 +146,13 @@ public class InMemoryServiceFactoryImpl 
     @Override
     public CmisService getService(CallContext context) {
         LOG.debug("start getService()");
-
+        CallContext contextToUse = context;
         // Attach the CallContext to a thread local context that can be
         // accessed from everywhere
         // Some unit tests set their own context. So if we find one then we use
         // this one and ignore the provided one. Otherwise we set a new context.
         if (fUseOverrideCtx && null != overrideCtx) {
-            context = overrideCtx;
+            contextToUse = overrideCtx;
         }
 
         InMemoryService inMemoryService = InMemoryServiceContext.getCmisService();
@@ -167,7 +165,7 @@ public class InMemoryServiceFactoryImpl 
             InMemoryServiceContext.setWrapperService(wrapperService);
         }
 
-        inMemoryService.setCallContext(context);
+        inMemoryService.setCallContext(contextToUse);
 
         LOG.debug("stop getService()");
         return inMemoryService;
@@ -244,13 +242,9 @@ public class InMemoryServiceFactoryImpl 
         if (null == typeDefsFileName) {
             LOG.info("No file name for type definitions given, no types will be created.");
         } else {
-            TypeManager typeManager = storeManager.getTypeManager(repositoryId);
-            if (typeManager instanceof TypeManagerCreatable) {
-                TypeManagerCreatable tmc = (TypeManagerCreatable) typeManager;
-                importTypesFromFile(tmc, typeDefsFileName);
-            } else {
-                LOG.warn("Type Definitions are configured in XML file but type manager cannot create types. Type definitions are ignored.");
-            }
+            TypeManagerCreatable typeManager = storeManager.getTypeManager(repositoryId);
+            TypeManagerCreatable tmc = (TypeManagerCreatable) typeManager;
+            importTypesFromFile(tmc, typeDefsFileName);
         }
         return created;
     }
@@ -284,7 +278,7 @@ public class InMemoryServiceFactoryImpl 
                                     .setPropertyDefinitions(new LinkedHashMap<String, PropertyDefinition<?>>());
                         }
                         tmc.addTypeDefinition(typeDef, false);
-                    } 
+                    }
                     XMLUtils.next(parser);
                 } else if (event == XMLStreamConstants.END_ELEMENT) {
                     break;
@@ -327,73 +321,73 @@ public class InMemoryServiceFactoryImpl 
         class DummyCallContext implements CallContext {
 
             @Override
-			public String get(String key) {
+            public String get(String key) {
                 return null;
             }
 
             @Override
-			public String getBinding() {
+            public String getBinding() {
                 return null;
             }
 
             @Override
-			public boolean isObjectInfoRequired() {
+            public boolean isObjectInfoRequired() {
                 return false;
             }
 
             @Override
-			public CmisVersion getCmisVersion() {
+            public CmisVersion getCmisVersion() {
                 return CmisVersion.CMIS_1_1;
             }
 
             @Override
-			public String getRepositoryId() {
+            public String getRepositoryId() {
                 return null;
             }
 
             @Override
-			public String getLocale() {
+            public String getLocale() {
                 return null;
             }
 
             @Override
-			public BigInteger getOffset() {
+            public BigInteger getOffset() {
                 return null;
             }
 
             @Override
-			public BigInteger getLength() {
+            public BigInteger getLength() {
                 return null;
             }
 
             @Override
-			public String getPassword() {
+            public String getPassword() {
                 return null;
             }
 
             @Override
-			public String getUsername() {
+            public String getUsername() {
                 return null;
             }
 
             @Override
-			public File getTempDirectory() {
+            public File getTempDirectory() {
 
                 return tempDir;
             }
 
             @Override
-			public boolean encryptTempFiles() {
+            public boolean encryptTempFiles() {
                 return encrypt;
             }
 
             @Override
-			public int getMemoryThreshold() {
+            public int getMemoryThreshold() {
                 return memoryThreshold;
             }
 
             @Override
-			public long getMaxContentSize() {
+            public long getMaxContentSize() {
                 return maxContentSize;
             }
         }
@@ -525,7 +519,7 @@ public class InMemoryServiceFactoryImpl 
 
             final Runnable cleaner = new Runnable() {
                 @Override
-				public void run() {
+                public void run() {
                     LOG.info("Cleaning repository as part of a scheduled maintenance job.");
                     for (String repositoryId : storeManager.getAllRepositoryIds()) {
                         ObjectStore store = storeManager.getObjectStore(repositoryId);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java?rev=1514619&r1=1514618&r2=1514619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java Fri Aug 16 08:47:50 2013
@@ -182,7 +182,6 @@ public class InMemoryVersioningServiceIm
         }
 
         VersionedDocument verDoc = (VersionedDocument) so;
-        res = new ArrayList<ObjectData>();
         List<DocumentVersion> versions = verDoc.getAllVersions();
         for (DocumentVersion version : versions) {
             ObjectData objData = getObject(context, repositoryId, version.getId(), filter, includeAllowableActions,

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Children.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Children.java?rev=1514619&r1=1514618&r2=1514619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Children.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Children.java Fri Aug 16 08:47:50 2013
@@ -28,7 +28,7 @@ import java.util.List;
  */
 public interface Children {
     
-    public class ChildrenResult {
+    class ChildrenResult {
         private int noItems;
         private List<? extends StoredObject> children;
                 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Filing.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Filing.java?rev=1514619&r1=1514618&r2=1514619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Filing.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Filing.java Fri Aug 16 08:47:50 2013
@@ -35,30 +35,31 @@ public interface Filing {
      * character indicating how folders are separated within a path string. This
      * char must not be a valid character of an object name.
      */
-    final String PATH_SEPARATOR = "/";
+    String PATH_SEPARATOR = "/";
 
     /**
-     * return a list of parents the principal has access to. for single parent object this list must contain
-     * only one element. returns an empty list if this is an unfiled document.
+     * return a list of parents the principal has access to. for single parent
+     * object this list must contain only one element. returns an empty list if
+     * this is an unfiled document.
      * 
      * @param user
-     * 		user id
+     *            user id
      * @return list of parent folders
      */
     List<String> getParentIds();
-    
+
     /**
      * usually true except for the root folder, optimized call that just tests
      * existence to provide information for AtomPub links (much cheaper than
      * calling getParents() and test for empty result.
      * 
-     * @return
-     *    true if object has a parent, false if it is a root object
+     * @return true if object has a parent, false if it is a root object
      */
     boolean hasParent();
 
     /**
      * get the path segment of this object
+     * 
      * @return
      */
     String getPathSegment();

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStore.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStore.java?rev=1514619&r1=1514618&r2=1514619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStore.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStore.java Fri Aug 16 08:47:50 2013
@@ -71,11 +71,13 @@ public interface ObjectStore {
      * Deletes an object from the store. For a folders the folder must be empty.
      * 
      * @param objectId
-     * @param user 
-     * @param allVersions is TRUE all version of the document are deleted, otherwise just this one
+     * @param user
+     * @param allVersions
+     *            is TRUE all version of the document are deleted, otherwise
+     *            just this one
      */
     void deleteObject(String objectId, Boolean allVersions, String user);
-       
+
     /**
      * Create a document as initial step. The document is created but still
      * temporary It is not yet persisted and does not have an id yet. After this
@@ -85,42 +87,41 @@ public interface ObjectStore {
      * @param name
      *            name of the document
      * @param propMap
-     * 			  map of properties   
+     *            map of properties
      * @param user
-     * 			  the user who creates the document
+     *            the user who creates the document
      * @param folder
-     * 			  the parent folder 
+     *            the parent folder
      * @param policies
-     *            list of policies to apply 
+     *            list of policies to apply
      * @param addACEs
-     * 			  aces that are added 
-     * @param removeACEs 
+     *            aces that are added
+     * @param removeACEs
      *            aces that are removed
      * @return document object
      */
-     Document createDocument(String name, Map<String, PropertyData<?>> propMap, String user, Folder folder,
- 			List<String> policies, Acl addACEs, Acl removeACEs);
-
+    Document createDocument(String name, Map<String, PropertyData<?>> propMap, String user, Folder folder,
+            List<String> policies, Acl addACEs, Acl removeACEs);
 
     /**
      * Create a folder as initial step. The folder is created but still
-     * temporary. It is not yet persisted and does not have an id yet. After this
-     * call additional actions can take place (like assigning properties and a
-     * type) before it is persisted.
+     * temporary. It is not yet persisted and does not have an id yet. After
+     * this call additional actions can take place (like assigning properties
+     * and a type) before it is persisted.
      * 
      * @param name
      *            name of the folder
      * @param propMap
-     * 			  map of properties   
+     *            map of properties
      * @param user
-     * 			  the user who creates the document
+     *            the user who creates the document
      * @param folder
-     * 			  the parent folder 
+     *            the parent folder
      * @param policies
-     *            list of policies to apply 
+     *            list of policies to apply
      * @param addACEs
-     * 			  aces that are added 
-     * @param removeACEs 
+     *            aces that are added
+     * @param removeACEs
      *            aces that are removed
      * @return folder object
      */
@@ -134,44 +135,42 @@ public interface ObjectStore {
      * properties and a type) before it is persisted.
      * 
      * @param name
-     *            name of the document
-     *             * @param propMap
-     * 			  map of properities   
+     *            name of the document * @param propMap map of properities
      * @param user
-     * 			  the user who creates the document
+     *            the user who creates the document
      * @param folder
-     * 			  the parent folder 
+     *            the parent folder
      * @param policies
-     *            list of policies to apply 
+     *            list of policies to apply
      * @param addACEs
-     * 			  aces that are added 
-     * @param removeACEs 
+     *            aces that are added
+     * @param removeACEs
      *            aces that are removed
      * @return versioned document object
      */
-    DocumentVersion createVersionedDocument(String name,
-			Map<String, PropertyData<?>> propMap, String user, Folder folder,
-			List<String> policies, Acl addACEs, Acl removeACEs, ContentStream contentStream, VersioningState versioningState);
+    DocumentVersion createVersionedDocument(String name, Map<String, PropertyData<?>> propMap, String user,
+            Folder folder, List<String> policies, Acl addACEs, Acl removeACEs, ContentStream contentStream,
+            VersioningState versioningState);
 
     /**
-     * Create an item as initial step. The item is created but still
-     * temporary. It is not yet persisted and does not have an id yet. After this
-     * call additional actions can take place (like assigning properties and a
-     * type) before it is persisted.
+     * Create an item as initial step. The item is created but still temporary.
+     * It is not yet persisted and does not have an id yet. After this call
+     * additional actions can take place (like assigning properties and a type)
+     * before it is persisted.
      * 
      * @param name
      *            name of the document
      * @param propMap
-     *            map of properties   
+     *            map of properties
      * @param user
      *            the user who creates the document
      * @param folder
-     *            the parent folder 
+     *            the parent folder
      * @param policies
-     *            list of policies to apply 
+     *            list of policies to apply
      * @param addACEs
-     *            aces that are added 
-     * @param removeACEs 
+     *            aces that are added
+     * @param removeACEs
      *            aces that are removed
      * @return document object
      */
@@ -179,50 +178,53 @@ public interface ObjectStore {
             List<String> policies, Acl addACEs, Acl removeACEs);
 
     /**
-     * Create a policy. The policy is created but still
-     * temporary. It is not yet persisted and does not have an id yet. After this
-     * call additional actions can take place (like assigning properties and a
-     * type) before it is persisted.
+     * Create a policy. The policy is created but still temporary. It is not yet
+     * persisted and does not have an id yet. After this call additional actions
+     * can take place (like assigning properties and a type) before it is
+     * persisted.
      * 
      * @param name
      *            name of the document
      * @param policyText
-     *            policy text to apply to this policy   
+     *            policy text to apply to this policy
      * @param propMap
-     *            map of properties   
+     *            map of properties
      * @param user
      *            the user who creates the document
      * @return policy object
      */
-    public StoredObject createPolicy(String name, String policyText, Map<String, PropertyData<?>> propMap, String user);
+    StoredObject createPolicy(String name, String policyText, Map<String, PropertyData<?>> propMap, String user,
+            Acl addACEs, Acl removeACEs);
 
     /**
      * Persist a new version in the store (created from a check-out)
+     * 
      * @param version
      */
-    public void storeVersion(DocumentVersion version);
-    
+    void storeVersion(DocumentVersion version);
+
     /**
      * remove a version from the store (after a cancel check-out)
+     * 
      * @param version
-     *      version to be deleted
+     *            version to be deleted
      */
-    public void deleteVersion(DocumentVersion version);
-    
+    void deleteVersion(DocumentVersion version);
+
     /**
      * Persist an object after modifying the properties
+     * 
      * @param so
-     *      object to be updated
+     *            object to be updated
      */
-    public void upateObject(StoredObject so);
-    
+    void upateObject(StoredObject so);
+
     /**
      * get the path of this folder (for folder in CMIS path is unique)
      * 
      * @param folderId
-     *      id of folder
-     * @return
-     *      path of this folder
+     *            id of folder
+     * @return path of this folder
      */
     String getFolderPath(String folderId);
 
@@ -230,91 +232,88 @@ public interface ObjectStore {
      * Clear repository and remove all data.
      */
     void clear();
-    
+
     /**
      * For statistics: return the number of objects contained in the system
-     * @return
-     *      number of stored objects
+     * 
+     * @return number of stored objects
      */
     long getObjectCount();
-    
+
     /**
-     * Create a relationship. The relationship is
-     * created but still temporary. It is not yet persisted and does not have an
-     * id yet. After this call additional actions can take place (like assigning
-     * properties and a type) before it is persisted.
+     * Create a relationship. The relationship is created but still temporary.
+     * It is not yet persisted and does not have an id yet. After this call
+     * additional actions can take place (like assigning properties and a type)
+     * before it is persisted.
      * 
      * @param sourceObject
      *            source of the relationship
      * @param targetObject
      *            target of the relationship
      * @param propMap
-     * 			  map of properities   
+     *            map of properities
      * @param user
-     * 			  the user who creates the document
+     *            the user who creates the document
      * @param folder
-     * 			  the parent folder 
+     *            the parent folder
      * @param addACEs
-     * 			  aces that are added 
-     * @param removeACEs 
+     *            aces that are added
+     * @param removeACEs
      *            aces that are removed
      * @return versioned document object
      */
-    StoredObject createRelationship(String name, StoredObject sourceObject, StoredObject targetObject, 
-    		Map<String, PropertyData<?>> propMap,
-			String user, Acl addACEs, Acl removeACEs);
-    
+    StoredObject createRelationship(String name, StoredObject sourceObject, StoredObject targetObject,
+            Map<String, PropertyData<?>> propMap, String user, Acl addACEs, Acl removeACEs);
+
     /**
      * Return a list of all documents that are checked out in the repository.
      * 
      * @param orderBy
      *            orderBy specification according to CMIS spec.
      * @param user
-     * 			user id of user calling
+     *            user id of user calling
      * @param includeRelationships
-     * 			if true include all relationships in the response
+     *            if true include all relationships in the response
      * @return list of checked out documents in the repository
      */
     List<StoredObject> getCheckedOutDocuments(String orderBy, String user, IncludeRelationships includeRelationships);
-    
+
     /**
-     * Apply a ACLs by relative adding and removing a list of ACEs to/from an object
+     * Apply a ACLs by relative adding and removing a list of ACEs to/from an
+     * object
      * 
      * @param so
-     *      object where ACLs are applied
+     *            object where ACLs are applied
      * @param addAces
-     *      list of ACEs to be added
+     *            list of ACEs to be added
      * @param removeAces
-     *      list of ACEs to be removed
+     *            list of ACEs to be removed
      * @param aclPropagation
-     *      enum value how to propagate ACLs to child objects
-     * @return
-     *      new ACL of object
+     *            enum value how to propagate ACLs to child objects
+     * @return new ACL of object
      */
     Acl applyAcl(StoredObject so, Acl addAces, Acl removeAces, AclPropagation aclPropagation, String principalId);
-    
+
     /**
      * Apply a ACLs by setting a new list of ACEs to an object
      * 
      * @param so
-     *      object where ACLs are applied
+     *            object where ACLs are applied
      * @param aces
-     *      list of ACEs to be applied
+     *            list of ACEs to be applied
      * @param aclPropagation
-     *      enum value how to propagate ACLs to child objects
-     * @return
-     *      new ACL of object
+     *            enum value how to propagate ACLs to child objects
+     * @return new ACL of object
      */
     Acl applyAcl(StoredObject so, Acl aces, AclPropagation aclPropagation, String principalId);
-    
+
     /**
      * Check if this store contains any object with the given type id
      * 
      * @param typeId
-     *      id of type definition to check
-     * @return
-     *      true if at least one object in the store has the given type, false
-     *      if no objects exist having this type
+     *            id of type definition to check
+     * @return true if at least one object in the store has the given type,
+     *         false if no objects exist having this type
      */
     boolean isTypeInUse(String typeId);
 
@@ -322,22 +321,21 @@ public interface ObjectStore {
      * Get relationships to and from an object
      * 
      * @param objectId
-     *      id of object to get relationships with
+     *            id of object to get relationships with
      * @param subTypeIds
-     *      list of all types to be included
+     *            list of all types to be included
      * @param relationshipDirection
-     *      direction of relationship
+     *            direction of relationship
      * @return
      */
-    List<StoredObject> getRelationships(String objectId, List<String> typeIds,
-            RelationshipDirection direction);
-    
+    List<StoredObject> getRelationships(String objectId, List<String> typeIds, RelationshipDirection direction);
+
     /**
      * get an ACL object from an ACL id
+     * 
      * @param aclId
-     *      id of ACL
-     * @return
-     *      ACL of this id
+     *            id of ACL
+     * @return ACL of this id
      */
-    public Acl getAcl(int aclId);
+    Acl getAcl(int aclId);
 }
\ No newline at end of file

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStoreFiling.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStoreFiling.java?rev=1514619&r1=1514618&r2=1514619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStoreFiling.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStoreFiling.java Fri Aug 16 08:47:50 2013
@@ -25,16 +25,16 @@ public interface ObjectStoreFiling {
     public static class ChildrenResult {
         private int noItems;
         private List<Fileable> children;
-                
+
         public ChildrenResult(List<Fileable> children, int noItems) {
             this.children = children;
             this.noItems = noItems;
         }
-        
+
         public int getNoItems() {
             return noItems;
         }
-        
+
         public List<Fileable> getChildren() {
             return children;
         }
@@ -50,10 +50,11 @@ public interface ObjectStoreFiling {
      *            max. number of items to return
      * @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; 
+     * @param user
+     *            user to determine visible children
+     * @param usePwc
+     *            if true return private working copy otherwise return latest
+     *            version;
      * 
      * @return list of children objects
      */
@@ -70,22 +71,22 @@ public interface ObjectStoreFiling {
      *            max. number of items to return
      * @param skipCount
      *            initial offset where to start fetching
-     * @param user 
+     * @param user
      * @return list of children folders
      */
     ChildrenResult getFolderChildren(Folder folder, int maxItems, int skipCount, String user);
 
     /**
      * get all parent ids of this object visible for a user
+     * 
      * @param user
-     *      user who can see parents
-     * @return
-     *      list of folder ids
+     *            user who can see parents
+     * @return list of folder ids
      */
-    public List<String> getParentIds(Filing spo, String user);
-    
+    List<String> getParentIds(Filing spo, String user);
+
     /**
-     * Move an object to a different folder. 
+     * Move an object to a different folder.
      * 
      * @param so
      *            object to be moved
@@ -98,10 +99,11 @@ public interface ObjectStoreFiling {
 
     /**
      * Rename an object
+     * 
      * @param so
-     *      object to be renamed
+     *            object to be renamed
      * @param newName
-     *      new name to be assigned
+     *            new name to be assigned
      */
-    public void rename(Fileable so, String newName);
+    void rename(Fileable so, String newName);
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoredObject.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoredObject.java?rev=1514619&r1=1514618&r2=1514619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoredObject.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoredObject.java Fri Aug 16 08:47:50 2013
@@ -47,7 +47,7 @@ import org.apache.chemistry.opencmis.com
  */
 /**
  * @author d058463
- *
+ * 
  */
 public interface StoredObject {
 
@@ -57,12 +57,12 @@ public interface StoredObject {
      * @return id of this object
      */
     String getId();
-    
+
     /**
      * Set the id of this object
      * 
      * @param id
-     *      id of this object
+     *            id of this object
      */
     void setId(String id);
 
@@ -95,28 +95,29 @@ public interface StoredObject {
      *            id of the type this object gets assigned.
      */
     void setTypeId(String type);
-    
+
     /**
      * CMIS 1.1 get ids of all secondary types
-     * @return
-     *      list of type ids
+     * 
+     * @return list of type ids
      */
     List<String> getSecondaryTypeIds();
 
     /**
      * CMIS 1.1: set description of an object
+     * 
      * @param description
-     *      description of this object
+     *            description of this object
      */
     void setDescription(String description);
-    
+
     /**
      * CMIS 1.1: get description of an object
-     * @return
-     *      description of this object
+     * 
+     * @return description of this object
      */
     String getDescription();
-    
+
     /**
      * Retrieve the user who created the document
      * 
@@ -176,11 +177,12 @@ public interface StoredObject {
 
     /**
      * Set the date and time of the last modification of this object
+     * 
      * @param calendar
-     *      timestamp of last modification
+     *            timestamp of last modification
      */
     void setModifiedAt(GregorianCalendar calendar);
-    
+
     /**
      * Get the repository id of this object where the object is stored.
      * 
@@ -263,73 +265,71 @@ public interface StoredObject {
      *            parameters
      */
     void setCustomProperties(Map<String, PropertyData<?>> properties);
-    
+
     /**
      * get the Acl id of the stored object
      */
     int getAclId();
-    
-	/*
-     * get the allowable actions  of the object
+
+    /*
+     * get the allowable actions of the object
      */
-	AllowableActions getAllowableActions(String user);
-	
+    AllowableActions getAllowableActions(String user);
+
     /**
-     * check if the document can generate a renditions and rendition is visible for user
-     * @return
-     *   true if rendition exists, false if not.
+     * check if the document can generate a renditions and rendition is visible
+     * for user
+     * 
+     * @return true if rendition exists, false if not.
      */
-    public boolean hasRendition(String user);
-    
-	/**
+    boolean hasRendition(String user);
+
+    /**
      * get the rendition this objects supports
      * 
      * @param renditionFilter
      * @param maxItems
      * @param skipCount
      * @param extension
-     * @return
-     *      List of renditions or null if no renditions are available for this object
+     * @return List of renditions or null if no renditions are available for
+     *         this object
      */
-    public List<RenditionData> getRenditions(String renditionFilter,
-            long maxItems, long skipCount);
-    
+    List<RenditionData> getRenditions(String renditionFilter, long maxItems, long skipCount);
+
     /**
      * get the rendition of this object
      * 
      * @param streamId
-     *      stream if of rendition
+     *            stream if of rendition
      * @param offset
-     *      offset in rendition content
+     *            offset in rendition content
      * @param length
-     *      length of rendition content
-     * @return
-     *     ContentStream containing the rendition
+     *            length of rendition content
+     * @return ContentStream containing the rendition
      */
-    public ContentStream getRenditionContent(String streamId, long offset, long length);
-    
+    ContentStream getRenditionContent(String streamId, long offset, long length);
+
     /**
      * get applied policies of this object
      * 
-     * @return
-     *      list of ids of policies applied to this object
+     * @return list of ids of policies applied to this object
      */
-    public List<String> getAppliedPolicies();
-    
+    List<String> getAppliedPolicies();
+
     /**
      * add an id of a policy to an object
      * 
      * @param policyId
-     *      id of policy to add
+     *            id of policy to add
      */
-    public void addAppliedPolicy(String policyId);
-    
+    void addAppliedPolicy(String policyId);
+
     /**
      * remove an id of a policy from an object
      * 
      * @param policyId
-     *      id of policy to remove
+     *            id of policy to remove
      */
-    public void removePolicy(String policyId);
+    void removePolicy(String policyId);
 
 }
\ No newline at end of file

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java?rev=1514619&r1=1514618&r2=1514619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java Fri Aug 16 08:47:50 2013
@@ -38,11 +38,15 @@ import org.slf4j.LoggerFactory;
 
 public class ContentStreamDataImpl implements LastModifiedContentStream {
 
+    private static final int SIZE_KB = 1024;
+
+    private static final int BUFFER_SIZE = 0xFFFF;
+
     private static final Logger LOG = LoggerFactory.getLogger(ContentStreamDataImpl.class.getName());
 
-    private static long totalLength  = 0L;
-    private static long totalCalls  = 0L;
-    
+    private static long totalLength = 0L;
+    private static long totalCalls = 0L;
+
     private int fLength;
 
     private String fMimeType;
@@ -50,7 +54,7 @@ public class ContentStreamDataImpl imple
     private String fFileName;
 
     private byte[] fContent;
-    
+
     private GregorianCalendar fLastModified;
 
     private long fStreamLimitOffset;
@@ -59,6 +63,23 @@ public class ContentStreamDataImpl imple
 
     private final long sizeLimitKB;
 
+    private static synchronized long getTotalLength () {
+        return totalLength;
+    }
+
+    private static synchronized void increaseTotalLength(int length) {
+        totalLength += length;
+    }
+    
+    private static synchronized long getTotalCalls () {
+        return totalCalls;
+    }
+
+    private static synchronized void increaseTotalCalls() {
+        totalCalls++;
+    }
+
+
     public ContentStreamDataImpl(long maxAllowedContentSizeKB) {
         sizeLimitKB = maxAllowedContentSizeKB;
         fLength = 0;
@@ -71,13 +92,13 @@ public class ContentStreamDataImpl imple
             fContent = null; // delete content
             fLength = 0;
         } else {
-            byte[] buffer = new byte[0xFFFF];
+            byte[] buffer = new byte[BUFFER_SIZE];
             ByteArrayOutputStream contentStream = new ByteArrayOutputStream();
             int len = in.read(buffer);
             while (len != -1) {
                 contentStream.write(buffer, 0, len);
                 fLength += len;
-                if (sizeLimitKB > 0 && fLength > sizeLimitKB * 1024) {
+                if (sizeLimitKB > 0 && fLength > sizeLimitKB * SIZE_KB) {
                     throw new CmisInvalidArgumentException("Content size exceeds max. allowed size of " + sizeLimitKB
                             + "KB.");
                 }
@@ -88,29 +109,30 @@ public class ContentStreamDataImpl imple
             contentStream.close();
             in.close();
         }
-        totalLength += fLength;
-        LOG.debug("setting content stream, total no calls " + ++totalCalls + ".");
-        LOG.debug("setting content stream, new size total " + (totalLength / (1024 * 1024)) + "MB.");
+        increaseTotalLength(fLength);
+        increaseTotalCalls();
+        LOG.debug("setting content stream, total no calls " + getTotalCalls() + ".");
+        LOG.debug("setting content stream, new size total " + (getTotalLength() / (SIZE_KB * SIZE_KB)) + "MB.");
     }
-    
+
     public void appendContent(InputStream is) throws IOException {
-        
+
         if (null == is) {
             return; // nothing to do
         } else {
-            byte[] buffer = new byte[0xFFFF];
+            byte[] buffer = new byte[BUFFER_SIZE];
             ByteArrayOutputStream contentStream = new ByteArrayOutputStream();
-            
+
             // first read existing stream
             contentStream.write(fContent);
             totalLength -= fLength;
-            
+
             // then append new content
             int len = is.read(buffer);
             while (len != -1) {
                 contentStream.write(buffer, 0, len);
                 fLength += len;
-                if (sizeLimitKB > 0 && fLength > sizeLimitKB * 1024) {
+                if (sizeLimitKB > 0 && fLength > sizeLimitKB * SIZE_KB) {
                     throw new CmisInvalidArgumentException("Content size exceeds max. allowed size of " + sizeLimitKB
                             + "KB.");
                 }
@@ -123,21 +145,21 @@ public class ContentStreamDataImpl imple
         }
         totalLength += fLength;
         LOG.debug("setting content stream, total no calls " + ++totalCalls + ".");
-        LOG.debug("setting content stream, new size total " + (totalLength / (1024 * 1024)) + "MB.");
+        LOG.debug("setting content stream, new size total " + (totalLength / (SIZE_KB * SIZE_KB)) + "MB.");
     }
 
     @Override
-	public long getLength() {
+    public long getLength() {
         return fLength;
     }
 
     @Override
-	public BigInteger getBigLength() {
+    public BigInteger getBigLength() {
         return BigInteger.valueOf(fLength);
     }
 
     @Override
-	public String getMimeType() {
+    public String getMimeType() {
         return fMimeType;
     }
 
@@ -146,7 +168,7 @@ public class ContentStreamDataImpl imple
     }
 
     @Override
-	public String getFileName() {
+    public String getFileName() {
         return fFileName;
     }
 
@@ -159,7 +181,7 @@ public class ContentStreamDataImpl imple
     }
 
     @Override
-	public InputStream getStream() {
+    public InputStream getStream() {
         if (null == fContent) {
             return null;
         } else if (fStreamLimitOffset <= 0 && fStreamLimitLength < 0) {
@@ -173,12 +195,12 @@ public class ContentStreamDataImpl imple
     public void setLastModified(GregorianCalendar lastModified) {
         this.fLastModified = lastModified;
     }
-    
+
     @Override
-	public GregorianCalendar getLastModified() {
+    public GregorianCalendar getLastModified() {
         return fLastModified;
     }
-    
+
     public ContentStream getCloneWithLimits(long offset, long length) {
         ContentStreamDataImpl clone = new ContentStreamDataImpl(0);
         clone.fFileName = fFileName;
@@ -196,12 +218,12 @@ public class ContentStreamDataImpl imple
     }
 
     @Override
-	public List<CmisExtensionElement> getExtensions() {
+    public List<CmisExtensionElement> getExtensions() {
         return null;
     }
 
     @Override
-	public void setExtensions(List<CmisExtensionElement> extensions) {
+    public void setExtensions(List<CmisExtensionElement> extensions) {
         // not implemented
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java?rev=1514619&r1=1514618&r2=1514619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java Fri Aug 16 08:47:50 2013
@@ -42,16 +42,17 @@ import org.slf4j.LoggerFactory;
 /**
  * InMemory Stored Document A document is a stored object that has a path and
  * (optional) content
- *
+ * 
  * @author Jens
- *
+ * 
  */
 
 public class DocumentImpl extends FilingImpl implements Document {
     private ContentStreamDataImpl fContent;
 
     private static final Logger LOG = LoggerFactory.getLogger(DocumentImpl.class.getName());
-    private static final Long MAX_CONTENT_SIZE_KB = ConfigurationSettings.getConfigurationValueAsLong(ConfigConstants.MAX_CONTENT_SIZE_KB);
+    private static final Long MAX_CONTENT_SIZE_KB = ConfigurationSettings
+            .getConfigurationValueAsLong(ConfigConstants.MAX_CONTENT_SIZE_KB);
 
     public static final int THUMBNAIL_SIZE = 100;
 
@@ -60,7 +61,7 @@ public class DocumentImpl extends Filing
     }
 
     @Override
-	public ContentStream getContent(long offset, long length) {
+    public ContentStream getContent(long offset, long length) {
         if (null == fContent) {
             return null;
         } else if (offset <= 0 && length < 0) {
@@ -71,7 +72,7 @@ public class DocumentImpl extends Filing
     }
 
     @Override
-	public void setContent(ContentStream content, boolean mustPersist) {
+    public void setContent(ContentStream content, boolean mustPersist) {
         if (null == content) {
             fContent = null;
         } else {
@@ -94,12 +95,13 @@ public class DocumentImpl extends Filing
             }
         }
     }
-    
+
     @Override
-	public void appendContent(ContentStream content) {
+    public void appendContent(ContentStream content) {
         if (null == content) {
             return;
-        } if (null == fContent) {
+        }
+        if (null == fContent) {
             setContent(content, true);
         } else {
             try {
@@ -110,7 +112,6 @@ public class DocumentImpl extends Filing
         }
     }
 
-
     @Override
     public void fillProperties(Map<String, PropertyData<?>> properties, BindingsObjectFactory objFactory,
             List<String> requestedIds) {
@@ -122,86 +123,87 @@ public class DocumentImpl extends Filing
         // properties always to be set
 
         if (FilterParser.isContainedInFilter(PropertyIds.IS_IMMUTABLE, requestedIds)) {
-            properties.put(PropertyIds.IS_IMMUTABLE, objFactory.createPropertyBooleanData(PropertyIds.IS_IMMUTABLE,
-                    false));
+            properties.put(PropertyIds.IS_IMMUTABLE,
+                    objFactory.createPropertyBooleanData(PropertyIds.IS_IMMUTABLE, false));
         }
 
         // Set the content related properties
         if (FilterParser.isContainedInFilter(PropertyIds.CONTENT_STREAM_FILE_NAME, requestedIds)) {
             properties.put(PropertyIds.CONTENT_STREAM_FILE_NAME, objFactory.createPropertyStringData(
-                    PropertyIds.CONTENT_STREAM_FILE_NAME, null != fContent ? fContent.getFileName() : (String)null) );
+                    PropertyIds.CONTENT_STREAM_FILE_NAME, null != fContent ? fContent.getFileName() : (String) null));
         }
         if (FilterParser.isContainedInFilter(PropertyIds.CONTENT_STREAM_ID, requestedIds)) {
-            properties.put(PropertyIds.CONTENT_STREAM_ID, objFactory.createPropertyStringData(
-                    PropertyIds.CONTENT_STREAM_ID, (String) null));
+            properties.put(PropertyIds.CONTENT_STREAM_ID,
+                    objFactory.createPropertyStringData(PropertyIds.CONTENT_STREAM_ID, (String) null));
         }
         if (FilterParser.isContainedInFilter(PropertyIds.CONTENT_STREAM_LENGTH, requestedIds)) {
-            properties.put(PropertyIds.CONTENT_STREAM_LENGTH, objFactory.createPropertyIntegerData(
-                    PropertyIds.CONTENT_STREAM_LENGTH, null != fContent ? fContent.getBigLength() : null));
+            properties.put(
+                    PropertyIds.CONTENT_STREAM_LENGTH,
+                    objFactory.createPropertyIntegerData(PropertyIds.CONTENT_STREAM_LENGTH,
+                            null != fContent ? fContent.getBigLength() : null));
         }
         if (FilterParser.isContainedInFilter(PropertyIds.CONTENT_STREAM_MIME_TYPE, requestedIds)) {
             properties.put(PropertyIds.CONTENT_STREAM_MIME_TYPE, objFactory.createPropertyStringData(
-                    PropertyIds.CONTENT_STREAM_MIME_TYPE, null != fContent ? fContent.getMimeType() : (String)null) );
+                    PropertyIds.CONTENT_STREAM_MIME_TYPE, null != fContent ? fContent.getMimeType() : (String) null));
         }
-        
+
         // Spec requires versioning properties even for unversioned documents
         // overwrite the version related properties
         if (FilterParser.isContainedInFilter(PropertyIds.VERSION_SERIES_ID, requestedIds)) {
-            properties.put(PropertyIds.VERSION_SERIES_ID, objFactory.createPropertyIdData(
-                    PropertyIds.VERSION_SERIES_ID, getId()));
+            properties.put(PropertyIds.VERSION_SERIES_ID,
+                    objFactory.createPropertyIdData(PropertyIds.VERSION_SERIES_ID, getId()));
         }
         if (FilterParser.isContainedInFilter(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT, requestedIds)) {
-            properties.put(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT, objFactory.createPropertyBooleanData(
-                    PropertyIds.IS_VERSION_SERIES_CHECKED_OUT, false));
+            properties.put(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT,
+                    objFactory.createPropertyBooleanData(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT, false));
         }
         if (FilterParser.isContainedInFilter(PropertyIds.VERSION_SERIES_CHECKED_OUT_BY, requestedIds)) {
-            properties.put(PropertyIds.VERSION_SERIES_CHECKED_OUT_BY, objFactory.createPropertyStringData(
-                    PropertyIds.VERSION_SERIES_CHECKED_OUT_BY, (String)null));
+            properties.put(PropertyIds.VERSION_SERIES_CHECKED_OUT_BY,
+                    objFactory.createPropertyStringData(PropertyIds.VERSION_SERIES_CHECKED_OUT_BY, (String) null));
         }
         if (FilterParser.isContainedInFilter(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID, requestedIds)) {
-            properties.put(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID, objFactory.createPropertyIdData(
-                    PropertyIds.VERSION_SERIES_CHECKED_OUT_ID, (String)null));
+            properties.put(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID,
+                    objFactory.createPropertyIdData(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID, (String) null));
         }
         if (FilterParser.isContainedInFilter(PropertyIds.IS_LATEST_VERSION, requestedIds)) {
-            properties.put(PropertyIds.IS_LATEST_VERSION, objFactory.createPropertyBooleanData(
-                    PropertyIds.IS_LATEST_VERSION, true));
+            properties.put(PropertyIds.IS_LATEST_VERSION,
+                    objFactory.createPropertyBooleanData(PropertyIds.IS_LATEST_VERSION, true));
         }
         if (FilterParser.isContainedInFilter(PropertyIds.IS_MAJOR_VERSION, requestedIds)) {
-            properties.put(PropertyIds.IS_MAJOR_VERSION, objFactory.createPropertyBooleanData(
-                    PropertyIds.IS_MAJOR_VERSION, true));
+            properties.put(PropertyIds.IS_MAJOR_VERSION,
+                    objFactory.createPropertyBooleanData(PropertyIds.IS_MAJOR_VERSION, true));
         }
         if (FilterParser.isContainedInFilter(PropertyIds.IS_LATEST_MAJOR_VERSION, requestedIds)) {
-            properties.put(PropertyIds.IS_LATEST_MAJOR_VERSION, objFactory.createPropertyBooleanData(
-                    PropertyIds.IS_LATEST_MAJOR_VERSION, true));
+            properties.put(PropertyIds.IS_LATEST_MAJOR_VERSION,
+                    objFactory.createPropertyBooleanData(PropertyIds.IS_LATEST_MAJOR_VERSION, true));
         }
         if (FilterParser.isContainedInFilter(PropertyIds.CHECKIN_COMMENT, requestedIds)) {
-            properties.put(PropertyIds.CHECKIN_COMMENT, objFactory.createPropertyStringData(
-                    PropertyIds.CHECKIN_COMMENT, (String )null));
+            properties.put(PropertyIds.CHECKIN_COMMENT,
+                    objFactory.createPropertyStringData(PropertyIds.CHECKIN_COMMENT, (String) null));
         }
         if (FilterParser.isContainedInFilter(PropertyIds.VERSION_LABEL, requestedIds)) {
-            properties.put(PropertyIds.VERSION_LABEL, objFactory.createPropertyStringData(PropertyIds.VERSION_LABEL,
-                    (String) null));
+            properties.put(PropertyIds.VERSION_LABEL,
+                    objFactory.createPropertyStringData(PropertyIds.VERSION_LABEL, (String) null));
         }
-        
+
         // CMIS 1.1
         if (FilterParser.isContainedInFilter(PropertyIds.IS_PRIVATE_WORKING_COPY, requestedIds)) {
             properties.put(PropertyIds.IS_PRIVATE_WORKING_COPY,
                     objFactory.createPropertyBooleanData(PropertyIds.IS_PRIVATE_WORKING_COPY, false));
         }
-        
+
     }
 
     @Override
-	public boolean hasContent() {
+    public boolean hasContent() {
         return null != fContent;
     }
 
     @Override
-    public List<RenditionData> getRenditions(String renditionFilter,
-            long maxItems, long skipCount) {
+    public List<RenditionData> getRenditions(String renditionFilter, long maxItems, long skipCount) {
 
         String tokenizer = "[\\s;]";
-        if (null==renditionFilter) {
+        if (null == renditionFilter) {
             return null;
         }
         String[] formats = renditionFilter.split(tokenizer);
@@ -233,13 +235,13 @@ public class DocumentImpl extends Filing
     }
 
     @Override
-    public ContentStream getRenditionContent(String streamId, long offset, long length) {     
+    public ContentStream getRenditionContent(String streamId, long offset, long length) {
         if (null == fContent) {
             return null;
         }
-        
+
         String mimeType = fContent.getMimeType();
-        
+
         try {
             if (isImage(mimeType)) {
                 ImageThumbnailGenerator generator = new ImageThumbnailGenerator(getContent(0L, -1L).getStream());
@@ -268,67 +270,47 @@ public class DocumentImpl extends Filing
             throw new CmisRuntimeException("Failed to generate rendition: " + e);
         }
     }
-    
+
     @Override
     public boolean hasRendition(String user) {
         if (null == fContent) {
             return false;
         }
-        
+
         String mimeType = fContent.getMimeType();
-        
-        if (isImage(mimeType)) {
-            return true;
-        } else if (isAudio(mimeType)) {
-            return true;
-        } else if (isVideo(mimeType)) {
-            return true;
-        } else if (isPDF(mimeType)) {
-            return true;
-        } else if (isPowerpoint(mimeType)) {
-            return true;
-        } else if (isExcel(mimeType)) {
-            return true;
-        } else if (isWord(mimeType)) {
-            return true;
-        } else if (isHtml(mimeType)) {
-            return true;
-        } else if (isPlainText(mimeType)) {
-            return true;
-        } else {
-            return false;
-        }
-    }
 
+        return isImage(mimeType) || isAudio(mimeType) || isVideo(mimeType) || isPDF(mimeType) || isPowerpoint(mimeType)
+                || isExcel(mimeType) || isWord(mimeType) || isHtml(mimeType) || isPlainText(mimeType);
+    }
 
     private boolean isImage(String mimeType) {
         return mimeType.startsWith("image/");
     }
 
     private boolean isWord(String mimeType) {
-        return mimeType.equals("application/vnd.openxmlformats-officedocument.wordprocessingml.document") ||
-                mimeType.equals("application/ms-word");
+        return mimeType.equals("application/vnd.openxmlformats-officedocument.wordprocessingml.document")
+                || mimeType.equals("application/ms-word");
     }
 
     private boolean isExcel(String mimeType) {
-        return mimeType.equals("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") ||
-                mimeType.equals("application/vnd.ms-excel");
+        return mimeType.equals("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
+                || mimeType.equals("application/vnd.ms-excel");
     }
-    
+
     private boolean isPowerpoint(String mimeType) {
-        return mimeType.equals("application/vnd.openxmlformats-officedocument.presentationml.slideshow") ||
-                mimeType.equals("application/vnd.openxmlformats-officedocument.presentationml.presentation") ||
-                mimeType.equals("application/vnd.ms-powerpoint");
+        return mimeType.equals("application/vnd.openxmlformats-officedocument.presentationml.slideshow")
+                || mimeType.equals("application/vnd.openxmlformats-officedocument.presentationml.presentation")
+                || mimeType.equals("application/vnd.ms-powerpoint");
     }
-    
+
     private boolean isPDF(String mimeType) {
         return mimeType.equals("application/pdf");
     }
-    
+
     private boolean isHtml(String mimeType) {
-       return mimeType.equals("text/html");
+        return mimeType.equals("text/html");
     }
-    
+
     private boolean isAudio(String mimeType) {
         return mimeType.startsWith("audio/");
     }
@@ -336,9 +318,9 @@ public class DocumentImpl extends Filing
     private boolean isVideo(String mimeType) {
         return mimeType.startsWith("video/");
     }
-    
+
     private boolean isPlainText(String mimeType) {
         return mimeType.equals("text/plain");
     }
 
- }
+}