Re: svn commit: r685836 - in /ofbiz/trunk/applications/order: script/org/ofbiz/order/request/CustRequestServices.xml servicedef/services_request.xml

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

Re: svn commit: r685836 - in /ofbiz/trunk/applications/order: script/org/ofbiz/order/request/CustRequestServices.xml servicedef/services_request.xml

Jacopo Cappellato-3
Hi Hans,

wouldn't be better (more readable code) to refactor the "if" condition  
using the <not> element?

Jacopo

On Aug 14, 2008, at 11:38 AM, [hidden email] wrote:

> Author: hansbak
> Date: Thu Aug 14 02:38:42 2008
> New Revision: 685836
>
> URL: http://svn.apache.org/viewvc?rev=685836&view=rev
> Log:
> when a custRequest is created, create also optionally the item  
> because often the texual customer request consists out of a single  
> item
>
> Modified:
>    ofbiz/trunk/applications/order/script/org/ofbiz/order/request/
> CustRequestServices.xml
>    ofbiz/trunk/applications/order/servicedef/services_request.xml
>
> Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/
> request/CustRequestServices.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml?rev=685836&r1=685835&r2=685836&view=diff
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- ofbiz/trunk/applications/order/script/org/ofbiz/order/request/
> CustRequestServices.xml (original)
> +++ ofbiz/trunk/applications/order/script/org/ofbiz/order/request/
> CustRequestServices.xml Thu Aug 14 02:38:42 2008
> @@ -83,6 +83,21 @@
>         <string-to-field string="REQ_REQUESTER" map-
> name="requesterMap" field-name="roleTypeId"/>
>         <call-service service-name="createCustRequestRole" in-map-
> name="requesterMap"/>
>         -->
> +
> +        <!-- create also the item if key fields are provided -->
> +        <if><condition><and>
> +            <if-empty field="parameters.productId"/>
> +            <if-empty field="parameters.reservStart"/>
> +            <if-empty field="parameters.story"/>
> +            <if-empty field="parameters.description"/>
> +        </and></condition>
> +        <then/>
> +            <else>
> +              <set-service-fields service-
> name="createCustRequestItem" map-name="parameters" to-map-
> name="createItem"/>
> +              <set field="createItem.custRequestId" from-
> field="newEntity.custRequestId"/>
> +              <call-service service-name="createCustRequestItem" in-
> map-name="createItem"/>
> +            </else>
> +        </if>
>     </simple-method>
>     <simple-method method-name="updateCustRequest" short-
> description="Update Customer Request">
>         <set from-field="parameters.custRequestId"  
> field="lookupPKMap.custRequestId"/>
>
> Modified: ofbiz/trunk/applications/order/servicedef/
> services_request.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services_request.xml?rev=685836&r1=685835&r2=685836&view=diff
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- ofbiz/trunk/applications/order/servicedef/services_request.xml  
> (original)
> +++ ofbiz/trunk/applications/order/servicedef/services_request.xml  
> Thu Aug 14 02:38:42 2008
> @@ -27,9 +27,10 @@
>     <!-- Customer Request Services -->
>     <service name="createCustRequest" engine="simple" default-entity-
> name="CustRequest"
>             location="org/ofbiz/order/request/
> CustRequestServices.xml" invoke="createCustRequest" auth="true">
> -        <description>Create a custRequest record</description>
> +        <description>Create a custRequest record and optionally  
> create a custRequest item.</description>
>         <auto-attributes include="nonpk" mode="IN" optional="true"/>
>         <auto-attributes include="pk" mode="INOUT" optional="true"/>
> +        <auto-attributes include="all" mode="IN" entity-
> name="CustRequestItem" optional="true"/>
>     </service>
>     <service name="updateCustRequest" engine="simple" default-entity-
> name="CustRequest"
>             location="org/ofbiz/order/request/
> CustRequestServices.xml" invoke="updateCustRequest" auth="true">
>
>


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r685836 - in /ofbiz/trunk/applications/order: script/org/ofbiz/order/request/CustRequestServices.xml servicedef/services_request.xml

