[OFBiz] Dev - How to put a new map into session?

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

[OFBiz] Dev - How to put a new map into session?

Bugzilla from elliot.li@gmail.com
Hello,

We all knew that the current user login infomation could be retrieved
through 'userLogin' in a service written in simple method or a form.
Now I want to put some addition information, such as fields of
employee, into session to make it available to all requests, just like
the 'userLogin'.

I've created a new service like this:
    <simple-method method-name="getCurrentEmployeeInfo"
short-description="Get employee infomation">
        <!-- Locate current user in Employee, and store it to
CurrentEmployee -->
        <field-to-field field-name="partyId" map-name="userLogin"
to-map-name="findPKMap"/>
        <find-by-primary-key entity-name="Employee"
map-name="findPKMap" value-name="CurrentEmployee"/>
        <check-errors/>

        <field-to-session field-name="CurrentEmployee"/>
        <check-errors/>
    </simple-method>

The servicedef is:
    <service name="getCurrentEmployeeInfo" engine="simple"
        location="org/ofbiz/common/CommonServices.xml"
invoke="getCurrentEmployeeInfo" auth="false">
        <description>Get current user's employee info, save to
session.</description>
    </service>

And I put it into controller.xml like this:
    <after-login>
        <event type="service" path="" invoke="getCurrentEmployeeInfo" />
    </after-login>

But this didn't work as I expected, I can't display a field in a form
like this ${CurrentEmployee.salary}. The result is empty.

What's wrong? Thanks in advance!

--
Best regards,
Yan
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: [OFBiz] Dev - How to put a new map into session?

David E. Jones

You should read through the MiniLang Guide on the Docs & Books page  
of the ofbiz.org site, especially the sections on calling a simple-
method as a service and calling it as an event.

-David


On Aug 1, 2005, at 1:59 AM, Yan Li wrote:

> Hello,
>
> We all knew that the current user login infomation could be retrieved
> through 'userLogin' in a service written in simple method or a form.
> Now I want to put some addition information, such as fields of
> employee, into session to make it available to all requests, just like
> the 'userLogin'.
>
> I've created a new service like this:
>     <simple-method method-name="getCurrentEmployeeInfo"
> short-description="Get employee infomation">
>         <!-- Locate current user in Employee, and store it to
> CurrentEmployee -->
>         <field-to-field field-name="partyId" map-name="userLogin"
> to-map-name="findPKMap"/>
>         <find-by-primary-key entity-name="Employee"
> map-name="findPKMap" value-name="CurrentEmployee"/>
>         <check-errors/>
>
>         <field-to-session field-name="CurrentEmployee"/>
>         <check-errors/>
>     </simple-method>
>
> The servicedef is:
>     <service name="getCurrentEmployeeInfo" engine="simple"
>         location="org/ofbiz/common/CommonServices.xml"
> invoke="getCurrentEmployeeInfo" auth="false">
>         <description>Get current user's employee info, save to
> session.</description>
>     </service>
>
> And I put it into controller.xml like this:
>     <after-login>
>         <event type="service" path=""  
> invoke="getCurrentEmployeeInfo" />
>     </after-login>
>
> But this didn't work as I expected, I can't display a field in a form
> like this ${CurrentEmployee.salary}. The result is empty.
>
> What's wrong? Thanks in advance!
>
> --
> Best regards,
> Yan
>
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
>

 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev

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

RE: [OFBiz] Dev - How to put a new map into session?

Bugzilla from elliot.li@gmail.com
Hello,

OK, Thank you very much!

Best Wishes,
___________________
Li, Yan
[hidden email]

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of David E. Jones
> Sent: Monday, August 01, 2005 5:13 PM
> To: OFBiz Project Development Discussion
> Subject: Re: [OFBiz] Dev - How to put a new map into session?
>
>
> You should read through the MiniLang Guide on the Docs &
> Books page of the ofbiz.org site, especially the sections on
> calling a simple- method as a service and calling it as an event.
>
> -David
>
>
> On Aug 1, 2005, at 1:59 AM, Yan Li wrote:
>
> > Hello,
> >
> > We all knew that the current user login infomation could be
> retrieved
> > through 'userLogin' in a service written in simple method or a form.
> > Now I want to put some addition information, such as fields of
> > employee, into session to make it available to all
> requests, just like
> > the 'userLogin'.
> >
> > I've created a new service like this:
> >     <simple-method method-name="getCurrentEmployeeInfo"
> > short-description="Get employee infomation">
> >         <!-- Locate current user in Employee, and store it to
> > CurrentEmployee -->
> >         <field-to-field field-name="partyId" map-name="userLogin"
> > to-map-name="findPKMap"/>
> >         <find-by-primary-key entity-name="Employee"
> > map-name="findPKMap" value-name="CurrentEmployee"/>
> >         <check-errors/>
> >
> >         <field-to-session field-name="CurrentEmployee"/>
> >         <check-errors/>
> >     </simple-method>
> >
> > The servicedef is:
> >     <service name="getCurrentEmployeeInfo" engine="simple"
> >         location="org/ofbiz/common/CommonServices.xml"
> > invoke="getCurrentEmployeeInfo" auth="false">
> >         <description>Get current user's employee info, save to
> > session.</description>
> >     </service>
> >
> > And I put it into controller.xml like this:
> >     <after-login>
> >         <event type="service" path=""  
> > invoke="getCurrentEmployeeInfo" />
> >     </after-login>
> >
> > But this didn't work as I expected, I can't display a field
> in a form
> > like this ${CurrentEmployee.salary}. The result is empty.
> >
> > What's wrong? Thanks in advance!
> >
> > --
> > Best regards,
> > Yan
> >
> > _______________________________________________
> > Dev mailing list
> > [hidden email]
> > http://lists.ofbiz.org/mailman/listinfo/dev
> >
>
>

 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev