You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Deepa Priolkar <de...@TechMahindra.com> on 2010/10/13 16:02:33 UTC

Event Releted Question

Can we call multiple services one after another as part of controller request-map entry

    <request-map uri="createPracticePersonJavaEvent">

        <security https="false" auth="true"/>

        <event type="java" path="org.hotwax.mypractice.PracticeEvents" invoke="createPracticePersonJavaEvent"/>

       <event type="java" path="org.hotwax.mypractice.PracticeEvents" invoke="createPracticePersonJavaEvent1"/>

        <response name="success" type="view" value="CreatePracticePersonEventJ"/>

        <response name="error" type="view" value="CreatePracticePersonEventJ"/>

    </request-map>

The xsd allows this, but what should the first service return for the second event to be called.  And how will this work if the first event is of type “simple”

============================================================================================================================Disclaimer:  This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at <a href="http://www.techmahindra.com/Disclaimer.html">http://www.techmahindra.com/Disclaimer.html</a> externally and <a href="http://tim.techmahindra.com/Disclaimer.html">http://tim.techmahindra.com/Disclaimer.html</a> internally within Tech Mahindra.============================================================================================================================

Re: Event Releted Question

Posted by Scott Gray <sc...@hotwaxmedia.com>.
You have three options (that come to mind):
1.  You can chain request-maps together to call multiple events by using "request" typed response element.
2.  You can call a single service which in turn calls two services, basically a wrapper.
3.  You can use a service group which is essentially a shortcut for #2

You can find examples for 1 and 3 in the source code so I'm not going to explain them here unless you have specific questions.  (#2 doesn't really need explaining)

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 14/10/2010, at 3:02 AM, Deepa Priolkar wrote:

> 
> Can we call multiple services one after another as part of controller request-map entry
> 
>    <request-map uri="createPracticePersonJavaEvent">
> 
>        <security https="false" auth="true"/>
> 
>        <event type="java" path="org.hotwax.mypractice.PracticeEvents" invoke="createPracticePersonJavaEvent"/>
> 
>       <event type="java" path="org.hotwax.mypractice.PracticeEvents" invoke="createPracticePersonJavaEvent1"/>
> 
>        <response name="success" type="view" value="CreatePracticePersonEventJ"/>
> 
>        <response name="error" type="view" value="CreatePracticePersonEventJ"/>
> 
>    </request-map>
> 
> The xsd allows this, but what should the first service return for the second event to be called.  And how will this work if the first event is of type “simple”
> 
> ============================================================================================================================Disclaimer:  This message and the information contained herein is proprietary and confidential and subject to the Tech Mahindra policy statement, you may review the policy at <a href="http://www.techmahindra.com/Disclaimer.html">http://www.techmahindra.com/Disclaimer.html</a> externally and <a href="http://tim.techmahindra.com/Disclaimer.html">http://tim.techmahindra.com/Disclaimer.html</a> internally within Tech Mahindra.============================================================================================================================


Re: Some Scenario

Posted by Bilgin Ibryam <bi...@gmail.com>.
Some changes to your process inline

On Wed, Oct 13, 2010 at 4:35 PM, Deepa Priolkar <de...@techmahindra.com>wrote:

> I have a scenario which is to do the following
>
> The web browser will call the server via ajax.  At the server the system
> should produce a pdf file and store it in the file system.  Next make a
> database update and return some data back to web browser using json
>
> Below is the steps as per my understanding to do the same
>
> ·         Front end to call a controller entry for a particular request map
>
correct

>
> ·         Request map to call a service and do some things and then kick
> off the view map of type ‘screenfop’ to generate pdf.
>

You don't have to use view-map with screenfop type in order to generate. You
need that only if you want to return a pdf as response. Instead you should
use a service to generate the pdf and store it in a file.  As a reference
for pdf generation you can check the pdf printing functionality order
manager.


>
> ·         This screen fop is mapped to custom handler based on
> org.ofbiz.widget.screen.ScreenFopViewHandler which has code tweaked to store
> the pdf as file on hard disk and then call another request map entry in the
> controller.xml
>

No, No.

>
> ·         This request map to do the rest of things like update database
> row and then return data in json back to client
>

Just added another request map, which is called in case of success of
previous service (where u create save the pdf) and call the service to do DB
operations.

Return json instead of a screen and view-map


>
> Is there a better way to execute the above scenario
>
> Secondly from my customer ScreenFopViewHandler how do I call another
> request map entry in controller.xml.  Will it via RequestDispatcher?
>

You don't need that


HTH
Bilgin Ibryam

Some Scenario

Posted by Deepa Priolkar <de...@TechMahindra.com>.
I have a scenario which is to do the following

The web browser will call the server via ajax.  At the server the system should produce a pdf file and store it in the file system.  Next make a database update and return some data back to web browser using json

Below is the steps as per my understanding to do the same

·         Front end to call a controller entry for a particular request map

·         Request map to call a service and do some things and then kick off the view map of type ‘screenfop’ to generate pdf. 

·         This screen fop is mapped to custom handler based on org.ofbiz.widget.screen.ScreenFopViewHandler which has code tweaked to store the pdf as file on hard disk and then call another request map entry in the controller.xml

·         This request map to do the rest of things like update database row and then return data in json back to client

Is there a better way to execute the above scenario

Secondly from my customer ScreenFopViewHandler how do I call another request map entry in controller.xml.  Will it via RequestDispatcher?