Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
how to pass information from portlet to a listener? Tanaji Londhe February 24, 2013 3:11 AM
RE: how to pass information from portlet to a listener? Rishi Dev Gupta February 24, 2013 3:24 AM
RE: how to pass information from portlet to a listener? Tanaji Londhe February 24, 2013 11:06 PM
RE: how to pass information from portlet to a listener? Siby Mathew February 25, 2013 2:05 AM
RE: how to pass information from portlet to a listener? Tanaji Londhe February 25, 2013 2:37 AM
RE: how to pass information from portlet to a listener? Tanaji Londhe February 25, 2013 4:47 AM
RE: how to pass information from portlet to a listener? Siby Mathew February 25, 2013 5:12 AM
RE: how to pass information from portlet to a listener? Tanaji Londhe February 25, 2013 6:41 AM
RE: how to pass information from portlet to a listener? Siby Mathew February 25, 2013 7:06 AM
RE: how to pass information from portlet to a listener? Tanaji Londhe February 25, 2013 7:10 AM
RE: how to pass information from portlet to a listener? Siby Mathew February 25, 2013 7:15 AM
RE: how to pass information from portlet to a listener? Tanaji Londhe February 25, 2013 7:26 AM
RE: how to pass information from portlet to a listener? Siby Mathew February 25, 2013 7:37 AM
RE: how to pass information from portlet to a listener? Tanaji Londhe February 25, 2013 7:42 AM
RE: how to pass information from portlet to a listener? David H Nebinger February 25, 2013 9:47 AM
RE: how to pass information from portlet to a listener? Vikas Kadam February 25, 2013 10:01 PM
RE: how to pass information from portlet to a listener? Tanaji Londhe February 26, 2013 10:39 PM
Tanaji Londhe
how to pass information from portlet to a listener?
February 24, 2013 3:11 AM
Answer

Tanaji Londhe

Rank: Regular Member

Posts: 196

Join Date: April 25, 2012

Recent Posts

Hi,
I am having one portlet, one Listener for organization and i am performing some operation adding, deleting in my custom table depending upon listener method.
I am adding any organization using liferay API in my portlet that time listener get call. So i want to pass some object from my portlet to that listener.
How can pass any object to listener or is there any way to get session object into a listener ?
Rishi Dev Gupta
RE: how to pass information from portlet to a listener?
February 24, 2013 3:24 AM
Answer

Rishi Dev Gupta

Rank: Expert

Posts: 255

Join Date: November 23, 2008

Recent Posts

You can pass the primary key of the object in hte message bus and in the listener fetch the object for same and do the processsing.
Tanaji Londhe
RE: how to pass information from portlet to a listener?
February 24, 2013 11:06 PM
Answer

Tanaji Londhe

Rank: Regular Member

Posts: 196

Join Date: April 25, 2012

Recent Posts

Hi Rishi,
u mean i can pass that whole object using message bus and in listener of a org will implement that MessageListener and receive that object. is it correct?
But Message Bus is used to exchange the information (only String message) between liferay and web applications. Is it right way to use message bus here or is there any other way?
Here i my case i am having one listener for organization like
//this is my portlet
public class EmployeeManagementPortlet extends MVCPortlet {
addEmployee(Employee emp ) {
OrganizationLocalServiceUtil.addOrganization(...)
}
}
//Listener for organization
public class CustomOrganizationListener extends BaseModelListener<Organization>{
@Override
public void onAfterCreate(AssetEntry model) throws ModelListenerException {
// here i want that emp object when i perform some operation in portlet action like OrganizationLocalServiceUtil.addOrganization(...) then this listener get called.
addEmployee(emp)
}
}

here how do i get emp object in above listener?
Siby Mathew
RE: how to pass information from portlet to a listener?
February 25, 2013 2:05 AM
Answer

Siby Mathew

Rank: Expert

Posts: 268

Join Date: March 4, 2011

Recent Posts

Hi Tanaji,
Is there any reason why you are using a ModelListener for this ?
Why are you not doing this operation inside your portlet?

Thanks,
Siby
Tanaji Londhe
RE: how to pass information from portlet to a listener?
February 25, 2013 2:37 AM
Answer

Tanaji Londhe

Rank: Regular Member

Posts: 196

Join Date: April 25, 2012

Recent Posts

Hi Siby,
Becuase i am perform some other operation like addEmployee... into my custom table, when i add any organization or user in liferay. thats why i am using this listener for organization.
Thanks for reply.
Tanaji Londhe
RE: how to pass information from portlet to a listener?
February 25, 2013 4:47 AM
Answer

Tanaji Londhe

Rank: Regular Member

Posts: 196

Join Date: April 25, 2012

Recent Posts

Can anybody tell me how can acheive this thing?

Thanks & regards,
Tanaji
Siby Mathew
RE: how to pass information from portlet to a listener?
February 25, 2013 5:12 AM
Answer

