private void deleteArchivedComments(final long processInstanceId) throws SBonitaException { final List<FilterOption> filters = Collections.singletonList(new FilterOption(SAComment.class, BuilderFactory.get(SACommentBuilderFactory.class) .getProcessInstanceIdKey(), processInstanceId)); final List<OrderByOption> orderByOptions = Collections.singletonList(new OrderByOption(SAComment.class, BuilderFactory.get( SACommentBuilderFactory.class).getIdKey(), OrderByType.ASC)); List<SAComment> searchArchivedComments; // fromIndex always will be zero because the elements will be deleted final QueryOptions queryOptions = new QueryOptions(0, 100, orderByOptions, filters, null); do { searchArchivedComments = commentService.searchArchivedComments(queryOptions); for (final SAComment saComment : searchArchivedComments) { archiveService.recordDelete(new DeleteRecord(saComment)); } } while (!searchArchivedComments.isEmpty()); }
private void deleteArchivedComments(final long processInstanceId) throws SBonitaException { final List<FilterOption> filters = Collections.singletonList(new FilterOption(SAComment.class, BuilderFactory.get(SACommentBuilderFactory.class) .getProcessInstanceIdKey(), processInstanceId)); final List<OrderByOption> orderByOptions = Collections.singletonList(new OrderByOption(SAComment.class, BuilderFactory.get( SACommentBuilderFactory.class).getIdKey(), OrderByType.ASC)); List<SAComment> searchArchivedComments; // fromIndex always will be zero because the elements will be deleted final QueryOptions queryOptions = new QueryOptions(0, 100, orderByOptions, filters, null); do { searchArchivedComments = commentService.searchArchivedComments(queryOptions); for (final SAComment saComment : searchArchivedComments) { archiveService.recordDelete(new DeleteRecord(saComment)); } } while (!searchArchivedComments.isEmpty()); }