org.apache.wicket.extensions.markup.html.repeater.util.SortParam Java Examples
The following examples show how to use
org.apache.wicket.extensions.markup.html.repeater.util.SortParam.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnalysisDataProvider.java From nextreports-server with Apache License 2.0 | 6 votes |
public List<String> getHeader() { List<String> result = analysisReader.getHeader(analysis); if (result.isEmpty()) { return result; } SortParam<String> sort = getSort(); if (sort == null) { setSort(result.get(0), SortOrder.ASCENDING); List<String> sortProperty = new ArrayList<String>(); sortProperty.add(result.get(0)); analysis.setSortProperty(sortProperty); List<Boolean> asc = new ArrayList<Boolean>(); asc.add(true); analysis.setAscending(asc); } return result; }
Example #2
Source File: BaseRestClient.java From syncope with Apache License 2.0 | 6 votes |
public static String toOrderBy(final SortParam<String> sort) { OrderByClauseBuilder builder = SyncopeClient.getOrderByClauseBuilder(); String property = sort.getProperty(); if (property.indexOf('#') != -1) { property = property.substring(property.indexOf('#') + 1); } if (sort.isAscending()) { builder.asc(property); } else { builder.desc(property); } return builder.build(); }
Example #3
Source File: TaskRestClient.java From syncope with Apache License 2.0 | 6 votes |
public static List<NotificationTaskTO> listNotificationTasks( final String notification, final AnyTypeKind anyTypeKind, final String entityKey, final int page, final int size, final SortParam<String> sort) { TaskQuery.Builder builder = new TaskQuery.Builder(TaskType.NOTIFICATION); if (notification != null) { builder.notification(notification); } if (anyTypeKind != null) { builder.anyTypeKind(anyTypeKind); } if (entityKey != null) { builder.entityKey(entityKey); } PagedResult<NotificationTaskTO> list = getService(TaskService.class). search(builder.page(page).size(size).orderBy(toOrderBy(sort)).build()); return list.getResult(); }
Example #4
Source File: LoggerRestClient.java From syncope with Apache License 2.0 | 6 votes |
public List<AuditEntry> search( final String key, final int page, final int size, final AuditElements.EventCategoryType type, final String category, final List<String> events, final AuditElements.Result result, final SortParam<String> sort) { AuditQuery query = new AuditQuery.Builder(). entityKey(key). size(size). page(page). type(type). category(category). events(events). result(result). orderBy(toOrderBy(sort)). build(); return getService(LoggerService.class).search(query).getResult(); }
Example #5
Source File: Groups.java From syncope with Apache License 2.0 | 6 votes |
/** * Retrieve dyn group memberships. */ @Override protected void reloadDynMemberships() { GroupFiqlSearchConditionBuilder builder = SyncopeClient.getGroupSearchConditionBuilder(); List<CompleteCondition> conditions = GroupableRelatableTO.class.cast(anyTO).getDynMemberships(). stream().map(membership -> builder.is(Constants.KEY_FIELD_NAME). equalTo(membership.getGroupKey()).wrap()). collect(Collectors.toList()); dynMemberships = new ArrayList<>(); if (SyncopeConsoleSession.get().owns(IdRepoEntitlement.GROUP_SEARCH) && !conditions.isEmpty()) { dynMemberships.addAll(groupRestClient.search( SyncopeConstants.ROOT_REALM, builder.or(conditions).query(), -1, -1, new SortParam<>("name", true), null).stream().map(GroupTO::getName).collect(Collectors.toList())); } }
Example #6
Source File: BaseRestClient.java From syncope with Apache License 2.0 | 6 votes |
protected static String toOrderBy(final SortParam<String> sort) { OrderByClauseBuilder builder = SyncopeClient.getOrderByClauseBuilder(); String property = sort.getProperty(); if (property.indexOf('#') != -1) { property = property.substring(property.indexOf('#') + 1); } if (sort.isAscending()) { builder.asc(property); } else { builder.desc(property); } return builder.build(); }
Example #7
Source File: UserRequestFormsWidget.java From syncope with Apache License 2.0 | 6 votes |
@Override protected IModel<List<UserRequestForm>> getLatestAlerts() { return new ListModel<UserRequestForm>() { private static final long serialVersionUID = -2583290457773357445L; @Override public List<UserRequestForm> getObject() { List<UserRequestForm> updatedForms; if (SyncopeConsoleSession.get().owns(FlowableEntitlement.USER_REQUEST_FORM_LIST)) { updatedForms = UserRequestRestClient.getForms(1, MAX_SIZE, new SortParam<>("createTime", true)); } else { updatedForms = Collections.<UserRequestForm>emptyList(); } return updatedForms; } }; }
Example #8
Source File: RemediationsWidget.java From syncope with Apache License 2.0 | 6 votes |
@Override protected IModel<List<RemediationTO>> getLatestAlerts() { return new ListModel<RemediationTO>() { private static final long serialVersionUID = 541491929575585613L; @Override public List<RemediationTO> getObject() { List<RemediationTO> updatedRemediations; if (SyncopeConsoleSession.get().owns(IdMEntitlement.REMEDIATION_LIST) && SyncopeConsoleSession.get().owns(IdMEntitlement.REMEDIATION_READ)) { updatedRemediations = RemediationRestClient.getRemediations(1, MAX_SIZE, new SortParam<>("instant", true)); } else { updatedRemediations = List.of(); } return updatedRemediations; } }; }
Example #9
Source File: ResourceRestClient.java From syncope with Apache License 2.0 | 6 votes |
public Pair<String, List<ConnObjectTO>> searchConnObjects( final String resource, final String anyTypeKey, final ConnObjectTOQuery.Builder queryBuilder, final SortParam<String> sortParam) { final List<ConnObjectTO> result = new ArrayList<>(); String nextPageResultCookie = null; PagedConnObjectTOResult list; try { if (sortParam != null) { queryBuilder.orderBy(toOrderBy(sortParam)); } list = getService(ResourceService.class).searchConnObjects(resource, anyTypeKey, queryBuilder.build()); result.addAll(list.getResult()); nextPageResultCookie = list.getPagedResultsCookie(); } catch (Exception e) { LOG.error("While listing objects on {} for any type {}", resource, anyTypeKey, e); } return Pair.of(nextPageResultCookie, result); }
Example #10
Source File: ConnObjectListViewPanel.java From syncope with Apache License 2.0 | 6 votes |
private List<ConnObjectTO> reloadItems( final String resource, final String anyType, final String cookie, final String fiql) { Pair<String, List<ConnObjectTO>> items = new ResourceRestClient().searchConnObjects(resource, anyType, new ConnObjectTOQuery.Builder(). size(SIZE). pagedResultsCookie(cookie). fiql(fiql), new SortParam<>(ConnIdSpecialName.UID, true)); nextPageCookie = items.getLeft(); return items.getRight(); }
Example #11
Source File: UserTrackingDataProvider.java From sakai with Educational Community License v2.0 | 6 votes |
@Override public PagedInfiniteIterator<DetailedEvent> iterator(long first, long count) { SortParam sort = getSort(); DetailedEventsManager dem = Locator.getFacade().getDetailedEventsManager(); List<DetailedEvent> deList = dem.getDetailedEvents(trackingParams, new PagingParams(first, count + 1), new SortingParams(sort.getProperty().toString(), sort.isAscending())); int numResults = deList.size(); boolean hasNextPage = false; if (numResults > count) { hasNextPage = true; numResults--; deList.remove(numResults); } return new PagedInfiniteIterator(deList.iterator(), first > 0, hasNextPage, numResults); }
Example #12
Source File: StatisticableSitesDataProvider.java From sakai with Educational Community License v2.0 | 6 votes |
private SortType getSSSortType() { SortParam sp = getSort(); if(sp.getProperty().equals(COL_TITLE)){ if(sp.isAscending()) { return SortType.TITLE_ASC; }else{ return SortType.TITLE_DESC; } }else if(sp.getProperty().equals(COL_TYPE)){ if(sp.isAscending()){ return SortType.TYPE_ASC; }else{ return SortType.TYPE_DESC; } }else if(sp.getProperty().equals(COL_STATUS)){ if(sp.isAscending()){ return SortType.PUBLISHED_ASC; }else{ return SortType.PUBLISHED_DESC; } }else{ return SortType.TITLE_ASC; } }
Example #13
Source File: UserTrackingDataProvider.java From sakai with Educational Community License v2.0 | 6 votes |
@Override public PagedInfiniteIterator<DetailedEvent> iterator(long first, long count) { SortParam sort = getSort(); DetailedEventsManager dem = Locator.getFacade().getDetailedEventsManager(); List<DetailedEvent> deList = dem.getDetailedEvents(trackingParams, new PagingParams(first, count + 1), new SortingParams(sort.getProperty().toString(), sort.isAscending())); int numResults = deList.size(); boolean hasNextPage = false; if (numResults > count) { hasNextPage = true; numResults--; deList.remove(numResults); } return new PagedInfiniteIterator(deList.iterator(), first > 0, hasNextPage, numResults); }
Example #14
Source File: StatisticableSitesDataProvider.java From sakai with Educational Community License v2.0 | 6 votes |
private SortType getSSSortType() { SortParam sp = getSort(); if(sp.getProperty().equals(COL_TITLE)){ if(sp.isAscending()) { return SortType.TITLE_ASC; }else{ return SortType.TITLE_DESC; } }else if(sp.getProperty().equals(COL_TYPE)){ if(sp.isAscending()){ return SortType.TYPE_ASC; }else{ return SortType.TYPE_DESC; } }else if(sp.getProperty().equals(COL_STATUS)){ if(sp.isAscending()){ return SortType.PUBLISHED_ASC; }else{ return SortType.PUBLISHED_DESC; } }else{ return SortType.TITLE_ASC; } }
Example #15
Source File: MyListPageSortableDataProvider.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
private void sortList(final List<T> list) { final SortParam<String> sp = getSort(); if (sp != null && "NOSORT".equals(sp.getProperty()) == false) { if (this.sortParam != null && StringUtils.equals(this.sortParam.getProperty(), sp.getProperty()) == false) { this.secondSortParam = this.sortParam; } final Comparator<T> comp = getComparator(sp, secondSortParam); Collections.sort(list, comp); } this.sortParam = sp; }
Example #16
Source File: LinkedAccountDetailsPanel.java From syncope with Apache License 2.0 | 5 votes |
private void setConnObjectFieldChoices( final AjaxTextFieldPanel ajaxTextFieldPanel, final String resource, final String searchTerm) { AtomicReference<String> resourceRemoteKey = new AtomicReference<>(ConnIdSpecialName.NAME); try { resourceRemoteKey.set(resourceRestClient.read(resource).getProvision(AnyTypeKind.USER.name()).get(). getMapping().getConnObjectKeyItem().getExtAttrName()); } catch (Exception ex) { LOG.error("While reading mapping for resource {}", resource, ex); } ConnObjectTOQuery.Builder builder = new ConnObjectTOQuery.Builder().size(SEARCH_SIZE); if (StringUtils.isNotBlank(searchTerm)) { builder.fiql(SyncopeClient.getConnObjectTOFiqlSearchConditionBuilder(). is(resourceRemoteKey.get()).equalTo(searchTerm + "*").query()).build(); } Pair<String, List<ConnObjectTO>> items = resourceRestClient.searchConnObjects(resource, AnyTypeKind.USER.name(), builder, new SortParam<>(resourceRemoteKey.get(), true)); connObjectKeyFieldValues = items.getRight().stream(). map(item -> item.getAttr(resourceRemoteKey.get()).get().getValues().get(0)). collect(Collectors.toList()); ajaxTextFieldPanel.setChoices(connObjectKeyFieldValues); }
Example #17
Source File: AbstractJavaSortableDataProvider.java From wicket-orientdb with Apache License 2.0 | 5 votes |
@Override public Iterator<? extends T> iterator(long first, long count) { Collection<T> data =dataModel.getObject(); if(data==null || data.size()==0) return Collections.emptyIterator(); if(filterPredicate!=null) data = Collections2.filter(data, filterPredicate); Iterator<T> it; final SortParam<S> sortParam = getSort(); if(sortParam!=null && sortParam.getProperty()!=null) { Ordering<T> ordering = Ordering.natural().nullsFirst().onResultOf(new Function<T, Comparable<?>>() { @Override public Comparable<?> apply(T input) { return comparableValue(input, sortParam.getProperty()); } }); if(!sortParam.isAscending()) ordering = ordering.reverse(); it=ordering.sortedCopy(data).iterator(); } else { it=data.iterator(); } if(filterPredicate!=null) it = Iterators.filter(it, filterPredicate); if(first>0) Iterators.advance(it, (int)first); return count>=0?Iterators.limit(it, (int)count):it; }
Example #18
Source File: GroupRestClient.java From syncope with Apache License 2.0 | 5 votes |
@Override public List<GroupTO> search( final String realm, final String fiql, final int page, final int size, final SortParam<String> sort, final String type) { return getService(GroupService.class). search(new AnyQuery.Builder().realm(realm).fiql(fiql).page(page).size(size).details(false). orderBy(toOrderBy(sort)).details(false).build()).getResult(); }
Example #19
Source File: AnyObjectRestClient.java From syncope with Apache License 2.0 | 5 votes |
@Override public List<AnyObjectTO> search(final String realm, final String fiql, final int page, final int size, final SortParam<String> sort, final String type) { return getService(AnyObjectService.class).search( new AnyQuery.Builder().realm(realm).fiql(fiql).page(page).size(size). orderBy(toOrderBy(sort)).details(false).build()).getResult(); }
Example #20
Source File: SortableDataAdapter.java From nextreports-server with Apache License 2.0 | 5 votes |
@Override public Iterator<T> iterator(long first, long count) { long size = provider.size(); List<T> resources = new ArrayList<T>((int) size); Iterator<? extends T> iter = provider.iterator(0, size); while (iter.hasNext()) { resources.add(iter.next()); } if (comparators != null) { SortParam<String> sortParam = getSort(); if (sortParam != null) { String sortProperty = sortParam.getProperty(); if (sortProperty != null) { Comparator<T> comparator = comparators.get(sortProperty); if (comparator != null) { Collections.sort(resources, comparator); if (getSort().isAscending() == false) { Collections.reverse(resources); } } else { SortDefinition sortDefinition = new MutableSortDefinition(sortProperty, true, getSort().isAscending()); PropertyComparator.sort(resources, sortDefinition); } } } } return Collections.unmodifiableList(resources.subList((int) first, (int) (first + count))).iterator(); }
Example #21
Source File: MySortableDataProvider.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
/** * @see org.apache.wicket.markup.repeater.data.IDataProvider#iterator(int, int) */ @Override public Iterator<? extends O> iterator(final long first, final long count) { final SortParam<String> sp = getSort(); final List<O> list = getList(); if (list == null) { return null; } if (sp != null && "NOSORT".equals(sp.getProperty()) == false) { final Comparator<O> comp = getComparator(sp.getProperty().toString(), sp.isAscending()); Collections.sort(list, comp); } return list.subList((int)first, (int)(first + count)).iterator(); }
Example #22
Source File: UserRestClient.java From syncope with Apache License 2.0 | 5 votes |
@Override public List<UserTO> search( final String realm, final String fiql, final int page, final int size, final SortParam<String> sort, final String type) { return getService(UserService.class). search(new AnyQuery.Builder().realm(realm).fiql(fiql).page(page).size(size).details(false). orderBy(toOrderBy(sort)).details(false).build()).getResult(); }
Example #23
Source File: ReportRestClient.java From syncope with Apache License 2.0 | 5 votes |
@Override public List<ExecTO> listExecutions( final String taskKey, final int page, final int size, final SortParam<String> sort) { return getService(ReportService.class). listExecutions(new ExecQuery.Builder().key(taskKey).page(page).size(size). orderBy(toOrderBy(sort)).build()).getResult(); }
Example #24
Source File: Groups.java From syncope with Apache License 2.0 | 5 votes |
/** * Retrieve the first MAX_GROUP_LIST_SIZE assignable. */ @Override protected void reloadObject() { groups = groupRestClient.search( realm, SyncopeClient.getGroupSearchConditionBuilder().isAssignable().query(), 1, Constants.MAX_GROUP_LIST_SIZE, new SortParam<>("name", true), null); }
Example #25
Source File: MyListPageSortableDataProvider.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
protected Comparator<T> getComparator(final SortParam<String> sortParam, final SortParam<String> secondSortParam) { final String sortProperty = sortParam != null ? sortParam.getProperty() : null; final boolean ascending = sortParam != null ? sortParam.isAscending() : true; final String secondSortProperty = secondSortParam != null ? secondSortParam.getProperty() : null; final boolean secondAscending = secondSortParam != null ? secondSortParam.isAscending() : true; return new MyBeanComparator<T>(sortProperty, ascending, secondSortProperty, secondAscending); }
Example #26
Source File: MyListPageSortableDataProvider.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
public MyListPageSortableDataProvider(final SortParam<String> sortParam, final SortParam<String> secondSortParam, final AbstractListPage< ? , ? , T> listPage) { this.listPage = listPage; // set default sort if (sortParam != null) { setSort(sortParam); } else { setSort("NOSORT", SortOrder.ASCENDING); } }
Example #27
Source File: AbstractListPage.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
/** * At default a new SortableDOProvider is returned. Overload this method e. g. for avoiding LazyInitializationExceptions due to sorting. * @param sortProperty * @param ascending */ protected ISortableDataProvider<O, String> createSortableDataProvider(final SortParam<String> sortParam, final SortParam<String> secondSortParam) { if (listPageSortableDataProvider == null) { listPageSortableDataProvider = new MyListPageSortableDataProvider<O>(sortParam, secondSortParam, this); } return listPageSortableDataProvider; }
Example #28
Source File: Flowable.java From syncope with Apache License 2.0 | 5 votes |
@Override public Iterator<UserRequest> iterator(final long first, final long count) { final int page = ((int) first / paginatorRows); return UserRequestRestClient.getUserRequests((page < 0 ? 0 : page) + 1, paginatorRows, SyncopeEnduserSession.get().getSelfTO().getUsername(), new SortParam<>(sortParam, true)).iterator(); }
Example #29
Source File: AbstractListPage.java From projectforge-webapp with GNU General Public License v3.0 | 5 votes |
/** * Later: Try AjaxFallBackDatatable again. * @param columns * @param sortProperty * @param ascending * @return */ protected DataTable<O, String> createDataTable(final List<IColumn<O, String>> columns, final String sortProperty, final SortOrder sortOrder) { final int pageSize = form.getPageSize(); final SortParam<String> sortParam = sortProperty != null ? new SortParam<String>(sortProperty, sortOrder == SortOrder.ASCENDING) : null; return new DefaultDataTable<O, String>("table", columns, createSortableDataProvider(sortParam), pageSize); // return new AjaxFallbackDefaultDataTable<O>("table", columns, createSortableDataProvider(sortProperty, ascending), pageSize); }
Example #30
Source File: UserRequestRestClient.java From syncope with Apache License 2.0 | 5 votes |
public static List<UserRequest> getUserRequests( final int page, final int size, final String username, final SortParam<String> sort) { return getService(UserRequestService.class).list(new UserRequestQuery.Builder(). user(StringUtils.isBlank(username) ? SyncopeEnduserSession.get().getSelfTO().getUsername() : username). page(page).size(size).build()).getResult(); }