Search in sources :

Example 6 with FilterSort

use of com.epam.ta.reportportal.entity.filter.FilterSort in project service-api by reportportal.

the class UserFilterBuilder method addSelectionParameters.

/**
 * Convert provided selection into db and add them in correct order
 * to filter object
 *
 * @param orders Filter sorting conditions
 * @return UserFilterBuilder
 */
public UserFilterBuilder addSelectionParameters(List<Order> orders) {
    userFilter.getFilterSorts().clear();
    ofNullable(orders).ifPresent(o -> o.forEach(order -> {
        FilterSort filterSort = new FilterSort();
        filterSort.setField(order.getSortingColumnName());
        filterSort.setDirection(order.getIsAsc() ? Sort.Direction.ASC : Sort.Direction.DESC);
        userFilter.getFilterSorts().add(filterSort);
    }));
    return this;
}
Also used : Project(com.epam.ta.reportportal.entity.project.Project) ObjectType(com.epam.ta.reportportal.entity.filter.ObjectType) UserFilter(com.epam.ta.reportportal.entity.filter.UserFilter) Optional.ofNullable(java.util.Optional.ofNullable) UpdateUserFilterRQ(com.epam.ta.reportportal.ws.model.filter.UpdateUserFilterRQ) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) Order(com.epam.ta.reportportal.ws.model.filter.Order) Set(java.util.Set) ErrorType(com.epam.ta.reportportal.ws.model.ErrorType) FilterCondition(com.epam.ta.reportportal.commons.querygen.FilterCondition) FilterSort(com.epam.ta.reportportal.entity.filter.FilterSort) Supplier(java.util.function.Supplier) UserFilterCondition(com.epam.ta.reportportal.ws.model.filter.UserFilterCondition) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) Condition(com.epam.ta.reportportal.commons.querygen.Condition) Sort(org.springframework.data.domain.Sort) FilterSort(com.epam.ta.reportportal.entity.filter.FilterSort)

Aggregations

FilterSort (com.epam.ta.reportportal.entity.filter.FilterSort)6 UserFilter (com.epam.ta.reportportal.entity.filter.UserFilter)5 Set (java.util.Set)3 Sort (org.springframework.data.domain.Sort)3 Filter (com.epam.ta.reportportal.commons.querygen.Filter)2 Project (com.epam.ta.reportportal.entity.project.Project)2 Order (com.epam.ta.reportportal.ws.model.filter.Order)2 UpdateUserFilterRQ (com.epam.ta.reportportal.ws.model.filter.UpdateUserFilterRQ)2 UserFilterCondition (com.epam.ta.reportportal.ws.model.filter.UserFilterCondition)2 Condition (com.epam.ta.reportportal.commons.querygen.Condition)1 FilterCondition (com.epam.ta.reportportal.commons.querygen.FilterCondition)1 DashboardWidget (com.epam.ta.reportportal.entity.dashboard.DashboardWidget)1 ObjectType (com.epam.ta.reportportal.entity.filter.ObjectType)1 Widget (com.epam.ta.reportportal.entity.widget.Widget)1 WidgetOptions (com.epam.ta.reportportal.entity.widget.WidgetOptions)1 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)1 ErrorType (com.epam.ta.reportportal.ws.model.ErrorType)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Optional.ofNullable (java.util.Optional.ofNullable)1