Update of /var/cvs/src/org/mmbase/datatypes/util/xml
In directory james.mmbase.org:/tmp/cvs-serv17549

Modified Files:
        DataTypeDefinition.java 
Log Message:
  MMB-1736


See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/datatypes/util/xml
See also: http://www.mmbase.org/jira/browse/MMB-1736


Index: DataTypeDefinition.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/datatypes/util/xml/DataTypeDefinition.java,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- DataTypeDefinition.java     8 Sep 2008 08:56:56 -0000       1.68
+++ DataTypeDefinition.java     1 Dec 2008 17:25:01 -0000       1.69
@@ -32,7 +32,7 @@
  *
  * @author Pierre van Rooden
  * @author Michiel Meeuwissen
- * @version $Id: DataTypeDefinition.java,v 1.68 2008/09/08 08:56:56 michiel 
Exp $
+ * @version $Id: DataTypeDefinition.java,v 1.69 2008/12/01 17:25:01 michiel 
Exp $
  * @since MMBase-1.8
  **/
 public class DataTypeDefinition {
@@ -250,6 +250,8 @@
             ret = true;
         } else if (addPasswordProperty(childElement)) {
             ret = true;
+        } else if (addDecimalCondition(childElement)) {
+            ret = true;
         } else if (addLengthDataCondition(childElement)) {
             ret =  true;
         } else if (addComparableCondition(childElement)) {
@@ -369,6 +371,28 @@
         return false;
     }
 
+    /**
+     * @since MMBase-1.9.1
+     */
+    protected boolean addDecimalCondition(Element conditionElement) {
+        if (dataType instanceof DecimalDataType) {
+            String localName = conditionElement.getLocalName();
+            DecimalDataType bDataType = (DecimalDataType) dataType;
+            if ("precision".equals(localName)) {
+                int value = (int) DataTypeXml.getLongValue(conditionElement);
+                bDataType.setPrecision(value);
+                setRestrictionData(bDataType.getPrecisionRestriction(), 
conditionElement);
+                return true;
+            } else if ("scale".equals(localName)) {
+                int value = (int) DataTypeXml.getLongValue(conditionElement);
+                bDataType.getScaleRestriction().setValue(value);
+                setRestrictionData(bDataType.getScaleRestriction(), 
conditionElement);
+                return true;
+            }
+        }
+        return false;
+    }
+
 
 
     protected boolean addPasswordProperty(Element propertyElement) {
_______________________________________________
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to