Author: sviluppatorefico
Date: 2008-05-18 07:03:33 -0400 (Sun, 18 May 2008)
New Revision: 10775
Modified:
branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/CurrentUsersPortlet.java
Log:
now we can to see all connected users and guests
Modified:
branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/CurrentUsersPortlet.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/CurrentUsersPortlet.java 2008-05-18
11:02:55 UTC (rev 10774)
+++
branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/users/CurrentUsersPortlet.java 2008-05-18
11:03:33 UTC (rev 10775)
@@ -56,24 +56,31 @@
rResponse.setContentType("text/html");
PrintWriter writer = rResponse.getWriter();
+
+ long currentTime = System.currentTimeMillis();
//TODO: this is wrong - should pass period instead of current time - actually it
works by a coincedence...
- Set users = uass.getActiveUsersNames(System.currentTimeMillis());
+ Set users = uass.getActiveUsersNames(currentTime);
+
+ int sessionCount = uass.getActiveSessionCount(currentTime);
+
+ int allLoggedSessions = uass.getUsersActivities(currentTime).size();
- if (users.size() == 1)
+ if (sessionCount == 1)
{
DelegateContext ctx = new DelegateContext();
ctx.put("USERS", users.toString());
- ctx.put("USERS_COUNT", Integer.toString(users.size()));
+ ctx.put("USERS_COUNT", Integer.toString(sessionCount));
rRequest.setAttribute(PortalJsp.CTX_REQUEST, ctx);
PortletRequestDispatcher rd =
getPortletContext().getRequestDispatcher("/WEB-INF/jsp/users/oneUser.jsp");
rd.include(rRequest, rResponse);
}
- else if (users.size() > 1)
+ else if (sessionCount > 1)
{
DelegateContext ctx = new DelegateContext();
ctx.put("USERS", users.toString());
- ctx.put("USERS_COUNT", Integer.toString(users.size()));
+ ctx.put("USERS_COUNT", Integer.toString(sessionCount));
+ ctx.put("USERS_LOGGED_COUNT", Integer.toString(users.size()));
rRequest.setAttribute(PortalJsp.CTX_REQUEST, ctx);
PortletRequestDispatcher rd =
getPortletContext().getRequestDispatcher("/WEB-INF/jsp/users/users.jsp");
rd.include(rRequest, rResponse);
Show replies by date