You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by dp...@apache.org on 2010/03/31 15:38:37 UTC
svn commit: r929536 -
/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java
Author: dpfister
Date: Wed Mar 31 13:38:37 2010
New Revision: 929536
URL: http://svn.apache.org/viewvc?rev=929536&view=rev
Log:
CMIS-187 - All nt:folder derived nodes should be considered folders
- check whether jcr:content subnode exists before accessing it
Modified:
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java
Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java?rev=929536&r1=929535&r2=929536&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java Wed Mar 31 13:38:37 2010
@@ -25,6 +25,7 @@ import java.util.Set;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.NodeType;
import javax.xml.namespace.QName;
import org.apache.chemistry.AllowableAction;
@@ -132,14 +133,19 @@ class JcrObjectEntry implements ObjectEn
if (hasCmisPrefix() && node.hasProperty(Property.TYPE_ID)) {
return node.getProperty(Property.TYPE_ID).getString();
}
- String nt = node.getPrimaryNodeType().getName();
- if (JcrCmisMap.isBaseTypeFolder(nt)) {
+ NodeType nt = node.getPrimaryNodeType();
+ if (JcrCmisMap.isBaseTypeFolder(nt.getName())) {
return BaseType.FOLDER.getId();
- } else {
- return BaseType.DOCUMENT.getId();
}
+ /* check supertypes of this type as well */
+ for (NodeType superType : nt.getSupertypes()) {
+ if (JcrCmisMap.isBaseTypeFolder(superType.getName())) {
+ return BaseType.FOLDER.getId();
+ }
+ }
+ return BaseType.DOCUMENT.getId();
} catch (RepositoryException e) {
- log.error("Unable to get type id", e);
+ log.error("Unable to inspect type hierarchy", e);
return BaseType.DOCUMENT.getId();
}
}
@@ -336,6 +342,9 @@ class JcrObjectEntry implements ObjectEn
return;
}
try {
+ if (!node.hasNode(JcrConstants.JCR_CONTENT)) {
+ return;
+ }
Node content = node.getNode(JcrConstants.JCR_CONTENT);
String filename = getName();
if (hasCmisPrefix() && node.hasProperty(Property.CONTENT_STREAM_FILE_NAME)) {