use of org.olat.restapi.system.vo.UserStatisticsVO in project OpenOLAT by OpenOLAT.
the class SystemTest method testSystemUserStatistics.
@Test
public void testSystemUserStatistics() throws IOException, URISyntaxException {
RestConnection conn = new RestConnection();
assertTrue(conn.login("administrator", "openolat"));
URI systemUri = conn.getContextURI().path("system").path("monitoring").path("openolat").path("users").build();
UserStatisticsVO userStats = conn.get(systemUri, UserStatisticsVO.class);
assertNotNull(userStats);
long totalUserCount = userStats.getTotalUserCount();
assertTrue(totalUserCount > 0);
long activeUserCount = userStats.getActiveUserCount();
assertTrue(activeUserCount >= 0);
long activeUserCountLastDay = userStats.getActiveUserCountLastDay();
assertTrue(activeUserCountLastDay >= 0);
long activeUserCountLastWeek = userStats.getActiveUserCountLastWeek();
assertTrue(activeUserCountLastWeek >= 0);
long activeUserCountLastMonth = userStats.getActiveUserCountLastMonth();
assertTrue(activeUserCountLastMonth >= 0);
long activeUserCountLast6Month = userStats.getActiveUserCountLast6Month();
assertTrue(activeUserCountLast6Month >= 0);
long blockedUserCount = userStats.getBlockedUserCount();
assertTrue(blockedUserCount >= 0);
long deletedUserCount = userStats.getDeletedUserCount();
assertTrue(deletedUserCount >= 0);
long externalUserCount = userStats.getExternalUserCount();
assertTrue(externalUserCount >= 0);
long totalGroupCount = userStats.getTotalGroupCount();
assertTrue(totalGroupCount >= 0);
conn.shutdown();
}
use of org.olat.restapi.system.vo.UserStatisticsVO in project OpenOLAT by OpenOLAT.
the class OpenOLATStatisticsWebService method getUserStatisticsVO.
private UserStatisticsVO getUserStatisticsVO() {
UserStatisticsVO stats = new UserStatisticsVO();
BaseSecurity securityManager = CoreSpringFactory.getImpl(BaseSecurity.class);
// activeUserCount="88" // registered and activated identities, same as in GUI
long countActiveUsers = securityManager.countIdentitiesByPowerSearch(null, null, false, null, null, null, null, null, null, null, Constants.USERSTATUS_ACTIVE);
stats.setActiveUserCount(countActiveUsers);
// active last day
Calendar lastDay = Calendar.getInstance();
lastDay.add(Calendar.DATE, -1);
long activeUserCountDay = securityManager.countUniqueUserLoginsSince(lastDay.getTime());
stats.setActiveUserCountLastDay(activeUserCountDay);
// active last week
Calendar lastWeek = Calendar.getInstance();
lastWeek.add(Calendar.DATE, -7);
long activeUserCountWeek = securityManager.countUniqueUserLoginsSince(lastWeek.getTime());
stats.setActiveUserCountLastWeek(activeUserCountWeek);
// active last month
Calendar lastMonth = Calendar.getInstance();
lastMonth.add(Calendar.MONTH, -1);
long activeUserCountMonth = securityManager.countUniqueUserLoginsSince(lastMonth.getTime());
stats.setActiveUserCountLastMonth(activeUserCountMonth);
// active last 6 month
Calendar last6Month = Calendar.getInstance();
last6Month.add(Calendar.MONTH, -6);
long activeUserCount6Month = securityManager.countUniqueUserLoginsSince(last6Month.getTime());
stats.setActiveUserCountLast6Month(activeUserCount6Month);
// externalUserCount="12" // EP invite identities, later maybe also used in courses for MOOCS, external experts etc)
long invitationsCount = CoreSpringFactory.getImpl(InvitationDAO.class).countInvitations();
stats.setExternalUserCount(invitationsCount);
// blockedUserCount="0" // identities in login blocked state
long blockedUserCount = securityManager.countIdentitiesByPowerSearch(null, null, true, null, null, null, null, null, null, null, Identity.STATUS_LOGIN_DENIED);
stats.setBlockedUserCount(blockedUserCount);
// deletedUserCount="943" // deleted identities
long deletedUserCount = securityManager.countIdentitiesByPowerSearch(null, null, true, null, null, null, null, null, null, null, Identity.STATUS_DELETED);
stats.setDeletedUserCount(deletedUserCount);
// totalUserCount="1043" // Sum of all above
long countUsers = securityManager.countIdentitiesByPowerSearch(null, null, false, null, null, null, null, null, null, null, null);
stats.setTotalUserCount(countUsers);
BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class);
long countGroups = bgs.countBusinessGroups(null, null);
stats.setTotalGroupCount(countGroups);
return stats;
}
use of org.olat.restapi.system.vo.UserStatisticsVO in project openolat by klemens.
the class OpenOLATStatisticsWebService method getUserStatisticsVO.
private UserStatisticsVO getUserStatisticsVO() {
UserStatisticsVO stats = new UserStatisticsVO();
BaseSecurity securityManager = CoreSpringFactory.getImpl(BaseSecurity.class);
// activeUserCount="88" // registered and activated identities, same as in GUI
long countActiveUsers = securityManager.countIdentitiesByPowerSearch(null, null, false, null, null, null, null, null, null, null, Constants.USERSTATUS_ACTIVE);
stats.setActiveUserCount(countActiveUsers);
// active last day
Calendar lastDay = Calendar.getInstance();
lastDay.add(Calendar.DATE, -1);
long activeUserCountDay = securityManager.countUniqueUserLoginsSince(lastDay.getTime());
stats.setActiveUserCountLastDay(activeUserCountDay);
// active last week
Calendar lastWeek = Calendar.getInstance();
lastWeek.add(Calendar.DATE, -7);
long activeUserCountWeek = securityManager.countUniqueUserLoginsSince(lastWeek.getTime());
stats.setActiveUserCountLastWeek(activeUserCountWeek);
// active last month
Calendar lastMonth = Calendar.getInstance();
lastMonth.add(Calendar.MONTH, -1);
long activeUserCountMonth = securityManager.countUniqueUserLoginsSince(lastMonth.getTime());
stats.setActiveUserCountLastMonth(activeUserCountMonth);
// active last 6 month
Calendar last6Month = Calendar.getInstance();
last6Month.add(Calendar.MONTH, -6);
long activeUserCount6Month = securityManager.countUniqueUserLoginsSince(last6Month.getTime());
stats.setActiveUserCountLast6Month(activeUserCount6Month);
// externalUserCount="12" // EP invite identities, later maybe also used in courses for MOOCS, external experts etc)
long invitationsCount = CoreSpringFactory.getImpl(InvitationDAO.class).countInvitations();
stats.setExternalUserCount(invitationsCount);
// blockedUserCount="0" // identities in login blocked state
long blockedUserCount = securityManager.countIdentitiesByPowerSearch(null, null, true, null, null, null, null, null, null, null, Identity.STATUS_LOGIN_DENIED);
stats.setBlockedUserCount(blockedUserCount);
// deletedUserCount="943" // deleted identities
long deletedUserCount = securityManager.countIdentitiesByPowerSearch(null, null, true, null, null, null, null, null, null, null, Identity.STATUS_DELETED);
stats.setDeletedUserCount(deletedUserCount);
// totalUserCount="1043" // Sum of all above
long countUsers = securityManager.countIdentitiesByPowerSearch(null, null, false, null, null, null, null, null, null, null, null);
stats.setTotalUserCount(countUsers);
BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class);
long countGroups = bgs.countBusinessGroups(null, null);
stats.setTotalGroupCount(countGroups);
return stats;
}
use of org.olat.restapi.system.vo.UserStatisticsVO in project openolat by klemens.
the class SystemTest method testSystemUserStatistics.
@Test
public void testSystemUserStatistics() throws IOException, URISyntaxException {
RestConnection conn = new RestConnection();
assertTrue(conn.login("administrator", "openolat"));
URI systemUri = conn.getContextURI().path("system").path("monitoring").path("openolat").path("users").build();
UserStatisticsVO userStats = conn.get(systemUri, UserStatisticsVO.class);
assertNotNull(userStats);
long totalUserCount = userStats.getTotalUserCount();
assertTrue(totalUserCount > 0);
long activeUserCount = userStats.getActiveUserCount();
assertTrue(activeUserCount >= 0);
long activeUserCountLastDay = userStats.getActiveUserCountLastDay();
assertTrue(activeUserCountLastDay >= 0);
long activeUserCountLastWeek = userStats.getActiveUserCountLastWeek();
assertTrue(activeUserCountLastWeek >= 0);
long activeUserCountLastMonth = userStats.getActiveUserCountLastMonth();
assertTrue(activeUserCountLastMonth >= 0);
long activeUserCountLast6Month = userStats.getActiveUserCountLast6Month();
assertTrue(activeUserCountLast6Month >= 0);
long blockedUserCount = userStats.getBlockedUserCount();
assertTrue(blockedUserCount >= 0);
long deletedUserCount = userStats.getDeletedUserCount();
assertTrue(deletedUserCount >= 0);
long externalUserCount = userStats.getExternalUserCount();
assertTrue(externalUserCount >= 0);
long totalGroupCount = userStats.getTotalGroupCount();
assertTrue(totalGroupCount >= 0);
conn.shutdown();
}
Aggregations