1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.exoplatform.services.wcm.publication;
18
19 import java.util.ArrayList;
20
21 import org.exoplatform.services.wcm.core.NodeLocation;
22 import org.exoplatform.services.wcm.utils.WCMCoreUtils;
23
24
25
26
27
28
29
30 @SuppressWarnings({ "deprecation", "unchecked" })
31 public class NodeLocationPaginatedResultIterator extends PaginatedResultIterator {
32
33 public NodeLocationPaginatedResultIterator(int pageSize) {
34 super(pageSize);
35 }
36
37 public NodeLocationPaginatedResultIterator(Result result, int pageSize) {
38 super(result, pageSize);
39 }
40
41
42
43
44 protected void populateCurrentPage(int page) throws Exception {
45 if(page == currentPage_) {
46 if(currentListPage_ != null)
47 return;
48 }
49 currentListPage_ = new ArrayList();
50
51 WCMComposer composer = WCMCoreUtils.getService(WCMComposer.class);
52 result.getFiltersDescriber().put(WCMComposer.FILTER_LIMIT, ""+this.getPageSize());
53 result.getFiltersDescriber().put(WCMComposer.FILTER_OFFSET, ""+(this.getPageSize()*(page-1)));
54 result.getFiltersDescriber().put(WCMComposer.FILTER_TOTAL, ""+this.result.getNumTotal());
55 result = composer.getPaginatedContents(result.getNodeLocationDescriber(),
56 result.getFiltersDescriber(),
57 WCMCoreUtils.getUserSessionProvider());
58
59 currentListPage_ = NodeLocation.getLocationsByNodeList(result.getNodes());
60
61 currentPage_ = page;
62 }
63
64 }