Ashish Vijaywargiya
+1
--
Ashish Vijaywargiya
Indore (M.P), India
http://en.wikipedia.org/wiki/Indore



On Thu, Aug 14, 2008 at 3:29 PM, Jacopo Cappellato <
[hidden email]> wrote:

> Hi Hans,
>
> wouldn't be better (more readable code) to refactor the "if" condition
> using the <not> element?
>
> Jacopo
>
>
> On Aug 14, 2008, at 11:38 AM, [hidden email] wrote:
>
>  Author: hansbak
>> Date: Thu Aug 14 02:38:42 2008
>> New Revision: 685836
>>
>> URL: http://svn.apache.org/viewvc?rev=685836&view=rev
>> Log:
>> when a custRequest is created, create also optionally the item because
>> often the texual customer request consists out of a single item
>>
>> Modified:
>>
>> ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml
>>   ofbiz/trunk/applications/order/servicedef/services_request.xml
>>
>> Modified:
>> ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml?rev=685836&r1=685835&r2=685836&view=diff
>>
>> ==============================================================================
>> ---
>> ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml
>> (original)
>> +++
>> ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml
>> Thu Aug 14 02:38:42 2008
>> @@ -83,6 +83,21 @@
>>        <string-to-field string="REQ_REQUESTER" map-name="requesterMap"
>> field-name="roleTypeId"/>
>>        <call-service service-name="createCustRequestRole"
>> in-map-name="requesterMap"/>
>>        -->
>> +
>> +        <!-- create also the item if key fields are provided -->
>> +        <if><condition><and>
>> +            <if-empty field="parameters.productId"/>
>> +            <if-empty field="parameters.reservStart"/>
>> +            <if-empty field="parameters.story"/>
>> +            <if-empty field="parameters.description"/>
>> +        </and></condition>
>> +        <then/>
>> +            <else>
>> +              <set-service-fields service-name="createCustRequestItem"
>> map-name="parameters" to-map-name="createItem"/>
>> +              <set field="createItem.custRequestId"
>> from-field="newEntity.custRequestId"/>
>> +              <call-service service-name="createCustRequestItem"
>> in-map-name="createItem"/>
>> +            </else>
>> +        </if>
>>    </simple-method>
>>    <simple-method method-name="updateCustRequest"
>> short-description="Update Customer Request">
>>        <set from-field="parameters.custRequestId"
>> field="lookupPKMap.custRequestId"/>
>>
>> Modified: ofbiz/trunk/applications/order/servicedef/services_request.xml
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services_request.xml?rev=685836&r1=685835&r2=685836&view=diff
>>
>> ==============================================================================
>> --- ofbiz/trunk/applications/order/servicedef/services_request.xml
>> (original)
>> +++ ofbiz/trunk/applications/order/servicedef/services_request.xml Thu Aug
>> 14 02:38:42 2008
>> @@ -27,9 +27,10 @@
>>    <!-- Customer Request Services -->
>>    <service name="createCustRequest" engine="simple"
>> default-entity-name="CustRequest"
>>            location="org/ofbiz/order/request/CustRequestServices.xml"
>> invoke="createCustRequest" auth="true">
>> -        <description>Create a custRequest record</description>
>> +        <description>Create a custRequest record and optionally create a
>> custRequest item.</description>
>>        <auto-attributes include="nonpk" mode="IN" optional="true"/>
>>        <auto-attributes include="pk" mode="INOUT" optional="true"/>
>> +        <auto-attributes include="all" mode="IN"
>> entity-name="CustRequestItem" optional="true"/>
>>    </service>
>>    <service name="updateCustRequest" engine="simple"
>> default-entity-name="CustRequest"
>>            location="org/ofbiz/order/request/CustRequestServices.xml"
>> invoke="updateCustRequest" auth="true">
>>
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r685836 - in /ofbiz/trunk/applications/order: script/org/ofbiz/order/request/CustRequestServices.xml servicedef/services_request.xml

hans_bakker
In reply to this post by Jacopo Cappellato-3
(resend because of email problems)

sure Jacopo, i tried to save some typing but readability
suffered.....corrected in revision 686100.

