You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by md...@apache.org on 2012/10/31 14:16:44 UTC
svn commit: r1404126 - in
/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr:
JcrFolder.java JcrNode.java
Author: mduerig
Date: Wed Oct 31 13:16:43 2012
New Revision: 1404126
URL: http://svn.apache.org/viewvc?rev=1404126&view=rev
Log:
CMIS-582: Missing property cmis:allowedChildObjectTypeIds
Credits to Ivan Vasyliev for the patch
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrFolder.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrNode.java
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrFolder.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrFolder.java?rev=1404126&r1=1404125&r2=1404126&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrFolder.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrFolder.java Wed Oct 31 13:16:43 2012
@@ -19,11 +19,27 @@
package org.apache.chemistry.opencmis.jcr;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.query.Query;
+import javax.jcr.query.QueryManager;
+import javax.jcr.query.QueryResult;
+import javax.jcr.version.Version;
+
import org.apache.chemistry.opencmis.commons.PropertyIds;
import org.apache.chemistry.opencmis.commons.data.Properties;
import org.apache.chemistry.opencmis.commons.data.PropertyData;
import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer;
import org.apache.chemistry.opencmis.commons.enums.Action;
import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
import org.apache.chemistry.opencmis.commons.enums.Updatability;
@@ -40,18 +56,6 @@ import org.apache.chemistry.opencmis.jcr
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.query.Query;
-import javax.jcr.query.QueryManager;
-import javax.jcr.query.QueryResult;
-import javax.jcr.version.Version;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
/**
* Instances of this class represent a cmis:folder backed by an underlying JCR <code>Node</code>.
@@ -213,6 +217,8 @@ public class JcrFolder extends JcrNode {
objectInfo.setHasParent(true);
addPropertyId(properties, typeId, filter, PropertyIds.PARENT_ID, getParent().getObjectId());
}
+
+ addPropertyAllowedChildObjectTypeIds(properties, filter, typeId);
}
@Override
@@ -335,4 +341,23 @@ public class JcrFolder extends JcrNode {
return queryResult.getNodes().hasNext();
}
+ /**
+ * Add property "cmis:allowedChildObjectTypeIds" to the CMIS object.
+ * See CMIS specification v.1.0, 2.1.5.4.2 Property Definitions.
+ *
+ * @param properties - the properties of the CMIS object represented by this instance.
+ * @param filter
+ * @param typeId - type ID of the instance.
+ */
+ private void addPropertyAllowedChildObjectTypeIds(PropertiesImpl properties,
+ Set<String> filter, String typeId) {
+ Iterator<TypeDefinitionContainer> typeDefIterator = super.typeManager.getTypeDefinitionList().iterator();
+ List<String> typeIds = new ArrayList<String>(super.typeManager.getTypeDefinitionList().size());
+ while (typeDefIterator.hasNext()) {
+ TypeDefinitionContainer definition = typeDefIterator.next();
+ typeIds.add(definition.getTypeDefinition().getId());
+ }
+ addPropertyList(properties, typeId, filter, PropertyIds.ALLOWED_CHILD_OBJECT_TYPE_IDS, typeIds);
+ }
+
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrNode.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrNode.java?rev=1404126&r1=1404125&r2=1404126&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrNode.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrNode.java Wed Oct 31 13:16:43 2012
@@ -685,6 +685,19 @@ public abstract class JcrNode {
prop.setQueryName(id);
props.addProperty(prop);
}
+
+ protected final void addPropertyList(PropertiesImpl props, String typeId, Set<String> filter, String id,
+ List<String> values) {
+
+ if (!checkAddProperty(props, typeId, filter, id)) {
+ return;
+ }
+
+ PropertyStringImpl prop = new PropertyStringImpl(id, values);
+ prop.setQueryName(id);
+ props.addProperty(prop);
+
+ }
/**
* Validate a set of properties against a filter and its definitions