seade       2003/09/28 22:58:47

  Modified:    xdocs    changes.xml
               src/java/org/apache/turbine/services/intake/model Field.java
  Log:
  Make use of the emptyValue attribute on the field element when no value has been 
set.  This makes it possible to clear values in an existing object that is being 
overwritten with Intake data using group.setProperties(obj).
  
  Revision  Changes    Path
  1.68      +11 -0     jakarta-turbine-2/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/xdocs/changes.xml,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- changes.xml       29 Sep 2003 05:12:31 -0000      1.67
  +++ changes.xml       29 Sep 2003 05:58:47 -0000      1.68
  @@ -104,6 +104,17 @@
          <em>$group.foo.StringValue</em> rather than <em>$group.foo.Value</em> 
          (you can do this for all values, not just DateString).
       </li>
  +    <li>
  +       Intake now makes use of the the emptyValue attribute from the field 
  +       elements when mapping from the group to the object when no value has 
  +       been set.  This makes it possible to clear values in an existing object
  +       that is being overwritten with Intake data using 
  +       <em>group.setProperties(obj)</em> (or you can provide non-null values
  +       in your intake.xml file).  Make sure you do not inadvertently include 
  +       the primary key for the object in the intake group without actually 
  +       setting it to the appropriate value (it shouldn't be in the group 
  +       anyway).
  +    </li>
     </ul>
   </p>
   </subsection>
  
  
  
  1.18      +24 -23    
jakarta-turbine-2/src/java/org/apache/turbine/services/intake/model/Field.java
  
  Index: Field.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/intake/model/Field.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Field.java        29 Sep 2003 05:12:31 -0000      1.17
  +++ Field.java        29 Sep 2003 05:58:47 -0000      1.18
  @@ -87,6 +87,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]>Daniel Rall</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Henning P. Schmiedehausen</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Quinton McCombs</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]">Scott Eade</a>
    * @version $Id$
    */
   public abstract class Field
  @@ -890,38 +891,38 @@
           if (isSet())
           {
               valArray[0] = getTestValue();
  -
               if (isDebugEnabled)
               {
                   log.debug(name + ": Property is set, value is " + valArray[0]);
               }
  -
  -            try
  -            {
  -                setter.invoke(obj, valArray);
  -            }
  -            catch (IllegalAccessException e)
  -            {
  -                throwSetGetException("setter", obj, this.getDisplayName(),
  -                        this.group.getIntakeGroupName(), e);
  -            }
  -            catch (IllegalArgumentException e)
  -            {
  -                throwSetGetException("setter", obj, this.getDisplayName(),
  -                        this.group.getIntakeGroupName(), e);
  -            }
  -            catch (InvocationTargetException e)
  -            {
  -                throwSetGetException("setter", obj, this.getDisplayName(),
  -                        this.group.getIntakeGroupName(), e);
  -            }
           }
           else
           {
  +            valArray[0] = getEmptyValue();
               if (isDebugEnabled)
               {
  -                log.debug(name+ ": Property is not set, skipping");
  +                log.debug(name + ": Property is not set, using emptyValue " + 
valArray[0]);
               }
  +        }
  +
  +        try
  +        {
  +            setter.invoke(obj, valArray);
  +        }
  +        catch (IllegalAccessException e)
  +        {
  +            throwSetGetException("setter", obj, this.getDisplayName(),
  +                    this.group.getIntakeGroupName(), e);
  +        }
  +        catch (IllegalArgumentException e)
  +        {
  +            throwSetGetException("setter", obj, this.getDisplayName(),
  +                    this.group.getIntakeGroupName(), e);
  +        }
  +        catch (InvocationTargetException e)
  +        {
  +            throwSetGetException("setter", obj, this.getDisplayName(),
  +                    this.group.getIntakeGroupName(), e);
           }
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to