Calling simple method from another component

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

Calling simple method from another component

aray
Hi,

I am trying to extend PartyMgr application to cover a few additional types of uses besides Employee, Customer types, for example 'Viewer'. As just have created a new component called 'myapp' under hot-deploy folder and have been able to get the forms showing. The form submit now goes through request mapping fine in controller.xml (under myapp). See snippet below

    <request-map uri="createViewer">
        <security https="true" auth="true"/>
        <event type="simple" path="component://viewer/script/org/ofbiz/party/user/UserEvents.xml" invoke="createViewer"/>
        <response name="success" type="request-redirect" value="viewprofile"/>
        <response name="error" type="view" value="NewViewer"/>
    </request-map>

"createViewer" code is on the lines similar to "createEmployee" that is available in UserEvents.xml under party component.

The trouble is createViewer method in turn needs to call
   <call-simple-method method-name="createUser"/>

createUser method is still under Party application and I looking to see if I can avoid duplicating the code and directly point to the orginal createUser method. Tried setting up a servicedef with the full package name like below but no luck.

    <service name="createUser" engine="simple" default-entity-name="Person"
            location="org.ofbiz.party.party.PartyServices" invoke="createUser" auth="false">

Any pointers to what I may be missing?

Thanks
Aray
Reply | Threaded
Open this post in threaded view
|

Re: Calling simple method from another component

Mridul Pathak-2
Following code will serve your purpose:


<call-simple-method method-name="createUser" xml-resource=
"component://party/script/org/ofbiz/party/user/UserEvents.xml"/>

--
Thanks & Regards
Mridul Pathak
Hotwax Media
http://www.hotwaxmedia.com
[hidden email]
-------------------------------------------------
direct: +91 - 942.592.6892


On Sat, Oct 3, 2009 at 3:26 PM, ARays <[hidden email]> wrote:

>
> Hi,
>
> I am trying to extend PartyMgr application to cover a few additional types
> of uses besides Employee, Customer types, for example 'Viewer'. As just
> have
> created a new component called 'myapp' under hot-deploy folder and have
> been
> able to get the forms showing. The form submit now goes through request
> mapping fine in controller.xml (under myapp). See snippet below
>
>    <request-map uri="createViewer">
>        <security https="true" auth="true"/>
>        <event type="simple"
> path="component://viewer/script/org/ofbiz/party/user/UserEvents.xml"
> invoke="createViewer"/>
>        <response name="success" type="request-redirect"
> value="viewprofile"/>
>        <response name="error" type="view" value="NewViewer"/>
>    </request-map>
>
> "createViewer" code is on the lines similar to "createEmployee" that is
> available in UserEvents.xml under party component.
>
> The trouble is createViewer method in turn needs to call
>   <call-simple-method method-name="createUser"/>
>
> createUser method is still under Party application and I looking to see if
> I
> can avoid duplicating the code and directly point to the orginal createUser
> method. Tried setting up a servicedef with the full package name like below
> but no luck.
>
>    <service name="createUser" engine="simple" default-entity-name="Person"
>            location="org.ofbiz.party.party.PartyServices"
> invoke="createUser" auth="false">
>
> Any pointers to what I may be missing?
>
> Thanks
> Aray
> --
> View this message in context:
> http://www.nabble.com/Calling-simple-method-from-another-component-tp25727271p25727271.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Calling simple method from another component

aray
ah! amazing..

Many thanks.
Arays


Mridul Pathak-2 wrote
Following code will serve your purpose:


<call-simple-method method-name="createUser" xml-resource=
"component://party/script/org/ofbiz/party/user/UserEvents.xml"/>

--
Thanks & Regards
Mridul Pathak
Hotwax Media
http://www.hotwaxmedia.com
mridul.pathak@hotwaxmedia.com
-------------------------------------------------
direct: +91 - 942.592.6892


On Sat, Oct 3, 2009 at 3:26 PM, ARays <aray@kenfuse.com> wrote:

>
> Hi,
>
> I am trying to extend PartyMgr application to cover a few additional types
> of uses besides Employee, Customer types, for example 'Viewer'. As just
> have
> created a new component called 'myapp' under hot-deploy folder and have
> been
> able to get the forms showing. The form submit now goes through request
> mapping fine in controller.xml (under myapp). See snippet below
>
>    <request-map uri="createViewer">
>        <security https="true" auth="true"/>
>        <event type="simple"
> path="component://viewer/script/org/ofbiz/party/user/UserEvents.xml"
> invoke="createViewer"/>
>        <response name="success" type="request-redirect"
> value="viewprofile"/>
>        <response name="error" type="view" value="NewViewer"/>
>    </request-map>
>
> "createViewer" code is on the lines similar to "createEmployee" that is
> available in UserEvents.xml under party component.
>
> The trouble is createViewer method in turn needs to call
>   <call-simple-method method-name="createUser"/>
>
> createUser method is still under Party application and I looking to see if
> I
> can avoid duplicating the code and directly point to the orginal createUser
> method. Tried setting up a servicedef with the full package name like below
> but no luck.
>
>    <service name="createUser" engine="simple" default-entity-name="Person"
>            location="org.ofbiz.party.party.PartyServices"
> invoke="createUser" auth="false">
>
> Any pointers to what I may be missing?
>
> Thanks
> Aray
> --
> View this message in context:
> http://www.nabble.com/Calling-simple-method-from-another-component-tp25727271p25727271.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>