Search in sources :

Example 1 with RepositoryEntryMyView

use of org.olat.repository.RepositoryEntryMyView in project OpenOLAT by OpenOLAT.

the class VideoEntryDataSource method getRows.

@Override
public ResultInfos<RepositoryEntryRow> getRows(String query, List<FlexiTableFilter> filters, List<String> condQueries, int firstResult, int maxResults, SortKey... orderBy) {
    if (condQueries != null && condQueries.size() > 0) {
        String filter = condQueries.get(0);
        if (StringHelper.containsNonWhitespace(filter)) {
            searchParams.setFilters(Collections.singletonList(Filter.valueOf(filter)));
        } else {
            searchParams.setFilters(null);
        }
    }
    if (orderBy != null && orderBy.length > 0 && orderBy[0] != null) {
        OrderBy o = OrderBy.valueOf(orderBy[0].getKey());
        searchParams.setOrderBy(o);
        searchParams.setOrderByAsc(orderBy[0].isAsc());
    }
    if (StringHelper.containsNonWhitespace(query)) {
        searchParams.setText(query);
    } else {
        searchParams.setText(null);
    }
    List<RepositoryEntryMyView> views = repositoryService.searchMyView(searchParams, firstResult, maxResults);
    List<RepositoryEntryRow> rows = processViewModel(views);
    ResultInfos<RepositoryEntryRow> results = new DefaultResultInfos<RepositoryEntryRow>(firstResult + rows.size(), -1, rows);
    if (firstResult == 0 && views.size() < maxResults) {
        count = new Integer(views.size());
    }
    return results;
}
Also used : OrderBy(org.olat.repository.model.SearchMyRepositoryEntryViewParams.OrderBy) DefaultResultInfos(org.olat.core.commons.persistence.DefaultResultInfos) RepositoryEntryRow(org.olat.repository.ui.list.RepositoryEntryRow) RepositoryEntryMyView(org.olat.repository.RepositoryEntryMyView)

Example 2 with RepositoryEntryMyView

use of org.olat.repository.RepositoryEntryMyView in project openolat by klemens.

the class RepositoryEntryMyCourseQueriesTest method searchViews.

@Test
public void searchViews() {
    Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("mycourses-view-1-");
    dbInstance.commit();
    Roles roles = securityManager.getRoles(id);
    SearchMyRepositoryEntryViewParams params = new SearchMyRepositoryEntryViewParams(id, roles);
    params.setMarked(Boolean.TRUE);
    List<RepositoryEntryMyView> views = repositoryEntryMyCourseViewQueries.searchViews(params, 0, 10);
    Assert.assertNotNull(views);
}
Also used : RepositoryEntryMyView(org.olat.repository.RepositoryEntryMyView) Roles(org.olat.core.id.Roles) Identity(org.olat.core.id.Identity) SearchMyRepositoryEntryViewParams(org.olat.repository.model.SearchMyRepositoryEntryViewParams) Test(org.junit.Test)

Example 3 with RepositoryEntryMyView

use of org.olat.repository.RepositoryEntryMyView in project openolat by klemens.

the class RepositoryEntryMyCourseQueriesTest method searchViews_orderBy.

@Test
public void searchViews_orderBy() {
    Identity id = JunitTestHelper.createAndPersistIdentityAsRndUser("mycourses-view-2-");
    dbInstance.commit();
    Roles roles = securityManager.getRoles(id);
    SearchMyRepositoryEntryViewParams params = new SearchMyRepositoryEntryViewParams(id, roles);
    params.setMarked(Boolean.TRUE);
    for (OrderBy orderBy : OrderBy.values()) {
        params.setOrderBy(orderBy);
        params.setOrderByAsc(true);
        List<RepositoryEntryMyView> viewAsc = repositoryEntryMyCourseViewQueries.searchViews(params, 0, 10);
        Assert.assertNotNull(viewAsc);
        params.setOrderByAsc(false);
        List<RepositoryEntryMyView> viewDesc = repositoryEntryMyCourseViewQueries.searchViews(params, 0, 10);
        Assert.assertNotNull(viewDesc);
    }
}
Also used : OrderBy(org.olat.repository.model.SearchMyRepositoryEntryViewParams.OrderBy) RepositoryEntryMyView(org.olat.repository.RepositoryEntryMyView) Roles(org.olat.core.id.Roles) Identity(org.olat.core.id.Identity) SearchMyRepositoryEntryViewParams(org.olat.repository.model.SearchMyRepositoryEntryViewParams) Test(org.junit.Test)

Example 4 with RepositoryEntryMyView

use of org.olat.repository.RepositoryEntryMyView in project openolat by klemens.

the class DefaultRepositoryEntryDataSource method getRows.

