jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r944294 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml: PropInfo.java SysViewImportHandler.java
Date Fri, 14 May 2010 14:37:30 GMT
Author: stefan
Date: Fri May 14 14:37:29 2010
New Revision: 944294

URL: http://svn.apache.org/viewvc?rev=944294&view=rev
Log:
JCR-2627 System-view export/import of multi-value property does not respect JCR 2.0

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java?rev=944294&r1=944293&r2=944294&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java
Fri May 14 14:37:29 2010
@@ -58,7 +58,7 @@ public class PropInfo {
     /**
      * Hint indicating whether the property is multi- or single-value
      */
-    public enum MultipleStatus { UNKNOWN, SINGLE, MULTIPLE };
+    public enum MultipleStatus { UNKNOWN, SINGLE, MULTIPLE }
     private MultipleStatus multipleStatus;
 
     /**
@@ -121,8 +121,14 @@ public class PropInfo {
         } else if (multipleStatus == MultipleStatus.SINGLE) {
             return ent.getApplicablePropertyDef(name, type, false);
         } else {
-            // could be single- or multi-valued
-            return ent.getApplicablePropertyDef(name, type);
+            // multipleStatus == MultipleStatus.UNKNOWN
+            if (values.length == 1) {
+                // one value => could be single- or multi-valued
+                return ent.getApplicablePropertyDef(name, type);
+            } else {
+                // zero or more than one values => must be multi-valued
+                return ent.getApplicablePropertyDef(name, type, true);
+            }
         }
     }
 
@@ -134,10 +140,6 @@ public class PropInfo {
         return type;
     }
 
-    public MultipleStatus getMultipleStatus() {
-        return multipleStatus;
-    }
-
     public TextValue[] getTextValues() {
         return values;        
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java?rev=944294&r1=944293&r2=944294&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java
Fri May 14 14:37:29 2010
@@ -294,6 +294,10 @@ class SysViewImportHandler extends Targe
                     throw new SAXException("error while retrieving value", ioe);
                 }
             } else {
+                if (currentPropMultipleStatus == MultipleStatus.UNKNOWN
+                        && currentPropValues.size() != 1) {
+                    currentPropMultipleStatus = MultipleStatus.MULTIPLE;
+                }
                 PropInfo prop = new PropInfo(
                         currentPropName,
                         currentPropType,



Mime
View raw message