<auto-attributes> tag in services.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

<auto-attributes> tag in services.xml

sqlien
hi,

Can anyone tell me what mean these two lines in services.xml files

<auto-attributes mode="IN" include="pk" optional="false"/>
<auto-attributes mode="IN" include="nonpk" optional="true"/>

why we use them ?

thanks
Reply | Threaded
Open this post in threaded view
|

Re: <auto-attributes> tag in services.xml

Amine AZZI
it's a shortcut, instead of declaring each attribute apart, you can use this
tag to generate all attributes with default values taken from the entity
model definition of the used entity.
Of course, you can override this declaration by declaring an existing
attribute.

Regards.
Amine.

2007/10/3, sqlien <[hidden email]>:

>
>
> hi,
>
> Can anyone tell me what mean these two lines in services.xml files
>
> <auto-attributes mode="IN" include="pk" optional="false"/>
> <auto-attributes mode="IN" include="nonpk" optional="true"/>
>
> why we use them ?
>
> thanks
> --
> View this message in context:
> http://www.nabble.com/%3Cauto-attributes%3E-tag-in-services.xml-tf4560287.html#a13014245
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: <auto-attributes> tag in services.xml

jonwimp
Not sure if <attribute> overrides an <auto-attributes>. There's <override>.

In <auto-attributes>, there's also <exclude>, so you can selectively exclude some attributes in
the entity specified in <auto-attributes entity-name="SomeEntity">.

Usually, you'll use <override> to override the "optional" attribute of an attribute. For eg,

   <auto-attributes entity-name="SomeEntity" include="pk" optional="false"/>
   <override name="somePkInSomeEntity" optional="true"/>

I skipped several attributes in the above eg.

Jonathon

Amine AZZI wrote:

> it's a shortcut, instead of declaring each attribute apart, you can use this
> tag to generate all attributes with default values taken from the entity
> model definition of the used entity.
> Of course, you can override this declaration by declaring an existing
> attribute.
>
> Regards.
> Amine.
>
> 2007/10/3, sqlien <[hidden email]>:
>>
>> hi,
>>
>> Can anyone tell me what mean these two lines in services.xml files
>>
>> <auto-attributes mode="IN" include="pk" optional="false"/>
>> <auto-attributes mode="IN" include="nonpk" optional="true"/>
>>
>> why we use them ?
>>
>> thanks
>> --
>> View this message in context:
>> http://www.nabble.com/%3Cauto-attributes%3E-tag-in-services.xml-tf4560287.html#a13014245
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>>
>
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.488 / Virus Database: 269.13.39/1045 - Release Date: 10/2/2007 6:43 PM

Reply | Threaded
Open this post in threaded view
|

Re: <auto-attributes> tag in services.xml

sqlien
Thank you for your replies.
other question : why we distinguishe these two attributes include="nonpk" and  include="pk"; in the implementation of a service i never found this distinction when manipulating IN parameters.
jonwimp wrote
Not sure if <attribute> overrides an <auto-attributes>. There's <override>.

In <auto-attributes>, there's also <exclude>, so you can selectively exclude some attributes in
the entity specified in <auto-attributes entity-name="SomeEntity">.

Usually, you'll use <override> to override the "optional" attribute of an attribute. For eg,

   <auto-attributes entity-name="SomeEntity" include="pk" optional="false"/>
   <override name="somePkInSomeEntity" optional="true"/>

I skipped several attributes in the above eg.

Jonathon

Amine AZZI wrote:
> it's a shortcut, instead of declaring each attribute apart, you can use this
> tag to generate all attributes with default values taken from the entity
> model definition of the used entity.
> Of course, you can override this declaration by declaring an existing
> attribute.
>
> Regards.
> Amine.
>
> 2007/10/3, sqlien <smailinfo_dz@yahoo.fr>:
>>
>> hi,
>>
>> Can anyone tell me what mean these two lines in services.xml files
>>
>> <auto-attributes mode="IN" include="pk" optional="false"/>
>> <auto-attributes mode="IN" include="nonpk" optional="true"/>
>>
>> why we use them ?
>>
>> thanks
>> --
>> View this message in context:
>> http://www.nabble.com/%3Cauto-attributes%3E-tag-in-services.xml-tf4560287.html#a13014245
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>>
>
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.488 / Virus Database: 269.13.39/1045 - Release Date: 10/2/2007 6:43 PM
Reply | Threaded
Open this post in threaded view
|

