1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package com.mindtree.techworks.insight.pagination;
25
26 import java.io.Serializable;
27 import java.util.ArrayList;
28 import java.util.List;
29
30 import com.mindtree.techworks.insight.preferences.util.PreferenceInterpreter;
31 import com.mindtree.techworks.insight.spi.LogEvent;
32
33
34
35
36
37
38
39
40
41
42
43 public abstract class PageImpl implements IPage, Serializable{
44
45
46
47
48 private static final long serialVersionUID = -4327725831329417826L;
49
50
51
52
53 private List logEventList;
54
55
56
57
58 private String pageSetNamespace;
59
60
61
62
63 private String pageNamespace;
64
65
66
67
68 private PageSet pageSet;
69
70
71
72
73
74
75
76
77 public List getLogEventList(){
78 return this.logEventList;
79 }
80
81
82
83
84
85
86 public void addLogEvent(LogEvent logEvent){
87 logEventList.add(logEvent);
88 if(logEventList.size() == PreferenceInterpreter.getCachePageSize()){
89 pageSet.thresholdReached();
90
91 }
92 }
93
94
95
96
97
98 public void init(PageSet set){
99 this.pageSet = set;
100 this.pageSetNamespace = pageSet.getNamespace();
101 this.pageNamespace = String.valueOf(pageSet.getPageCnt());
102 this.logEventList = new ArrayList();
103 }
104
105
106
107
108
109 protected abstract void store();
110
111
112
113
114
115 protected abstract void load();
116
117
118
119
120
121 protected abstract void delete();
122
123
124
125
126 public String getPageNamespace() {
127 return this.pageNamespace;
128 }
129
130
131
132
133 public String getPageSetNamespace() {
134 return this.pageSetNamespace;
135 }
136
137
138
139
140 public void setPageNamespace(String string) {
141 this.pageNamespace = string;
142 }
143
144
145
146
147 public void setPageSetNamespace(String string) {
148 this.pageSetNamespace = string;
149 }
150
151
152
153
154
155 protected void setLogEventList(List eventList) {
156 this.logEventList = eventList;
157 }
158
159
160
161
162
163 public void clear(){
164 logEventList.clear();
165 logEventList = null;
166 }
167 }