chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1189475 - /chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java
Date Wed, 26 Oct 2011 21:21:56 GMT
Author: fmui
Date: Wed Oct 26 21:21:56 2011
New Revision: 1189475

URL: http://svn.apache.org/viewvc?rev=1189475&view=rev
Log:
CMIS-457: smarter parent detection

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java?rev=1189475&r1=1189474&r2=1189475&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java
Wed Oct 26 21:21:56 2011
@@ -981,9 +981,19 @@ public abstract class AbstractCmisServic
         }
 
         // parent
-        List<ObjectParentData> parents = getObjectParents(repositoryId, object.getId(),
null, Boolean.FALSE,
-                IncludeRelationships.NONE, "cmis:none", Boolean.FALSE, null);
-        info.setHasParent(parents.size() > 0);
+        if (object.getBaseTypeId() == BaseTypeId.CMIS_RELATIONSHIP) {
+            info.setHasParent(false);
+        } else if (object.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) {
+            info.setHasParent(!object.getId().equals(repositoryInfo.getRootFolderId()));
+        } else {
+            try {
+                List<ObjectParentData> parents = getObjectParents(repositoryId, object.getId(),
null, Boolean.FALSE,
+                        IncludeRelationships.NONE, "cmis:none", Boolean.FALSE, null);
+                info.setHasParent(parents.size() > 0);
+            } catch (CmisInvalidArgumentException e) {
+                info.setHasParent(false);
+            }
+        }
 
         // policies and relationships
         info.setSupportsRelationships(false);



Mime
View raw message