incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r634716 - /incubator/sling/trunk/sling/ujax/src/main/java/org/apache/sling/ujax/UjaxPropertyValueHandler.java
Date Fri, 07 Mar 2008 15:27:39 GMT
Author: cziegeler
Date: Fri Mar  7 07:27:38 2008
New Revision: 634716

URL: http://svn.apache.org/viewvc?rev=634716&view=rev
Log:
SLING-306: Let jcr convert the type if no type hint is available.

Modified:
    incubator/sling/trunk/sling/ujax/src/main/java/org/apache/sling/ujax/UjaxPropertyValueHandler.java

Modified: incubator/sling/trunk/sling/ujax/src/main/java/org/apache/sling/ujax/UjaxPropertyValueHandler.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/ujax/src/main/java/org/apache/sling/ujax/UjaxPropertyValueHandler.java?rev=634716&r1=634715&r2=634716&view=diff
==============================================================================
--- incubator/sling/trunk/sling/ujax/src/main/java/org/apache/sling/ujax/UjaxPropertyValueHandler.java
(original)
+++ incubator/sling/trunk/sling/ujax/src/main/java/org/apache/sling/ujax/UjaxPropertyValueHandler.java
Fri Mar  7 07:27:38 2008
@@ -73,7 +73,7 @@
     /**
      * Set property on given node, with some automatic values when user provides
      * the field name but no value.
-     * 
+     *
      * html example for testing:
      * <xmp>
      *   <input type="hidden" name="created"/>
@@ -182,7 +182,7 @@
             throws RepositoryException {
 
         // no explicit typehint
-        int type = PropertyType.STRING;
+        int type = PropertyType.UNDEFINED;
         if (prop.getTypeHint() != null) {
             try {
                 type = PropertyType.valueFromName(prop.getTypeHint());
@@ -217,9 +217,13 @@
                 }
                 // fall back to default behaviour
             }
-            ctx.getChangeLog().onModified(
-                parent.setProperty(prop.getName(), values[0], type).getPath()
-            );
+            final Property p;
+            if ( type == PropertyType.UNDEFINED ) {
+                p = parent.setProperty(prop.getName(), values[0]);
+            } else {
+                p = parent.setProperty(prop.getName(), values[0], type);
+            }
+            ctx.getChangeLog().onModified(p.getPath());
         } else {
             removePropertyIfExists(parent, prop.getName());
             if (type == PropertyType.DATE) {
@@ -233,9 +237,13 @@
                 }
                 // fall back to default behaviour
             }
-            ctx.getChangeLog().onModified(
-                parent.setProperty(prop.getName(), values, type).getPath()
-            );
+            final Property p;
+            if ( type == PropertyType.UNDEFINED ) {
+                p = parent.setProperty(prop.getName(), values);
+            } else {
+                p = parent.setProperty(prop.getName(), values, type);
+            }
+            ctx.getChangeLog().onModified(p.getPath());
         }
     }
 



Mime
View raw message