[cvs] Expresso commit by lhamel: Instead of calling it an error if there is

JCorporate Ltd jcorp at jcorp2.servlets.net
Sun Oct 3 21:14:03 PDT 2004


Log Message:
-----------
Instead of calling it an error if there is no parameter value for a field that has a default value, DefaultAutoElement.parseBlocks() now sets the field to the default value. This is especially useful for RegisterUser, which insists on values for Industry and Employees.

Modified Files:
--------------
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/controller/ui:
        DefaultAutoElement.java

Revision Data
-------------
Index: DefaultAutoElement.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/controller/ui/DefaultAutoElement.java,v
retrieving revision 1.51
retrieving revision 1.52
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/services/controller/ui/DefaultAutoElement.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/services/controller/ui/DefaultAutoElement.java -u -r1.51 -r1.52
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/services/controller/ui/DefaultAutoElement.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/services/controller/ui/DefaultAutoElement.java
@@ -450,6 +450,12 @@
                 try {
                     String fieldValue = theObjects[i].getField(fieldName);
 
+                    // use default value if possible
+                    if ((fieldValue == null) || (fieldValue.length() == 0)) {
+                        fieldValue = theObjects[i].getMetaData().getDefaultValue(fieldName);
+                        if ( fieldValue != null ) theObjects[i].set(fieldName, fieldValue);
+                    }
+
                     if ((fieldValue == null) || (fieldValue.length() == 0)) {
                         theObjects[i].checkField(fieldName, fieldValue);
                     }
@@ -1493,7 +1499,6 @@
      *
      * @return an instantiated DataObject.
      *
-     * @throws DataException
      * @throws IllegalArgumentException
      */
 //    private DataObject constructLookupObject(DataObject sourceObject,
@@ -1541,7 +1546,6 @@
      *
      * @return a properly constructed Mappable object
      *
-     * @throws DataException upon error
      * @throws IllegalArgumentException
      */
 //    private Mappable constructMappableObject(DataObject sourceObject,


More information about the cvs mailing list