Re: <auto-attributes> tag in services.xml

jonwimp
Sometimes, when you need only the reference to an existing record, you will want service callers
to pass in PK (primary key) fields. PK fields are combined to form the "key" to look up a
particular record. Non-PK fields form the "data" for the record.

Other times, when you need to update an existing record or to create a new record, you will
obviously need more than PK fields. You'll need non-PK fields.

Jonathon

sqlien wrote:

> Thank you for your replies.
> other question : why we distinguishe these two attributes include="nonpk"
> and  include="pk"; in the implementation of a service i never found this
> distinction when manipulating IN parameters.
>
> jonwimp wrote:
>> Not sure if <attribute> overrides an <auto-attributes>. There's
>> <override>.
>>
>> In <auto-attributes>, there's also <exclude>, so you can selectively
>> exclude some attributes in
>> the entity specified in <auto-attributes entity-name="SomeEntity">.
>>
>> Usually, you'll use <override> to override the "optional" attribute of an
>> attribute. For eg,
>>
>>    <auto-attributes entity-name="SomeEntity" include="pk"
>> optional="false"/>
>>    <override name="somePkInSomeEntity" optional="true"/>
>>
>> I skipped several attributes in the above eg.
>>
>> Jonathon
>>
>> Amine AZZI wrote:
>>> it's a shortcut, instead of declaring each attribute apart, you can use
>>> this
>>> tag to generate all attributes with default values taken from the entity
>>> model definition of the used entity.
>>> Of course, you can override this declaration by declaring an existing
>>> attribute.
>>>
>>> Regards.
>>> Amine.
>>>
>>> 2007/10/3, sqlien <[hidden email]>:
>>>> hi,
>>>>
>>>> Can anyone tell me what mean these two lines in services.xml files
>>>>
>>>> <auto-attributes mode="IN" include="pk" optional="false"/>
>>>> <auto-attributes mode="IN" include="nonpk" optional="true"/>
>>>>
>>>> why we use them ?
>>>>
>>>> thanks
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/%3Cauto-attributes%3E-tag-in-services.xml-tf4560287.html#a13014245
>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> No virus found in this incoming message.
>>> Checked by AVG Free Edition.
>>> Version: 7.5.488 / Virus Database: 269.13.39/1045 - Release Date:
>>> 10/2/2007 6:43 PM
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: <auto-attributes> tag in services.xml

sqlien
In reply to this post by sqlien
if I make <auto-attributes mode="IN"  optional="false"/> without  include="pk" / include="nonpk", pk and non pk fields are implicitly passed IN or not ?

sqlien wrote
hi,

Can anyone tell me what mean these two lines in services.xml files

<auto-attributes mode="IN" include="pk" optional="false"/>
<auto-attributes mode="IN" include="nonpk" optional="true"/>

why we use them ?

thanks
Reply | Threaded
Open this post in threaded view
|

Re: <auto-attributes> tag in services.xml

jonwimp
I think the default is inclue="all". Which means, pk and nonpk fields are included.

Jonathon

sqlien wrote:

> if I make <auto-attributes mode="IN"  optional="false"/> without
> include="pk" / include="nonpk", pk and non pk fields are implicitly passed
> IN or not ?
>
>
> sqlien wrote:
>> hi,
>>
>> Can anyone tell me what mean these two lines in services.xml files
>>
>> <auto-attributes mode="IN" include="pk" optional="false"/>
>> <auto-attributes mode="IN" include="nonpk" optional="true"/>
>>
>> why we use them ?
>>
>> thanks
>>
>