| 479 |
rajveer |
1 |
package in.shop2020.metamodel.util;
|
|
|
2 |
|
|
|
3 |
import in.shop2020.metamodel.core.Entity;
|
| 1050 |
rajveer |
4 |
import in.shop2020.metamodel.core.EntityState;
|
| 7286 |
amit.gupta |
5 |
import in.shop2020.metamodel.core.ExpertReview;
|
|
|
6 |
import in.shop2020.metamodel.core.ExpertReviewSource;
|
| 1153 |
rajveer |
7 |
import in.shop2020.metamodel.core.Feature;
|
| 2275 |
rajveer |
8 |
import in.shop2020.metamodel.core.Helpdoc;
|
| 1153 |
rajveer |
9 |
import in.shop2020.metamodel.core.Slide;
|
| 7286 |
amit.gupta |
10 |
import in.shop2020.metamodel.core.SpecialPage;
|
| 1165 |
rajveer |
11 |
import in.shop2020.metamodel.definitions.Catalog;
|
|
|
12 |
import in.shop2020.metamodel.definitions.Category;
|
|
|
13 |
import in.shop2020.metamodel.definitions.CategorySlideDefinition;
|
| 1050 |
rajveer |
14 |
import in.shop2020.storage.bdb.StorageManager;
|
| 1584 |
chandransh |
15 |
import in.shop2020.util.Utils;
|
| 479 |
rajveer |
16 |
|
| 1584 |
chandransh |
17 |
import java.io.File;
|
| 479 |
rajveer |
18 |
import java.io.PrintWriter;
|
|
|
19 |
import java.io.StringWriter;
|
|
|
20 |
import java.io.Writer;
|
| 1153 |
rajveer |
21 |
import java.util.ArrayList;
|
| 1050 |
rajveer |
22 |
import java.util.Collection;
|
| 7286 |
amit.gupta |
23 |
import java.util.Date;
|
|
|
24 |
import java.util.HashMap;
|
|
|
25 |
import java.util.HashSet;
|
| 479 |
rajveer |
26 |
import java.util.List;
|
|
|
27 |
import java.util.Map;
|
| 7286 |
amit.gupta |
28 |
import java.util.Set;
|
| 479 |
rajveer |
29 |
|
|
|
30 |
/**
|
| 1154 |
rajveer |
31 |
* All storage and retrival utility methods
|
| 1050 |
rajveer |
32 |
* @author rajveer
|
| 479 |
rajveer |
33 |
*
|
|
|
34 |
*/
|
|
|
35 |
public class CreationUtils {
|
| 1050 |
rajveer |
36 |
|
|
|
37 |
private static final String LEARNED_BULLETS = "LEARNED_BULLETS";
|
|
|
38 |
private static final String DEFAULT_ENTITY_SCORES = "DEFAULT_ENTITY_SCORES";
|
|
|
39 |
private static final String FACET_VALUES = "FACET_VALUES";
|
|
|
40 |
private static final String SLIDE_SCORES = "SLIDE_SCORES";
|
| 1443 |
rajveer |
41 |
private static final String CONTENT_GENERATION_TIME = "CONTENT_GENERATION_TIME";
|
| 2094 |
rajveer |
42 |
private static final String INCONSISTENT_ENTITIES = "INCONSISTENT_ENTITIES";
|
| 2471 |
rajveer |
43 |
private static final String HELPDOC_ENTITYIDS = "HELPDOC_ENTITYIDS";
|
| 2651 |
rajveer |
44 |
private static final String RELATED_ACCESSORIES = "RELATED_ACCESSORIES";
|
| 2733 |
rajveer |
45 |
private static final String COMPARISON_STATS = "COMPARISON_STATS";
|
| 5600 |
amit.gupta |
46 |
private static final String SEARCH_STATS = "SEARCH_STATS";
|
| 5074 |
amit.gupta |
47 |
private static final String SYNONYMS = "SYNONYMS";
|
| 7286 |
amit.gupta |
48 |
private static final String EXPERT_REVIEWS = "EXPERT_REVIEWS";
|
|
|
49 |
private static final String EXPERT_REVIEW_SOURCES = "EXPERT_REVIEW_SOURCES";
|
| 2275 |
rajveer |
50 |
private static long helpDocId;
|
| 2838 |
mandeep.dh |
51 |
private static long specialPageId;
|
| 479 |
rajveer |
52 |
|
|
|
53 |
/**
|
|
|
54 |
*
|
| 1050 |
rajveer |
55 |
* @param aThrowable
|
| 479 |
rajveer |
56 |
* @return
|
|
|
57 |
*/
|
| 1050 |
rajveer |
58 |
public static String getStackTrace(Throwable aThrowable) {
|
|
|
59 |
final Writer result = new StringWriter();
|
|
|
60 |
final PrintWriter printWriter = new PrintWriter(result);
|
|
|
61 |
aThrowable.printStackTrace(printWriter);
|
|
|
62 |
return result.toString();
|
| 479 |
rajveer |
63 |
}
|
|
|
64 |
|
| 2094 |
rajveer |
65 |
/**
|
|
|
66 |
*
|
|
|
67 |
* @param entity
|
|
|
68 |
* @throws Exception
|
|
|
69 |
*/
|
|
|
70 |
public static void storeInconsistentEntities(List<Long> inconsistentEntities) throws Exception {
|
|
|
71 |
StorageManager.getStorageManager().storeDataObject(CreationUtils.INCONSISTENT_ENTITIES, inconsistentEntities);
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
/**
|
|
|
75 |
*
|
|
|
76 |
* @return
|
|
|
77 |
* @throws Exception
|
|
|
78 |
*/
|
|
|
79 |
@SuppressWarnings("unchecked")
|
|
|
80 |
public static List<Long> getInconsistentEntities() throws Exception {
|
|
|
81 |
return (List<Long>) StorageManager.getStorageManager().getDataObject(CreationUtils.INCONSISTENT_ENTITIES);
|
|
|
82 |
}
|
|
|
83 |
|
|
|
84 |
/**
|
|
|
85 |
*
|
|
|
86 |
* @param entity
|
|
|
87 |
* @throws Exception
|
|
|
88 |
*/
|
|
|
89 |
public static void storeLearnedBullets(Map<Long, List<ExpandedBullet>> learnedBullets) throws Exception {
|
|
|
90 |
StorageManager.getStorageManager().storeDataObject(CreationUtils.LEARNED_BULLETS, learnedBullets);
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
/**
|
|
|
94 |
*
|
|
|
95 |
* @return
|
|
|
96 |
* @throws Exception
|
|
|
97 |
*/
|
|
|
98 |
@SuppressWarnings("unchecked")
|
|
|
99 |
public static Map<Long, List<ExpandedBullet>> getLearnedBullets() throws Exception {
|
|
|
100 |
return (Map<Long, List<ExpandedBullet>>) StorageManager.getStorageManager().getDataObject(CreationUtils.LEARNED_BULLETS);
|
|
|
101 |
}
|
|
|
102 |
|
| 2471 |
rajveer |
103 |
/**
|
|
|
104 |
*
|
|
|
105 |
* @param entity
|
|
|
106 |
* @throws Exception
|
|
|
107 |
*/
|
|
|
108 |
public static void storeHelpdocEntityIds(Map<Long, List<Long>> helpdocEntityIds) throws Exception {
|
|
|
109 |
StorageManager.getStorageManager().storeDataObject(CreationUtils.HELPDOC_ENTITYIDS, helpdocEntityIds);
|
|
|
110 |
}
|
|
|
111 |
|
|
|
112 |
/**
|
|
|
113 |
*
|
|
|
114 |
* @return
|
|
|
115 |
* @throws Exception
|
|
|
116 |
*/
|
|
|
117 |
@SuppressWarnings("unchecked")
|
|
|
118 |
public static Map<Long, List<Long>> getHelpdocEntityIds() throws Exception {
|
|
|
119 |
return (Map<Long, List<Long>>) StorageManager.getStorageManager().getDataObject(CreationUtils.HELPDOC_ENTITYIDS);
|
|
|
120 |
}
|
|
|
121 |
|
| 2651 |
rajveer |
122 |
|
|
|
123 |
/**
|
|
|
124 |
*
|
|
|
125 |
* @param entity
|
|
|
126 |
* @throws Exception
|
|
|
127 |
*/
|
|
|
128 |
public static void storeRelatedAccessories(Map<Long, Map<Long, List<Long>>> relatedAccessories) throws Exception {
|
|
|
129 |
StorageManager.getStorageManager().storeDataObject(CreationUtils.RELATED_ACCESSORIES, relatedAccessories);
|
|
|
130 |
}
|
| 2471 |
rajveer |
131 |
|
| 5074 |
amit.gupta |
132 |
/**
|
|
|
133 |
*
|
|
|
134 |
* @param Synonym that contains map of brand/category name as keys and their synonyms as values.
|
|
|
135 |
* @throws Exception
|
|
|
136 |
*/
|
|
|
137 |
@SuppressWarnings("unchecked")
|
|
|
138 |
public static Map<String, Map<String, String>> getSynonyms() throws Exception {
|
|
|
139 |
return (Map<String, Map<String,String>>)StorageManager.getStorageManager().getDataObject(CreationUtils.SYNONYMS);
|
|
|
140 |
}
|
|
|
141 |
|
|
|
142 |
/**
|
|
|
143 |
*
|
|
|
144 |
* @param Synonym that contains map of brand/category name as keys and their synonyms as values.
|
|
|
145 |
* @throws Exception
|
|
|
146 |
*/
|
|
|
147 |
public static void storeSynonyms(Map<String, Map<String, String>> synonyms) throws Exception {
|
|
|
148 |
StorageManager.getStorageManager().storeDataObject(CreationUtils.SYNONYMS, synonyms);
|
|
|
149 |
}
|
|
|
150 |
|
| 7286 |
amit.gupta |
151 |
|
|
|
152 |
/**
|
|
|
153 |
*
|
|
|
154 |
* @param Synonym that contains map of brand/category name as keys and their synonyms as values.
|
|
|
155 |
* @throws Exception
|
|
|
156 |
*/
|
|
|
157 |
@SuppressWarnings("unchecked")
|
|
|
158 |
public static Map<Long, List<ExpertReview>> getExpertReviews() throws Exception {
|
|
|
159 |
return (Map<Long, List<ExpertReview>>)StorageManager.getStorageManager().getDataObject(CreationUtils.EXPERT_REVIEWS);
|
|
|
160 |
}
|
|
|
161 |
|
|
|
162 |
/**
|
|
|
163 |
*
|
|
|
164 |
* @param Synonym that contains map of brand/category name as keys and their synonyms as values.
|
|
|
165 |
* @throws Exception
|
|
|
166 |
*/
|
|
|
167 |
@SuppressWarnings("unchecked")
|
|
|
168 |
public static List<ExpertReview> getExpertReviewByEntity(long entityId) throws Exception {
|
|
|
169 |
return ((Map<Long, List<ExpertReview>>)StorageManager.getStorageManager().getDataObject(CreationUtils.EXPERT_REVIEWS)).get(entityId);
|
|
|
170 |
}
|
|
|
171 |
|
|
|
172 |
public static Set<ExpertReviewSource> getExpertReviewSources() throws Exception {
|
|
|
173 |
return (Set<ExpertReviewSource>)StorageManager.getStorageManager().getDataObject(CreationUtils.EXPERT_REVIEW_SOURCES);
|
|
|
174 |
}
|
|
|
175 |
|
|
|
176 |
public static void addExpertReviewSource(ExpertReviewSource expertReviewSource) throws Exception {
|
|
|
177 |
Set<ExpertReviewSource> expertReviewSources = (Set<ExpertReviewSource>)StorageManager.getStorageManager().getDataObject(CreationUtils.EXPERT_REVIEW_SOURCES);
|
|
|
178 |
if(expertReviewSources == null){
|
|
|
179 |
expertReviewSources = new HashSet<ExpertReviewSource>();
|
|
|
180 |
}
|
|
|
181 |
expertReviewSources.add(expertReviewSource);
|
|
|
182 |
StorageManager.getStorageManager().storeDataObject(CreationUtils.EXPERT_REVIEW_SOURCES, expertReviewSources);
|
|
|
183 |
|
|
|
184 |
}
|
|
|
185 |
|
|
|
186 |
public static void deleteExpertReviewSource(ExpertReviewSource expertReviewSource) throws Exception {
|
|
|
187 |
Set<ExpertReviewSource> expertReviewSources = (Set<ExpertReviewSource>)StorageManager.getStorageManager().getDataObject(CreationUtils.EXPERT_REVIEW_SOURCES);
|
|
|
188 |
expertReviewSources.remove(expertReviewSource);
|
|
|
189 |
StorageManager.getStorageManager().storeDataObject(CreationUtils.EXPERT_REVIEW_SOURCES, expertReviewSources);
|
|
|
190 |
|
|
|
191 |
}
|
|
|
192 |
|
|
|
193 |
/**
|
|
|
194 |
*
|
|
|
195 |
* @param Synonym that contains map of brand/category name as keys and their synonyms as values.
|
|
|
196 |
* @throws Exception
|
|
|
197 |
*/
|
|
|
198 |
public static void storeExpertReview(long entityId, ExpertReview expertReview) throws Exception {
|
|
|
199 |
Map<Long, List<ExpertReview>> expertReviewMap = (Map<Long, List<ExpertReview>>)StorageManager.getStorageManager().getDataObject(CreationUtils.EXPERT_REVIEWS);
|
|
|
200 |
if(expertReviewMap == null){
|
|
|
201 |
expertReviewMap = new HashMap<Long, List<ExpertReview>>();
|
|
|
202 |
}
|
|
|
203 |
EntityState es = CreationUtils.getEntityState(entityId);
|
|
|
204 |
es.setMerkedReadyOn(new Date());
|
|
|
205 |
CreationUtils.updateEntityState(es);
|
|
|
206 |
List<ExpertReview> er = expertReviewMap.get(entityId);
|
|
|
207 |
if(er == null) {
|
|
|
208 |
er = new ArrayList<ExpertReview>();
|
|
|
209 |
expertReviewMap.put(entityId, er);
|
|
|
210 |
}
|
|
|
211 |
er.add(expertReview);
|
|
|
212 |
|
|
|
213 |
StorageManager.getStorageManager().storeDataObject(CreationUtils.EXPERT_REVIEWS, expertReviewMap);
|
|
|
214 |
}
|
|
|
215 |
|
|
|
216 |
public static void storeExpertReview(long entityId, List<ExpertReview> expertReviews) throws Exception {
|
|
|
217 |
Map<Long, List<ExpertReview>> expertReviewMap = (Map<Long, List<ExpertReview>>)StorageManager.getStorageManager().getDataObject(CreationUtils.EXPERT_REVIEWS);
|
|
|
218 |
expertReviewMap.put(entityId, expertReviews);
|
|
|
219 |
StorageManager.getStorageManager().storeDataObject(CreationUtils.EXPERT_REVIEWS, expertReviewMap);
|
|
|
220 |
}
|
|
|
221 |
|
|
|
222 |
public static void deleteExpertReview(long entityId, int index) throws Exception {
|
|
|
223 |
Map<Long, List<ExpertReview>> expertReviewMap = (Map<Long, List<ExpertReview>>)StorageManager.getStorageManager().getDataObject(CreationUtils.EXPERT_REVIEWS);
|
|
|
224 |
List<ExpertReview> er = expertReviewMap.get(entityId);
|
|
|
225 |
er.remove(index);
|
|
|
226 |
EntityState es = CreationUtils.getEntityState(entityId);
|
|
|
227 |
es.setMerkedReadyOn(new Date());
|
|
|
228 |
CreationUtils.updateEntityState(es);
|
|
|
229 |
|
|
|
230 |
StorageManager.getStorageManager().storeDataObject(CreationUtils.EXPERT_REVIEWS, expertReviewMap);
|
|
|
231 |
}
|
|
|
232 |
|
|
|
233 |
/**
|
|
|
234 |
*
|
|
|
235 |
* @param Synonym that contains map of brand/category name as keys and their synonyms as values.
|
|
|
236 |
* @throws Exception
|
|
|
237 |
*/
|
|
|
238 |
public static void deleteExpertReviews(long entityId) throws Exception {
|
|
|
239 |
Map<Long, List<ExpertReview>> expertReviewMap = (Map<Long, List<ExpertReview>>)StorageManager.getStorageManager().getDataObject(CreationUtils.EXPERT_REVIEWS);
|
|
|
240 |
expertReviewMap.remove(entityId);
|
|
|
241 |
EntityState es = CreationUtils.getEntityState(entityId);
|
|
|
242 |
es.setMerkedReadyOn(new Date());
|
|
|
243 |
CreationUtils.updateEntityState(es);
|
|
|
244 |
StorageManager.getStorageManager().storeDataObject(CreationUtils.EXPERT_REVIEWS, expertReviewMap);
|
|
|
245 |
}
|
|
|
246 |
|
| 2651 |
rajveer |
247 |
|
|
|
248 |
/**
|
|
|
249 |
*
|
|
|
250 |
* @return
|
|
|
251 |
* @throws Exception
|
|
|
252 |
*/
|
|
|
253 |
@SuppressWarnings("unchecked")
|
|
|
254 |
public static Map<Long, Map<Long, List<Long>>> getRelatedAccessories() throws Exception {
|
|
|
255 |
return (Map<Long, Map<Long, List<Long>>>) StorageManager.getStorageManager().getDataObject(CreationUtils.RELATED_ACCESSORIES);
|
|
|
256 |
}
|
|
|
257 |
|
| 2733 |
rajveer |
258 |
|
|
|
259 |
/**
|
|
|
260 |
*
|
|
|
261 |
* @param entity
|
|
|
262 |
* @throws Exception
|
|
|
263 |
*/
|
|
|
264 |
public static void storeComparisonStats(Map<Long, Map<Long, Long>> comparisonStats) throws Exception {
|
|
|
265 |
StorageManager.getStorageManager().storeDataObject(CreationUtils.COMPARISON_STATS, comparisonStats);
|
|
|
266 |
}
|
| 2651 |
rajveer |
267 |
|
| 2733 |
rajveer |
268 |
|
|
|
269 |
/**
|
|
|
270 |
*
|
|
|
271 |
* @return
|
|
|
272 |
* @throws Exception
|
|
|
273 |
*/
|
|
|
274 |
@SuppressWarnings("unchecked")
|
|
|
275 |
public static Map<Long, Map<Long, Long>> getComparisonStats() throws Exception {
|
|
|
276 |
return (Map<Long, Map<Long, Long>>) StorageManager.getStorageManager().getDataObject(CreationUtils.COMPARISON_STATS);
|
|
|
277 |
}
|
| 5600 |
amit.gupta |
278 |
|
|
|
279 |
/**
|
|
|
280 |
*
|
|
|
281 |
* @param entity
|
|
|
282 |
* @throws Exception
|
|
|
283 |
*/
|
|
|
284 |
public static void storeSearchStats(String date, List<String> searchStats) throws Exception {
|
|
|
285 |
StorageManager.getStorageManager().storeDataObject(CreationUtils.SEARCH_STATS + date, searchStats);
|
|
|
286 |
}
|
| 2733 |
rajveer |
287 |
|
| 5600 |
amit.gupta |
288 |
/**
|
|
|
289 |
*
|
|
|
290 |
* @param entity
|
|
|
291 |
* @throws Exception
|
|
|
292 |
*/
|
|
|
293 |
public static void deleteSearchStats(String date) throws Exception {
|
|
|
294 |
StorageManager.getStorageManager().deleteDataObject(CreationUtils.SEARCH_STATS + date);
|
|
|
295 |
}
|
|
|
296 |
|
|
|
297 |
|
|
|
298 |
/**
|
|
|
299 |
*
|
|
|
300 |
* @return
|
|
|
301 |
* @throws Exception
|
|
|
302 |
*/
|
|
|
303 |
@SuppressWarnings("unchecked")
|
|
|
304 |
public static List<String> getSearchStats(String date) throws Exception {
|
|
|
305 |
return (List<String>) StorageManager.getStorageManager().getDataObject(CreationUtils.SEARCH_STATS + date);
|
|
|
306 |
}
|
|
|
307 |
|
| 479 |
rajveer |
308 |
/**
|
|
|
309 |
*
|
| 1154 |
rajveer |
310 |
* @param featureDefinitionID
|
|
|
311 |
* @return
|
|
|
312 |
* @throws Exception
|
|
|
313 |
*/
|
| 1050 |
rajveer |
314 |
@SuppressWarnings("unchecked")
|
|
|
315 |
public static List<ExpandedBullet> getLearnedBullets(long featureDefinitionID) throws Exception {
|
|
|
316 |
Map<Long, List<ExpandedBullet>> learnedBullets = (Map<Long, List<ExpandedBullet>>) StorageManager.getStorageManager().getDataObject(CreationUtils.LEARNED_BULLETS);
|
|
|
317 |
if(learnedBullets==null){
|
|
|
318 |
return null;
|
| 479 |
rajveer |
319 |
}
|
| 1050 |
rajveer |
320 |
return learnedBullets.get(featureDefinitionID);
|
| 479 |
rajveer |
321 |
}
|
| 1050 |
rajveer |
322 |
|
| 1154 |
rajveer |
323 |
/**
|
|
|
324 |
*
|
|
|
325 |
* @param facetIDFacetValues
|
|
|
326 |
* @throws Exception
|
|
|
327 |
*/
|
| 1050 |
rajveer |
328 |
public static void storeFacetValues(Map<Long, List<String>> facetIDFacetValues) throws Exception {
|
|
|
329 |
StorageManager.getStorageManager().storeDataObject(CreationUtils.FACET_VALUES, facetIDFacetValues);
|
| 479 |
rajveer |
330 |
}
|
| 1050 |
rajveer |
331 |
|
| 1154 |
rajveer |
332 |
/**
|
|
|
333 |
*
|
|
|
334 |
* @return
|
|
|
335 |
* @throws Exception
|
|
|
336 |
*/
|
| 1050 |
rajveer |
337 |
@SuppressWarnings("unchecked")
|
|
|
338 |
public static Map<Long, List<String>> getFacetValues() throws Exception {
|
|
|
339 |
return (Map<Long, List<String>>) StorageManager.getStorageManager().getDataObject(CreationUtils.FACET_VALUES);
|
| 479 |
rajveer |
340 |
}
|
|
|
341 |
|
| 1154 |
rajveer |
342 |
/**
|
|
|
343 |
*
|
|
|
344 |
* @param facetDefinitionID
|
|
|
345 |
* @return
|
|
|
346 |
* @throws Exception
|
|
|
347 |
*/
|
| 1050 |
rajveer |
348 |
@SuppressWarnings("unchecked")
|
|
|
349 |
public static List<String> getFacetValues(long facetDefinitionID) throws Exception {
|
|
|
350 |
Map<Long, List<String>> facetValues = (Map<Long, List<String>>) StorageManager.getStorageManager().getDataObject(CreationUtils.FACET_VALUES);
|
|
|
351 |
return facetValues.get(facetDefinitionID);
|
| 479 |
rajveer |
352 |
}
|
| 1050 |
rajveer |
353 |
|
| 1154 |
rajveer |
354 |
/**
|
|
|
355 |
*
|
|
|
356 |
* @param slideScoresByEntity
|
|
|
357 |
* @throws Exception
|
|
|
358 |
*/
|
| 1929 |
rajveer |
359 |
public static void storeSlideScores( Map<Long, Map<Long, Double>> slideScoresByEntity) throws Exception {
|
| 1050 |
rajveer |
360 |
StorageManager.getStorageManager().storeDataObject(CreationUtils.SLIDE_SCORES, slideScoresByEntity);
|
|
|
361 |
}
|
|
|
362 |
|
| 1154 |
rajveer |
363 |
/**
|
|
|
364 |
*
|
|
|
365 |
* @return
|
|
|
366 |
* @throws Exception
|
|
|
367 |
*/
|
| 479 |
rajveer |
368 |
@SuppressWarnings("unchecked")
|
| 1929 |
rajveer |
369 |
public static Map<Long, Map<Long, Double>> getSlideScores() throws Exception {
|
|
|
370 |
return (Map<Long, Map<Long, Double>>) StorageManager.getStorageManager().getDataObject(CreationUtils.SLIDE_SCORES);
|
| 479 |
rajveer |
371 |
}
|
|
|
372 |
|
| 1154 |
rajveer |
373 |
/**
|
|
|
374 |
*
|
|
|
375 |
* @param entityID
|
|
|
376 |
* @return
|
|
|
377 |
* @throws Exception
|
|
|
378 |
*/
|
| 1050 |
rajveer |
379 |
@SuppressWarnings("unchecked")
|
| 1929 |
rajveer |
380 |
public static Map<Long, Double> getSlideComparisonScores(long entityID) throws Exception{
|
|
|
381 |
Map<Long, Map<Long, Double>> slideScores = (Map<Long, Map<Long, Double>>) StorageManager.getStorageManager().getDataObject(CreationUtils.SLIDE_SCORES);
|
| 1050 |
rajveer |
382 |
return slideScores.get(entityID);
|
| 479 |
rajveer |
383 |
}
|
|
|
384 |
|
| 1050 |
rajveer |
385 |
|
| 1154 |
rajveer |
386 |
/**
|
|
|
387 |
*
|
|
|
388 |
* @param finalScoreByEntityID
|
|
|
389 |
* @throws Exception
|
|
|
390 |
*/
|
| 1929 |
rajveer |
391 |
public static void storeDefaultEntityScores(Map<Long, Double> finalScoreByEntityID) throws Exception {
|
| 1050 |
rajveer |
392 |
StorageManager.getStorageManager().storeDataObject(CreationUtils.DEFAULT_ENTITY_SCORES, finalScoreByEntityID);
|
| 479 |
rajveer |
393 |
}
|
|
|
394 |
|
| 1154 |
rajveer |
395 |
/**
|
|
|
396 |
*
|
|
|
397 |
* @return
|
|
|
398 |
* @throws Exception
|
|
|
399 |
*/
|
| 1050 |
rajveer |
400 |
@SuppressWarnings("unchecked")
|
|
|
401 |
public static Map<Long, Integer> getDefaultEntityScores() throws Exception {
|
|
|
402 |
return (Map<Long, Integer>) StorageManager.getStorageManager().getDataObject(CreationUtils.DEFAULT_ENTITY_SCORES);
|
| 479 |
rajveer |
403 |
}
|
|
|
404 |
|
| 1154 |
rajveer |
405 |
/**
|
|
|
406 |
*
|
|
|
407 |
* @param entityID
|
|
|
408 |
* @return
|
|
|
409 |
* @throws Exception
|
|
|
410 |
*/
|
| 1050 |
rajveer |
411 |
@SuppressWarnings("unchecked")
|
|
|
412 |
public static Integer getEntityComparisonScores(long entityID) throws Exception {
|
|
|
413 |
Map<Long, Integer> scoresMap = (Map<Long, Integer>) StorageManager.getStorageManager().getDataObject(CreationUtils.DEFAULT_ENTITY_SCORES);
|
|
|
414 |
Integer objScore = scoresMap.get(entityID);
|
|
|
415 |
if(objScore==null){
|
|
|
416 |
return -1;
|
| 479 |
rajveer |
417 |
}
|
| 1050 |
rajveer |
418 |
return objScore;
|
| 479 |
rajveer |
419 |
}
|
|
|
420 |
|
|
|
421 |
|
| 1443 |
rajveer |
422 |
/**
|
|
|
423 |
*
|
|
|
424 |
* @return
|
|
|
425 |
* @throws Exception
|
|
|
426 |
*/
|
|
|
427 |
public static Long getLastContentGenerationTime() throws Exception {
|
|
|
428 |
return (Long) StorageManager.getStorageManager().getDataObject(CreationUtils.CONTENT_GENERATION_TIME);
|
|
|
429 |
}
|
| 479 |
rajveer |
430 |
|
|
|
431 |
/**
|
| 1443 |
rajveer |
432 |
*
|
|
|
433 |
* @param storageTime
|
|
|
434 |
* @throws Exception
|
|
|
435 |
*/
|
|
|
436 |
public static void storeLastContentGenerationTime(Long storageTime) throws Exception {
|
|
|
437 |
StorageManager.getStorageManager().storeDataObject(CreationUtils.CONTENT_GENERATION_TIME, storageTime);
|
|
|
438 |
}
|
|
|
439 |
/**
|
| 1050 |
rajveer |
440 |
* Resolves Entity ID into Entity object
|
| 479 |
rajveer |
441 |
*
|
|
|
442 |
* @param entityID
|
| 1050 |
rajveer |
443 |
* @return Entity
|
|
|
444 |
* @throws Exception
|
| 479 |
rajveer |
445 |
*/
|
| 1050 |
rajveer |
446 |
public static Entity getEntity(long entityID) throws Exception{
|
|
|
447 |
return StorageManager.getStorageManager().getEntity(entityID);
|
| 479 |
rajveer |
448 |
}
|
|
|
449 |
|
| 1154 |
rajveer |
450 |
/**
|
|
|
451 |
*
|
|
|
452 |
* @param entity
|
|
|
453 |
* @throws Exception
|
|
|
454 |
*/
|
| 1050 |
rajveer |
455 |
public static void updateEntity(Entity entity) throws Exception {
|
| 2471 |
rajveer |
456 |
//FIXME This should not happen here.
|
| 1379 |
rajveer |
457 |
entity.reorderSlides(entity.getSlideSequence());
|
| 2471 |
rajveer |
458 |
CreationUtils.learn(entity);
|
| 1050 |
rajveer |
459 |
StorageManager.getStorageManager().updateEntity(entity);
|
| 1226 |
rajveer |
460 |
|
| 1379 |
rajveer |
461 |
|
| 2471 |
rajveer |
462 |
|
| 479 |
rajveer |
463 |
}
|
|
|
464 |
|
| 1154 |
rajveer |
465 |
/**
|
|
|
466 |
*
|
|
|
467 |
* @param entity
|
|
|
468 |
* @param entityMetadata
|
|
|
469 |
* @throws Exception
|
|
|
470 |
*/
|
| 1050 |
rajveer |
471 |
public static void createEntity(Entity entity, EntityState entityMetadata) throws Exception {
|
| 1584 |
chandransh |
472 |
/*
|
|
|
473 |
* Creating media directory by default. Even if there is no media uploaded yet.
|
|
|
474 |
*/
|
|
|
475 |
String mediaDirPath = Utils.CONTENT_DB_PATH + "media" + File.separator + entity.getID();
|
|
|
476 |
File mediaDir = new File(mediaDirPath);
|
|
|
477 |
if(!mediaDir.exists()) {
|
|
|
478 |
mediaDir.mkdir();
|
|
|
479 |
}
|
| 1050 |
rajveer |
480 |
StorageManager.getStorageManager().createEntity(entity, entityMetadata);
|
| 479 |
rajveer |
481 |
}
|
| 1050 |
rajveer |
482 |
|
| 1154 |
rajveer |
483 |
/**
|
|
|
484 |
*
|
|
|
485 |
* @param entityId
|
|
|
486 |
* @throws Exception
|
|
|
487 |
*/
|
| 1050 |
rajveer |
488 |
public static void deleteEntity(long entityId) throws Exception {
|
|
|
489 |
StorageManager.getStorageManager().deleteEntity(entityId);
|
| 479 |
rajveer |
490 |
}
|
|
|
491 |
|
| 1050 |
rajveer |
492 |
|
| 1154 |
rajveer |
493 |
/**
|
|
|
494 |
*
|
|
|
495 |
* @return
|
|
|
496 |
* @throws Exception
|
|
|
497 |
*/
|
| 1050 |
rajveer |
498 |
public static Map<Long, EntityState> getEntitiesState() throws Exception {
|
|
|
499 |
return StorageManager.getStorageManager().getEntitiesMetadata();
|
| 479 |
rajveer |
500 |
}
|
|
|
501 |
|
| 1154 |
rajveer |
502 |
/**
|
|
|
503 |
*
|
|
|
504 |
* @param entityId
|
|
|
505 |
* @return
|
|
|
506 |
* @throws Exception
|
|
|
507 |
*/
|
| 1050 |
rajveer |
508 |
public static EntityState getEntityState(long entityId) throws Exception {
|
|
|
509 |
return StorageManager.getStorageManager().getEntityMetadata(entityId);
|
|
|
510 |
}
|
| 479 |
rajveer |
511 |
|
| 1154 |
rajveer |
512 |
/**
|
|
|
513 |
*
|
|
|
514 |
* @param entityMetadata
|
|
|
515 |
* @throws Exception
|
|
|
516 |
*/
|
| 1050 |
rajveer |
517 |
public static void updateEntityState(EntityState entityMetadata) throws Exception {
|
|
|
518 |
StorageManager.getStorageManager().updateEntityMetadata(entityMetadata);
|
| 479 |
rajveer |
519 |
}
|
| 1050 |
rajveer |
520 |
|
| 1154 |
rajveer |
521 |
/**
|
|
|
522 |
*
|
|
|
523 |
* @param entity
|
|
|
524 |
* @throws Exception
|
|
|
525 |
*/
|
| 1050 |
rajveer |
526 |
private static void learn(Entity entity) throws Exception{
|
|
|
527 |
CN cn = new CN();
|
| 2471 |
rajveer |
528 |
cn.learn(entity);
|
|
|
529 |
cn.learnHelpdocs(entity);
|
| 1050 |
rajveer |
530 |
}
|
|
|
531 |
|
| 1154 |
rajveer |
532 |
/**
|
|
|
533 |
*
|
|
|
534 |
* @return
|
|
|
535 |
* @throws Exception
|
|
|
536 |
*/
|
| 1050 |
rajveer |
537 |
public static Map<Long, Entity> getEntities() throws Exception {
|
|
|
538 |
return StorageManager.getStorageManager().getEntities();
|
|
|
539 |
}
|
|
|
540 |
|
| 1154 |
rajveer |
541 |
/**
|
|
|
542 |
*
|
|
|
543 |
* @param categoryId
|
|
|
544 |
* @return
|
|
|
545 |
* @throws Exception
|
|
|
546 |
*/
|
| 1050 |
rajveer |
547 |
public static Collection<Entity> getEntities(long categoryId) throws Exception {
|
|
|
548 |
return StorageManager.getStorageManager().getEntitisByCategory(categoryId);
|
|
|
549 |
}
|
| 1153 |
rajveer |
550 |
|
| 2275 |
rajveer |
551 |
|
|
|
552 |
public static void storeHelpdoc(Helpdoc helpdoc) throws Exception {
|
|
|
553 |
StorageManager.getStorageManager().updateHelpdoc(helpdoc);
|
|
|
554 |
}
|
|
|
555 |
|
|
|
556 |
public static Helpdoc getHelpdoc(Long helpdocId) throws Exception {
|
|
|
557 |
return StorageManager.getStorageManager().getHelpdoc(helpdocId);
|
|
|
558 |
}
|
|
|
559 |
|
|
|
560 |
public static Map<Long, Helpdoc> getHelpdocs() throws Exception {
|
|
|
561 |
return StorageManager.getStorageManager().getHelpdocs();
|
|
|
562 |
}
|
| 3485 |
rajveer |
563 |
|
|
|
564 |
public static void deleteHelpdoc(Long helpdocId) throws Exception {
|
|
|
565 |
StorageManager.getStorageManager().deleteHelpdoc(helpdocId);
|
|
|
566 |
}
|
|
|
567 |
|
| 2275 |
rajveer |
568 |
public static long getNewHelpdocId() {
|
|
|
569 |
if(helpDocId == 0){
|
|
|
570 |
helpDocId = 200000;
|
|
|
571 |
Map<Long, Helpdoc> helpdocs = StorageManager.getStorageManager().getHelpdocs();
|
|
|
572 |
if(helpdocs != null){
|
|
|
573 |
for(long id : StorageManager.getStorageManager().getHelpdocs().keySet()){
|
|
|
574 |
if(helpDocId <= id){
|
|
|
575 |
helpDocId = id;
|
|
|
576 |
}
|
|
|
577 |
}
|
|
|
578 |
}
|
|
|
579 |
}
|
|
|
580 |
return ++helpDocId;
|
|
|
581 |
}
|
|
|
582 |
|
|
|
583 |
|
| 1153 |
rajveer |
584 |
/**
|
|
|
585 |
*
|
|
|
586 |
* @param slide
|
|
|
587 |
* @param featureDefinitionID
|
|
|
588 |
* @return Feature
|
|
|
589 |
*/
|
|
|
590 |
public static Feature getFeature(Slide slide, long featureDefinitionID) {
|
|
|
591 |
List<Feature> features = slide.getFeatures();
|
|
|
592 |
|
|
|
593 |
if(features != null) {
|
|
|
594 |
for(Feature feature : features) {
|
|
|
595 |
if(feature.getFeatureDefinitionID() == featureDefinitionID) {
|
|
|
596 |
return feature;
|
|
|
597 |
}
|
|
|
598 |
}
|
|
|
599 |
}
|
|
|
600 |
|
|
|
601 |
Feature feature = null;
|
|
|
602 |
|
|
|
603 |
List<Slide> childrenSlides = slide.getChildrenSlides();
|
|
|
604 |
if(childrenSlides != null) {
|
|
|
605 |
for(Slide childSlide : childrenSlides) {
|
|
|
606 |
|
|
|
607 |
feature = CreationUtils.getFeature(childSlide, featureDefinitionID);
|
|
|
608 |
if(feature == null) {
|
|
|
609 |
continue;
|
|
|
610 |
}
|
|
|
611 |
else {
|
|
|
612 |
break;
|
|
|
613 |
}
|
|
|
614 |
}
|
|
|
615 |
}
|
|
|
616 |
|
|
|
617 |
return feature;
|
|
|
618 |
}
|
| 479 |
rajveer |
619 |
|
| 1153 |
rajveer |
620 |
|
|
|
621 |
/**
|
|
|
622 |
* Utility method to find out Slide object in Entity instance
|
|
|
623 |
*
|
|
|
624 |
* @param entityID
|
|
|
625 |
* @param slideDefinitionID
|
|
|
626 |
* @return
|
|
|
627 |
* @throws Exception
|
|
|
628 |
*/
|
|
|
629 |
public static Slide getSlide(long entityID, long slideDefinitionID)
|
|
|
630 |
throws Exception {
|
|
|
631 |
Entity entity = CreationUtils.getEntity(entityID);
|
|
|
632 |
|
|
|
633 |
List<Slide> slides = entity.getSlides();
|
|
|
634 |
|
|
|
635 |
Slide resultSlide = null;
|
|
|
636 |
|
|
|
637 |
if(slides != null) {
|
|
|
638 |
for(Slide slide : slides) {
|
|
|
639 |
|
|
|
640 |
if(slide.getSlideDefinitionID() == slideDefinitionID) {
|
|
|
641 |
return slide;
|
|
|
642 |
}
|
|
|
643 |
|
|
|
644 |
resultSlide = CreationUtils.getSlide(slide, slideDefinitionID);
|
|
|
645 |
|
|
|
646 |
if(resultSlide == null) {
|
|
|
647 |
continue;
|
|
|
648 |
}
|
|
|
649 |
else {
|
|
|
650 |
break;
|
|
|
651 |
}
|
|
|
652 |
}
|
|
|
653 |
}
|
|
|
654 |
|
|
|
655 |
return resultSlide;
|
|
|
656 |
}
|
|
|
657 |
|
|
|
658 |
|
|
|
659 |
/**
|
|
|
660 |
*
|
|
|
661 |
* @param slide
|
|
|
662 |
* @param slideDefinitionID
|
|
|
663 |
* @return
|
|
|
664 |
*/
|
|
|
665 |
public static Slide getSlide(Slide slide, long slideDefinitionID) {
|
|
|
666 |
|
|
|
667 |
List<Slide> childrenSlides = slide.getChildrenSlides();
|
|
|
668 |
|
|
|
669 |
Slide resultSlide = null;
|
|
|
670 |
|
|
|
671 |
if(childrenSlides != null) {
|
|
|
672 |
for(Slide childSlide : childrenSlides) {
|
|
|
673 |
if(childSlide.getSlideDefinitionID() == slideDefinitionID) {
|
|
|
674 |
return childSlide;
|
|
|
675 |
}
|
|
|
676 |
|
|
|
677 |
resultSlide = CreationUtils.getSlide(childSlide, slideDefinitionID);
|
|
|
678 |
if(resultSlide == null) {
|
|
|
679 |
continue;
|
|
|
680 |
}
|
|
|
681 |
else {
|
|
|
682 |
break;
|
|
|
683 |
}
|
|
|
684 |
}
|
|
|
685 |
}
|
|
|
686 |
|
|
|
687 |
return resultSlide;
|
|
|
688 |
}
|
|
|
689 |
|
|
|
690 |
/**
|
|
|
691 |
* Utility method to find out Feature object in Entity instance
|
|
|
692 |
*
|
|
|
693 |
* @param entityID
|
|
|
694 |
* @param featureDefinitionID
|
|
|
695 |
* @return Feature
|
|
|
696 |
* @throws Exception
|
|
|
697 |
*/
|
|
|
698 |
public static Feature getFeature(long entityID, long featureDefinitionID)
|
|
|
699 |
throws Exception {
|
|
|
700 |
Entity entity = CreationUtils.getEntity(entityID);
|
|
|
701 |
|
|
|
702 |
Feature feature = null;
|
|
|
703 |
|
|
|
704 |
List<Slide> slides = entity.getSlides();
|
|
|
705 |
for(Slide slide : slides) {
|
|
|
706 |
feature = CreationUtils.getFeature(slide, featureDefinitionID);
|
|
|
707 |
|
|
|
708 |
// Until all slides are searched
|
|
|
709 |
if(feature == null) {
|
|
|
710 |
continue;
|
|
|
711 |
}
|
|
|
712 |
else {
|
|
|
713 |
break;
|
|
|
714 |
}
|
|
|
715 |
}
|
|
|
716 |
|
|
|
717 |
return feature;
|
|
|
718 |
}
|
|
|
719 |
|
|
|
720 |
|
|
|
721 |
/**
|
|
|
722 |
* Returns expand form of entity object. All references are resolved into
|
|
|
723 |
* corresponding detail object
|
|
|
724 |
*
|
|
|
725 |
* @param entityID
|
|
|
726 |
* @return ExpandedEntity
|
|
|
727 |
* @throws Exception
|
|
|
728 |
*/
|
|
|
729 |
public static ExpandedEntity getExpandedEntity(long entityID) throws Exception {
|
|
|
730 |
Entity entity = CreationUtils.getEntity(entityID);
|
|
|
731 |
if(entity==null){
|
|
|
732 |
System.out.println("Entity is null");
|
|
|
733 |
return null;
|
|
|
734 |
}
|
|
|
735 |
System.out.println( entity.getCategoryID());
|
|
|
736 |
ExpandedEntity expEntity = new ExpandedEntity(entity);
|
|
|
737 |
return expEntity;
|
|
|
738 |
}
|
|
|
739 |
|
|
|
740 |
|
|
|
741 |
/**
|
|
|
742 |
* Returns list of borrowed slides
|
|
|
743 |
*
|
|
|
744 |
* @param entity
|
|
|
745 |
* @return list of borrowed slides
|
|
|
746 |
*/
|
|
|
747 |
public static List<Slide> getBorrowedSlides(Entity entity) {
|
|
|
748 |
List<Slide> borrowedSlides = new ArrayList<Slide>();
|
|
|
749 |
|
|
|
750 |
List<Slide> slides = entity.getSlides();
|
|
|
751 |
|
|
|
752 |
for(Slide slide : slides) {
|
| 1165 |
rajveer |
753 |
if(CreationUtils.isBorrowedSlide(slide.getSlideDefinitionID(), entity.getCategoryID())) {
|
| 1153 |
rajveer |
754 |
borrowedSlides.add(slide);
|
|
|
755 |
}
|
|
|
756 |
}
|
|
|
757 |
|
|
|
758 |
return borrowedSlides;
|
|
|
759 |
}
|
|
|
760 |
|
|
|
761 |
/**
|
|
|
762 |
* Returns first parent slide with matching label
|
|
|
763 |
*
|
|
|
764 |
* @param expEntity2
|
|
|
765 |
* @param slideLabel
|
|
|
766 |
* @return Null if not found
|
|
|
767 |
*/
|
|
|
768 |
public static ExpandedSlide getParentExpandedSlide(ExpandedEntity expEntity2, String slideLabel) {
|
|
|
769 |
|
|
|
770 |
ExpandedSlide matchingSlide = null;
|
|
|
771 |
List<ExpandedSlide> expSlides = expEntity2.getExpandedSlides();
|
|
|
772 |
|
|
|
773 |
for(ExpandedSlide expSlide : expSlides) {
|
|
|
774 |
if(expSlide.getSlideDefinition().getLabel().equals(slideLabel)) {
|
|
|
775 |
matchingSlide = expSlide;
|
|
|
776 |
break;
|
|
|
777 |
}
|
|
|
778 |
}
|
|
|
779 |
|
|
|
780 |
return matchingSlide;
|
|
|
781 |
}
|
| 1165 |
rajveer |
782 |
|
|
|
783 |
/**
|
|
|
784 |
*
|
|
|
785 |
* @param slideDefinitionID
|
|
|
786 |
* @param categoryID
|
|
|
787 |
* @return
|
|
|
788 |
*/
|
|
|
789 |
public static boolean isBorrowedSlide(long slideDefinitionID,long categoryID) {
|
| 1226 |
rajveer |
790 |
List<CategorySlideDefinition> slideDefinitions;
|
| 1165 |
rajveer |
791 |
try {
|
| 1226 |
rajveer |
792 |
slideDefinitions = Catalog.getInstance().getDefinitionsContainer().getCategorySlideDefinitions(categoryID);
|
|
|
793 |
for(CategorySlideDefinition slideDef: slideDefinitions){
|
|
|
794 |
if(slideDefinitionID == slideDef.getSlideDefintionID()){
|
|
|
795 |
return false;
|
|
|
796 |
}
|
| 1165 |
rajveer |
797 |
}
|
|
|
798 |
} catch (Exception e) {
|
|
|
799 |
// TODO Auto-generated catch block
|
|
|
800 |
e.printStackTrace();
|
|
|
801 |
}
|
| 1226 |
rajveer |
802 |
return true;
|
| 1165 |
rajveer |
803 |
}
|
|
|
804 |
|
|
|
805 |
/**
|
|
|
806 |
*
|
|
|
807 |
* @param slideDefinitionID
|
|
|
808 |
* @param categoryID
|
|
|
809 |
* @return
|
|
|
810 |
*/
|
|
|
811 |
public static long getBorrowedCategoryID(long slideDefinitionID, long categoryID) {
|
|
|
812 |
try {
|
| 1226 |
rajveer |
813 |
List<CategorySlideDefinition> slideDefinitions = Catalog.getInstance().getDefinitionsContainer().getCategorySlideDefinitions(categoryID);
|
|
|
814 |
for(CategorySlideDefinition slideDef: slideDefinitions){
|
|
|
815 |
if(slideDefinitionID == slideDef.getSlideDefintionID()){
|
|
|
816 |
return categoryID;
|
|
|
817 |
}
|
|
|
818 |
}
|
|
|
819 |
|
|
|
820 |
|
|
|
821 |
List<Category> cats = Catalog.getInstance().getDefinitionsContainer().getCategory(categoryID).getParentCategory().getChildrenCategory();
|
|
|
822 |
for(Category cat: cats){
|
|
|
823 |
if(cat.getID() == categoryID){
|
|
|
824 |
continue;
|
|
|
825 |
}else{
|
|
|
826 |
List<CategorySlideDefinition> slideDefs = Catalog.getInstance().getDefinitionsContainer().getCategorySlideDefinitions(cat.getID());
|
|
|
827 |
for(CategorySlideDefinition slideDef: slideDefs){
|
|
|
828 |
if(slideDefinitionID == slideDef.getSlideDefintionID()){
|
| 1165 |
rajveer |
829 |
return cat.getID();
|
|
|
830 |
}
|
|
|
831 |
}
|
| 1226 |
rajveer |
832 |
|
| 1165 |
rajveer |
833 |
}
|
|
|
834 |
}
|
| 1226 |
rajveer |
835 |
|
| 1165 |
rajveer |
836 |
} catch (Exception e) {
|
|
|
837 |
// TODO Auto-generated catch block
|
|
|
838 |
e.printStackTrace();
|
|
|
839 |
}
|
| 1226 |
rajveer |
840 |
return categoryID;
|
| 1165 |
rajveer |
841 |
}
|
|
|
842 |
|
| 2768 |
mandeep.dh |
843 |
/**
|
| 2838 |
mandeep.dh |
844 |
* Special page ids start from 300000. Here, we pick the last one used and return
|
| 2768 |
mandeep.dh |
845 |
* a value one more than it.
|
|
|
846 |
*/
|
| 2838 |
mandeep.dh |
847 |
public static long getNewSpecialPageId() {
|
|
|
848 |
if (specialPageId == 0) {
|
|
|
849 |
specialPageId = 300000;
|
|
|
850 |
Map<Long, SpecialPage> specialPages = StorageManager.getStorageManager().getSpecialPages();
|
|
|
851 |
if (specialPages != null) {
|
|
|
852 |
for (long id : StorageManager.getStorageManager().getSpecialPages().keySet()) {
|
|
|
853 |
if (specialPageId <= id) {
|
|
|
854 |
specialPageId = id;
|
| 2768 |
mandeep.dh |
855 |
}
|
|
|
856 |
}
|
|
|
857 |
}
|
|
|
858 |
}
|
|
|
859 |
|
| 2838 |
mandeep.dh |
860 |
return ++specialPageId;
|
| 2768 |
mandeep.dh |
861 |
}
|
|
|
862 |
|
|
|
863 |
/**
|
| 2838 |
mandeep.dh |
864 |
* Updates a given special page object in database.
|
| 2768 |
mandeep.dh |
865 |
*/
|
| 2838 |
mandeep.dh |
866 |
public static void storeSpecialPage(SpecialPage specialPage) {
|
|
|
867 |
StorageManager.getStorageManager().updateSpecialPage(specialPage);
|
| 2768 |
mandeep.dh |
868 |
}
|
|
|
869 |
|
|
|
870 |
/**
|
| 2838 |
mandeep.dh |
871 |
* Looks up a special page given its Id from database and returns the same.
|
| 2768 |
mandeep.dh |
872 |
*/
|
| 2838 |
mandeep.dh |
873 |
public static SpecialPage getSpecialPage(long specialPageId) {
|
|
|
874 |
return StorageManager.getStorageManager().getSpecialPage(specialPageId);
|
| 2768 |
mandeep.dh |
875 |
}
|
|
|
876 |
|
|
|
877 |
/**
|
| 2838 |
mandeep.dh |
878 |
* Returns all special pages in the database.
|
| 2768 |
mandeep.dh |
879 |
*/
|
| 2838 |
mandeep.dh |
880 |
public static Map<Long, SpecialPage> getSpecialPages() {
|
|
|
881 |
return StorageManager.getStorageManager().getSpecialPages();
|
| 2768 |
mandeep.dh |
882 |
}
|
| 3356 |
rajveer |
883 |
|
|
|
884 |
/**
|
|
|
885 |
* delete the special pages from database.
|
|
|
886 |
*/
|
|
|
887 |
public static void deleteSpecialPage(long specialPageId) {
|
|
|
888 |
StorageManager.getStorageManager().deleteSpecialPage(specialPageId);
|
|
|
889 |
}
|
| 479 |
rajveer |
890 |
}
|