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 2011/07/31 22:23:53 UTC

svn commit: r1152626 - in /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory: server/InMemoryNavigationServiceImpl.java types/PropertyCreationHelper.java

Author: jens
Date: Sun Jul 31 20:23:53 2011
New Revision: 1152626

URL: http://svn.apache.org/viewvc?rev=1152626&view=rev
Log:
avoid some minor code duplications, small bugfix

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java

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=1152626&r1=1152625&r2=1152626&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 Sun Jul 31 20:23:53 2011
@@ -295,34 +295,15 @@ public class InMemoryNavigationServiceIm
         List<? extends StoredObject> children = folderOnly ? folder.getFolderChildren(maxItems, skipCount, user) : folder
                 .getChildren(maxItems, skipCount, user);
 
-        List<String> requestedIds = FilterParser.getRequestedIdsFromFilter(filter);
-
         for (StoredObject spo : children) {
             ObjectInFolderDataImpl oifd = new ObjectInFolderDataImpl();
-            ObjectDataImpl objectData = new ObjectDataImpl();
             if (includePathSegments != null && includePathSegments) {
                 oifd.setPathSegment(spo.getName());
             }
-            if (includeAllowableActions != null && includeAllowableActions) {
-             //   AllowableActions allowableActions = DataObjectCreator.fillAllowableActions(spo, user);
-                AllowableActions allowableActions = spo.getAllowableActions(user);
-                objectData.setAllowableActions(allowableActions);
-            }
-//            if (includeRelationships != null && includeRelationships != IncludeRelationships.NONE) {
-//                objectData.setRelationships(null /* f.getRelationships() */);
-//            }
-            objectData.setRelationships(DataObjectCreator.getRelationships(includeRelationships, spo, user));
-            
-            if (renditionFilter != null && renditionFilter.length() > 0) {
-                objectData.setRelationships(null /*
-                                                  * f.getRenditions(renditionFilter
-                                                  * )
-                                                  */);
-            }
 
-            TypeDefinition td = fStoreManager.getTypeById(repositoryId, spo.getTypeId()).getTypeDefinition();
-            Properties props = PropertyCreationHelper.getPropertiesFromObject(spo, td, requestedIds, true);
-            objectData.setProperties(props);
+            TypeDefinition typeDef = fStoreManager.getTypeById(repositoryId, spo.getTypeId()).getTypeDefinition();
+            ObjectData objectData = PropertyCreationHelper.getObjectData(typeDef, spo, filter, user, includeAllowableActions, 
+                    includeRelationships, renditionFilter, false, true, null);
 
             oifd.setObject(objectData);
             folderList.add(oifd);
@@ -392,13 +373,8 @@ public class InMemoryNavigationServiceIm
                 ObjectParentDataImpl parentData = new ObjectParentDataImpl();
                 parentData.setObject(parent);
                 String path = ((SingleFiling) sop).getPath();
-                int beginIndex = path.lastIndexOf(Filing.PATH_SEPARATOR) + 1; // Note
-                // :
-                // if
-                // /
-                // not
-                // found
-                // results in 0
+                int beginIndex = path.lastIndexOf(Filing.PATH_SEPARATOR) + 1; 
+                //   Note: if not found results in 0
                 String relPathSeg = path.substring(beginIndex, path.length());
                 parentData.setRelativePathSegment(relPathSeg);
                 result = Collections.singletonList((ObjectParentData) parentData);
@@ -412,16 +388,10 @@ public class InMemoryNavigationServiceIm
             if (null != parents) {
                 for (Folder parent : parents) {
                     ObjectParentDataImpl parentData = new ObjectParentDataImpl();
-                    ObjectDataImpl objData = new ObjectDataImpl();
-                    copyFilteredProperties(repositoryId, parent, filter, objData);
-                    
-                    objData.setRelationships(DataObjectCreator.getRelationships(includeRelationships, parent, user));                  
-                    
-                    if (includeAllowableActions != null && includeAllowableActions) {
-                        //  AllowableActions allowableActions = DataObjectCreator.fillAllowableActions(spo, user);
-                      	AllowableActions allowableActions = parent.getAllowableActions(user);
-                      	objData.setAllowableActions(allowableActions);
-                      }
+                    TypeDefinition typeDef = fStoreManager.getTypeById(repositoryId, parent.getTypeId()).getTypeDefinition();
+                    ObjectData objData = PropertyCreationHelper.getObjectData(typeDef, parent, filter, user, includeAllowableActions, 
+                            IncludeRelationships.NONE, "", false, true, null);
+
                     parentData.setObject(objData);
                     parentData.setRelativePathSegment(multiParentObj.getPathSegment());
                     result.add(parentData);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.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/types/PropertyCreationHelper.java?rev=1152626&r1=1152625&r2=1152626&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java Sun Jul 31 20:23:53 2011
@@ -294,8 +294,9 @@ public class PropertyCreationHelper {
         	AllowableActions allowableActions = so.getAllowableActions(user);
             od.setAllowableActions(allowableActions);
         }
+        
         if (null != includeACL && includeACL) {
-            od.setAcl(null);
+            od.setAcl(so.getAcl());
         }
         od.setIsExactAcl(true);