On Thu, 2008-08-14 at 11:59 +0200, Jacopo Cappellato wrote:

> Hi Hans,
>
> wouldn't be better (more readable code) to refactor the "if" condition  
> using the <not> element?
>
> Jacopo
>
> On Aug 14, 2008, at 11:38 AM, [hidden email] wrote:
>
> > Author: hansbak
> > Date: Thu Aug 14 02:38:42 2008
> > New Revision: 685836
> >
> > URL: http://svn.apache.org/viewvc?rev=685836&view=rev
> > Log:
> > when a custRequest is created, create also optionally the item  
> > because often the texual customer request consists out of a single  
> > item
> >
> > Modified:
> >    ofbiz/trunk/applications/order/script/org/ofbiz/order/request/
> > CustRequestServices.xml
> >    ofbiz/trunk/applications/order/servicedef/services_request.xml
> >
> > Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/
> > request/CustRequestServices.xml
> > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml?rev=685836&r1=685835&r2=685836&view=diff
> > =
> > =
> > =
> > =
> > =
> > =
> > =
> > =
> > ======================================================================
> > --- ofbiz/trunk/applications/order/script/org/ofbiz/order/request/
> > CustRequestServices.xml (original)
> > +++ ofbiz/trunk/applications/order/script/org/ofbiz/order/request/
> > CustRequestServices.xml Thu Aug 14 02:38:42 2008
> > @@ -83,6 +83,21 @@
> >         <string-to-field string="REQ_REQUESTER" map-
> > name="requesterMap" field-name="roleTypeId"/>
> >         <call-service service-name="createCustRequestRole" in-map-
> > name="requesterMap"/>
> >         -->
> > +
> > +        <!-- create also the item if key fields are provided -->
> > +        <if><condition><and>
> > +            <if-empty field="parameters.productId"/>
> > +            <if-empty field="parameters.reservStart"/>
> > +            <if-empty field="parameters.story"/>
> > +            <if-empty field="parameters.description"/>
> > +        </and></condition>
> > +        <then/>
> > +            <else>
> > +              <set-service-fields service-
> > name="createCustRequestItem" map-name="parameters" to-map-
> > name="createItem"/>
> > +              <set field="createItem.custRequestId" from-
> > field="newEntity.custRequestId"/>
> > +              <call-service service-name="createCustRequestItem" in-
> > map-name="createItem"/>
> > +            </else>
> > +        </if>
> >     </simple-method>
> >     <simple-method method-name="updateCustRequest" short-
> > description="Update Customer Request">
> >         <set from-field="parameters.custRequestId"  
> > field="lookupPKMap.custRequestId"/>
> >
> > Modified: ofbiz/trunk/applications/order/servicedef/
> > services_request.xml
> > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services_request.xml?rev=685836&r1=685835&r2=685836&view=diff
> > =
> > =
> > =
> > =
> > =
> > =
> > =
> > =
> > ======================================================================
> > --- ofbiz/trunk/applications/order/servicedef/services_request.xml  
> > (original)
> > +++ ofbiz/trunk/applications/order/servicedef/services_request.xml  
> > Thu Aug 14 02:38:42 2008
> > @@ -27,9 +27,10 @@
> >     <!-- Customer Request Services -->
> >     <service name="createCustRequest" engine="simple" default-entity-
> > name="CustRequest"
> >             location="org/ofbiz/order/request/
> > CustRequestServices.xml" invoke="createCustRequest" auth="true">
> > -        <description>Create a custRequest record</description>
> > +        <description>Create a custRequest record and optionally  
> > create a custRequest item.</description>
> >         <auto-attributes include="nonpk" mode="IN" optional="true"/>
> >         <auto-attributes include="pk" mode="INOUT" optional="true"/>
> > +        <auto-attributes include="all" mode="IN" entity-
> > name="CustRequestItem" optional="true"/>
> >     </service>
> >     <service name="updateCustRequest" engine="simple" default-entity-
> > name="CustRequest"
> >             location="org/ofbiz/order/request/
> > CustRequestServices.xml" invoke="updateCustRequest" auth="true">
> >
> >
>