jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r464424 - /jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetPropertyValue.java
Date Mon, 16 Oct 2006 09:17:07 GMT
Author: angela
Date: Mon Oct 16 02:17:06 2006
New Revision: 464424

URL: http://svn.apache.org/viewvc?view=rev&rev=464424
Log:
work in progress

- purge values array

Modified:
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetPropertyValue.java

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetPropertyValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetPropertyValue.java?view=diff&rev=464424&r1=464423&r2=464424
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetPropertyValue.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetPropertyValue.java
Mon Oct 16 02:17:06 2006
@@ -28,6 +28,8 @@
 import javax.jcr.version.VersionException;
 import javax.jcr.lock.LockException;
 import javax.jcr.nodetype.ConstraintViolationException;
+import java.util.List;
+import java.util.ArrayList;
 
 /**
  * <code>SetPropertyValue</code>...
@@ -42,7 +44,7 @@
         this.propertyState = propertyState;
         this.propertyType = propertyType;
         this.values = values;
-        
+
         addAffectedItemState(propertyState);
     }
 
@@ -69,9 +71,17 @@
     }
 
     //------------------------------------------------------------< Factory >---
-    public static Operation create(PropertyState propState, QValue[] iva,
+    public static Operation create(PropertyState propState, QValue[] qValues,
                                    int valueType) {
-        SetPropertyValue sv = new SetPropertyValue(propState, valueType, iva);
+        // compact array (purge null entries)
+        List list = new ArrayList();
+        for (int i = 0; i < qValues.length; i++) {
+            if (qValues[i] != null) {
+                list.add(qValues[i]);
+            }
+        }
+        QValue[] cleanValues = (QValue[]) list.toArray(new QValue[list.size()]);
+        SetPropertyValue sv = new SetPropertyValue(propState, valueType, cleanValues);
         return sv;
     }
 }



Mime
View raw message