You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by an...@apache.org on 2008/04/18 10:29:23 UTC

svn commit: r649404 - in /jackrabbit/trunk: jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/ jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/

Author: angela
Date: Fri Apr 18 01:29:14 2008
New Revision: 649404

URL: http://svn.apache.org/viewvc?rev=649404&view=rev
Log:
JCR-1539: SPI: Get rid of unused method ItemInfo.getParentId()

Modified:
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/NodeInfoImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/PropertyInfoImpl.java
    jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/ItemInfo.java
    jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/NodeInfoImpl.java
    jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/PropertyInfoImpl.java

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoImpl.java?rev=649404&r1=649403&r2=649404&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ItemInfoImpl.java Fri Apr 18 01:29:14 2008
@@ -17,9 +17,9 @@
 package org.apache.jackrabbit.spi.commons;
 
 import org.apache.jackrabbit.spi.ItemInfo;
-import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.NodeId;
 
 import java.io.Serializable;
 
@@ -30,12 +30,6 @@
 public abstract class ItemInfoImpl implements ItemInfo, Serializable {
 
     /**
-     * The parent node id of this item or <code>null</code> if this item
-     * represents the root node info.
-     */
-    private final NodeId parentId;
-
-    /**
      * The name of this item info.
      */
     private final Name name;
@@ -51,26 +45,31 @@
     private final boolean isNode;
 
     /**
-     * Creates a new serializable item info for the given qualified
-     * <code>item</code> info.
+     * Creates a new item info from the given name, path and boolean flag.
      *
      * @param parentId the parent id.
      * @param name     the name of this item.
      * @param path     the path to this item.
      * @param isNode   if this item is a node.
+     * @deprecated Use {@link #ItemInfoImpl(Name, Path, boolean)} instead. The
+     * parentId is not used any more and the corresponding getter has been
+     * removed.
      */
     public ItemInfoImpl(NodeId parentId, Name name, Path path, boolean isNode) {
-        this.parentId = parentId;
-        this.name = name;
-        this.path = path;
-        this.isNode = isNode;
+        this(name, path, isNode);
     }
-
+    
     /**
-     * {@inheritDoc}
+     * Creates a new item info from the given name, path and boolean flag.
+     *
+     * @param name     the name of this item.
+     * @param path     the path to this item.
+     * @param isNode   if this item is a node.
      */
-    public NodeId getParentId() {
-        return parentId;
+    public ItemInfoImpl(Name name, Path path, boolean isNode) {
+        this.name = name;
+        this.path = path;
+        this.isNode = isNode;
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/NodeInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/NodeInfoImpl.java?rev=649404&r1=649403&r2=649404&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/NodeInfoImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/NodeInfoImpl.java Fri Apr 18 01:29:14 2008
@@ -83,16 +83,10 @@
                         parentId.getUniqueID(), parentId.getPath());
                 serRefs.add(idFactory.createPropertyId(parentId, refs[i].getName()));
             }
-            NodeId parentId = null;
-            if (nodeInfo.getParentId() != null) {
-                parentId = nodeInfo.getParentId();
-                parentId = idFactory.createNodeId(
-                        parentId.getUniqueID(), parentId.getPath());
-            }
             NodeId nodeId = nodeInfo.getId();
             nodeId = idFactory.createNodeId(nodeId.getUniqueID(), nodeId.getPath());
             final Iterator propIds = nodeInfo.getPropertyIds();
-            return new NodeInfoImpl(parentId, nodeInfo.getName(),
+            return new NodeInfoImpl(nodeInfo.getName(),
                     nodeInfo.getPath(), nodeId,
                     nodeInfo.getIndex(), nodeInfo.getNodetype(),
                     nodeInfo.getMixins(), serRefs.iterator(),
@@ -116,8 +110,7 @@
     }
 
     /**
-     * Creates a new serializable node info for the given <code>node</code>
-     * info.
+     * Creates a new node info from the given parameters.
      *
      * @param parentId        the parent id.
      * @param name            the name of this item.
@@ -128,11 +121,31 @@
      * @param mixinNames      the names of the assigned mixins.
      * @param references      the references to this node.
      * @param propertyIds     the properties of this node.
+     * @deprecated Use {@link #NodeInfoImpl(Name, Path, NodeId, int, Name, Name[], Iterator, Iterator)}
+     * instead. The parentId is not used any more.
      */
     public NodeInfoImpl(NodeId parentId, Name name, Path path, NodeId id,
-                         int index, Name primaryTypeName, Name[] mixinNames,
-                         Iterator references, Iterator propertyIds) {
-        super(parentId, name, path, true);
+                        int index, Name primaryTypeName, Name[] mixinNames,
+                        Iterator references, Iterator propertyIds) {
+         this(name, path, id, index, primaryTypeName, mixinNames, references, propertyIds);
+    }
+
+    /**
+     * Creates a new node info from the given parameters.
+     *
+     * @param name            the name of this item.
+     * @param path            the path to this item.
+     * @param id              the id of this item.
+     * @param index           the index of this item.
+     * @param primaryTypeName the name of the primary node type.
+     * @param mixinNames      the names of the assigned mixins.
+     * @param references      the references to this node.
+     * @param propertyIds     the properties of this node.
+     */
+    public NodeInfoImpl(Name name, Path path, NodeId id,
+                        int index, Name primaryTypeName, Name[] mixinNames,
+                        Iterator references, Iterator propertyIds) {
+        super(name, path, true);
         this.id = id;
         this.index = index;
         this.primaryTypeName = primaryTypeName;

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/PropertyInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/PropertyInfoImpl.java?rev=649404&r1=649403&r2=649404&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/PropertyInfoImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/PropertyInfoImpl.java Fri Apr 18 01:29:14 2008
@@ -63,19 +63,19 @@
         if (propertyInfo instanceof Serializable) {
             return propertyInfo;
         } else {
-            NodeId parentId = propertyInfo.getParentId();
+            NodeId parentId = propertyInfo.getId().getParentId();
             parentId = idFactory.createNodeId(
                     parentId.getUniqueID(), parentId.getPath());
             PropertyId propId = idFactory.createPropertyId(
                     parentId, propertyInfo.getId().getName());
-            return new PropertyInfoImpl(parentId, propertyInfo.getName(),
+            return new PropertyInfoImpl(propertyInfo.getName(),
                     propertyInfo.getPath(), propId, propertyInfo.getType(),
                     propertyInfo.isMultiValued(), propertyInfo.getValues());
         }
     }
 
     /**
-     * Creates a new serializable property info for the given parameters.
+     * Creates a new property info for the given parameters.
      *
      * @param parentId      the parent id.
      * @param name          the name of this property.
@@ -84,11 +84,29 @@
      * @param type          the type of this property.
      * @param isMultiValued whether this property is multi-valued.
      * @param values        the values.
+     * @deprecated Use {@link #PropertyInfoImpl(Name, Path, PropertyId, int, boolean, QValue[])}
+     * instead. The parentId is not used any more.
      */
     public PropertyInfoImpl(NodeId parentId, Name name, Path path,
                             PropertyId id, int type, boolean isMultiValued,
                             QValue[] values) {
-        super(parentId, name, path, false);
+        this(name, path, id, type, isMultiValued, values);
+    }
+
+    /**
+     * Creates a new property info for the given parameters.
+     *
+     * @param name          the name of this property.
+     * @param path          the path to this property.
+     * @param id            the id of this property.
+     * @param type          the type of this property.
+     * @param isMultiValued whether this property is multi-valued.
+     * @param values        the values.
+     */
+    public PropertyInfoImpl(Name name, Path path,
+                            PropertyId id, int type, boolean isMultiValued,
+                            QValue[] values) {
+        super(name, path, false);
         this.propertyId = id;
         this.type = type;
         this.isMultiValued = isMultiValued;

Modified: jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/ItemInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/ItemInfo.java?rev=649404&r1=649403&r2=649404&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/ItemInfo.java (original)
+++ jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/ItemInfo.java Fri Apr 18 01:29:14 2008
@@ -23,13 +23,6 @@
 public interface ItemInfo {
 
     /**
-     * Returns the id of the parent <code>NodeInfo</code>.
-     *
-     * @return the id of the parent item info.
-     */
-    public NodeId getParentId();
-
-    /**
      * Returns the qualified representation of the item name. For the root node
      * expected return value is <code>{""}""</code>.
      *

Modified: jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/NodeInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/NodeInfoImpl.java?rev=649404&r1=649403&r2=649404&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/NodeInfoImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/NodeInfoImpl.java Fri Apr 18 01:29:14 2008
@@ -49,8 +49,7 @@
                         IdFactoryImpl idFactory,
                         NamePathResolver resolver)
             throws RepositoryException, NameException {
-        super(node.getName().length() == 0 ? null : idFactory.createNodeId(node.getParent(), resolver),
-                node.getName().length() == 0 ? NameConstants.ROOT : resolver.getQName(node.getName()),
+        super(node.getName().length() == 0 ? NameConstants.ROOT : resolver.getQName(node.getName()),
                 resolver.getQPath(node.getPath()),
                 idFactory.createNodeId(node, resolver), node.getIndex(),
                 resolver.getQName(node.getPrimaryNodeType().getName()),

Modified: jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/PropertyInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/PropertyInfoImpl.java?rev=649404&r1=649403&r2=649404&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/PropertyInfoImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/PropertyInfoImpl.java Fri Apr 18 01:29:14 2008
@@ -48,8 +48,7 @@
                             NamePathResolver resolver,
                             QValueFactory qValueFactory)
             throws RepositoryException, NameException {
-        super(idFactory.createNodeId(property.getParent(), resolver),
-                resolver.getQName(property.getName()),
+        super(resolver.getQName(property.getName()),
                 resolver.getQPath(property.getPath()),
                 idFactory.createPropertyId(property, resolver),
                 property.getType(), property.getDefinition().isMultiple(),