Search in sources :

Example 1 with DefaultResultInfos

use of org.olat.core.commons.persistence.DefaultResultInfos 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 DefaultResultInfos

use of org.olat.core.commons.persistence.DefaultResultInfos in project OpenOLAT by OpenOLAT.

the class AuthoringEntryDataSource method getRows.

@Override
public final ResultInfos<AuthoringEntryRow> getRows(String query, List<FlexiTableFilter> filters, List<String> condQueries, int firstResult, int maxResults, SortKey... orderBy) {
    if (filters != null && filters.size() > 0) {
        String filter = filters.get(0).getFilter();
        if (StringHelper.containsNonWhitespace(filter)) {
            searchParams.setResourceTypes(Collections.singletonList(filter));
        } else {
            searchParams.setResourceTypes(null);
        }
    } else if (useFilters) {
        searchParams.setResourceTypes(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<RepositoryEntryAuthorView> views = repositoryService.searchAuthorView(searchParams, firstResult, maxResults);
    List<AuthoringEntryRow> rows = processViewModel(views);
    ResultInfos<AuthoringEntryRow> results = new DefaultResultInfos<>(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.SearchAuthorRepositoryEntryViewParams.OrderBy) DefaultResultInfos(org.olat.core.commons.persistence.DefaultResultInfos) RepositoryEntryAuthorView(org.olat.repository.RepositoryEntryAuthorView)

Example 3 with DefaultResultInfos

use of org.olat.core.commons.persistence.DefaultResultInfos 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 4 with DefaultResultInfos

use of org.olat.core.commons.persistence.DefaultResultInfos 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)

Example 5 with DefaultResultInfos

use of org.olat.core.commons.persistence.DefaultResultInfos in project openolat by klemens.

the class AuthoringEntryDataSource method getRows.

@Override
public final ResultInfos<AuthoringEntryRow> getRows(String query, List<FlexiTableFilter> filters, List<String> condQueries, int firstResult, int maxResults, SortKey... orderBy) {
    if (filters != null && filters.size() > 0) {
        String filter = filters.get(0).getFilter();
        if (StringHelper.containsNonWhitespace(filter)) {
            searchParams.setResourceTypes(Collections.singletonList(filter));
        } else {
            searchParams.setResourceTypes(null);
        }
    } else if (useFilters) {
        searchParams.setResourceTypes(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<RepositoryEntryAuthorView> views = repositoryService.searchAuthorView(searchParams, firstResult, maxResults);
    List<AuthoringEntryRow> rows = processViewModel(views);
    ResultInfos<AuthoringEntryRow> results = new DefaultResultInfos<>(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.SearchAuthorRepositoryEntryViewParams.OrderBy) DefaultResultInfos(org.olat.core.commons.persistence.DefaultResultInfos) RepositoryEntryAuthorView(org.olat.repository.RepositoryEntryAuthorView)

Aggregations

DefaultResultInfos (org.olat.core.commons.persistence.DefaultResultInfos)10 ArrayList (java.util.ArrayList)4 QuestionItemView (org.olat.modules.qpool.QuestionItemView)4 RepositoryEntryMyView (org.olat.repository.RepositoryEntryMyView)4 OrderBy (org.olat.repository.model.SearchMyRepositoryEntryViewParams.OrderBy)4 ResourceLicense (org.olat.core.commons.services.license.ResourceLicense)2 Identity (org.olat.core.id.Identity)2 RepositoryEntryAuthorView (org.olat.repository.RepositoryEntryAuthorView)2 OrderBy (org.olat.repository.model.SearchAuthorRepositoryEntryViewParams.OrderBy)2 RepositoryEntryRow (org.olat.repository.ui.list.RepositoryEntryRow)2