You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2011/04/24 18:58:48 UTC

svn commit: r1096345 - /chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractFilableCmisObject.java

Author: fmui
Date: Sun Apr 24 16:58:47 2011
New Revision: 1096345

URL: http://svn.apache.org/viewvc?rev=1096345&view=rev
Log:
bug fix: the query name of cmis:path must be retrieved from cmis:folder, not the object type of the object

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractFilableCmisObject.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractFilableCmisObject.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractFilableCmisObject.java?rev=1096345&r1=1096344&r2=1096345&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractFilableCmisObject.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractFilableCmisObject.java Sun Apr 24 16:58:47 2011
@@ -25,11 +25,14 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.client.api.FileableCmisObject;
 import org.apache.chemistry.opencmis.client.api.Folder;
 import org.apache.chemistry.opencmis.client.api.ObjectId;
+import org.apache.chemistry.opencmis.client.api.ObjectType;
 import org.apache.chemistry.opencmis.commons.PropertyIds;
 import org.apache.chemistry.opencmis.commons.data.ObjectParentData;
 import org.apache.chemistry.opencmis.commons.data.PropertyData;
 import org.apache.chemistry.opencmis.commons.data.PropertyId;
 import org.apache.chemistry.opencmis.commons.data.PropertyString;
+import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
+import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.spi.Holder;
@@ -37,8 +40,7 @@ import org.apache.chemistry.opencmis.com
 /**
  * Base class for all filable persistent session object impl classes.
  */
-public abstract class AbstractFilableCmisObject extends AbstractCmisObject implements
-        FileableCmisObject {
+public abstract class AbstractFilableCmisObject extends AbstractCmisObject implements FileableCmisObject {
 
     private static final long serialVersionUID = 1L;
 
@@ -46,9 +48,9 @@ public abstract class AbstractFilableCmi
         String objectId = getObjectId();
 
         // get object ids of the parent folders
-        List<ObjectParentData> bindingParents = getBinding().getNavigationService().getObjectParents(
-                getRepositoryId(), objectId, getPropertyQueryName(PropertyIds.OBJECT_ID), false,
-                IncludeRelationships.NONE, null, false, null);
+        List<ObjectParentData> bindingParents = getBinding().getNavigationService().getObjectParents(getRepositoryId(),
+                objectId, getPropertyQueryName(PropertyIds.OBJECT_ID), false, IncludeRelationships.NONE, null, false,
+                null);
 
         List<Folder> parents = new ArrayList<Folder>();
 
@@ -82,10 +84,13 @@ public abstract class AbstractFilableCmi
     public List<String> getPaths() {
         String objectId = getObjectId();
 
+        ObjectType folderType = getSession().getTypeDefinition(BaseTypeId.CMIS_FOLDER.value());
+        PropertyDefinition<?> propDef = folderType.getPropertyDefinitions().get(PropertyIds.PATH);
+        String pathQueryName = (propDef == null ? null : propDef.getQueryName());
+
         // get object paths of the parent folders
-        List<ObjectParentData> bindingParents = getBinding().getNavigationService().getObjectParents(
-                getRepositoryId(), objectId, getPropertyQueryName(PropertyIds.PATH), false, IncludeRelationships.NONE,
-                null, true, null);
+        List<ObjectParentData> bindingParents = getBinding().getNavigationService().getObjectParents(getRepositoryId(),
+                objectId, pathQueryName, false, IncludeRelationships.NONE, null, true, null);
 
         List<String> paths = new ArrayList<String>();