You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by "Weaver, Scott" <Sw...@rippe.com> on 2002/02/15 18:39:16 UTC

[PATCH] o.a.t.services.intake.model.Field throwing npe

Greetings,

I have noticed o.a.t.services.intake.model.Field throws a null pointer
exception if one of the form fields in the intake group does not map into
the mapToObject specified.    

IMOHO, intake should allow for some fields, contained within groups that map
to specific class, to ignore fields that don't map into that class.

Below is my example.  I want to map MOST of the information into my
ProductImage object from the form. However, there is no need for me to put
the FileItem from the upload into my business object.  I still wanted to
keep the standardized naming that Intake offers without having to clutter up
my ProductImage class by creating bogus place holder methods setUploadFile()
and getUploadFile() for soul purpose of keeping Intake happy.


<!-- Product Image upload -->
<group key="imgupload" name="ImageUpload"
mapToObject="com.rippe.essential.agora.services.genericresource.ProductImage
">

<field key="imgid" name="ImageId" type="StringKey" mapToProperty="Id"/>

<field key="rid" name="RemoteId" type="StringKey"
mapToProperty="ResourceRemoteId">
<rule name="minLength" value="1">You must include the ID for object this
image is associated with</rule>
</field>

<!--This is just for upload purposes and should not be mapped into
ProductImage-->
<field key="fileitm" name="UploadFile" type="FileItem" />

<field key="imgname" name="ImageName" type="String" mapToProperty="Name">
<rule name="mask" value="\w+">Your image name can only contain number and/or
letters.</rule>
<rule name="minLength" value="1">Your Image Name must be at least 1
character long.</rule>
<required-message>You must provide an Image Name.</required-message>
</field>
<field key="imgtext" name="ImageText" type="String"
mapToProperty="ImageText">
<rule name="mask" value="\w+">Your image text can only contain number and/or
letters.</rule>
<rule name="minLength" value="1">Your Image text must be at least 1
character long.</rule>
<required-message>You must provide an Image text.</required-message>
</field>

<field key="isprimary" name="IsPrimary" type="boolean" defaultValue="false"
mapToProperty="Primary"/>

</group>

Thanks,
Scott


Re: [PATCH] o.a.t.services.intake.model.Field throwing npe

Posted by John McNally <jm...@collab.net>.
set mapToProperty="" on field key=fileitm.

john mcnally

> "Weaver, Scott" wrote:
> 
> Greetings,
> 
> I have noticed o.a.t.services.intake.model.Field throws a null pointer
> exception if one of the form fields in the intake group does not map
> into the mapToObject specified.
> 
> IMOHO, intake should allow for some fields, contained within groups
> that map to specific class, to ignore fields that don't map into that
> class.
> 
> Below is my example.  I want to map MOST of the information into my
> ProductImage object from the form. However, there is no need for me to
> put the FileItem from the upload into my business object.  I still
> wanted to keep the standardized naming that Intake offers without
> having to clutter up my ProductImage class by creating bogus place
> holder methods setUploadFile() and getUploadFile() for soul purpose of
> keeping Intake happy.
> 
> <!-- Product Image upload -->
> <group key="imgupload" name="ImageUpload"
> mapToObject="com.rippe.essential.agora.services.genericresource.ProductImage">
> 
> <field key="imgid" name="ImageId" type="StringKey"
> mapToProperty="Id"/>
> 
> <field key="rid" name="RemoteId" type="StringKey"
> mapToProperty="ResourceRemoteId">
> <rule name="minLength" value="1">You must include the ID for object
> this image is associated with</rule>
> </field>
> 
> <!--This is just for upload purposes and should not be mapped into
> ProductImage-->
> <field key="fileitm" name="UploadFile" type="FileItem" />
> 
> <field key="imgname" name="ImageName" type="String"
> mapToProperty="Name">
> <rule name="mask" value="\w+">Your image name can only contain number
> and/or letters.</rule>
> <rule name="minLength" value="1">Your Image Name must be at least 1
> character long.</rule>
> <required-message>You must provide an Image Name.</required-message>
> </field>
> <field key="imgtext" name="ImageText" type="String"
> mapToProperty="ImageText">
> <rule name="mask" value="\w+">Your image text can only contain number
> and/or letters.</rule>
> <rule name="minLength" value="1">Your Image text must be at least 1
> character long.</rule>
> <required-message>You must provide an Image text.</required-message>
> </field>
> 
> <field key="isprimary" name="IsPrimary" type="boolean"
> defaultValue="false" mapToProperty="Primary"/>
> 
> </group>
> 
> Thanks,
> Scott
> 
> 
> 
>    o.a.t.s.intake.model.Field-setProperty-throws-NPE.txtName: o.a.t.s.intake.model.Field-setProperty-throws-NPE.txt
>                                                         Type: Plain Text (text/plain)
> 
>     ---------------------------------------------------------------
> --
> 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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>