| 242 |
naveen |
1 |
/**
|
|
|
2 |
*
|
|
|
3 |
*/
|
|
|
4 |
package in.shop2020.creation.controllers;
|
|
|
5 |
|
| 480 |
rajveer |
6 |
import in.shop2020.metamodel.util.CreationUtils;
|
| 242 |
naveen |
7 |
import in.shop2020.metamodel.core.Entity;
|
| 249 |
naveen |
8 |
import in.shop2020.metamodel.core.Slide;
|
| 480 |
rajveer |
9 |
import in.shop2020.metamodel.definitions.Catalog;
|
| 242 |
naveen |
10 |
import in.shop2020.metamodel.definitions.Category;
|
|
|
11 |
import in.shop2020.metamodel.definitions.CategorySlideDefinition;
|
|
|
12 |
import in.shop2020.metamodel.definitions.DefinitionsContainer;
|
|
|
13 |
|
|
|
14 |
import java.util.ArrayList;
|
|
|
15 |
import java.util.Arrays;
|
|
|
16 |
import java.util.HashMap;
|
| 250 |
naveen |
17 |
import java.util.LinkedHashMap;
|
| 242 |
naveen |
18 |
import java.util.List;
|
|
|
19 |
import java.util.Map;
|
|
|
20 |
|
|
|
21 |
import org.apache.juli.logging.Log;
|
|
|
22 |
import org.apache.juli.logging.LogFactory;
|
| 1051 |
rajveer |
23 |
import org.apache.struts2.convention.annotation.InterceptorRef;
|
|
|
24 |
import org.apache.struts2.convention.annotation.InterceptorRefs;
|
| 242 |
naveen |
25 |
import org.apache.struts2.convention.annotation.Result;
|
|
|
26 |
import org.apache.struts2.convention.annotation.Results;
|
|
|
27 |
|
| 1051 |
rajveer |
28 |
@InterceptorRefs({
|
|
|
29 |
@InterceptorRef("myDefault"),
|
|
|
30 |
@InterceptorRef("login")
|
|
|
31 |
})
|
|
|
32 |
|
| 242 |
naveen |
33 |
@Results({
|
|
|
34 |
@Result(name="success", type="redirectAction",
|
|
|
35 |
params = {"actionName" , "slides"}),
|
|
|
36 |
@Result(name="redirect", location="${url}", type="redirect")
|
|
|
37 |
})
|
|
|
38 |
|
| 1051 |
rajveer |
39 |
public class SlidesController extends BaseController {
|
| 242 |
naveen |
40 |
|
|
|
41 |
/**
|
|
|
42 |
*
|
|
|
43 |
*/
|
|
|
44 |
private static final long serialVersionUID = 1L;
|
|
|
45 |
|
|
|
46 |
/**
|
|
|
47 |
*
|
|
|
48 |
*/
|
|
|
49 |
private static Log log = LogFactory.getLog(SlidesController.class);
|
|
|
50 |
|
|
|
51 |
/**
|
|
|
52 |
*
|
|
|
53 |
*/
|
|
|
54 |
private String id;
|
|
|
55 |
private String redirectURL;
|
|
|
56 |
private Map<String, String[]> reqparams;
|
| 1051 |
rajveer |
57 |
private DefinitionsContainer defs = Catalog.getInstance().getDefinitionsContainer();
|
|
|
58 |
private List<List<String[]>> allSlidesData = new ArrayList<List<String[]>>();
|
| 242 |
naveen |
59 |
|
| 953 |
chandransh |
60 |
/**
|
|
|
61 |
* Key: Slide Definition Id
|
|
|
62 |
* Value: Category Slide Definition
|
|
|
63 |
*/
|
| 250 |
naveen |
64 |
private Map<Long, CategorySlideDefinition> mapAllCatSlideDefs =
|
| 242 |
naveen |
65 |
new HashMap<Long, CategorySlideDefinition>();
|
|
|
66 |
|
| 250 |
naveen |
67 |
private Entity entity;
|
| 242 |
naveen |
68 |
/**
|
|
|
69 |
*
|
|
|
70 |
* @return
|
|
|
71 |
*/
|
|
|
72 |
public String edit() {
|
|
|
73 |
log.info("SlidesController.edit");
|
|
|
74 |
|
|
|
75 |
long entityID = Long.parseLong(this.getId());
|
|
|
76 |
log.info("entityID:" + entityID);
|
|
|
77 |
|
|
|
78 |
try {
|
| 1051 |
rajveer |
79 |
entity = CreationUtils.getEntity(entityID);
|
| 242 |
naveen |
80 |
|
| 1051 |
rajveer |
81 |
//List<Long> selection = CreationUtils.getSlideSequence(entityID, entity.getCategoryID());
|
|
|
82 |
List<Long> selection = entity.getSlideSequence();
|
|
|
83 |
if(selection == null){
|
|
|
84 |
entity.setSlideSequence(Catalog.getInstance().getDefinitionsContainer().getCategorySlideSequence(entity.getCategoryID()));
|
|
|
85 |
CreationUtils.updateEntity(entity);
|
|
|
86 |
selection = entity.getSlideSequence();
|
|
|
87 |
}
|
| 242 |
naveen |
88 |
log.info("selection:" + selection);
|
|
|
89 |
|
|
|
90 |
// Entity's category first
|
|
|
91 |
long catID = entity.getCategoryID();
|
|
|
92 |
List<String[]> slidesData = this.getSlidesData(catID, selection,
|
|
|
93 |
true);
|
|
|
94 |
|
|
|
95 |
this.allSlidesData.add(slidesData);
|
|
|
96 |
|
|
|
97 |
// Get slides for rest of the categories
|
| 499 |
rajveer |
98 |
long parentCatID = (defs.getCategory(catID)).getParentCategory().getID();
|
|
|
99 |
|
|
|
100 |
List<Category> cats = defs.getChildrenCategories(parentCatID);
|
| 242 |
naveen |
101 |
for(Category cat : cats) {
|
|
|
102 |
if(cat.getID() != catID) {
|
| 2424 |
rajveer |
103 |
// Case when same level categories dont have slides.
|
|
|
104 |
if(defs.getCategorySlideSequence(cat.getID())== null){
|
|
|
105 |
continue;
|
|
|
106 |
}
|
|
|
107 |
|
| 242 |
naveen |
108 |
List<String[]> thisSlidesData =
|
|
|
109 |
this.getSlidesData(cat.getID(), selection, false);
|
| 953 |
chandransh |
110 |
if(!thisSlidesData.isEmpty()){
|
|
|
111 |
this.allSlidesData.add(thisSlidesData);
|
|
|
112 |
}
|
| 242 |
naveen |
113 |
}
|
|
|
114 |
}
|
|
|
115 |
|
|
|
116 |
} catch (Exception e) {
|
|
|
117 |
log.error(CreationUtils.getStackTrace(e));
|
|
|
118 |
this.setErrorString(CreationUtils.getStackTrace(e));
|
|
|
119 |
return "fatal";
|
|
|
120 |
}
|
|
|
121 |
return "edit";
|
|
|
122 |
}
|
|
|
123 |
|
| 1068 |
rajveer |
124 |
public String show(){
|
|
|
125 |
if(this.reqparams.get("sequence") != null){
|
|
|
126 |
String itemlist = this.reqparams.get("sequence")[0];
|
|
|
127 |
long entityID = Long.parseLong(this.getId());
|
|
|
128 |
try {
|
|
|
129 |
this.entity = CreationUtils.getEntity(entityID);
|
|
|
130 |
List<Long> slideSequence = entity.getSlideSequence();
|
|
|
131 |
List<Long> newSlideSequence = new ArrayList<Long>();
|
|
|
132 |
String[] items = itemlist.split("-");
|
|
|
133 |
for(int i = 0; i < items.length; i++){
|
|
|
134 |
newSlideSequence.add(slideSequence.get(Integer.parseInt(items[i])));
|
|
|
135 |
}
|
|
|
136 |
entity.setSlideSequence(newSlideSequence);
|
|
|
137 |
CreationUtils.updateEntity(entity);
|
|
|
138 |
} catch (Exception e) {
|
|
|
139 |
// TODO Auto-generated catch block
|
|
|
140 |
e.printStackTrace();
|
|
|
141 |
}
|
|
|
142 |
}
|
|
|
143 |
this.redirectURL = "/slides/" + this.getId() + "/edit";
|
|
|
144 |
return "redirect";
|
|
|
145 |
}
|
|
|
146 |
|
| 242 |
naveen |
147 |
/**
|
|
|
148 |
*
|
|
|
149 |
* @return
|
|
|
150 |
*/
|
|
|
151 |
public String update() {
|
|
|
152 |
log.info("SlidesController.update");
|
| 480 |
rajveer |
153 |
for(String reqparam: this.reqparams.keySet()){
|
|
|
154 |
String[] values = this.reqparams.get(reqparam);
|
|
|
155 |
for(String value: values){
|
|
|
156 |
System.out.println("Param: " + reqparam + "Value: " + value);
|
|
|
157 |
}
|
|
|
158 |
}
|
| 1068 |
rajveer |
159 |
|
| 1051 |
rajveer |
160 |
//FIXME
|
|
|
161 |
/* Need to fix me while reordering
|
| 480 |
rajveer |
162 |
if(this.reqparams.get("slideid") != null){
|
|
|
163 |
long slideId = Long.parseLong(this.reqparams.get("slideid")[0]);
|
|
|
164 |
long afterSlideId = Long.parseLong(this.reqparams.get("afterslide")[0]);
|
|
|
165 |
long entityID = Long.parseLong(this.getId());
|
|
|
166 |
|
|
|
167 |
// List<Long> slideSequence = CreationUtils.getSlideSequence(entityID);
|
|
|
168 |
// List<Long> newSlideSequence = new ArrayList<Long>();
|
|
|
169 |
//
|
|
|
170 |
// for(Long slide: slideSequence){
|
|
|
171 |
// newSlideSequence.add(slide);
|
|
|
172 |
// if(slide.equals(new Long(afterSlideId))){
|
|
|
173 |
// newSlideSequence.add(new Long(slideId));
|
|
|
174 |
// }
|
|
|
175 |
// }
|
|
|
176 |
|
|
|
177 |
try{
|
| 1051 |
rajveer |
178 |
entity = CreationUtils.getEntity(entityID);
|
| 480 |
rajveer |
179 |
|
| 1051 |
rajveer |
180 |
//Map<Long, List<Long>> catSlideSequence = CreationUtils.getRawSlideSequence(entityID);
|
|
|
181 |
|
|
|
182 |
Map<Long, List<Long>> catSlideSequence = defs.getCategorySlideSequence();
|
| 480 |
rajveer |
183 |
|
|
|
184 |
List<Long> allSlideSequence = catSlideSequence.get(new Long(-1));
|
|
|
185 |
List<Long> newAllSlideSequence = new ArrayList<Long>();
|
|
|
186 |
|
|
|
187 |
catSlideSequence.remove(new Long(-1));
|
|
|
188 |
Map<Long, List<Long>> newCatSlideSequence = new HashMap<Long, List<Long>>();
|
|
|
189 |
|
|
|
190 |
for(Long slide: allSlideSequence){
|
|
|
191 |
newAllSlideSequence.add(slide);
|
|
|
192 |
if(slide.equals(new Long(afterSlideId))){
|
|
|
193 |
newAllSlideSequence.add(new Long(slideId));
|
|
|
194 |
}
|
|
|
195 |
}
|
| 1051 |
rajveer |
196 |
|
| 480 |
rajveer |
197 |
for(Long cat: catSlideSequence.keySet()){
|
|
|
198 |
List<Long> newSlideSequence = new ArrayList<Long>();
|
|
|
199 |
List<Long> slides = catSlideSequence.get(cat);
|
|
|
200 |
|
|
|
201 |
boolean contains = false;
|
|
|
202 |
List<CategorySlideDefinition> catdefs = defs.getCategorySlideDefinitions(cat);
|
|
|
203 |
for(CategorySlideDefinition catdef: catdefs){
|
|
|
204 |
if(catdef.getSlideDefintionID()==slideId){
|
|
|
205 |
contains = true;
|
|
|
206 |
}
|
|
|
207 |
}
|
|
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
|
211 |
for(Long slide: slides){
|
|
|
212 |
newSlideSequence.add(slide);
|
|
|
213 |
}
|
|
|
214 |
if(contains){
|
|
|
215 |
newSlideSequence.add(new Long(slideId));
|
|
|
216 |
}
|
|
|
217 |
|
|
|
218 |
newCatSlideSequence.put(cat, newSlideSequence);
|
|
|
219 |
}
|
|
|
220 |
|
|
|
221 |
newCatSlideSequence.put(new Long(-1), newAllSlideSequence);
|
|
|
222 |
|
| 1051 |
rajveer |
223 |
//CreationUtils.storeSlideSequence(entityID, newCatSlideSequence);
|
|
|
224 |
|
|
|
225 |
entity.setSlideSequence(newAllSlideSequence);
|
|
|
226 |
|
| 480 |
rajveer |
227 |
}catch(Exception e){
|
|
|
228 |
e.printStackTrace();
|
|
|
229 |
}
|
|
|
230 |
this.redirectURL = "/slides/" + this.getId() + "/edit";
|
|
|
231 |
return "redirect";
|
|
|
232 |
}
|
|
|
233 |
|
| 1051 |
rajveer |
234 |
*/
|
| 480 |
rajveer |
235 |
|
| 242 |
naveen |
236 |
try {
|
| 250 |
naveen |
237 |
long entityID = Long.parseLong(this.getId());
|
| 1051 |
rajveer |
238 |
entity = CreationUtils.getEntity(entityID);
|
| 480 |
rajveer |
239 |
Long catId = new Long(entity.getCategoryID());
|
| 250 |
naveen |
240 |
// Slides of entity's category
|
| 1152 |
rajveer |
241 |
String[] strSlideDefIDs = this.reqparams.get(new Long(entity.getCategoryID()).toString());
|
| 250 |
naveen |
242 |
|
| 1152 |
rajveer |
243 |
|
|
|
244 |
|
| 250 |
naveen |
245 |
log.info("strSlideDefIDs:" + Arrays.toString(strSlideDefIDs));
|
|
|
246 |
|
| 1152 |
rajveer |
247 |
|
|
|
248 |
|
| 1051 |
rajveer |
249 |
List<Long> sequence= entity.getSlideSequence();
|
|
|
250 |
log.info("S1"+sequence);
|
| 480 |
rajveer |
251 |
if(sequence == null){
|
|
|
252 |
sequence = new ArrayList<Long>();
|
| 1051 |
rajveer |
253 |
entity.setSlideSequence(sequence);
|
| 480 |
rajveer |
254 |
}
|
|
|
255 |
|
| 1152 |
rajveer |
256 |
List<Long> newSequence = new ArrayList<Long>();
|
| 250 |
naveen |
257 |
|
|
|
258 |
// Add entity's category slides first
|
| 242 |
naveen |
259 |
List<Long> slideDefIDs = new ArrayList<Long>();
|
|
|
260 |
for(String strSlideDefID : strSlideDefIDs) {
|
| 1152 |
rajveer |
261 |
newSequence.add(new Long(Long.parseLong(strSlideDefID)));
|
| 242 |
naveen |
262 |
slideDefIDs.add(new Long(Long.parseLong(strSlideDefID)));
|
| 480 |
rajveer |
263 |
if(!sequence.contains(new Long(Long.parseLong(strSlideDefID)))){
|
|
|
264 |
sequence.add(new Long(Long.parseLong(strSlideDefID)));
|
|
|
265 |
}
|
| 242 |
naveen |
266 |
}
|
|
|
267 |
|
| 1051 |
rajveer |
268 |
log.info("S2"+sequence);
|
| 499 |
rajveer |
269 |
long parentCatID = (defs.getCategory(entity.getCategoryID())).getParentCategory().getID();
|
|
|
270 |
|
|
|
271 |
List<Category> cats = defs.getChildrenCategories(parentCatID);
|
|
|
272 |
|
| 250 |
naveen |
273 |
// Add slides borrowed from other categories
|
|
|
274 |
for(Category cat : cats) {
|
|
|
275 |
Long lCat = new Long(cat.getID());
|
| 1051 |
rajveer |
276 |
String[] strCatSlideDefIDs = this.reqparams.get(lCat.toString());
|
| 250 |
naveen |
277 |
if(strCatSlideDefIDs != null && strCatSlideDefIDs.length > 0) {
|
|
|
278 |
for(String strCatSlideDefID : strCatSlideDefIDs) {
|
| 1152 |
rajveer |
279 |
newSequence.add(new Long(Long.parseLong(strCatSlideDefID)));
|
| 480 |
rajveer |
280 |
if(!lCat.equals(catId) && !sequence.contains(new Long(Long.parseLong(strCatSlideDefID)))){
|
|
|
281 |
sequence.add(new Long(Long.parseLong(strCatSlideDefID)));
|
| 1051 |
rajveer |
282 |
log.info("S3"+sequence);
|
| 480 |
rajveer |
283 |
}
|
| 250 |
naveen |
284 |
}
|
|
|
285 |
}
|
|
|
286 |
}
|
| 480 |
rajveer |
287 |
|
| 1051 |
rajveer |
288 |
|
|
|
289 |
//FIXME To remove not required slide ids and slides
|
| 499 |
rajveer |
290 |
// to remove obsolete elements
|
| 1152 |
rajveer |
291 |
|
| 499 |
rajveer |
292 |
List<Long> removeList = new ArrayList<Long>();
|
|
|
293 |
for(Long slideId: sequence){
|
|
|
294 |
boolean isContains = false;
|
| 1152 |
rajveer |
295 |
if(newSequence.contains(slideId)){
|
|
|
296 |
isContains = true;
|
| 499 |
rajveer |
297 |
}
|
|
|
298 |
if(!isContains){
|
|
|
299 |
removeList.add(slideId);
|
|
|
300 |
}
|
|
|
301 |
}
|
| 1051 |
rajveer |
302 |
log.info("To remove"+removeList);
|
| 499 |
rajveer |
303 |
for(Long slideId: removeList){
|
|
|
304 |
sequence.remove(slideId);
|
|
|
305 |
}
|
|
|
306 |
// end
|
|
|
307 |
|
| 250 |
naveen |
308 |
|
| 249 |
naveen |
309 |
// Delete slides no longer present in the list
|
|
|
310 |
List<Slide> slides = entity.getSlides();
|
| 250 |
naveen |
311 |
if(slides != null) {
|
|
|
312 |
List<Slide> deletedSlides = new ArrayList<Slide>();
|
|
|
313 |
for(Slide slide : slides) {
|
|
|
314 |
Long lSlideDefID = new Long(slide.getSlideDefinitionID());
|
| 1051 |
rajveer |
315 |
|
|
|
316 |
log.info(sequence);
|
|
|
317 |
if(!sequence.contains(lSlideDefID)) {
|
| 250 |
naveen |
318 |
log.info("deleted lSlideDefID:" + lSlideDefID);
|
|
|
319 |
deletedSlides.add(slide);
|
|
|
320 |
}
|
|
|
321 |
}
|
|
|
322 |
|
|
|
323 |
for(Slide deletedSlide : deletedSlides) {
|
|
|
324 |
slides.remove(deletedSlide);
|
|
|
325 |
}
|
| 249 |
naveen |
326 |
}
|
|
|
327 |
|
| 1051 |
rajveer |
328 |
CreationUtils.updateEntity(entity);
|
|
|
329 |
|
| 250 |
naveen |
330 |
if(this.reqparams.containsKey("save")) {
|
|
|
331 |
this.redirectURL = "/entity";
|
| 249 |
naveen |
332 |
}
|
| 250 |
naveen |
333 |
else {
|
|
|
334 |
this.redirectURL = "/entity/" + this.getId() + "/edit" +
|
|
|
335 |
"?slideDefID=" + slideDefIDs.get(0);
|
|
|
336 |
}
|
| 249 |
naveen |
337 |
|
| 242 |
naveen |
338 |
return "redirect";
|
|
|
339 |
} catch (Exception e) {
|
|
|
340 |
log.error(CreationUtils.getStackTrace(e));
|
|
|
341 |
this.setErrorString(CreationUtils.getStackTrace(e));
|
|
|
342 |
return "fatal";
|
|
|
343 |
}
|
|
|
344 |
}
|
|
|
345 |
|
|
|
346 |
/**
|
|
|
347 |
*
|
|
|
348 |
*/
|
|
|
349 |
@Override
|
|
|
350 |
public void setParameters(Map<String, String[]> reqmap) {
|
|
|
351 |
log.info("setParameters:" + reqmap);
|
|
|
352 |
|
|
|
353 |
this.reqparams = reqmap;
|
|
|
354 |
}
|
|
|
355 |
|
|
|
356 |
/**
|
|
|
357 |
* @param id the id to set
|
|
|
358 |
*/
|
|
|
359 |
public void setId(String id) {
|
|
|
360 |
this.id = id;
|
|
|
361 |
}
|
|
|
362 |
|
|
|
363 |
/**
|
|
|
364 |
* @return the id
|
|
|
365 |
*/
|
|
|
366 |
public String getId() {
|
|
|
367 |
return id;
|
|
|
368 |
}
|
|
|
369 |
|
|
|
370 |
/**
|
|
|
371 |
*
|
|
|
372 |
* @return
|
|
|
373 |
*/
|
|
|
374 |
public List<List<String[]>> getAllSlidesData() {
|
|
|
375 |
return this.allSlidesData;
|
|
|
376 |
}
|
|
|
377 |
|
|
|
378 |
/**
|
|
|
379 |
*
|
|
|
380 |
* @return
|
|
|
381 |
*/
|
|
|
382 |
public String getUrl() {
|
|
|
383 |
return this.redirectURL;
|
|
|
384 |
}
|
|
|
385 |
|
|
|
386 |
/**
|
|
|
387 |
* @param errorString the exceptionString to set
|
|
|
388 |
*/
|
|
|
389 |
public void setErrorString(String errorString) {
|
|
|
390 |
}
|
|
|
391 |
|
|
|
392 |
/**
|
|
|
393 |
*
|
|
|
394 |
* @return
|
|
|
395 |
*/
|
|
|
396 |
public List<String> getMandatorySlideLabels() {
|
|
|
397 |
List<String[]> slidesdata = this.allSlidesData.get(0);
|
|
|
398 |
|
|
|
399 |
List<String> mandatorySlideLabels = new ArrayList<String>();
|
|
|
400 |
for(String[] data : slidesdata) {
|
|
|
401 |
if("Mandatory".equals(data[4])) {
|
|
|
402 |
mandatorySlideLabels.add(data[3]);
|
|
|
403 |
}
|
|
|
404 |
}
|
|
|
405 |
|
|
|
406 |
return mandatorySlideLabels;
|
|
|
407 |
}
|
|
|
408 |
|
|
|
409 |
/**
|
|
|
410 |
*
|
|
|
411 |
* @param catID
|
|
|
412 |
* @param selection
|
|
|
413 |
* @return
|
|
|
414 |
* @throws Exception
|
|
|
415 |
*/
|
|
|
416 |
private List<String[]> getSlidesData(long catID, List<Long> selection,
|
|
|
417 |
boolean isEntityCategory) throws Exception {
|
| 250 |
naveen |
418 |
log.info("catID:" + catID);
|
| 242 |
naveen |
419 |
List<Long> slideDefIDs = defs.getCategorySlideSequence(catID);
|
| 250 |
naveen |
420 |
log.info("slideDefIDs:" + slideDefIDs);
|
| 242 |
naveen |
421 |
|
|
|
422 |
List<CategorySlideDefinition> catSlideDefs =
|
|
|
423 |
defs.getCategorySlideDefinitions(catID);
|
| 250 |
naveen |
424 |
log.info("catSlideDefs:" + catSlideDefs);
|
| 242 |
naveen |
425 |
|
|
|
426 |
// Convert it into Map, this will help put CategorySlideDefinition
|
|
|
427 |
// objects in sequence
|
|
|
428 |
// FIXME - Quick and dirty
|
|
|
429 |
List<Long> excludeList = new ArrayList<Long>();
|
|
|
430 |
for(CategorySlideDefinition catSlideDef : catSlideDefs) {
|
|
|
431 |
Long slideDefID = new Long(catSlideDef.getSlideDefintionID());
|
|
|
432 |
|
|
|
433 |
if(!this.mapAllCatSlideDefs.containsKey(slideDefID)) {
|
|
|
434 |
this.mapAllCatSlideDefs.put(slideDefID, catSlideDef);
|
|
|
435 |
}
|
|
|
436 |
else {
|
|
|
437 |
excludeList.add(slideDefID);
|
|
|
438 |
}
|
|
|
439 |
}
|
| 250 |
naveen |
440 |
log.info("excludeList:" + excludeList);
|
| 242 |
naveen |
441 |
|
|
|
442 |
List<String[]> slidesData = new ArrayList<String[]>();
|
|
|
443 |
|
|
|
444 |
String categoryLabel = defs.getCategory(catID).getLabel();
|
|
|
445 |
|
|
|
446 |
for(Long slideDefID : slideDefIDs) {
|
|
|
447 |
// Do not repeat if already covered
|
|
|
448 |
if(excludeList.contains(slideDefID)) {
|
|
|
449 |
continue;
|
|
|
450 |
}
|
|
|
451 |
|
| 953 |
chandransh |
452 |
// Category slide definition for the slide def id.
|
|
|
453 |
CategorySlideDefinition catSlideDef = this.mapAllCatSlideDefs.get(slideDefID);
|
|
|
454 |
log.info("catSlideDef: " + catSlideDef);
|
| 242 |
naveen |
455 |
|
| 953 |
chandransh |
456 |
String slideLabel = defs.getSlideDefinition(catSlideDef.getSlideDefintionID()).getLabel();
|
| 242 |
naveen |
457 |
|
|
|
458 |
Long lSlideDefID = new Long(catSlideDef.getSlideDefintionID());
|
|
|
459 |
|
|
|
460 |
String selected = "0";
|
|
|
461 |
if(selection != null) {
|
|
|
462 |
selected = selection.contains(lSlideDefID) ? "1" : "0";
|
|
|
463 |
}
|
|
|
464 |
else if(isEntityCategory) {
|
|
|
465 |
String edImp = catSlideDef.getEditorialImportance().toString();
|
|
|
466 |
selected = (edImp.equals("Mandatory") ||
|
|
|
467 |
edImp.endsWith("Recommended")) ? "1" : "0";
|
|
|
468 |
}
|
|
|
469 |
|
|
|
470 |
String[] data = new String[] {
|
|
|
471 |
new Long(catID).toString(),
|
|
|
472 |
categoryLabel,
|
|
|
473 |
lSlideDefID.toString(),
|
|
|
474 |
slideLabel,
|
|
|
475 |
catSlideDef.getEditorialImportance().toString(),
|
|
|
476 |
selected
|
|
|
477 |
};
|
|
|
478 |
|
|
|
479 |
slidesData.add(data);
|
|
|
480 |
}
|
|
|
481 |
|
|
|
482 |
return slidesData;
|
|
|
483 |
}
|
| 1051 |
rajveer |
484 |
|
|
|
485 |
public List<Long> getSlideSequence(){
|
|
|
486 |
return this.entity.getSlideSequence();
|
|
|
487 |
}
|
| 242 |
naveen |
488 |
|
|
|
489 |
}
|