Siby Mathew

Rank: Expert

Posts: 268

Join Date: March 4, 2011

Recent Posts

Hi Tanaji,
So you mean whenever an organization is created, you want some user to be added to your custom table.
You are saying you cannot write this logic inside your portlet's addEmployee(Employee emp ) method because this creation might happen from other places outside the portlet.
Am i right ?

Question : In case the organization is created via control panel, what employee details are you planning to store in your custom table ? (The current logged-in user ?)

Thanks,
Siby
Tanaji Londhe
RE: how to pass information from portlet to a listener?
February 25, 2013 6:41 AM
Answer

Tanaji Londhe

Rank: Regular Member

Posts: 196

Join Date: April 25, 2012

Recent Posts

Hi Siby,
Thanks for reply. Yeah u r right.
But I am not adding any organization from control panel, here i am using custom UI for it and it will also add in liferay table using liferay API.
Siby Mathew
RE: how to pass information from portlet to a listener?
February 25, 2013 7:06 AM
Answer

Siby Mathew

Rank: Expert

Posts: 268

Join Date: March 4, 2011

Recent Posts

Hi Tanaji,
If you are adding organization only with your custom UI, then you can do it without the ModelListener itself.
You can just write your logic after addOrganization is invoked.

Thanks,
Siby
Tanaji Londhe
RE: how to pass information from portlet to a listener?
February 25, 2013 7:10 AM
Answer

Tanaji Londhe

Rank: Regular Member

Posts: 196

Join Date: April 25, 2012

Recent Posts

Hi Siby,
No. Its requirement to add it in listener only. thats why adding in listener.
Siby Mathew
RE: how to pass information from portlet to a listener?
February 25, 2013 7:15 AM
Answer

Siby Mathew

Rank: Expert

Posts: 268

Join Date: March 4, 2011

Recent Posts

Hi Tanaji,
My point is, if you use a model Listener, it will get invoked even if an Organization is created inside the control panel.
Its not something specific to your custom portlet.
In that case, where it doesnt have any relationship between this employee object, what will you store ?
Tanaji Londhe
RE: how to pass information from portlet to a listener?
February 25, 2013 7:26 AM
Answer

Tanaji Londhe

Rank: Regular Member

Posts: 196

Join Date: April 25, 2012

Recent Posts

Hi Siby,
when i add emloyee using my custom code (actually emp is not added in custom table till now ) some portlet action (like addEmpoyeeAction(.....) ) is get called then listener is called. Listener having actually emp addition code. In listener i want that emp object which is present in portlet action method like
//Portlet action mtd
addEmpoyeeAction(ActionRequest actionRequest, ActionResponse actionResponse ) {
emp = actionRequest.getParamter("employee");
// emp object i want to pass to the listener.
.............
}
Siby Mathew
RE: how to pass information from portlet to a listener?
February 25, 2013 7:37 AM
Answer

Siby Mathew

Rank: Expert

Posts: 268

Join Date: March 4, 2011

Recent Posts

Hi Tanaji,
You are not getting my point. If you are creating a model listener it will be invoked by any component using the Liferay Organization API.
If you want this functionality to be present only in addEmployeeAction(), then you should write this logic only inside this method, not in a model listener.

Thanks,
Siby
Tanaji Londhe
RE: how to pass information from portlet to a listener?
February 25, 2013 7:42 AM
Answer

Tanaji Londhe

Rank: Regular Member

Posts: 196

Join Date: April 25, 2012

Recent Posts

Hi Siby,
Yeah i am getting your point but Its client requirement to add this addEmp code is only within listener.
David H Nebinger
RE: how to pass information from portlet to a listener?
February 25, 2013 9:47 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 12529

Join Date: September 1, 2006

Recent Posts

Tanaji M. Londhe:
Yeah i am getting your point but Its client requirement to add this addEmp code is only within listener.


I have a requirement that my Liferay should generate a nice soft serve ice cream cone every time a new user registers for the site, but the flavor must be whatever the administrator currently thinking about at the time of registration.

What? It can't be done? But I have this requirement! How do I satisfy a requirement that cannot be done?
Vikas Kadam
RE: how to pass information from portlet to a listener?
February 25, 2013 10:01 PM
Answer

Vikas Kadam

Rank: New Member

Posts: 22

Join Date: June 15, 2011

Recent Posts

Hi Tanaji,
Look for expando, this might alleviate you;
http://www.liferay.com/web/juan.fernandez/blog/-/blogs/sample-expando-hook

Kind regards,
Vikas
Tanaji Londhe
RE: how to pass information from portlet to a listener?
February 26, 2013 10:39 PM
Answer

Tanaji Londhe

Rank: Regular Member

Posts: 196

Join Date: April 25, 2012

Recent Posts

Hi Vikas,
Thanks. I have done this using Expando concept. emoticon