turbine-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Quinton McCombs" <qmcco...@nequalsone.com>
Subject RE: Intake problem
Date Tue, 03 Dec 2002 22:25:42 GMT
In the logic to determine if a field is set, it makes two checks.

1) Does the key exist?
2) Is the value of the key something other than an empty string?

In my case, test #1 passes.  The second test fails but I am trying to
set the value to an empty string.

I would think that in the case of a form only mapping to some of the
attributes of an object, it wouold not be an issue.  As long as the
group used on the form did not map a field to the attribute, it would
not even enter the loop where the attributes are set.  Evern if the
group did map that field, as long as the field was not used on the form,
the first test would fail.

Is this working for anyone else?  It seems odd that no one using intake
is having this problem.  

-----Original Message-----
From: Chris K Chew [mailto:chris@fenetics.com] 
Sent: Tuesday, December 03, 2002 4:22 PM
To: Turbine Developers List
Subject: RE: Intake problem


It seems to me an implication would be in cases where people have
multiple forms to populate a single object, like in a wizard.  I think
it might be nice to have a switch in the <group tag that set
clearAbsentFieldValues="true|false" (false).  Intake could then use some
logic to handle what Quinton has in mind, but still takes care of the
cases where people don't want the values of absent fields set to null.

Chris

> -----Original Message-----
> From: John McNally [mailto:jmcnally@collab.net]
> Sent: Tuesday, December 03, 2002 3:10 PM
> To: Turbine Developers List
> Subject: Re: Intake problem
>
>
> It is a problem with the fact that intake treats an empty string as an

> unset value.  I'm not sure the implications of changing this behavior.
>
> john mcnally
>
> On Tue, 2002-12-03 at 13:37, Quinton McCombs wrote:
> > I have noticed a small problem with intake after migrating to T2.2 
> > RC2. It appears that I can not set a string field to null if it 
> > already had a value.  Here are a few snippets from my configuration 
> > files....
> >
> > intake.xml -
> >
> >     <group name="Person" key="per" mapToObject="Person">
> >
> >         <field name="FirstName" key="perfn" type="String">
> >             <rule name="maxlength" value="50">Maximum Length is 
> > 50</rule>
> >             <rule name="mask" value="^[a-zA-Z\s\-]+$">Alphabetic 
> > Value Required</rule>
> >         </field>
> >
> >     </group>
> >
> > schema.xml -
> >
> >     <table name="PERSON">
> >
> >         <column name="FIRST_NAME" size="20" type="VARCHAR"/>
> >
> >     </table>
> >
> >
> > My form is initially populated with data from the Person object.  
> > The field "FirstName" has a value.  I then delete the value from the

> > field and submit the form.
> >
> > After I get the intake tool and retreive the group, I look at the 
> > value of group.get("FirstName").getValue().  It is null.  I load my 
> > object
> > (person) from database to make modifications to it.  The value of
> > person.getFirstName() is "John".  All is well so far.
> >
> > This line of code executes to update my persistent object with data
from
> > the group:          group.setProperties(person);
> >
> > After this line of code executes, person.getFirstName() is "John".
> >
> > Other fields that were changed to non-null values were set properly 
> > during the execution of the method.
> >
> > After looking through the code a little, I found that
> > Field.setProperty(Object) will nto eexcute the setter method unless
> > Field.isSet() returns true.  Is this a defect or is there something 
> > that I need to change in the way I am using intake?
> >
>
>
>
> --
> To unsubscribe, e-mail: 
> <mailto:turbine-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:turbine-dev-help@jakarta.apache.org>


--
To unsubscribe, e-mail:
<mailto:turbine-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:turbine-dev-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:turbine-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:turbine-dev-help@jakarta.apache.org>


Mime
View raw message