Search in sources :

Example 1 with RepositoryStatisticsVO

use of org.olat.restapi.system.vo.RepositoryStatisticsVO in project OpenOLAT by OpenOLAT.

the class SystemTest method testSystemRepositoryStatistics.

@Test
public void testSystemRepositoryStatistics() throws IOException, URISyntaxException {
    RestConnection conn = new RestConnection();
    assertTrue(conn.login("administrator", "openolat"));
    URI systemUri = conn.getContextURI().path("system").path("monitoring").path("openolat").path("repository").build();
    RepositoryStatisticsVO repoStats = conn.get(systemUri, RepositoryStatisticsVO.class);
    assertNotNull(repoStats);
    assertTrue(repoStats.getCoursesCount() >= 0);
    assertTrue(repoStats.getPublishedCoursesCount() >= 0);
    conn.shutdown();
}
Also used : RepositoryStatisticsVO(org.olat.restapi.system.vo.RepositoryStatisticsVO) URI(java.net.URI) Test(org.junit.Test)

Example 2 with RepositoryStatisticsVO

use of org.olat.restapi.system.vo.RepositoryStatisticsVO in project OpenOLAT by OpenOLAT.

the class OpenOLATStatisticsWebService method getRepositoryStatisticsVO.

private RepositoryStatisticsVO getRepositoryStatisticsVO() {
    RepositoryStatisticsVO stats = new RepositoryStatisticsVO();
    RepositoryManager repoMgr = CoreSpringFactory.getImpl(RepositoryManager.class);
    int allCourses = repoMgr.countByTypeLimitAccess(CourseModule.ORES_TYPE_COURSE, RepositoryEntry.ACC_OWNERS);
    int publishedCourses = repoMgr.countByTypeLimitAccess(CourseModule.ORES_TYPE_COURSE, RepositoryEntry.ACC_USERS);
    stats.setCoursesCount(allCourses);
    stats.setPublishedCoursesCount(publishedCourses);
    return stats;
}
Also used : RepositoryStatisticsVO(org.olat.restapi.system.vo.RepositoryStatisticsVO) RepositoryManager(org.olat.repository.RepositoryManager)

Example 3 with RepositoryStatisticsVO

use of org.olat.restapi.system.vo.RepositoryStatisticsVO in project openolat by klemens.

the class OpenOLATStatisticsWebService method getRepositoryStatisticsVO.

private RepositoryStatisticsVO getRepositoryStatisticsVO() {
    RepositoryStatisticsVO stats = new RepositoryStatisticsVO();
    RepositoryManager repoMgr = CoreSpringFactory.getImpl(RepositoryManager.class);
    int allCourses = repoMgr.countByTypeLimitAccess(CourseModule.ORES_TYPE_COURSE, RepositoryEntry.ACC_OWNERS);
    int publishedCourses = repoMgr.countByTypeLimitAccess(CourseModule.ORES_TYPE_COURSE, RepositoryEntry.ACC_USERS);
    stats.setCoursesCount(allCourses);
    stats.setPublishedCoursesCount(publishedCourses);
    return stats;
}
Also used : RepositoryStatisticsVO(org.olat.restapi.system.vo.RepositoryStatisticsVO) RepositoryManager(org.olat.repository.RepositoryManager)

Example 4 with RepositoryStatisticsVO

use of org.olat.restapi.system.vo.RepositoryStatisticsVO in project openolat by klemens.

the class SystemTest method testSystemRepositoryStatistics.

@Test
public void testSystemRepositoryStatistics() throws IOException, URISyntaxException {
    RestConnection conn = new RestConnection();
    assertTrue(conn.login("administrator", "openolat"));
    URI systemUri = conn.getContextURI().path("system").path("monitoring").path("openolat").path("repository").build();
    RepositoryStatisticsVO repoStats = conn.get(systemUri, RepositoryStatisticsVO.class);
    assertNotNull(repoStats);
    assertTrue(repoStats.getCoursesCount() >= 0);
    assertTrue(repoStats.getPublishedCoursesCount() >= 0);
    conn.shutdown();
}
Also used : RepositoryStatisticsVO(org.olat.restapi.system.vo.RepositoryStatisticsVO) URI(java.net.URI) Test(org.junit.Test)

Aggregations

RepositoryStatisticsVO (org.olat.restapi.system.vo.RepositoryStatisticsVO)4 URI (java.net.URI)2 Test (org.junit.Test)2 RepositoryManager (org.olat.repository.RepositoryManager)2