jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r773842 - /jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
Date Tue, 12 May 2009 10:29:39 GMT
Author: angela
Date: Tue May 12 10:29:39 2009
New Revision: 773842

URL: http://svn.apache.org/viewvc?rev=773842&view=rev
Log:
JCR-2003: JCR2SPI / SPI: Add support for JCR 2.0

Modified:
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java?rev=773842&r1=773841&r2=773842&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
Tue May 12 10:29:39 2009
@@ -77,6 +77,7 @@
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.QValue;
+import org.apache.jackrabbit.spi.PropertyId;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.commons.value.ValueFormat;
@@ -531,9 +532,7 @@
      * @see Node#getReferences()
      */
     public PropertyIterator getReferences() throws RepositoryException {
-        checkStatus();
-        List refs = Arrays.asList(getNodeState().getNodeReferences());
-        return new LazyItemIterator(getItemManager(), session.getHierarchyManager(), refs.iterator());
+        return getReferences(null);
     }
 
     /**
@@ -1215,8 +1214,23 @@
      * @see javax.jcr.Node#getReferences(String)
      */
     public PropertyIterator getReferences(String name) throws RepositoryException {
-        // TODO: implementation missing
-        throw new UnsupportedRepositoryOperationException("JCR-1104");
+        checkStatus();
+        List refs = Arrays.asList(getNodeState().getNodeReferences());
+        if (name != null) {
+            // remove property ids that don't match the given name
+            Name qName = getQName(name);
+            refs = new ArrayList(refs);
+            for (Iterator iter = refs.iterator(); iter.hasNext();) {
+                PropertyId propId = (PropertyId) iter.next();
+                if (!propId.getName().equals(qName)) {
+                    refs.remove(propId);
+                }
+            }
+        } // else: name == null -> return all references
+
+        // create an property iterator for all or the matching property ids
+        // according to the specified name.
+        return new LazyItemIterator(getItemManager(), session.getHierarchyManager(), refs.iterator());
     }
 
     /**



Mime
View raw message