jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1382967 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeImpl.java oak-jcr/pom.xml
Date Mon, 10 Sep 2012 16:23:05 GMT
Author: mduerig
Date: Mon Sep 10 16:23:04 2012
New Revision: 1382967

URL: http://svn.apache.org/viewvc?rev=1382967&view=rev
Log:
OAK-66: JCR Node Type Management
NodeType.canRemove methods: inexistent items can never be removed.

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeImpl.java
    jackrabbit/oak/trunk/oak-jcr/pom.xml

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeImpl.java?rev=1382967&r1=1382966&r2=1382967&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeImpl.java
Mon Sep 10 16:23:04 2012
@@ -385,7 +385,8 @@ class NodeTypeImpl implements NodeType {
 
     @Override
     public boolean canRemoveNode(String nodeName) {
-        for (NodeDefinition definition : getChildNodeDefinitions()) {
+        NodeDefinition[] childNodeDefinitions = getChildNodeDefinitions();
+        for (NodeDefinition definition : childNodeDefinitions) {
             String name = definition.getName();
             if (matches(nodeName, name)) {
                 if (definition.isMandatory() || definition.isProtected()) {
@@ -393,12 +394,13 @@ class NodeTypeImpl implements NodeType {
                 }
             }
         }
-        return true;
+        return childNodeDefinitions.length > 0;
     }
 
     @Override
     public boolean canRemoveProperty(String propertyName) {
-        for (PropertyDefinition definition : getPropertyDefinitions()) {
+        PropertyDefinition[] propertyDefinitions = getPropertyDefinitions();
+        for (PropertyDefinition definition : propertyDefinitions) {
             String name = definition.getName();
             if (propertyName.equals(name)) {
                 if (definition.isMandatory() || definition.isProtected()) {
@@ -406,7 +408,7 @@ class NodeTypeImpl implements NodeType {
                 }
             }
         }
-        return true;
+        return propertyDefinitions.length > 0;
     }
 
     private static boolean matches(String childNodeName, String name) {

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1382967&r1=1382966&r2=1382967&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Mon Sep 10 16:23:04 2012
@@ -73,7 +73,6 @@ org.apache.jackrabbit.test.api.nodetype.
 org.apache.jackrabbit.test.api.nodetype.CanSetPropertyPathTest#testConversions
 org.apache.jackrabbit.test.api.nodetype.CanAddChildNodeCallWithoutNodeTypeTest#testDefinedWithoutDefault
<!-- OAK-66 -->
 org.apache.jackrabbit.test.api.nodetype.CanAddChildNodeCallWithoutNodeTypeTest#testResidualWithoutDefault
<!-- OAK-66 -->
-org.apache.jackrabbit.test.api.nodetype.CanRemoveItemTest#testMandatoryProperty <!-- OAK-66
-->
 org.apache.jackrabbit.test.api.LifecycleTest
 org.apache.jackrabbit.test.api.query.ElementTest#testElementTestNameTestSomeNTWithSNS<!--
OAK-203 -->
 org.apache.jackrabbit.test.api.query.GetPropertyNamesTest#testGetPropertyNames



Mime
View raw message