@Override
public final ResultInfos<RepositoryEntryRow> getRows(String query, List<FlexiTableFilter> filters, List<String> condQueries, int firstResult, int maxResults, SortKey... orderBy) {
    if (filters != null && filters.size() > 0 && filters.get(0) != null) {
        String filter = filters.get(0).getFilter();
        if (StringHelper.containsNonWhitespace(filter)) {
            searchParams.setFilters(Collections.singletonList(Filter.valueOf(filter)));
        } else {
            searchParams.setFilters(null);
        }
    } else {
        searchParams.setFilters(null);
    }
    if (orderBy != null && orderBy.length > 0 && orderBy[0] != null) {
        OrderBy o = OrderBy.valueOf(orderBy[0].getKey());
        searchParams.setOrderBy(o);
        searchParams.setOrderByAsc(orderBy[0].isAsc());
    }
    if (StringHelper.containsNonWhitespace(query)) {
        searchParams.setIdRefsAndTitle(query);
    } else {
        searchParams.setIdRefsAndTitle(null);
    }
    List<RepositoryEntryMyView> views = repositoryService.searchMyView(searchParams, firstResult, maxResults);
    List<RepositoryEntryRow> rows = processViewModel(views);
    ResultInfos<RepositoryEntryRow> results = new DefaultResultInfos<RepositoryEntryRow>(firstResult + rows.size(), -1, rows);
    if (firstResult == 0 && views.size() < maxResults) {
        count = new Integer(views.size());
    }
    return results;
}
Also used : OrderBy(org.olat.repository.model.SearchMyRepositoryEntryViewParams.OrderBy) DefaultResultInfos(org.olat.core.commons.persistence.DefaultResultInfos) RepositoryEntryMyView(org.olat.repository.RepositoryEntryMyView)

Example 5 with RepositoryEntryMyView

use of org.olat.repository.RepositoryEntryMyView in project openolat by klemens.

the class VideoEntryDataSource method getRows.

@Override
public ResultInfos<RepositoryEntryRow> getRows(String query, List<FlexiTableFilter> filters, List<String> condQueries, int firstResult, int maxResults, SortKey... orderBy) {
    if (condQueries != null && condQueries.size() > 0) {
        String filter = condQueries.get(0);
        if (StringHelper.containsNonWhitespace(filter)) {
            searchParams.setFilters(Collections.singletonList(Filter.valueOf(filter)));
        } else {
            searchParams.setFilters(null);
        }
    }
    if (orderBy != null && orderBy.length > 0 && orderBy[0] != null) {
        OrderBy o = OrderBy.valueOf(orderBy[0].getKey());
        searchParams.setOrderBy(o);
        searchParams.setOrderByAsc(orderBy[0].isAsc());
    }
    if (StringHelper.containsNonWhitespace(query)) {
        searchParams.setText(query);
    } else {
        searchParams.setText(null);
    }
    List<RepositoryEntryMyView> views = repositoryService.searchMyView(searchParams, firstResult, maxResults);
    List<RepositoryEntryRow> rows = processViewModel(views);
    ResultInfos<RepositoryEntryRow> results = new DefaultResultInfos<RepositoryEntryRow>(firstResult + rows.size(), -1, rows);
    if (firstResult == 0 && views.size() < maxResults) {
        count = new Integer(views.size());
    }
    return results;
}
Also used : OrderBy(org.olat.repository.model.SearchMyRepositoryEntryViewParams.OrderBy) DefaultResultInfos(org.olat.core.commons.persistence.DefaultResultInfos) RepositoryEntryRow(org.olat.repository.ui.list.RepositoryEntryRow) RepositoryEntryMyView(org.olat.repository.RepositoryEntryMyView)

Aggregations

RepositoryEntryMyView (org.olat.repository.RepositoryEntryMyView)14 ArrayList (java.util.ArrayList)6 OrderBy (org.olat.repository.model.SearchMyRepositoryEntryViewParams.OrderBy)6 Test (org.junit.Test)4 DefaultResultInfos (org.olat.core.commons.persistence.DefaultResultInfos)4 Identity (org.olat.core.id.Identity)4 Roles (org.olat.core.id.Roles)4 SearchMyRepositoryEntryViewParams (org.olat.repository.model.SearchMyRepositoryEntryViewParams)4 RepositoryEntryRow (org.olat.repository.ui.list.RepositoryEntryRow)4 OLATResource (org.olat.resource.OLATResource)4 HashMap (java.util.HashMap)2 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)2 UserEfficiencyStatementLight (org.olat.course.assessment.model.UserEfficiencyStatementLight)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2 RepositoryEntryMyCourseImpl (org.olat.repository.model.RepositoryEntryMyCourseImpl)2 RepositoryEntryStatistics (org.olat.repository.model.RepositoryEntryStatistics)2 PriceMethod (org.olat.repository.ui.PriceMethod)2 AccessMethodHandler (org.olat.resource.accesscontrol.method.AccessMethodHandler)2 OLATResourceAccess (org.olat.resource.accesscontrol.model.OLATResourceAccess)2 PriceMethodBundle (org.olat.resource.accesscontrol.model.PriceMethodBundle)2