You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by an...@apache.org on 2013/11/12 10:38:08 UTC
svn commit: r1540985 - in
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype:
EffectiveType.java ItemDefinitionImpl.java
Author: angela
Date: Tue Nov 12 09:38:08 2013
New Revision: 1540985
URL: http://svn.apache.org/r1540985
Log:
minor improvement: remove unused methods
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveType.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveType.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveType.java?rev=1540985&r1=1540984&r2=1540985&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveType.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/EffectiveType.java Tue Nov 12 09:38:08 2013
@@ -16,6 +16,17 @@
*/
package org.apache.jackrabbit.oak.plugins.nodetype;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
+import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.api.Type;
+import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
+import org.apache.jackrabbit.oak.spi.state.NodeState;
+
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.addAll;
import static com.google.common.collect.Iterables.concat;
@@ -23,7 +34,6 @@ import static com.google.common.collect.
import static com.google.common.collect.Lists.newArrayListWithCapacity;
import static com.google.common.collect.Sets.newHashSet;
import static org.apache.jackrabbit.JcrConstants.JCR_DEFAULTPRIMARYTYPE;
-import static org.apache.jackrabbit.JcrConstants.JCR_ISMIXIN;
import static org.apache.jackrabbit.JcrConstants.JCR_MANDATORY;
import static org.apache.jackrabbit.JcrConstants.JCR_MIXINTYPES;
import static org.apache.jackrabbit.JcrConstants.JCR_NODETYPENAME;
@@ -34,7 +44,6 @@ import static org.apache.jackrabbit.oak.
import static org.apache.jackrabbit.oak.api.Type.UNDEFINED;
import static org.apache.jackrabbit.oak.api.Type.UNDEFINEDS;
import static org.apache.jackrabbit.oak.commons.PathUtils.dropIndexFromName;
-import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.JCR_IS_ABSTRACT;
import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.OAK_MANDATORY_CHILD_NODES;
import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.OAK_MANDATORY_PROPERTIES;
import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.OAK_NAMED_CHILD_NODE_DEFINITIONS;
@@ -43,20 +52,6 @@ import static org.apache.jackrabbit.oak.
import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.OAK_RESIDUAL_PROPERTY_DEFINITIONS;
import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.OAK_SUPERTYPES;
-import java.util.List;
-import java.util.Set;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-
-import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.api.PropertyState;
-import org.apache.jackrabbit.oak.api.Type;
-import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
-import org.apache.jackrabbit.oak.spi.state.NodeState;
-
-import com.google.common.collect.Lists;
-
class EffectiveType {
private final List<NodeState> types;
@@ -279,64 +274,6 @@ class EffectiveType {
return names;
}
- /**
- * Collects the primary and mixin types and all related supertypes
- * of the given child node and returns them as an effective node type.
- *
- * @param types the {@code /jcr:system/jcr:nodeTypes} subtree
- * @param path path of the parent node
- * @param name name of the child node
- * @param primary name of the primary type
- * @param mixins names of the mixin types
- * @throws CommitFailedException if the effective node type is invalid
- */
- EffectiveType computeEffectiveType(
- NodeState types, String path,
- String name, String primary, Iterable<String> mixins)
- throws CommitFailedException {
- List<NodeState> list = Lists.newArrayList();
-
- NodeState type = types.getChildNode(primary);
- if (!type.exists()) {
- throw constraintViolation(
- 1, path, "The primary type " + primary
- + " of child node " + name + " does not exist");
- } else if (type.getBoolean(JCR_ISMIXIN)) {
- throw constraintViolation(
- 2, path, "Mixin type " + primary
- + " used as the primary type of child node " + name);
- } else if (type.getBoolean(JCR_IS_ABSTRACT)) {
- throw constraintViolation(
- 3, path, "Abstract type " + primary
- + " used as the primary type of child node " + name);
- } else {
- list.add(type);
- }
-
- // mixin types
- for (String mixin : mixins) {
- type = types.getChildNode(mixin);
- if (!type.exists()) {
- throw constraintViolation(
- 5, path, "The mixin type " + mixin
- + " of child node " + name + " does not exist");
- } else if (!type.getBoolean(JCR_ISMIXIN)) {
- throw constraintViolation(
- 6, path, "Primary type " + mixin
- + " used as a mixin type of child node " + name);
- } else if (type.getBoolean(JCR_IS_ABSTRACT)) {
- throw constraintViolation(
- 7, path, "Abstract type " + mixin
- + " used as a mixin type of child node " + name);
- } else {
- list.add(type);
- }
- }
-
- return new EffectiveType(list);
- }
-
-
//------------------------------------------------------------< Object >--
@Override
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java?rev=1540985&r1=1540984&r2=1540985&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ItemDefinitionImpl.java Tue Nov 12 09:38:08 2013
@@ -16,8 +16,6 @@
*/
package org.apache.jackrabbit.oak.plugins.nodetype;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import javax.jcr.nodetype.ItemDefinition;
import javax.jcr.nodetype.NodeType;
import javax.jcr.version.OnParentVersionAction;
@@ -26,6 +24,8 @@ import org.apache.jackrabbit.JcrConstant
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.namepath.NamePathMapper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* <pre>
* [nt:{propertyDefinition,childNodeDefinition}]
@@ -49,14 +49,6 @@ class ItemDefinitionImpl extends Abstrac
this.type = checkNotNull(type);
}
- String getOakName() {
- String oakName = getName(JcrConstants.JCR_NAME);
- if (oakName == null) {
- oakName = NodeTypeConstants.RESIDUAL_NAME;
- }
- return oakName;
- }
-
//-----------------------------------------------------< ItemDefinition >---
@Override