Foros de discusión

Live Users in a personnal portlet

Lambert Mickael, modificado hace 11 años.

Live Users in a personnal portlet

Junior Member Mensajes: 58 Fecha de incorporación: 29/12/11 Mensajes recientes
Hello everyone,

I have a problem, i want to display a list of connected Users in a portlet that i have developped, but i don't know how.

I know that i have to enable two properties in my portal-ext.properties : live.users.enabled and another.

I already did this. My situation is that i want to display this list not in monitoring in the control panel but in the body of my portlet.

Can someone please help me ?
thumbnail
Gnaniyar Zubair, modificado hace 11 años.

RE: Live Users in a personnal portlet

Liferay Master Mensajes: 722 Fecha de incorporación: 19/12/07 Mensajes recientes
After setting this property :
live.users.enabled=true


You can access like this

LiveUsers. getSessionUsers(companyId)
Lambert Mickael, modificado hace 11 años.

RE: Live Users in a personnal portlet

Junior Member Mensajes: 58 Fecha de incorporación: 29/12/11 Mensajes recientes
Gnaniyar Zubair:
After setting this property :
live.users.enabled=true


You can access like this

LiveUsers. getSessionUsers(companyId)


Unfortunately, i think this class is only in portal-impl.jar and not in portal-service.jar, so i can't access ...
thumbnail
Gnaniyar Zubair, modificado hace 11 años.

RE: Live Users in a personnal portlet

Liferay Master Mensajes: 722 Fecha de incorporación: 19/12/07 Mensajes recientes
Yes you are right. Just i verified now. In chat portlet they are getting live users through
StatusLocalServiceUtil
.

Please check the code from chat portlet. You might get some clarity.
Lambert Mickael, modificado hace 11 años.

RE: Live Users in a personnal portlet

Junior Member Mensajes: 58 Fecha de incorporación: 29/12/11 Mensajes recientes
Gnaniyar Zubair:
Yes you are right. Just i verified now. In chat portlet they are getting live users through
StatusLocalServiceUtil
.

Please check the code from chat portlet. You might get some clarity.



I try this, i'll tell you if it works or not. Thanks for your quick answers
Lambert Mickael, modificado hace 11 años.

RE: Live Users in a personnal portlet

Junior Member Mensajes: 58 Fecha de incorporación: 29/12/11 Mensajes recientes
Lambert Mickael:
Gnaniyar Zubair:
Yes you are right. Just i verified now. In chat portlet they are getting live users through
StatusLocalServiceUtil
.

Please check the code from chat portlet. You might get some clarity.



I try this, i'll tell you if it works or not. Thanks for your quick answers


I did this :


List<object[]> buddies = null;
     
     long buddiesModifiedDate = System.currentTimeMillis() - Time.MINUTE;
     
     ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
     
     buddies = StatusLocalServiceUtil.getAllStatuses(themeDisplay.getCompanyId(), themeDisplay.getUserId(), buddiesModifiedDate, 0, SearchContainer.DEFAULT_DELTA);
     
     out.println("Online visiting Users ="+ buddies.size());</object[]>


I import these 3 classes : <%@ page import="com.liferay.chat.service.StatusLocalServiceUtil" %>
<%@ page import="com.liferay.portal.kernel.util.Time" %>
<%@ page import="com.liferay.portal.kernel.dao.search.SearchContainer" %>

There are 5 parameters for the fonction getAllStatuses with the new Liferay (6.1.1)

And it tells me this :

"org.apache.jasper.JasperException : An exception occured processing JSP page 'mypage' at line 24"

The line 24 is this line :

buddies = StatusLocalServiceUtil.getAllStatuses(themeDisplay.getCompanyId(), themeDisplay.getUserId(), buddiesModifiedDate, 0, SearchContainer.DEFAULT_DELTA);
thumbnail
Gnaniyar Zubair, modificado hace 11 años.

RE: Live Users in a personnal portlet

Liferay Master Mensajes: 722 Fecha de incorporación: 19/12/07 Mensajes recientes
How did you get the StatusLcoalServiceUtil which is there in Chat plugin..?
Lambert Mickael, modificado hace 11 años.

RE: Live Users in a personnal portlet

Junior Member Mensajes: 58 Fecha de incorporación: 29/12/11 Mensajes recientes
I searched in the forum and found this way to do that.

But it's really weird that there is no way to get all the users online!
Lambert Mickael, modificado hace 11 años.

RE: Live Users in a personnal portlet

Junior Member Mensajes: 58 Fecha de incorporación: 29/12/11 Mensajes recientes
Gnaniyar Zubair:
How did you get the StatusLcoalServiceUtil which is there in Chat plugin..?


So, can you help me ? :s

I'm sorry, but i'm really looking for a solution... I don't understand why there is this stacktrace ...
thumbnail
Gnaniyar Zubair, modificado hace 11 años.

RE: Live Users in a personnal portlet

Liferay Master Mensajes: 722 Fecha de incorporación: 19/12/07 Mensajes recientes
Sure will look into that. Have a look here . they have counted the users manually by extending LoginPostAction thorugh HOOK.

http://www.liferay.com/community/forums/-/message_boards/message/1885734

But I am not sure that this is a best approach.