| 10 |
shop2020 |
1 |
/**
|
|
|
2 |
*
|
|
|
3 |
*/
|
|
|
4 |
package in.shop2020.metamodel.definitions;
|
|
|
5 |
|
| 1050 |
rajveer |
6 |
import in.shop2020.metamodel.jaxb.comparison.CMPBucketDefinitionType;
|
|
|
7 |
import in.shop2020.metamodel.jaxb.comparison.CMPDefinitionType;
|
|
|
8 |
import in.shop2020.metamodel.jaxb.comparison.CMPRuleDefinitionType;
|
|
|
9 |
import in.shop2020.metamodel.jaxb.comparison.CMPSlideRuleDefinitionType;
|
|
|
10 |
import in.shop2020.metamodel.jaxb.core.BulletDefinitionType;
|
|
|
11 |
import in.shop2020.metamodel.jaxb.core.CategorySlideDefinitionType;
|
|
|
12 |
import in.shop2020.metamodel.jaxb.core.CategorySlideSequenceType;
|
|
|
13 |
import in.shop2020.metamodel.jaxb.core.CategoryType;
|
| 4959 |
amit.gupta |
14 |
import in.shop2020.metamodel.jaxb.core.ChildSlideType;
|
| 1050 |
rajveer |
15 |
import in.shop2020.metamodel.jaxb.core.CompositeDefinitionType;
|
|
|
16 |
import in.shop2020.metamodel.jaxb.core.CompositePartDefinitionType;
|
|
|
17 |
import in.shop2020.metamodel.jaxb.core.DatatypeDefinitionType;
|
|
|
18 |
import in.shop2020.metamodel.jaxb.core.DefinitionType;
|
|
|
19 |
import in.shop2020.metamodel.jaxb.core.EditorialImportanceType;
|
|
|
20 |
import in.shop2020.metamodel.jaxb.core.EnumDefinitionType;
|
|
|
21 |
import in.shop2020.metamodel.jaxb.core.EnumValueType;
|
|
|
22 |
import in.shop2020.metamodel.jaxb.core.FeatureDefinitionType;
|
| 2170 |
rajveer |
23 |
import in.shop2020.metamodel.jaxb.core.HelpDocDefinitionType;
|
| 1050 |
rajveer |
24 |
import in.shop2020.metamodel.jaxb.core.SlideDefinitionType;
|
|
|
25 |
import in.shop2020.metamodel.jaxb.core.SlideFeatureDefinitionType;
|
|
|
26 |
import in.shop2020.metamodel.jaxb.core.UnitType;
|
|
|
27 |
import in.shop2020.metamodel.jaxb.facets.CategoryFacetDefinitionType;
|
|
|
28 |
import in.shop2020.metamodel.jaxb.facets.FacetDefinitionType;
|
| 1314 |
rajveer |
29 |
import in.shop2020.metamodel.jaxb.facets.FacetSlideDefinitionType;
|
| 1050 |
rajveer |
30 |
import in.shop2020.metamodel.jaxb.facets.IRDefinitionType;
|
|
|
31 |
import in.shop2020.metamodel.jaxb.facets.RuleDefinitionType;
|
| 70 |
naveen |
32 |
import in.shop2020.metamodel.util.ExpandedCMPSlideRuleDefinition;
|
| 45 |
naveen |
33 |
import in.shop2020.metamodel.util.ExpandedCategory;
|
| 62 |
naveen |
34 |
import in.shop2020.metamodel.util.ExpandedCategoryFacetDefinition;
|
| 199 |
naveen |
35 |
import in.shop2020.metamodel.util.ExpandedSlideDefinition;
|
| 70 |
naveen |
36 |
import in.shop2020.util.Utils;
|
| 17 |
naveen |
37 |
|
| 457 |
rajveer |
38 |
import java.io.File;
|
| 1050 |
rajveer |
39 |
import java.io.FileInputStream;
|
| 10 |
shop2020 |
40 |
import java.io.Serializable;
|
| 18 |
naveen |
41 |
import java.util.ArrayList;
|
| 1050 |
rajveer |
42 |
import java.util.HashMap;
|
| 18 |
naveen |
43 |
import java.util.Iterator;
|
|
|
44 |
import java.util.List;
|
| 10 |
shop2020 |
45 |
import java.util.Map;
|
| 1050 |
rajveer |
46 |
import java.util.TreeMap;
|
| 10 |
shop2020 |
47 |
|
| 1050 |
rajveer |
48 |
import javax.xml.bind.JAXBContext;
|
|
|
49 |
import javax.xml.bind.JAXBElement;
|
|
|
50 |
import javax.xml.bind.Unmarshaller;
|
|
|
51 |
|
| 10 |
shop2020 |
52 |
/**
|
| 49 |
naveen |
53 |
* Single point of access to all definition objects
|
|
|
54 |
*
|
| 10 |
shop2020 |
55 |
* @author naveen
|
|
|
56 |
*
|
|
|
57 |
*/
|
|
|
58 |
public class DefinitionsContainer implements Serializable {
|
|
|
59 |
|
| 41 |
naveen |
60 |
/**
|
| 10 |
shop2020 |
61 |
*
|
|
|
62 |
*/
|
|
|
63 |
private static final long serialVersionUID = 1L;
|
| 49 |
naveen |
64 |
|
|
|
65 |
/**
|
|
|
66 |
* Hashtable of Category ID to Category object
|
|
|
67 |
*/
|
| 10 |
shop2020 |
68 |
private Map<Long, Category> categories;
|
| 49 |
naveen |
69 |
|
|
|
70 |
/**
|
|
|
71 |
* Hashtable of Slide ID to SlideDefinition object
|
|
|
72 |
*/
|
| 10 |
shop2020 |
73 |
private Map<Long, SlideDefinition> slideDefinitions;
|
| 49 |
naveen |
74 |
|
|
|
75 |
/**
|
|
|
76 |
* Hashtable of Feature Definition ID to FeatureDefinition object
|
|
|
77 |
*/
|
| 10 |
shop2020 |
78 |
private Map<Long, FeatureDefinition> featureDefinitions;
|
| 49 |
naveen |
79 |
|
|
|
80 |
/**
|
|
|
81 |
* Hashtable of Datatype Definition ID to DatatypeDefinition object
|
|
|
82 |
*/
|
| 10 |
shop2020 |
83 |
private Map<Long, DatatypeDefinition> datatypeDefinitions;
|
| 49 |
naveen |
84 |
|
|
|
85 |
/**
|
|
|
86 |
* Hashtable of Enum value ID to EnumValue object
|
|
|
87 |
*/
|
| 24 |
naveen |
88 |
private Map<Long, EnumValue> enumValues;
|
| 49 |
naveen |
89 |
|
|
|
90 |
/**
|
|
|
91 |
* Hashtable of Unit ID to Unit object
|
|
|
92 |
*/
|
| 10 |
shop2020 |
93 |
private Map<Long, Unit> units;
|
|
|
94 |
|
|
|
95 |
/**
|
| 62 |
naveen |
96 |
* Hashtable of Facet Definition ID to FacetDefinition object
|
|
|
97 |
*/
|
|
|
98 |
private Map<Long, FacetDefinition> facetDefinitions;
|
|
|
99 |
|
| 1314 |
rajveer |
100 |
|
| 62 |
naveen |
101 |
/**
|
| 1314 |
rajveer |
102 |
* Hashtable of Slide Definition ID to FacetDefinition object
|
|
|
103 |
*/
|
|
|
104 |
private Map<Long, List<FacetDefinition>> slideFacetDefinitions;
|
|
|
105 |
|
|
|
106 |
/**
|
| 62 |
naveen |
107 |
* Hashtable of Category Facet Definition ID to CategoryFacetDefinition
|
|
|
108 |
* object
|
|
|
109 |
*/
|
|
|
110 |
private Map<Long, CategoryFacetDefinition> categoryFacetDefinitions;
|
|
|
111 |
|
|
|
112 |
/**
|
|
|
113 |
* Hashtable of IR Data Rule ID to RuleDefinition object
|
|
|
114 |
*/
|
|
|
115 |
private Map<Long, RuleDefinition> irDataRuleDefinitions;
|
|
|
116 |
|
|
|
117 |
/**
|
|
|
118 |
* Hashtable of IR Meta Data Rule ID to RuleDefinition object
|
|
|
119 |
*/
|
|
|
120 |
private Map<Long, RuleDefinition> irMetaDataRuleDefinitions;
|
|
|
121 |
|
|
|
122 |
|
|
|
123 |
/**
|
| 70 |
naveen |
124 |
* Hashtable of Comparison Rule ID to CMPRuleDefinition object
|
|
|
125 |
*/
|
|
|
126 |
private Map<Long, CMPRuleDefinition> cmpRuleDefinitions;
|
|
|
127 |
|
|
|
128 |
/**
|
|
|
129 |
* Hashtable of SlideDefinition ID to CMPSlideRuleDefinition object
|
|
|
130 |
*/
|
|
|
131 |
private Map<Long, CMPSlideRuleDefinition> cmpSlideRuleDefinitions;
|
|
|
132 |
|
|
|
133 |
/**
|
| 72 |
naveen |
134 |
* Hashtable of Category ID to list of CMPBucketDefinition object
|
|
|
135 |
*/
|
|
|
136 |
private Map<Long, List<CMPBucketDefinition>> cmpBucketDefinitions;
|
| 102 |
naveen |
137 |
|
|
|
138 |
/**
|
|
|
139 |
* Hashtable of feature definition ID to normalization rule definition ID
|
|
|
140 |
*/
|
|
|
141 |
private Map<Long, RuleDefinition> normalizationRuleDefinitions;
|
| 2170 |
rajveer |
142 |
|
|
|
143 |
/**
|
|
|
144 |
* Hashtable of help doc definition ID to help doc definition object
|
|
|
145 |
*/
|
|
|
146 |
private Map<Long, HelpDocDefinition> helpDocDefinitions;
|
| 199 |
naveen |
147 |
|
|
|
148 |
/**
|
|
|
149 |
* Hashtable of feature definition ID to normalization rule definition ID
|
|
|
150 |
*/
|
|
|
151 |
private Map<Long, List<Long>> categorySlideSequence;
|
| 72 |
naveen |
152 |
|
|
|
153 |
/**
|
| 473 |
rajveer |
154 |
* Database path. Just in case we want to override
|
|
|
155 |
*/
|
| 1050 |
rajveer |
156 |
private String xmlDefinitionsPath = Utils.CONTENT_DB_PATH + "definitions" + File.separator;
|
| 473 |
rajveer |
157 |
|
|
|
158 |
/**
|
| 49 |
naveen |
159 |
* Empty constructor. Data structures are initialised as needed
|
| 1050 |
rajveer |
160 |
* @throws Exception
|
| 10 |
shop2020 |
161 |
*/
|
| 1050 |
rajveer |
162 |
public DefinitionsContainer(){
|
|
|
163 |
try {
|
|
|
164 |
initialize();
|
|
|
165 |
} catch (Exception e) {
|
|
|
166 |
// TODO Auto-generated catch block
|
|
|
167 |
e.printStackTrace();
|
|
|
168 |
}
|
| 10 |
shop2020 |
169 |
}
|
|
|
170 |
|
|
|
171 |
/**
|
| 473 |
rajveer |
172 |
* Empty constructor. Just dbPath is initialised
|
| 1050 |
rajveer |
173 |
* @throws Exception
|
| 473 |
rajveer |
174 |
*/
|
| 1050 |
rajveer |
175 |
public DefinitionsContainer(String xmlDefinitionsPath) throws Exception {
|
|
|
176 |
this.xmlDefinitionsPath = xmlDefinitionsPath;
|
|
|
177 |
initialize();
|
| 473 |
rajveer |
178 |
}
|
| 1050 |
rajveer |
179 |
|
| 473 |
rajveer |
180 |
|
| 1050 |
rajveer |
181 |
private void initialize() throws Exception{
|
|
|
182 |
initializeCoreDefinitionObjects();
|
|
|
183 |
initializeFacetsDefinitionObjects();
|
|
|
184 |
initializeComparisonDefinitionObjects();
|
|
|
185 |
}
|
|
|
186 |
|
|
|
187 |
private void initializeCoreDefinitionObjects() throws Exception{
|
|
|
188 |
DefinitionType defType = null;
|
|
|
189 |
String srcFile;
|
|
|
190 |
Object oDefType = null;
|
|
|
191 |
|
|
|
192 |
// categoriy slide sequence
|
|
|
193 |
srcFile = xmlDefinitionsPath+ "categories.xml";
|
|
|
194 |
oDefType = this.unmarshallSrcFile(srcFile, "core");
|
|
|
195 |
defType = (DefinitionType)oDefType;
|
|
|
196 |
//FIXME
|
|
|
197 |
categories = new HashMap<Long, Category>();
|
|
|
198 |
Category root = this.convertCategories(defType, categories, srcFile);
|
|
|
199 |
|
|
|
200 |
// category slide sequence
|
|
|
201 |
srcFile = xmlDefinitionsPath+ "categoryslidesequence.xml";
|
|
|
202 |
oDefType = this.unmarshallSrcFile(srcFile, "core");
|
|
|
203 |
defType = (DefinitionType)oDefType;
|
|
|
204 |
this.categorySlideSequence = this.convertCategorySlideSequence(defType);
|
|
|
205 |
|
|
|
206 |
// units
|
|
|
207 |
srcFile = xmlDefinitionsPath+ "units.xml";
|
|
|
208 |
oDefType = this.unmarshallSrcFile(srcFile, "core");
|
|
|
209 |
defType = (DefinitionType)oDefType;
|
|
|
210 |
this.units = this.convertUnits(defType);
|
|
|
211 |
|
|
|
212 |
//data type definitions
|
|
|
213 |
srcFile = xmlDefinitionsPath+ "datatypedefinitions.xml";
|
|
|
214 |
oDefType = this.unmarshallSrcFile(srcFile, "core");
|
|
|
215 |
defType = (DefinitionType)oDefType;
|
|
|
216 |
this.datatypeDefinitions = this.convertDatatypeDefinition(defType);
|
|
|
217 |
|
|
|
218 |
//enum values
|
|
|
219 |
populateEnumValues();
|
|
|
220 |
|
|
|
221 |
//feature definitions
|
|
|
222 |
srcFile = xmlDefinitionsPath+ "featuredefinitions.xml";
|
|
|
223 |
oDefType = this.unmarshallSrcFile(srcFile, "core");
|
|
|
224 |
defType = (DefinitionType)oDefType;
|
|
|
225 |
this.featureDefinitions = this.convertFeatureDefinitions(defType);
|
|
|
226 |
|
|
|
227 |
//slide definitions
|
|
|
228 |
srcFile = xmlDefinitionsPath+ "slidedefinitions.xml";
|
|
|
229 |
oDefType = this.unmarshallSrcFile(srcFile, "core");
|
|
|
230 |
defType = (DefinitionType)oDefType;
|
|
|
231 |
this.slideDefinitions = this.convertSlideDefinitions(defType);
|
| 2170 |
rajveer |
232 |
|
|
|
233 |
//help doc definition
|
|
|
234 |
srcFile = xmlDefinitionsPath+ "helpdocdefinitions.xml";
|
|
|
235 |
oDefType = this.unmarshallSrcFile(srcFile, "core");
|
|
|
236 |
defType = (DefinitionType)oDefType;
|
|
|
237 |
this.helpDocDefinitions = this.convertHelpDocDefinitions(defType);
|
| 1050 |
rajveer |
238 |
|
|
|
239 |
}
|
|
|
240 |
|
|
|
241 |
private void initializeFacetsDefinitionObjects() throws Exception{
|
|
|
242 |
IRDefinitionType irDefType = null;
|
|
|
243 |
String srcFile;
|
|
|
244 |
Object oDefType = null;
|
|
|
245 |
|
|
|
246 |
//all facet definitions
|
|
|
247 |
srcFile = xmlDefinitionsPath+ "facetdefinitions.xml";
|
|
|
248 |
oDefType = this.unmarshallSrcFile(srcFile, "facets");
|
|
|
249 |
irDefType = (IRDefinitionType)oDefType;
|
|
|
250 |
this.facetDefinitions = this.convertFacetDefinitions(irDefType);
|
|
|
251 |
|
| 1314 |
rajveer |
252 |
//
|
|
|
253 |
this.populateSlideFacetDefinitions();
|
|
|
254 |
|
| 1050 |
rajveer |
255 |
//category facet definitions
|
|
|
256 |
srcFile = xmlDefinitionsPath+ "categoryfacetdefinitions.xml";
|
|
|
257 |
oDefType = this.unmarshallSrcFile(srcFile, "facets");
|
|
|
258 |
irDefType = (IRDefinitionType)oDefType;
|
|
|
259 |
this.categoryFacetDefinitions = this.convertCategoryFacetDefinitions(irDefType);
|
|
|
260 |
|
| 1314 |
rajveer |
261 |
|
| 1050 |
rajveer |
262 |
//ir data rules
|
|
|
263 |
srcFile = xmlDefinitionsPath+ "irdatarules.xml";
|
|
|
264 |
oDefType = this.unmarshallSrcFile(srcFile, "facets");
|
|
|
265 |
irDefType = (IRDefinitionType)oDefType;
|
|
|
266 |
irDataRuleDefinitions = this.convertRuleDefinitions(irDefType);
|
|
|
267 |
|
|
|
268 |
//ir meta data rules
|
|
|
269 |
srcFile = xmlDefinitionsPath+ "irmetadatarules.xml";
|
|
|
270 |
oDefType = this.unmarshallSrcFile(srcFile, "facets");
|
|
|
271 |
irDefType = (IRDefinitionType)oDefType;
|
| 1071 |
chandransh |
272 |
irMetaDataRuleDefinitions = this.convertRuleDefinitions(irDefType);
|
| 1050 |
rajveer |
273 |
|
|
|
274 |
//normalization rules
|
|
|
275 |
srcFile = xmlDefinitionsPath+ "normalizationrules.xml";
|
|
|
276 |
oDefType = this.unmarshallSrcFile(srcFile, "facets");
|
|
|
277 |
irDefType = (IRDefinitionType)oDefType;
|
|
|
278 |
normalizationRuleDefinitions = this.convertNormalizationRuleDefinitions(irDefType);
|
|
|
279 |
}
|
|
|
280 |
|
|
|
281 |
private void initializeComparisonDefinitionObjects() throws Exception{
|
|
|
282 |
CMPDefinitionType cmpDefType = null;
|
|
|
283 |
String srcFile;
|
|
|
284 |
Object oDefType = null;
|
|
|
285 |
|
|
|
286 |
//all facet definitions
|
|
|
287 |
srcFile = xmlDefinitionsPath+ "comparisonrules.xml";
|
|
|
288 |
oDefType = this.unmarshallSrcFile(srcFile, "comparison");
|
|
|
289 |
cmpDefType = (CMPDefinitionType)oDefType;
|
|
|
290 |
this.cmpRuleDefinitions = this.convertComparisonRuleDefinitions(cmpDefType);
|
|
|
291 |
|
|
|
292 |
|
|
|
293 |
//all f
|
|
|
294 |
srcFile = xmlDefinitionsPath+ "comparisondefinitions.xml";
|
|
|
295 |
oDefType = this.unmarshallSrcFile(srcFile, "comparison");
|
|
|
296 |
cmpDefType = (CMPDefinitionType)oDefType;
|
|
|
297 |
this.cmpSlideRuleDefinitions = this.convertComparisonDefinitions(cmpDefType);
|
|
|
298 |
|
|
|
299 |
//all facet definitions
|
|
|
300 |
srcFile = xmlDefinitionsPath+ "comparisonbuckets.xml";
|
|
|
301 |
oDefType = this.unmarshallSrcFile(srcFile, "comparison");
|
|
|
302 |
cmpDefType = (CMPDefinitionType)oDefType;
|
|
|
303 |
this.cmpBucketDefinitions = this.convertComparisonBuckets(cmpDefType);
|
|
|
304 |
|
|
|
305 |
}
|
|
|
306 |
|
|
|
307 |
|
| 473 |
rajveer |
308 |
/**
|
| 1050 |
rajveer |
309 |
*
|
|
|
310 |
* @param irDefType
|
|
|
311 |
* @return
|
|
|
312 |
*/
|
|
|
313 |
private Map<Long, RuleDefinition> convertNormalizationRuleDefinitions(
|
|
|
314 |
IRDefinitionType defType) {
|
|
|
315 |
|
|
|
316 |
Map<Long, RuleDefinition> idRuleDef =
|
|
|
317 |
new TreeMap<Long, RuleDefinition>();
|
|
|
318 |
|
|
|
319 |
List<RuleDefinitionType> jaxbRuleDefs = defType.getRuleDefinition();
|
|
|
320 |
|
|
|
321 |
for(RuleDefinitionType jaxbRuleDef : jaxbRuleDefs) {
|
|
|
322 |
long id = jaxbRuleDef.getID();
|
|
|
323 |
String script = jaxbRuleDef.getScript();
|
|
|
324 |
|
|
|
325 |
RuleDefinition ruleDef = new RuleDefinition(id, script);
|
|
|
326 |
ruleDef.setDescription(jaxbRuleDef.getDescription());
|
|
|
327 |
|
|
|
328 |
idRuleDef.put(new Long(id), ruleDef);
|
|
|
329 |
}
|
|
|
330 |
|
|
|
331 |
Utils.info("idRuleDef=" + idRuleDef);
|
|
|
332 |
|
|
|
333 |
return idRuleDef;
|
|
|
334 |
}
|
|
|
335 |
|
|
|
336 |
|
|
|
337 |
|
|
|
338 |
/**
|
|
|
339 |
*
|
|
|
340 |
* @param defType
|
|
|
341 |
* @return Map<Long, CMPRuleDefinition>
|
|
|
342 |
*/
|
|
|
343 |
private Map<Long, CMPRuleDefinition> convertComparisonRuleDefinitions(
|
|
|
344 |
CMPDefinitionType defType) {
|
|
|
345 |
Map<Long, CMPRuleDefinition> idRuleDef =
|
|
|
346 |
new TreeMap<Long, CMPRuleDefinition>();
|
|
|
347 |
|
|
|
348 |
List<CMPRuleDefinitionType> jaxbRuleDefs =
|
|
|
349 |
defType.getCMPRuleDefinition();
|
|
|
350 |
|
|
|
351 |
for(CMPRuleDefinitionType jaxbRuleDef : jaxbRuleDefs) {
|
|
|
352 |
long id = jaxbRuleDef.getID();
|
|
|
353 |
String script = jaxbRuleDef.getScript();
|
|
|
354 |
|
|
|
355 |
CMPRuleDefinition ruleDef = new CMPRuleDefinition(id, script);
|
|
|
356 |
ruleDef.setDescription(jaxbRuleDef.getDescription());
|
|
|
357 |
|
|
|
358 |
idRuleDef.put(new Long(id), ruleDef);
|
|
|
359 |
}
|
|
|
360 |
|
|
|
361 |
Utils.info("idRuleDef=" + idRuleDef);
|
|
|
362 |
return idRuleDef;
|
|
|
363 |
}
|
|
|
364 |
|
|
|
365 |
/**
|
|
|
366 |
*
|
|
|
367 |
* @param defType
|
|
|
368 |
* @return Map<Long, CMPSlideRuleDefinition>
|
|
|
369 |
*/
|
|
|
370 |
private Map<Long, CMPSlideRuleDefinition> convertComparisonDefinitions(
|
|
|
371 |
CMPDefinitionType defType) {
|
|
|
372 |
|
|
|
373 |
Map<Long, CMPSlideRuleDefinition> slideRuleDefs =
|
|
|
374 |
new TreeMap<Long, CMPSlideRuleDefinition>();
|
|
|
375 |
|
|
|
376 |
List<CMPSlideRuleDefinitionType> jaxbDefs =
|
|
|
377 |
defType.getCMPSlideRuleDefinition();
|
|
|
378 |
|
|
|
379 |
for(CMPSlideRuleDefinitionType jaxbDef : jaxbDefs) {
|
|
|
380 |
long ruleDefID = jaxbDef.getRuleDefinitionID();
|
|
|
381 |
long slideDefID = jaxbDef.getSlideDefinitionID();
|
|
|
382 |
|
|
|
383 |
CMPSlideRuleDefinition slideRuleDef =
|
|
|
384 |
new CMPSlideRuleDefinition(slideDefID, ruleDefID);
|
|
|
385 |
|
|
|
386 |
slideRuleDef.setDescription(jaxbDef.getDescription());
|
|
|
387 |
|
|
|
388 |
slideRuleDefs.put(new Long(slideDefID), slideRuleDef);
|
|
|
389 |
}
|
|
|
390 |
|
|
|
391 |
Utils.info("slideRuleDefs=" + slideRuleDefs);
|
|
|
392 |
return slideRuleDefs;
|
|
|
393 |
}
|
|
|
394 |
|
|
|
395 |
/**
|
|
|
396 |
*
|
|
|
397 |
* @param defType
|
|
|
398 |
* @return
|
|
|
399 |
*/
|
|
|
400 |
private Map<Long, List<CMPBucketDefinition>> convertComparisonBuckets(
|
|
|
401 |
CMPDefinitionType defType) {
|
|
|
402 |
|
|
|
403 |
Map<Long, List<CMPBucketDefinition>> cmpBuckets =
|
|
|
404 |
new HashMap<Long, List<CMPBucketDefinition>>();
|
|
|
405 |
|
|
|
406 |
List<CMPBucketDefinitionType> jaxbBuckets =
|
|
|
407 |
defType.getCMPBucketDefinition();
|
|
|
408 |
|
|
|
409 |
for(CMPBucketDefinitionType jaxbBucket : jaxbBuckets) {
|
|
|
410 |
String name = jaxbBucket.getName();
|
|
|
411 |
long categoryID = jaxbBucket.getCategoryID();
|
|
|
412 |
|
|
|
413 |
CMPBucketDefinition bucketDef =
|
|
|
414 |
new CMPBucketDefinition(name, categoryID);
|
|
|
415 |
|
|
|
416 |
bucketDef.setDescription(jaxbBucket.getDescription());
|
|
|
417 |
bucketDef.setDefaultWeight(
|
|
|
418 |
jaxbBucket.getDefaultWeight().intValue());
|
|
|
419 |
bucketDef.setSlideDefinitionIDs(jaxbBucket.getSlideDefinitionID());
|
|
|
420 |
|
|
|
421 |
List<CMPBucketDefinition> categoryBuckets =
|
|
|
422 |
cmpBuckets.get(new Long(categoryID));
|
|
|
423 |
|
|
|
424 |
if(categoryBuckets == null) {
|
|
|
425 |
categoryBuckets = new ArrayList<CMPBucketDefinition>();
|
|
|
426 |
cmpBuckets.put(new Long(categoryID), categoryBuckets);
|
|
|
427 |
}
|
|
|
428 |
|
|
|
429 |
categoryBuckets.add(bucketDef);
|
|
|
430 |
}
|
|
|
431 |
Utils.info("cmpBuckets=" + cmpBuckets);
|
|
|
432 |
|
|
|
433 |
return cmpBuckets;
|
|
|
434 |
}
|
|
|
435 |
|
|
|
436 |
|
|
|
437 |
/**
|
|
|
438 |
*
|
|
|
439 |
* @param defType
|
|
|
440 |
* @return
|
|
|
441 |
*/
|
|
|
442 |
private Map<Long, RuleDefinition> convertRuleDefinitions(
|
|
|
443 |
IRDefinitionType defType) {
|
|
|
444 |
Map<Long, RuleDefinition> idRuleDef =
|
|
|
445 |
new TreeMap<Long, RuleDefinition>();
|
|
|
446 |
|
|
|
447 |
List<RuleDefinitionType> jaxbRuleDefs = defType.getRuleDefinition();
|
|
|
448 |
|
|
|
449 |
for(RuleDefinitionType jaxbRuleDef : jaxbRuleDefs) {
|
|
|
450 |
long id = jaxbRuleDef.getID();
|
|
|
451 |
String script = jaxbRuleDef.getScript();
|
|
|
452 |
|
|
|
453 |
RuleDefinition ruleDef = new RuleDefinition(id, script);
|
|
|
454 |
ruleDef.setDescription(jaxbRuleDef.getDescription());
|
|
|
455 |
|
|
|
456 |
idRuleDef.put(new Long(id), ruleDef);
|
|
|
457 |
}
|
|
|
458 |
|
|
|
459 |
Utils.info("idRuleDef=" + idRuleDef);
|
|
|
460 |
return idRuleDef;
|
|
|
461 |
}
|
|
|
462 |
|
|
|
463 |
|
|
|
464 |
/**
|
|
|
465 |
*
|
|
|
466 |
* @param defType
|
|
|
467 |
* @return
|
|
|
468 |
*/
|
|
|
469 |
private Map<Long, FacetDefinition> convertFacetDefinitions(
|
|
|
470 |
IRDefinitionType defType) {
|
|
|
471 |
List<FacetDefinitionType> jaxbFacetDefs = defType.getFacetDefinition();
|
|
|
472 |
|
|
|
473 |
Map<Long, FacetDefinition> idFacetDefs =
|
|
|
474 |
new TreeMap<Long, FacetDefinition>();
|
|
|
475 |
|
|
|
476 |
for(FacetDefinitionType jaxbFacetDef : jaxbFacetDefs) {
|
|
|
477 |
long id = jaxbFacetDef.getID();
|
|
|
478 |
String target = jaxbFacetDef.getTarget();
|
|
|
479 |
|
|
|
480 |
FacetDefinition facetDef = new FacetDefinition(id, target);
|
|
|
481 |
|
| 1314 |
rajveer |
482 |
List<FacetSlideDefinition> facetSlideDefinitions = convertFacetSlideDefinitions(jaxbFacetDef);
|
| 1050 |
rajveer |
483 |
|
| 1314 |
rajveer |
484 |
facetDef.setFacetSlideDefinitions(facetSlideDefinitions);
|
| 1050 |
rajveer |
485 |
|
|
|
486 |
facetDef.setDescription(jaxbFacetDef.getDescription());
|
|
|
487 |
|
|
|
488 |
idFacetDefs.put(new Long(id), facetDef);
|
| 1314 |
rajveer |
489 |
|
| 1050 |
rajveer |
490 |
}
|
|
|
491 |
Utils.info("idFacetDefs=" + idFacetDefs);
|
|
|
492 |
return idFacetDefs;
|
|
|
493 |
}
|
|
|
494 |
|
| 1314 |
rajveer |
495 |
private void populateSlideFacetDefinitions() {
|
|
|
496 |
this.slideFacetDefinitions = new HashMap<Long, List<FacetDefinition>>();
|
|
|
497 |
for(FacetDefinition facetDef: facetDefinitions.values())
|
|
|
498 |
for(FacetSlideDefinition facetSlideDef: facetDef.getFacetSlideDefinitions()){
|
|
|
499 |
List<FacetDefinition> facetDefs = this.slideFacetDefinitions.get(facetSlideDef.getSlideDefinitionID());
|
|
|
500 |
if(facetDefs==null){
|
|
|
501 |
facetDefs = new ArrayList<FacetDefinition>();
|
|
|
502 |
}
|
|
|
503 |
facetDefs.add(facetDef);
|
|
|
504 |
this.slideFacetDefinitions.put(facetSlideDef.getSlideDefinitionID(), facetDefs);
|
|
|
505 |
}
|
|
|
506 |
}
|
|
|
507 |
|
|
|
508 |
private List<FacetSlideDefinition> convertFacetSlideDefinitions(
|
|
|
509 |
FacetDefinitionType jaxbFacetDef) {
|
|
|
510 |
|
|
|
511 |
List<FacetSlideDefinition> facetSlideDefinitions = new ArrayList<FacetSlideDefinition>();
|
|
|
512 |
|
|
|
513 |
for(FacetSlideDefinitionType jaxbFacetSlideDef : jaxbFacetDef.getFacetSlideDefinition()){
|
|
|
514 |
long irDataRuleID = jaxbFacetSlideDef.getIRDataRuleID();
|
|
|
515 |
long irMetaDataRuleID = jaxbFacetSlideDef.getIRMetaDataRuleID();
|
|
|
516 |
long slideDefinitionID = jaxbFacetSlideDef.getSlideDefinitionID();
|
|
|
517 |
FacetSlideDefinition facetSlideDefinition = new FacetSlideDefinition(slideDefinitionID, irMetaDataRuleID, irDataRuleID);
|
|
|
518 |
facetSlideDefinitions.add(facetSlideDefinition);
|
|
|
519 |
}
|
|
|
520 |
return facetSlideDefinitions;
|
|
|
521 |
}
|
|
|
522 |
|
| 1050 |
rajveer |
523 |
/**
|
|
|
524 |
*
|
|
|
525 |
* @param defType
|
|
|
526 |
* @return
|
|
|
527 |
* @throws Exception
|
|
|
528 |
*/
|
|
|
529 |
private Map<Long, CategoryFacetDefinition> convertCategoryFacetDefinitions(
|
|
|
530 |
IRDefinitionType defType) throws Exception {
|
| 1314 |
rajveer |
531 |
List<CategoryFacetDefinitionType> jaxbCategoryFacetDefs = defType.getCategoryFacetDefinition();
|
| 1050 |
rajveer |
532 |
|
|
|
533 |
Map<Long, CategoryFacetDefinition> idCategoryFacetDefs =
|
|
|
534 |
new TreeMap<Long, CategoryFacetDefinition>();
|
|
|
535 |
|
|
|
536 |
for(CategoryFacetDefinitionType jaxbCategoryFacetDef :
|
|
|
537 |
jaxbCategoryFacetDefs) {
|
| 1314 |
rajveer |
538 |
|
| 1050 |
rajveer |
539 |
long categoryID = jaxbCategoryFacetDef.getCategoryID();
|
|
|
540 |
|
|
|
541 |
CategoryFacetDefinition categoryFacetDef =
|
|
|
542 |
new CategoryFacetDefinition(categoryID);
|
|
|
543 |
|
|
|
544 |
|
| 1314 |
rajveer |
545 |
List<Long> facetIDs = jaxbCategoryFacetDef.getFacetDefinitionID();
|
|
|
546 |
|
|
|
547 |
|
|
|
548 |
for(Long facetID : facetIDs) {
|
|
|
549 |
categoryFacetDef.addFacetDefinition(facetDefinitions.get(facetID));
|
| 1050 |
rajveer |
550 |
}
|
|
|
551 |
|
|
|
552 |
idCategoryFacetDefs.put(new Long(categoryID), categoryFacetDef);
|
|
|
553 |
}
|
|
|
554 |
|
|
|
555 |
// Append parent's facets
|
|
|
556 |
// Go only one level for now
|
|
|
557 |
// Categories need to be imported first
|
|
|
558 |
|
|
|
559 |
for(Long categoryID : idCategoryFacetDefs.keySet()) {
|
|
|
560 |
Category category = this.getCategory(categoryID.longValue());
|
|
|
561 |
Category parentCategory = category.getParentCategory();
|
|
|
562 |
|
|
|
563 |
if(parentCategory != null) {
|
|
|
564 |
long parentCategoryID = parentCategory.getID();
|
|
|
565 |
|
|
|
566 |
CategoryFacetDefinition parentCategoryFacetDef =
|
|
|
567 |
idCategoryFacetDefs.get(new Long(parentCategoryID));
|
|
|
568 |
|
|
|
569 |
if(parentCategoryFacetDef != null) {
|
| 1314 |
rajveer |
570 |
List<FacetDefinition> parentsFacetDefs =
|
|
|
571 |
parentCategoryFacetDef.getFacetDefinitions();
|
| 1050 |
rajveer |
572 |
|
| 1314 |
rajveer |
573 |
if(parentsFacetDefs != null) {
|
| 1050 |
rajveer |
574 |
CategoryFacetDefinition categoryFacetDef =
|
|
|
575 |
idCategoryFacetDefs.get(categoryID);
|
|
|
576 |
|
| 1314 |
rajveer |
577 |
categoryFacetDef.appendFacetDefinitions(
|
|
|
578 |
parentsFacetDefs);
|
| 1050 |
rajveer |
579 |
}
|
|
|
580 |
}
|
|
|
581 |
}
|
|
|
582 |
}
|
|
|
583 |
|
|
|
584 |
Utils.info("idCategoryFacetDefs=" + idCategoryFacetDefs);
|
|
|
585 |
return idCategoryFacetDefs;
|
|
|
586 |
}
|
|
|
587 |
|
| 1314 |
rajveer |
588 |
private FacetDefinition convertFacetDefinition(
|
|
|
589 |
FacetDefinitionType jaxbFacetDef) {
|
|
|
590 |
long facetID = jaxbFacetDef.getID();
|
|
|
591 |
String target = jaxbFacetDef.getTarget();
|
|
|
592 |
FacetDefinition facetDefinition = new FacetDefinition(facetID, target);
|
|
|
593 |
facetDefinition.setDescription(jaxbFacetDef.getDescription());
|
|
|
594 |
facetDefinition.setFacetSlideDefinitions(convertFacetSlideDefinitions(jaxbFacetDef));
|
|
|
595 |
return facetDefinition;
|
|
|
596 |
}
|
|
|
597 |
|
|
|
598 |
|
| 1050 |
rajveer |
599 |
/**
|
|
|
600 |
*
|
|
|
601 |
* @param jaxbFacetRuleDef
|
|
|
602 |
* @return
|
|
|
603 |
*/
|
| 1314 |
rajveer |
604 |
/*
|
| 1050 |
rajveer |
605 |
private FacetRuleDefinition convertFacetRuleDefinition(
|
|
|
606 |
FacetRuleDefinitionType jaxbFacetRuleDef) {
|
|
|
607 |
long facetDefID = jaxbFacetRuleDef.getFacetDefinitionID();
|
|
|
608 |
long irDataRuleID = jaxbFacetRuleDef.getIRDataRuleID();
|
|
|
609 |
|
|
|
610 |
FacetRuleDefinition facetRuleDef = new FacetRuleDefinition(facetDefID,
|
|
|
611 |
irDataRuleID);
|
|
|
612 |
|
|
|
613 |
facetRuleDef.setDescription(jaxbFacetRuleDef.getDescription());
|
|
|
614 |
|
|
|
615 |
if(jaxbFacetRuleDef.getFeatureDefinitionID() != null) {
|
|
|
616 |
facetRuleDef.setFeatureDefinitionID(
|
|
|
617 |
jaxbFacetRuleDef.getFeatureDefinitionID().longValue());
|
|
|
618 |
}
|
|
|
619 |
|
|
|
620 |
if(jaxbFacetRuleDef.getSlideDefinitionID() != null) {
|
|
|
621 |
facetRuleDef.setSlideDefinitionID(
|
|
|
622 |
jaxbFacetRuleDef.getSlideDefinitionID().longValue());
|
|
|
623 |
}
|
|
|
624 |
|
|
|
625 |
return facetRuleDef;
|
|
|
626 |
}
|
| 1314 |
rajveer |
627 |
*/
|
| 1050 |
rajveer |
628 |
|
|
|
629 |
private void populateEnumValues(){
|
|
|
630 |
// RE-VISIT - May not be optimal
|
|
|
631 |
Map<Long, EnumValue> enumValuesMap = new TreeMap<Long, EnumValue>();
|
|
|
632 |
for(Long datatypeDefID : datatypeDefinitions.keySet()) {
|
|
|
633 |
DatatypeDefinition datatypeDef =
|
|
|
634 |
datatypeDefinitions.get(datatypeDefID);
|
|
|
635 |
|
|
|
636 |
if(datatypeDef instanceof EnumDefinition) {
|
|
|
637 |
List<EnumValue> enumValues =
|
|
|
638 |
((EnumDefinition) datatypeDef).getEnumValues();
|
|
|
639 |
|
|
|
640 |
for(EnumValue enumValue : enumValues) {
|
|
|
641 |
enumValuesMap.put(new Long(enumValue.getID()),
|
|
|
642 |
enumValue);
|
|
|
643 |
}
|
|
|
644 |
}
|
|
|
645 |
}
|
|
|
646 |
this.enumValues = enumValuesMap;
|
|
|
647 |
}
|
|
|
648 |
|
|
|
649 |
|
|
|
650 |
/**
|
| 199 |
naveen |
651 |
* Returns Slide sequence for a category in the database
|
|
|
652 |
*
|
|
|
653 |
* @return Map Null if Category-Slide definitions are not imported into
|
|
|
654 |
* definitions db
|
|
|
655 |
* (serialized java objects)
|
|
|
656 |
*
|
|
|
657 |
* @throws Exception
|
|
|
658 |
*/
|
|
|
659 |
public Map<Long, List<Long>> getCategorySlideSequence() throws Exception {
|
| 1050 |
rajveer |
660 |
return this.categorySlideSequence;
|
|
|
661 |
}
|
|
|
662 |
|
|
|
663 |
|
|
|
664 |
/**
|
|
|
665 |
*
|
|
|
666 |
* @param defType
|
|
|
667 |
* @return
|
|
|
668 |
*/
|
|
|
669 |
private Map<Long, List<Long>> convertCategorySlideSequence(
|
|
|
670 |
DefinitionType defType) {
|
|
|
671 |
Map<Long, List<Long>> catSlideSeq = new HashMap<Long, List<Long>>();
|
|
|
672 |
|
|
|
673 |
List<CategorySlideSequenceType> jaxbCatSlideSeqs =
|
|
|
674 |
defType.getCategorySlideSequence();
|
|
|
675 |
|
|
|
676 |
for(CategorySlideSequenceType jaxbCatSlideSeq : jaxbCatSlideSeqs) {
|
|
|
677 |
long catID = jaxbCatSlideSeq.getCategoryID();
|
|
|
678 |
List<Long> slideDefIDs = jaxbCatSlideSeq.getSlideDefinitionID();
|
| 199 |
naveen |
679 |
|
| 1050 |
rajveer |
680 |
Long lCatID = new Long(catID);
|
|
|
681 |
catSlideSeq.put(lCatID, slideDefIDs);
|
| 199 |
naveen |
682 |
}
|
|
|
683 |
|
| 1050 |
rajveer |
684 |
return catSlideSeq;
|
| 199 |
naveen |
685 |
}
|
|
|
686 |
|
| 1050 |
rajveer |
687 |
|
| 199 |
naveen |
688 |
/**
|
|
|
689 |
* Given a category ID, returns all slide definition IDs in sequence
|
|
|
690 |
* provided by content editor
|
|
|
691 |
*
|
|
|
692 |
* @param categoryID
|
|
|
693 |
* @return List of Slide Definition IDs
|
|
|
694 |
* @throws Exception
|
|
|
695 |
*/
|
| 1050 |
rajveer |
696 |
public List<Long> getCategorySlideSequence(long categoryID) throws Exception {
|
| 199 |
naveen |
697 |
return this.categorySlideSequence.get(new Long(categoryID));
|
|
|
698 |
}
|
|
|
699 |
|
|
|
700 |
/**
|
| 49 |
naveen |
701 |
* Returns all Unit objects in the database
|
| 10 |
shop2020 |
702 |
*
|
| 49 |
naveen |
703 |
* @return Map Null if units are not imported into definitions db
|
|
|
704 |
* (serialized java objects)
|
|
|
705 |
*
|
| 18 |
naveen |
706 |
* @throws Exception
|
| 10 |
shop2020 |
707 |
*/
|
| 1050 |
rajveer |
708 |
public Map<Long, Unit> getUnits() throws Exception {
|
|
|
709 |
return this.units;
|
|
|
710 |
}
|
|
|
711 |
|
|
|
712 |
|
|
|
713 |
/**
|
|
|
714 |
*
|
|
|
715 |
* @param srcFile
|
|
|
716 |
* @return
|
|
|
717 |
* @throws Exception
|
|
|
718 |
*/
|
|
|
719 |
private Object unmarshallSrcFile(String srcFile, String type)
|
|
|
720 |
throws Exception {
|
|
|
721 |
|
|
|
722 |
JAXBContext jc = JAXBContext.newInstance("in.shop2020.metamodel.jaxb." +
|
|
|
723 |
type);
|
|
|
724 |
|
|
|
725 |
// create an Unmarshaller
|
|
|
726 |
Unmarshaller u = jc.createUnmarshaller();
|
|
|
727 |
|
|
|
728 |
JAXBElement<?> element = (JAXBElement<?>)u.unmarshal(
|
|
|
729 |
new FileInputStream(srcFile));
|
|
|
730 |
|
|
|
731 |
return element.getValue();
|
|
|
732 |
}
|
|
|
733 |
|
|
|
734 |
/**
|
|
|
735 |
*
|
|
|
736 |
* @return Map
|
|
|
737 |
*/
|
|
|
738 |
private Map<Long, Unit> convertUnits(DefinitionType defType) {
|
|
|
739 |
|
|
|
740 |
Map<Long, Unit> allUnits = new HashMap<Long, Unit>();
|
|
|
741 |
List<UnitType> jaxbUnits = defType.getUnit();
|
|
|
742 |
Iterator<UnitType> it = jaxbUnits.iterator();
|
|
|
743 |
|
|
|
744 |
while(it.hasNext()) {
|
|
|
745 |
UnitType jaxbUnit = it.next();
|
| 18 |
naveen |
746 |
|
| 1050 |
rajveer |
747 |
Unit unit = new Unit(jaxbUnit.getID());
|
|
|
748 |
unit.setDescription(jaxbUnit.getDescription());
|
|
|
749 |
unit.setFullForm(jaxbUnit.getFullform());
|
|
|
750 |
unit.setShortForm(jaxbUnit.getShortform());
|
|
|
751 |
Utils.info("unit=" + unit);
|
|
|
752 |
|
|
|
753 |
allUnits.put(new Long(jaxbUnit.getID()), unit);
|
| 17 |
naveen |
754 |
}
|
| 18 |
naveen |
755 |
|
| 1050 |
rajveer |
756 |
return allUnits;
|
| 10 |
shop2020 |
757 |
}
|
|
|
758 |
|
| 1050 |
rajveer |
759 |
|
| 10 |
shop2020 |
760 |
/**
|
| 49 |
naveen |
761 |
* Resolves Unit ID into Unit object
|
| 10 |
shop2020 |
762 |
*
|
| 49 |
naveen |
763 |
* @param unitID Unit ID
|
| 10 |
shop2020 |
764 |
* @return Unit
|
| 18 |
naveen |
765 |
* @throws Exception
|
| 10 |
shop2020 |
766 |
*/
|
| 18 |
naveen |
767 |
public Unit getUnit(long unitID) throws Exception {
|
| 10 |
shop2020 |
768 |
return this.units.get(new Long(unitID));
|
|
|
769 |
}
|
|
|
770 |
|
|
|
771 |
/**
|
| 49 |
naveen |
772 |
* Returns all DatatypeDefintion object in database
|
|
|
773 |
*
|
|
|
774 |
* @return the datatypeDefinitions List of DatatypeDefinition objects
|
| 18 |
naveen |
775 |
* @throws Exception
|
| 10 |
shop2020 |
776 |
*/
|
| 1050 |
rajveer |
777 |
public Map<Long, DatatypeDefinition> getDatatypeDefinitions(){
|
|
|
778 |
return this.datatypeDefinitions;
|
|
|
779 |
}
|
|
|
780 |
|
|
|
781 |
|
|
|
782 |
/**
|
|
|
783 |
*
|
|
|
784 |
* @param defType
|
|
|
785 |
* @return
|
|
|
786 |
*/
|
|
|
787 |
private Map<Long, DatatypeDefinition> convertDatatypeDefinition(DefinitionType defType) {
|
| 18 |
naveen |
788 |
|
| 1050 |
rajveer |
789 |
Map<Long, DatatypeDefinition> defs = new HashMap<Long, DatatypeDefinition>();
|
|
|
790 |
|
|
|
791 |
List<DatatypeDefinitionType> jaxbDefs = defType.getDatatypeDefinition();
|
|
|
792 |
Iterator<DatatypeDefinitionType> it = jaxbDefs.iterator();
|
|
|
793 |
|
|
|
794 |
while(it.hasNext()) {
|
|
|
795 |
DatatypeDefinitionType jaxbDef = it.next();
|
| 18 |
naveen |
796 |
|
| 1050 |
rajveer |
797 |
DatatypeDefinition def = null;
|
|
|
798 |
CompositeDefinitionType compositeDefType = jaxbDef.getCompositeDefinition();
|
|
|
799 |
|
|
|
800 |
EnumDefinitionType enumDefType = jaxbDef.getEnumDefinition();
|
|
|
801 |
|
|
|
802 |
// Composite data type
|
|
|
803 |
if(compositeDefType != null) {
|
|
|
804 |
CompositeDefinition compDef = new CompositeDefinition(jaxbDef.getID(), jaxbDef.getName(), compositeDefType.getSeparator());
|
|
|
805 |
|
|
|
806 |
List<CompositePartDefinitionType> jaxbPartDefs = compositeDefType.getCompositePartDefinition();
|
|
|
807 |
|
|
|
808 |
Iterator<CompositePartDefinitionType> itPartDefs = jaxbPartDefs.iterator();
|
|
|
809 |
|
|
|
810 |
// Collect parts
|
|
|
811 |
while(itPartDefs.hasNext()) {
|
|
|
812 |
CompositePartDefinitionType jaxbPartDef = itPartDefs.next();
|
|
|
813 |
CompositePartDefinition partDef = this.convertCompositePartDefinition(jaxbPartDef);
|
|
|
814 |
|
|
|
815 |
compDef.addCompositePartDefinition(partDef);
|
|
|
816 |
}
|
|
|
817 |
|
|
|
818 |
def = compDef;
|
|
|
819 |
}
|
|
|
820 |
|
|
|
821 |
// Enumerated values
|
|
|
822 |
else if(enumDefType != null) {
|
|
|
823 |
EnumDefinition enumDef = new EnumDefinition(jaxbDef.getID(),
|
|
|
824 |
jaxbDef.getName());
|
|
|
825 |
|
|
|
826 |
List<EnumValueType> jaxbEnumValues =
|
|
|
827 |
enumDefType.getEnumValue();
|
|
|
828 |
|
|
|
829 |
Iterator<EnumValueType> itEnumValues =
|
|
|
830 |
jaxbEnumValues.iterator();
|
|
|
831 |
|
|
|
832 |
// Collect individual value
|
|
|
833 |
while(itEnumValues.hasNext()) {
|
|
|
834 |
EnumValueType jaxbEnumValue = itEnumValues.next();
|
|
|
835 |
EnumValue enumValue =
|
|
|
836 |
this.convertEnumValueDefinition(jaxbEnumValue);
|
|
|
837 |
|
|
|
838 |
enumDef.addEnumValue(enumValue);
|
|
|
839 |
}
|
|
|
840 |
|
|
|
841 |
def = enumDef;
|
|
|
842 |
}
|
|
|
843 |
|
|
|
844 |
// Primitive
|
|
|
845 |
else {
|
|
|
846 |
def = new DatatypeDefinition(jaxbDef.getID(),
|
|
|
847 |
jaxbDef.getName());
|
|
|
848 |
}
|
|
|
849 |
|
|
|
850 |
def.setDescription(jaxbDef.getDescription());
|
|
|
851 |
Utils.info("def=" + def);
|
|
|
852 |
|
|
|
853 |
defs.put(new Long(jaxbDef.getID()), def);
|
| 18 |
naveen |
854 |
}
|
| 1050 |
rajveer |
855 |
|
|
|
856 |
return defs;
|
| 10 |
shop2020 |
857 |
}
|
| 18 |
naveen |
858 |
|
|
|
859 |
/**
|
| 1050 |
rajveer |
860 |
*
|
|
|
861 |
* @param jaxbPartDef
|
|
|
862 |
* @return CompositePartDefinition
|
|
|
863 |
*/
|
|
|
864 |
private CompositePartDefinition convertCompositePartDefinition(
|
|
|
865 |
CompositePartDefinitionType jaxbPartDef) {
|
|
|
866 |
|
|
|
867 |
CompositePartDefinition partDef = new CompositePartDefinition(
|
|
|
868 |
jaxbPartDef.getLabel(), jaxbPartDef.getDatatypeDefinitionID(),
|
|
|
869 |
jaxbPartDef.getUnitID());
|
|
|
870 |
|
|
|
871 |
partDef.setDescription(jaxbPartDef.getDescription());
|
|
|
872 |
|
|
|
873 |
return partDef;
|
|
|
874 |
}
|
|
|
875 |
|
|
|
876 |
/**
|
| 49 |
naveen |
877 |
* Resolves Datatype Definition ID into DatetypeDefinition object
|
| 18 |
naveen |
878 |
*
|
| 49 |
naveen |
879 |
* @param unitID Unit ID
|
| 18 |
naveen |
880 |
* @return Unit
|
|
|
881 |
* @throws Exception
|
|
|
882 |
*/
|
|
|
883 |
public DatatypeDefinition getDatatypeDefinition(long id) throws Exception {
|
|
|
884 |
|
|
|
885 |
// Initialize
|
|
|
886 |
if(this.datatypeDefinitions == null) {
|
|
|
887 |
this.getDatatypeDefinitions();
|
|
|
888 |
}
|
|
|
889 |
|
|
|
890 |
return this.datatypeDefinitions.get(new Long(id));
|
|
|
891 |
}
|
| 19 |
naveen |
892 |
|
|
|
893 |
/**
|
| 1050 |
rajveer |
894 |
*
|
|
|
895 |
* @param jaxbEnumValue
|
|
|
896 |
* @return EnumValue
|
|
|
897 |
*/
|
|
|
898 |
private EnumValue convertEnumValueDefinition(EnumValueType jaxbEnumValue) {
|
|
|
899 |
|
|
|
900 |
EnumValue enumValue = new EnumValue(jaxbEnumValue.getID(),
|
|
|
901 |
jaxbEnumValue.getValue());
|
| 2170 |
rajveer |
902 |
if(jaxbEnumValue.getHelpDocDefinitionID() != null){
|
|
|
903 |
enumValue.setHelpDocDefinitionID(jaxbEnumValue.getHelpDocDefinitionID());
|
|
|
904 |
}
|
| 1050 |
rajveer |
905 |
return enumValue;
|
|
|
906 |
}
|
|
|
907 |
/**
|
| 49 |
naveen |
908 |
* Returns EnumValue ID for datatype definition ID and enum value string
|
|
|
909 |
* to match. Match is case insensitive
|
| 19 |
naveen |
910 |
*
|
| 49 |
naveen |
911 |
* @param datatypeDefID DatatypeDefinition ID
|
|
|
912 |
* @param value query enum value string
|
| 19 |
naveen |
913 |
* @return long enumValueID - "-1" if not found
|
|
|
914 |
* @throws Exception
|
|
|
915 |
*/
|
|
|
916 |
public long getEnumValueID(long datatypeDefID, String value)
|
|
|
917 |
throws Exception {
|
|
|
918 |
long enumValueID = -1L;
|
|
|
919 |
|
|
|
920 |
// Let the callers catch ClassCastException
|
|
|
921 |
EnumDefinition enumDef =
|
|
|
922 |
(EnumDefinition)this.getDatatypeDefinition(datatypeDefID);
|
|
|
923 |
|
| 24 |
naveen |
924 |
List<EnumValue> enumValues = enumDef.getEnumValues();
|
| 19 |
naveen |
925 |
for(EnumValue enumValue : enumValues) {
|
|
|
926 |
if(value.equalsIgnoreCase(enumValue.getValue())) {
|
|
|
927 |
enumValueID = enumValue.getID();
|
|
|
928 |
break;
|
|
|
929 |
}
|
|
|
930 |
}
|
|
|
931 |
|
|
|
932 |
return enumValueID;
|
|
|
933 |
}
|
| 17 |
naveen |
934 |
|
| 10 |
shop2020 |
935 |
/**
|
| 49 |
naveen |
936 |
* Returns all category objects in the database
|
|
|
937 |
*
|
| 10 |
shop2020 |
938 |
* @return the categories
|
| 17 |
naveen |
939 |
* @throws Exception
|
| 10 |
shop2020 |
940 |
*/
|
| 1050 |
rajveer |
941 |
public Map<Long, Category> getCategories() {
|
|
|
942 |
return this.categories;
|
|
|
943 |
}
|
|
|
944 |
|
|
|
945 |
|
|
|
946 |
/**
|
|
|
947 |
*
|
|
|
948 |
* @param defType
|
|
|
949 |
* @param catMap
|
|
|
950 |
* @return
|
|
|
951 |
*/
|
|
|
952 |
private Category convertCategories(DefinitionType defType,
|
|
|
953 |
Map<Long, Category> catMap, String srcFile) {
|
|
|
954 |
|
|
|
955 |
List<CategoryType> jaxbCats = defType.getCategory();
|
|
|
956 |
Iterator<CategoryType> it = jaxbCats.iterator();
|
|
|
957 |
|
|
|
958 |
// Get root category
|
|
|
959 |
CategoryType jaxbCat = it.next();
|
|
|
960 |
if(jaxbCat == null) {
|
|
|
961 |
Utils.info("Invalid file: " + srcFile);
|
|
|
962 |
return null;
|
|
|
963 |
}
|
|
|
964 |
|
|
|
965 |
Category root = this.convertCategoryType(jaxbCat, null, catMap);
|
|
|
966 |
return root;
|
|
|
967 |
}
|
|
|
968 |
|
|
|
969 |
|
|
|
970 |
/**
|
|
|
971 |
*
|
|
|
972 |
* @param jaxbCat
|
|
|
973 |
* @param parentCat
|
|
|
974 |
* @param catMap
|
|
|
975 |
* @return
|
|
|
976 |
*/
|
| 17 |
naveen |
977 |
@SuppressWarnings("unchecked")
|
| 1050 |
rajveer |
978 |
private Category convertCategoryType(CategoryType jaxbCat,
|
|
|
979 |
Category parentCat, Map<Long, Category> catMap) {
|
| 17 |
naveen |
980 |
|
| 1050 |
rajveer |
981 |
Category cat = new Category(jaxbCat.getID());
|
|
|
982 |
cat.setLabel(jaxbCat.getName());
|
|
|
983 |
cat.setDescription(jaxbCat.getDescription());
|
| 4802 |
amit.gupta |
984 |
cat.setHasAccessories(jaxbCat.isHasAccessories());
|
|
|
985 |
cat.setComparable(jaxbCat.isComparable());
|
| 1050 |
rajveer |
986 |
if(parentCat != null) {
|
|
|
987 |
cat.setParentCategory(parentCat);
|
| 17 |
naveen |
988 |
|
| 1050 |
rajveer |
989 |
// Copy parent's category-slide definitions
|
|
|
990 |
ArrayList<CategorySlideDefinition> parentCSDef =
|
|
|
991 |
(ArrayList<CategorySlideDefinition>)
|
|
|
992 |
parentCat.getCategorySlideDefintions();
|
|
|
993 |
|
|
|
994 |
if(parentCSDef != null) {
|
|
|
995 |
cat.setCategorySlideDefintions(
|
|
|
996 |
(List<CategorySlideDefinition>) parentCSDef.clone());
|
|
|
997 |
}
|
| 17 |
naveen |
998 |
}
|
| 1050 |
rajveer |
999 |
|
|
|
1000 |
// Category Slide Definition
|
|
|
1001 |
List<CategorySlideDefinitionType> jaxbDefs =
|
|
|
1002 |
jaxbCat.getCategorySlideDefinition();
|
|
|
1003 |
|
|
|
1004 |
Iterator<CategorySlideDefinitionType> it = jaxbDefs.iterator();
|
|
|
1005 |
while(it.hasNext()) {
|
|
|
1006 |
CategorySlideDefinitionType jaxbDef = it.next();
|
|
|
1007 |
CategorySlideDefinition catSlideDef
|
|
|
1008 |
= this.convertCategorySlideDefinitionType(jaxbCat.getID(), jaxbDef);
|
|
|
1009 |
|
|
|
1010 |
cat.addCategorySlideDefintion(catSlideDef);
|
|
|
1011 |
}
|
|
|
1012 |
|
|
|
1013 |
// Children
|
|
|
1014 |
List<CategoryType> jaxbChildren = jaxbCat.getChildCategory();
|
|
|
1015 |
//Utils.info("jaxbChildren.size: " + jaxbChildren.size());
|
|
|
1016 |
|
|
|
1017 |
Iterator<CategoryType> itChildren = jaxbChildren.iterator();
|
|
|
1018 |
while(itChildren.hasNext()) {
|
|
|
1019 |
CategoryType jaxbChildCat = itChildren.next();
|
|
|
1020 |
Category childCat = this.convertCategoryType(jaxbChildCat, cat,
|
|
|
1021 |
catMap);
|
|
|
1022 |
cat.addChild(childCat);
|
|
|
1023 |
}
|
|
|
1024 |
|
|
|
1025 |
//FIXME put debug messages
|
|
|
1026 |
//Utils.info("Parent cat: " + cat);
|
|
|
1027 |
// DEBUG ONLY
|
|
|
1028 |
Utils.info("####### Cat ID: " + cat.getID());
|
|
|
1029 |
if(cat.getCategorySlideDefintions() != null) {
|
|
|
1030 |
for(CategorySlideDefinition csd : cat.getCategorySlideDefintions()){
|
|
|
1031 |
Utils.info("####### SlideDefintionID=" + csd.getSlideDefintionID());
|
|
|
1032 |
}
|
|
|
1033 |
}
|
|
|
1034 |
|
|
|
1035 |
catMap.put(new Long(jaxbCat.getID()), cat);
|
|
|
1036 |
return cat;
|
| 10 |
shop2020 |
1037 |
}
|
| 17 |
naveen |
1038 |
|
| 10 |
shop2020 |
1039 |
/**
|
| 1050 |
rajveer |
1040 |
*
|
|
|
1041 |
* @param categoryID
|
|
|
1042 |
* @param jaxbDef
|
|
|
1043 |
* @return
|
|
|
1044 |
*/
|
|
|
1045 |
private CategorySlideDefinition convertCategorySlideDefinitionType(
|
|
|
1046 |
long categoryID, CategorySlideDefinitionType jaxbDef) {
|
|
|
1047 |
|
|
|
1048 |
CategorySlideDefinition catSlideDef = new CategorySlideDefinition(
|
|
|
1049 |
jaxbDef.getSlideDefinitionID());
|
|
|
1050 |
|
|
|
1051 |
catSlideDef.setDescription(jaxbDef.getDescription());
|
|
|
1052 |
|
|
|
1053 |
EditorialImportanceType jaxbEdImp = jaxbDef.getEditorialImportance();
|
|
|
1054 |
EditorialImportance edImp = this.convertEditorialImportance(jaxbEdImp);
|
|
|
1055 |
catSlideDef.setEditorialImportance(edImp);
|
|
|
1056 |
|
|
|
1057 |
return catSlideDef;
|
|
|
1058 |
}
|
|
|
1059 |
|
| 4959 |
amit.gupta |
1060 |
private ChildSlideDefinition convertChildSlideDefintionType(ChildSlideType jaxbDef) {
|
|
|
1061 |
ChildSlideDefinition childSlideDef = new ChildSlideDefinition(
|
|
|
1062 |
jaxbDef.getID());
|
|
|
1063 |
EditorialImportanceType jaxbEdImp = jaxbDef.getEditorialImportance();
|
|
|
1064 |
EditorialImportance edImp = this.convertEditorialImportance(jaxbEdImp);
|
|
|
1065 |
childSlideDef.setEditorialImportance(edImp);
|
|
|
1066 |
return childSlideDef;
|
|
|
1067 |
|
|
|
1068 |
}
|
|
|
1069 |
|
| 1050 |
rajveer |
1070 |
/**
|
|
|
1071 |
*
|
|
|
1072 |
* @param jaxbEdImp
|
|
|
1073 |
* @return EditorialImportance
|
|
|
1074 |
*/
|
|
|
1075 |
private EditorialImportance convertEditorialImportance(
|
|
|
1076 |
EditorialImportanceType jaxbEdImp) {
|
|
|
1077 |
|
|
|
1078 |
String strEdImp = jaxbEdImp.value();
|
|
|
1079 |
EditorialImportance edImp = null;
|
|
|
1080 |
|
|
|
1081 |
if(strEdImp.equals("Mandatory"))
|
|
|
1082 |
edImp = EditorialImportance.MANDATORY;
|
|
|
1083 |
else if(strEdImp.equals("Optional"))
|
|
|
1084 |
edImp = EditorialImportance.OPTIONAL;
|
|
|
1085 |
else
|
|
|
1086 |
edImp = EditorialImportance.RECOMMENDED;
|
|
|
1087 |
|
|
|
1088 |
return edImp;
|
|
|
1089 |
}
|
|
|
1090 |
|
|
|
1091 |
|
|
|
1092 |
/**
|
| 49 |
naveen |
1093 |
* Resolves Category ID into Category object
|
| 17 |
naveen |
1094 |
*
|
| 49 |
naveen |
1095 |
* @param categoryID Category ID
|
| 17 |
naveen |
1096 |
* @return Category
|
|
|
1097 |
* @throws Exception
|
| 10 |
shop2020 |
1098 |
*/
|
| 1050 |
rajveer |
1099 |
public Category getCategory(long categoryID) {
|
| 17 |
naveen |
1100 |
return this.categories.get(new Long(categoryID));
|
| 10 |
shop2020 |
1101 |
}
|
| 17 |
naveen |
1102 |
|
| 10 |
shop2020 |
1103 |
/**
|
| 49 |
naveen |
1104 |
* Returns expanded Category object. All numeric identifiers are resolved
|
|
|
1105 |
* into detailed objects
|
| 18 |
naveen |
1106 |
*
|
|
|
1107 |
* @param categoryID
|
| 45 |
naveen |
1108 |
* @return ExpandedCategory
|
|
|
1109 |
* @throws Exception
|
|
|
1110 |
*/
|
|
|
1111 |
public ExpandedCategory getExpandedCategory(long categoryID)
|
|
|
1112 |
throws Exception {
|
|
|
1113 |
Category category = this.getCategory(categoryID);
|
|
|
1114 |
|
|
|
1115 |
ExpandedCategory expCategory = new ExpandedCategory(category);
|
|
|
1116 |
|
|
|
1117 |
return expCategory;
|
|
|
1118 |
}
|
|
|
1119 |
|
|
|
1120 |
/**
|
| 49 |
naveen |
1121 |
* Returns all children categories for a Category ID
|
| 45 |
naveen |
1122 |
*
|
|
|
1123 |
* @param categoryID
|
| 49 |
naveen |
1124 |
* @return List<Category> Children Categories
|
| 34 |
naveen |
1125 |
* @throws Exception
|
|
|
1126 |
*/
|
| 1050 |
rajveer |
1127 |
public List<Category> getChildrenCategories(long categoryID){
|
| 34 |
naveen |
1128 |
return this.categories.get(new Long(categoryID)).getChildrenCategory();
|
|
|
1129 |
}
|
| 49 |
naveen |
1130 |
|
| 34 |
naveen |
1131 |
/**
|
| 49 |
naveen |
1132 |
* Returns all CategorySlideDefinition objects for a Category ID
|
| 34 |
naveen |
1133 |
*
|
| 49 |
naveen |
1134 |
* @param categoryID Category ID
|
| 18 |
naveen |
1135 |
* @return List<CategorySlideDefinition>
|
|
|
1136 |
* @throws Exception
|
|
|
1137 |
*/
|
|
|
1138 |
public List<CategorySlideDefinition> getCategorySlideDefinitions(
|
|
|
1139 |
long categoryID) throws Exception {
|
|
|
1140 |
Category category = this.getCategory(categoryID);
|
|
|
1141 |
|
|
|
1142 |
return category.getCategorySlideDefintions();
|
|
|
1143 |
}
|
|
|
1144 |
|
|
|
1145 |
/**
|
| 49 |
naveen |
1146 |
* Returns All SlideDefinition objects in database
|
|
|
1147 |
*
|
| 10 |
shop2020 |
1148 |
* @return the slideDefinitions
|
| 18 |
naveen |
1149 |
* @throws Exception
|
| 10 |
shop2020 |
1150 |
*/
|
| 1050 |
rajveer |
1151 |
public Map<Long, SlideDefinition> getSlideDefinitions(){
|
|
|
1152 |
return this.slideDefinitions;
|
|
|
1153 |
}
|
|
|
1154 |
|
|
|
1155 |
/**
|
|
|
1156 |
*
|
|
|
1157 |
* @return Map
|
|
|
1158 |
*/
|
|
|
1159 |
private Map<Long, SlideDefinition> convertSlideDefinitions(
|
|
|
1160 |
DefinitionType defType) {
|
| 18 |
naveen |
1161 |
|
| 1050 |
rajveer |
1162 |
Map<Long, SlideDefinition> defs =
|
|
|
1163 |
new HashMap<Long, SlideDefinition>();
|
|
|
1164 |
|
|
|
1165 |
List<SlideDefinitionType> jaxbDefs = defType.getSlideDefinition();
|
|
|
1166 |
Iterator<SlideDefinitionType> itjaxbDefs = jaxbDefs.iterator();
|
|
|
1167 |
|
|
|
1168 |
// Slide definitions
|
|
|
1169 |
while(itjaxbDefs.hasNext()) {
|
|
|
1170 |
SlideDefinitionType jaxbDef = itjaxbDefs.next();
|
| 18 |
naveen |
1171 |
|
| 1050 |
rajveer |
1172 |
Utils.info("Slide label=" + jaxbDef.getLabel());
|
|
|
1173 |
SlideDefinition def = new SlideDefinition(jaxbDef.getID(),
|
|
|
1174 |
jaxbDef.getLabel());
|
|
|
1175 |
def.setDescription(jaxbDef.getDescription());
|
|
|
1176 |
|
| 2322 |
rajveer |
1177 |
Long helpDocDefID = jaxbDef.getHelpDocDefinitionID();
|
|
|
1178 |
if(helpDocDefID != null) {
|
|
|
1179 |
def.setHelpDocDefinitionID(helpDocDefID.longValue());
|
|
|
1180 |
}
|
|
|
1181 |
|
| 1050 |
rajveer |
1182 |
// Children Slides
|
| 4959 |
amit.gupta |
1183 |
List<Long> childSlides=new ArrayList<Long>();
|
|
|
1184 |
List<ChildSlideDefinition> childSlideDefs = new ArrayList<ChildSlideDefinition>();
|
|
|
1185 |
for(ChildSlideType cst : jaxbDef.getChildSlides()){
|
|
|
1186 |
childSlideDefs.add(convertChildSlideDefintionType(cst));
|
|
|
1187 |
childSlides.add(cst.getID());
|
|
|
1188 |
}
|
|
|
1189 |
Utils.info("jaxbDef.getChildSlideID=" + childSlides);
|
|
|
1190 |
def.setChildrenSlideDefinitionIDs(childSlides);
|
|
|
1191 |
def.setChildSlideDefinitions(childSlideDefs);
|
| 1050 |
rajveer |
1192 |
|
|
|
1193 |
// Slide Feature Definition
|
|
|
1194 |
List<SlideFeatureDefinitionType> jaxbSlideFeatureDefs =
|
|
|
1195 |
jaxbDef.getSlideFeatureDefinition();
|
|
|
1196 |
|
|
|
1197 |
if(jaxbSlideFeatureDefs != null) {
|
|
|
1198 |
def.setSlideFeatureDefinitions((
|
|
|
1199 |
this.convertSlideFeatureDefinitions(
|
|
|
1200 |
jaxbSlideFeatureDefs)));
|
|
|
1201 |
}
|
|
|
1202 |
Utils.info("def=" + def);
|
|
|
1203 |
|
|
|
1204 |
defs.put(new Long(jaxbDef.getID()), def);
|
| 18 |
naveen |
1205 |
}
|
| 1050 |
rajveer |
1206 |
|
|
|
1207 |
return defs;
|
| 10 |
shop2020 |
1208 |
}
|
| 1050 |
rajveer |
1209 |
|
| 18 |
naveen |
1210 |
|
|
|
1211 |
/**
|
| 2170 |
rajveer |
1212 |
*
|
|
|
1213 |
* @return Map
|
|
|
1214 |
*/
|
|
|
1215 |
private Map<Long, HelpDocDefinition> convertHelpDocDefinitions(DefinitionType defType) {
|
|
|
1216 |
|
|
|
1217 |
Map<Long, HelpDocDefinition> defs =
|
|
|
1218 |
new HashMap<Long, HelpDocDefinition>();
|
|
|
1219 |
|
|
|
1220 |
List<HelpDocDefinitionType> jaxbDefs = defType.getHelpDocDefinition();
|
|
|
1221 |
Iterator<HelpDocDefinitionType> itjaxbDefs = jaxbDefs.iterator();
|
|
|
1222 |
|
|
|
1223 |
// Help Doc definitions
|
|
|
1224 |
while(itjaxbDefs.hasNext()) {
|
|
|
1225 |
HelpDocDefinitionType jaxbDef = itjaxbDefs.next();
|
|
|
1226 |
|
|
|
1227 |
Utils.info("Helo doc name is =" + jaxbDef.getName());
|
|
|
1228 |
HelpDocDefinition def = new HelpDocDefinition(jaxbDef.getID(), jaxbDef.getName());
|
|
|
1229 |
|
|
|
1230 |
Utils.info("def=" + def);
|
|
|
1231 |
|
|
|
1232 |
defs.put(new Long(jaxbDef.getID()), def);
|
|
|
1233 |
}
|
|
|
1234 |
|
|
|
1235 |
return defs;
|
|
|
1236 |
}
|
|
|
1237 |
|
|
|
1238 |
|
|
|
1239 |
/**
|
| 1050 |
rajveer |
1240 |
*
|
|
|
1241 |
* @param jaxbDefs
|
|
|
1242 |
* @return List<SlideFeatureDefinition>
|
|
|
1243 |
*/
|
|
|
1244 |
private List<SlideFeatureDefinition> convertSlideFeatureDefinitions(
|
|
|
1245 |
List<SlideFeatureDefinitionType> jaxbDefs) {
|
|
|
1246 |
|
|
|
1247 |
List<SlideFeatureDefinition> defs =
|
|
|
1248 |
new ArrayList<SlideFeatureDefinition>();
|
|
|
1249 |
|
|
|
1250 |
Iterator<SlideFeatureDefinitionType> itjaxbDefs = jaxbDefs.iterator();
|
|
|
1251 |
|
|
|
1252 |
// Slide-feature definitions
|
|
|
1253 |
while(itjaxbDefs.hasNext()) {
|
|
|
1254 |
SlideFeatureDefinitionType jaxbDef = itjaxbDefs.next();
|
|
|
1255 |
SlideFeatureDefinition def = new SlideFeatureDefinition(
|
|
|
1256 |
jaxbDef.getFeatureDefinitionID());
|
|
|
1257 |
|
|
|
1258 |
def.setEditorialImportance(this.convertEditorialImportance(
|
|
|
1259 |
jaxbDef.getEditorialImportance()));
|
|
|
1260 |
|
|
|
1261 |
def.setDescription(jaxbDef.getDescription());
|
|
|
1262 |
|
|
|
1263 |
defs.add(def);
|
|
|
1264 |
}
|
|
|
1265 |
|
|
|
1266 |
return defs;
|
|
|
1267 |
}
|
|
|
1268 |
|
|
|
1269 |
|
|
|
1270 |
/**
|
| 49 |
naveen |
1271 |
* Resolves SlideDefinition ID into SlideDefinition object
|
| 18 |
naveen |
1272 |
*
|
|
|
1273 |
* @param id
|
|
|
1274 |
* @return SlideDefinition
|
|
|
1275 |
* @throws Exception
|
|
|
1276 |
*/
|
|
|
1277 |
public SlideDefinition getSlideDefinition(long id) throws Exception {
|
|
|
1278 |
|
|
|
1279 |
// Initialize
|
|
|
1280 |
if(this.slideDefinitions == null) {
|
|
|
1281 |
this.getSlideDefinitions();
|
|
|
1282 |
}
|
|
|
1283 |
|
|
|
1284 |
return this.slideDefinitions.get(new Long(id));
|
|
|
1285 |
}
|
|
|
1286 |
|
|
|
1287 |
/**
|
| 199 |
naveen |
1288 |
*
|
|
|
1289 |
* @param slideID
|
|
|
1290 |
* @return ExpandedSlideDefinition
|
|
|
1291 |
* @throws Exception
|
|
|
1292 |
*/
|
|
|
1293 |
public ExpandedSlideDefinition getExpandedSlideDefinition(long slideID)
|
|
|
1294 |
throws Exception {
|
|
|
1295 |
SlideDefinition slideDef = this.getSlideDefinition(slideID);
|
|
|
1296 |
|
|
|
1297 |
return new ExpandedSlideDefinition(slideDef);
|
|
|
1298 |
}
|
|
|
1299 |
|
|
|
1300 |
/**
|
| 49 |
naveen |
1301 |
* Returns SlideDefinition objects for a category and matching slide label
|
| 18 |
naveen |
1302 |
*
|
| 19 |
naveen |
1303 |
* @param label
|
|
|
1304 |
* @return List<SlideDefinition>
|
|
|
1305 |
* @throws Exception
|
|
|
1306 |
*/
|
| 32 |
naveen |
1307 |
public List<SlideDefinition> getSlideDefinitions(long categoryID,
|
|
|
1308 |
String label) throws Exception {
|
|
|
1309 |
|
|
|
1310 |
// RE-VISIT
|
|
|
1311 |
// May be we need a new data structure, category id to slide definitions
|
|
|
1312 |
// for now
|
|
|
1313 |
List<SlideDefinition> matchingSlides = new ArrayList<SlideDefinition>();
|
| 19 |
naveen |
1314 |
|
| 32 |
naveen |
1315 |
List<CategorySlideDefinition> csDefs = this.getCategorySlideDefinitions(
|
|
|
1316 |
categoryID);
|
|
|
1317 |
|
|
|
1318 |
for(CategorySlideDefinition csDef : csDefs) {
|
|
|
1319 |
SlideDefinition sDef = this.getSlideDefinition(
|
|
|
1320 |
csDef.getSlideDefintionID());
|
|
|
1321 |
|
|
|
1322 |
if(sDef.getLabel().equalsIgnoreCase(label)) {
|
|
|
1323 |
matchingSlides.add(sDef);
|
|
|
1324 |
}
|
| 19 |
naveen |
1325 |
}
|
|
|
1326 |
|
| 32 |
naveen |
1327 |
return matchingSlides;
|
|
|
1328 |
}
|
|
|
1329 |
|
|
|
1330 |
/**
|
| 49 |
naveen |
1331 |
* Resolves Category ID into Category object
|
| 32 |
naveen |
1332 |
*
|
|
|
1333 |
* @param categoryID
|
| 49 |
naveen |
1334 |
* @return List<SlideDefinition>
|
| 32 |
naveen |
1335 |
* @throws Exception
|
|
|
1336 |
*/
|
|
|
1337 |
public List<SlideDefinition> getSlideDefinitions(long categoryID)
|
|
|
1338 |
throws Exception {
|
|
|
1339 |
|
|
|
1340 |
// RE-VISIT
|
|
|
1341 |
// May be we need a new data structure, category id to slide definitions
|
|
|
1342 |
// for now
|
| 19 |
naveen |
1343 |
List<SlideDefinition> matchingSlides = new ArrayList<SlideDefinition>();
|
| 32 |
naveen |
1344 |
|
|
|
1345 |
List<CategorySlideDefinition> csDefs = this.getCategorySlideDefinitions(
|
|
|
1346 |
categoryID);
|
|
|
1347 |
|
|
|
1348 |
for(CategorySlideDefinition csDef : csDefs) {
|
|
|
1349 |
SlideDefinition sDef = this.getSlideDefinition(
|
|
|
1350 |
csDef.getSlideDefintionID());
|
| 19 |
naveen |
1351 |
|
| 32 |
naveen |
1352 |
matchingSlides.add(sDef);
|
| 19 |
naveen |
1353 |
}
|
|
|
1354 |
|
|
|
1355 |
return matchingSlides;
|
|
|
1356 |
}
|
| 49 |
naveen |
1357 |
|
| 19 |
naveen |
1358 |
/**
|
| 49 |
naveen |
1359 |
* Returns list of SlideDefinition objects for a category and editorial
|
|
|
1360 |
* importance value
|
| 19 |
naveen |
1361 |
*
|
| 18 |
naveen |
1362 |
* @param categoryID
|
|
|
1363 |
* @param EditorialImportance imp
|
|
|
1364 |
* @return List<SlideDefinition>
|
|
|
1365 |
* @throws Exception
|
|
|
1366 |
*/
|
|
|
1367 |
public List<SlideDefinition> getSlides(long categoryID,
|
|
|
1368 |
EditorialImportance imp)
|
|
|
1369 |
throws Exception {
|
|
|
1370 |
|
|
|
1371 |
List<CategorySlideDefinition> catSlideDefs =
|
|
|
1372 |
this.getCategorySlideDefinitions(categoryID);
|
|
|
1373 |
|
|
|
1374 |
Iterator<CategorySlideDefinition> itCatSlideDefs =
|
|
|
1375 |
catSlideDefs.iterator();
|
|
|
1376 |
|
|
|
1377 |
List<SlideDefinition> slideDefs = new ArrayList<SlideDefinition>();
|
|
|
1378 |
while(itCatSlideDefs.hasNext()) {
|
|
|
1379 |
CategorySlideDefinition catSlideDef = itCatSlideDefs.next();
|
|
|
1380 |
if(catSlideDef.getEditorialImportance() == imp) {
|
|
|
1381 |
long slideDefID = catSlideDef.getSlideDefintionID();
|
|
|
1382 |
slideDefs.add(this.getSlideDefinition(slideDefID));
|
|
|
1383 |
}
|
|
|
1384 |
}
|
|
|
1385 |
return slideDefs;
|
|
|
1386 |
}
|
|
|
1387 |
|
|
|
1388 |
/**
|
| 49 |
naveen |
1389 |
* Returns all FeatureDefinition object in database
|
| 18 |
naveen |
1390 |
*
|
|
|
1391 |
* @return Map<Long, FeatureDefinition>
|
|
|
1392 |
* @throws Exception
|
|
|
1393 |
*/
|
| 1050 |
rajveer |
1394 |
public Map<Long, FeatureDefinition> getFeatureDefinitions(){
|
|
|
1395 |
return this.featureDefinitions;
|
|
|
1396 |
}
|
|
|
1397 |
|
|
|
1398 |
|
|
|
1399 |
/**
|
|
|
1400 |
*
|
|
|
1401 |
* @param defType
|
|
|
1402 |
* @return
|
|
|
1403 |
*/
|
|
|
1404 |
private Map<Long, FeatureDefinition> convertFeatureDefinitions(
|
|
|
1405 |
DefinitionType defType) {
|
| 18 |
naveen |
1406 |
|
| 1050 |
rajveer |
1407 |
Map<Long, FeatureDefinition> defs =
|
|
|
1408 |
new HashMap<Long, FeatureDefinition>();
|
|
|
1409 |
|
|
|
1410 |
List<FeatureDefinitionType> jaxbDefs = defType.getFeatureDefinition();
|
|
|
1411 |
Iterator<FeatureDefinitionType> itjaxbDefs = jaxbDefs.iterator();
|
|
|
1412 |
|
|
|
1413 |
// Feature definitions
|
|
|
1414 |
while(itjaxbDefs.hasNext()) {
|
|
|
1415 |
FeatureDefinitionType jaxbDef = itjaxbDefs.next();
|
| 1314 |
rajveer |
1416 |
Utils.info("******"+ jaxbDef.getID());
|
| 18 |
naveen |
1417 |
|
| 1050 |
rajveer |
1418 |
//Utils.info("Feature label=" + jaxbDef.getLabel());
|
|
|
1419 |
FeatureDefinition def = new FeatureDefinition(jaxbDef.getID(),
|
|
|
1420 |
jaxbDef.getLabel());
|
|
|
1421 |
def.setAllowsBlank(jaxbDef.isCanbeBlank());
|
|
|
1422 |
def.setDescription(jaxbDef.getDescription());
|
|
|
1423 |
|
|
|
1424 |
// Bullet Definition
|
|
|
1425 |
BulletDefinitionType jaxbBulletDef = jaxbDef.getBulletDefinition();
|
|
|
1426 |
if(jaxbBulletDef != null) {
|
|
|
1427 |
def.setBulletDefinition(this.convertBulletDefinition(
|
|
|
1428 |
jaxbBulletDef));
|
|
|
1429 |
}
|
|
|
1430 |
|
|
|
1431 |
Long normRuleDefID = jaxbDef.getNormalizationRuleDefinitionID();
|
|
|
1432 |
if(normRuleDefID != null) {
|
|
|
1433 |
def.setNormalizationRuleDefinitionID(normRuleDefID.longValue());
|
|
|
1434 |
}
|
|
|
1435 |
Utils.info("def=" + def);
|
|
|
1436 |
|
| 2170 |
rajveer |
1437 |
Long helpDocDefID = jaxbDef.getHelpDocDefinitionID();
|
|
|
1438 |
if(helpDocDefID != null) {
|
|
|
1439 |
def.setHelpDocDefinitionID(helpDocDefID.longValue());
|
|
|
1440 |
}
|
|
|
1441 |
Utils.info("def=" + def);
|
|
|
1442 |
|
| 1050 |
rajveer |
1443 |
defs.put(new Long(jaxbDef.getID()), def);
|
| 18 |
naveen |
1444 |
}
|
| 1050 |
rajveer |
1445 |
|
|
|
1446 |
return defs;
|
| 18 |
naveen |
1447 |
}
|
| 1050 |
rajveer |
1448 |
|
| 19 |
naveen |
1449 |
|
| 10 |
shop2020 |
1450 |
/**
|
| 1050 |
rajveer |
1451 |
*
|
|
|
1452 |
* @param jaxbDef BulletDefinitionType
|
|
|
1453 |
* @return BulletDefinition
|
|
|
1454 |
*/
|
|
|
1455 |
private BulletDefinition convertBulletDefinition(
|
|
|
1456 |
BulletDefinitionType jaxbDef) {
|
|
|
1457 |
|
|
|
1458 |
BulletDefinition def = new BulletDefinition(
|
|
|
1459 |
jaxbDef.getDatatypeDefinitionID());
|
|
|
1460 |
|
|
|
1461 |
List<Long> unitIDs = jaxbDef.getUnitID();
|
|
|
1462 |
if(unitIDs != null && !unitIDs.isEmpty()) {
|
|
|
1463 |
def.setUnitIDs(unitIDs);
|
|
|
1464 |
}
|
|
|
1465 |
Utils.info("jaxbDef.isIsMultivalue=" + jaxbDef.isIsMultivalue());
|
|
|
1466 |
|
|
|
1467 |
def.setMultivalue(jaxbDef.isIsMultivalue());
|
|
|
1468 |
def.setLearned(jaxbDef.isIsLearned());
|
|
|
1469 |
def.setDescription(jaxbDef.getDescription());
|
|
|
1470 |
|
|
|
1471 |
return def;
|
|
|
1472 |
}
|
|
|
1473 |
|
|
|
1474 |
|
|
|
1475 |
/**
|
| 49 |
naveen |
1476 |
* Returns all FeatureDefinition objects for a slide
|
| 18 |
naveen |
1477 |
*
|
| 19 |
naveen |
1478 |
* @param slideID
|
|
|
1479 |
* @return List<FeatureDefinition>
|
|
|
1480 |
* @throws Exception
|
|
|
1481 |
*/
|
|
|
1482 |
public List<FeatureDefinition> getFeatureDefinitions(long slideID)
|
|
|
1483 |
throws Exception {
|
|
|
1484 |
List<FeatureDefinition> featureDefs =
|
|
|
1485 |
new ArrayList<FeatureDefinition>();
|
|
|
1486 |
|
|
|
1487 |
SlideDefinition slideDef = this.getSlideDefinition(slideID);
|
|
|
1488 |
List<SlideFeatureDefinition> slideFeatureDefs =
|
|
|
1489 |
slideDef.getSlideFeatureDefinitions();
|
|
|
1490 |
|
|
|
1491 |
for(int i=0; i<slideFeatureDefs.size(); i++) {
|
|
|
1492 |
featureDefs.add(this.getFeatureDefinition(
|
|
|
1493 |
slideFeatureDefs.get(i).getFeatureDefintionID()));
|
|
|
1494 |
}
|
|
|
1495 |
|
|
|
1496 |
return featureDefs;
|
|
|
1497 |
}
|
|
|
1498 |
|
|
|
1499 |
/**
|
| 49 |
naveen |
1500 |
* Returns list of FeatureDefinition objects for a slide given editorial
|
|
|
1501 |
* importance
|
| 19 |
naveen |
1502 |
*
|
|
|
1503 |
* @param slideID
|
| 49 |
naveen |
1504 |
* @param imp Editorial Importance enum object
|
| 19 |
naveen |
1505 |
* @return List<FeatureDefinition>
|
|
|
1506 |
* @throws Exception
|
|
|
1507 |
*/
|
|
|
1508 |
public List<FeatureDefinition> getFeatureDefinitions(long slideID,
|
|
|
1509 |
EditorialImportance imp) throws Exception {
|
|
|
1510 |
List<FeatureDefinition> featureDefs =
|
|
|
1511 |
new ArrayList<FeatureDefinition>();
|
|
|
1512 |
|
|
|
1513 |
SlideDefinition slideDef = this.getSlideDefinition(slideID);
|
|
|
1514 |
List<SlideFeatureDefinition> slideFeatureDefs =
|
|
|
1515 |
slideDef.getSlideFeatureDefinitions();
|
|
|
1516 |
|
|
|
1517 |
for(SlideFeatureDefinition slideFeatureDef : slideFeatureDefs) {
|
|
|
1518 |
if(slideFeatureDef.getEditorialImportance() == imp) {
|
|
|
1519 |
featureDefs.add(this.getFeatureDefinition(
|
|
|
1520 |
slideFeatureDef.getFeatureDefintionID()));
|
|
|
1521 |
}
|
|
|
1522 |
}
|
|
|
1523 |
|
|
|
1524 |
return featureDefs;
|
|
|
1525 |
}
|
|
|
1526 |
|
|
|
1527 |
/**
|
| 49 |
naveen |
1528 |
* Resolves Feature Definition ID into FeatureDefinition object
|
| 19 |
naveen |
1529 |
*
|
| 49 |
naveen |
1530 |
* @param id Feature Definition ID
|
| 19 |
naveen |
1531 |
* @return FeatureDefinition
|
| 18 |
naveen |
1532 |
* @throws Exception
|
| 10 |
shop2020 |
1533 |
*/
|
| 18 |
naveen |
1534 |
public FeatureDefinition getFeatureDefinition(long id) throws Exception {
|
|
|
1535 |
|
|
|
1536 |
// Initialize
|
|
|
1537 |
if(this.featureDefinitions == null) {
|
|
|
1538 |
this.getFeatureDefinitions();
|
|
|
1539 |
}
|
|
|
1540 |
|
|
|
1541 |
return this.featureDefinitions.get(new Long(id));
|
|
|
1542 |
}
|
| 19 |
naveen |
1543 |
|
|
|
1544 |
/**
|
| 49 |
naveen |
1545 |
* Returns matching FeatureDefinition object for slide ID and feature label.
|
|
|
1546 |
* Label matching is case insensitive.
|
| 19 |
naveen |
1547 |
*
|
| 49 |
naveen |
1548 |
* @param slideID Slide ID
|
|
|
1549 |
* @param featureLabel label to match, case is ignored
|
| 19 |
naveen |
1550 |
* @return FeatureDefinition
|
|
|
1551 |
* @throws Exception
|
|
|
1552 |
*/
|
|
|
1553 |
public FeatureDefinition getFeatureDefinition(long slideID,
|
|
|
1554 |
String featureLabel) throws Exception {
|
|
|
1555 |
FeatureDefinition featureDef = null;
|
|
|
1556 |
|
|
|
1557 |
SlideDefinition slideDef = this.getSlideDefinition(slideID);
|
|
|
1558 |
for(SlideFeatureDefinition slideFeatureDef :
|
|
|
1559 |
slideDef.getSlideFeatureDefinitions()) {
|
|
|
1560 |
|
|
|
1561 |
long featureDefID = slideFeatureDef.getFeatureDefintionID();
|
|
|
1562 |
|
|
|
1563 |
FeatureDefinition thisFeatureDef = this.getFeatureDefinition(
|
|
|
1564 |
featureDefID);
|
|
|
1565 |
|
| 28 |
naveen |
1566 |
if(featureLabel.equalsIgnoreCase(thisFeatureDef.getLabel())) {
|
| 19 |
naveen |
1567 |
featureDef = thisFeatureDef;
|
|
|
1568 |
}
|
|
|
1569 |
}
|
|
|
1570 |
|
|
|
1571 |
return featureDef;
|
|
|
1572 |
}
|
| 24 |
naveen |
1573 |
|
|
|
1574 |
/**
|
| 49 |
naveen |
1575 |
* Returns all EnumValue objects in the database
|
|
|
1576 |
*
|
| 24 |
naveen |
1577 |
* @return the enumValues
|
|
|
1578 |
* @throws Exception
|
|
|
1579 |
*/
|
|
|
1580 |
public Map<Long, EnumValue> getEnumValues() throws Exception {
|
|
|
1581 |
return this.enumValues;
|
|
|
1582 |
}
|
| 19 |
naveen |
1583 |
|
| 1050 |
rajveer |
1584 |
|
| 24 |
naveen |
1585 |
/**
|
| 49 |
naveen |
1586 |
* Resolves Enum value ID into EnumValue object
|
| 24 |
naveen |
1587 |
*
|
|
|
1588 |
* @param enumValueID
|
|
|
1589 |
* @return EnumValue
|
|
|
1590 |
* @throws Exception
|
|
|
1591 |
*/
|
|
|
1592 |
public EnumValue getEnumValue(long enumValueID) throws Exception {
|
|
|
1593 |
return this.enumValues.get(new Long(enumValueID));
|
|
|
1594 |
}
|
| 2170 |
rajveer |
1595 |
|
| 62 |
naveen |
1596 |
/**
|
|
|
1597 |
* Returns all FacetDefinition objects in the database
|
|
|
1598 |
*
|
|
|
1599 |
* @return Map Null if facet definitions are not imported into definitions
|
|
|
1600 |
* db (serialized java objects)
|
|
|
1601 |
*
|
|
|
1602 |
* @throws Exception
|
|
|
1603 |
*/
|
| 1050 |
rajveer |
1604 |
public Map<Long, FacetDefinition> getFacetDefinitions(){
|
| 62 |
naveen |
1605 |
return this.facetDefinitions;
|
|
|
1606 |
}
|
|
|
1607 |
|
|
|
1608 |
/**
|
| 1314 |
rajveer |
1609 |
* Get List of Facets for a given slide.
|
|
|
1610 |
*
|
|
|
1611 |
* @return
|
|
|
1612 |
*/
|
|
|
1613 |
public Map<Long, List<FacetDefinition>> getSlideFacetDefinitions(){
|
|
|
1614 |
return slideFacetDefinitions;
|
|
|
1615 |
}
|
|
|
1616 |
/**
|
| 62 |
naveen |
1617 |
* Resolves Facet Definition ID into FacetDefinition object
|
|
|
1618 |
*
|
|
|
1619 |
* @param facetDefinitionID
|
|
|
1620 |
* @return FacetDefinition
|
|
|
1621 |
* @throws Exception
|
|
|
1622 |
*/
|
|
|
1623 |
public FacetDefinition getFacetDefinition(long facetDefinitionID)
|
|
|
1624 |
throws Exception {
|
|
|
1625 |
|
|
|
1626 |
if(this.facetDefinitions == null) {
|
|
|
1627 |
this.getFacetDefinitions();
|
|
|
1628 |
}
|
|
|
1629 |
|
|
|
1630 |
return this.facetDefinitions.get(new Long(facetDefinitionID));
|
|
|
1631 |
}
|
|
|
1632 |
|
|
|
1633 |
/**
|
|
|
1634 |
* Utility method to get Expanded version of ExpandedFacetDefinition object
|
|
|
1635 |
*
|
|
|
1636 |
* @param facetDefinitionID
|
|
|
1637 |
* @return ExpandedFacetDefinition
|
|
|
1638 |
* @throws Exception
|
|
|
1639 |
*/
|
| 1314 |
rajveer |
1640 |
/*
|
| 62 |
naveen |
1641 |
public ExpandedFacetDefinition getExpandedFacetDefinition(
|
|
|
1642 |
long facetDefinitionID) throws Exception {
|
|
|
1643 |
|
|
|
1644 |
FacetDefinition facetDefinition =
|
|
|
1645 |
this.getFacetDefinition(facetDefinitionID);
|
|
|
1646 |
|
|
|
1647 |
ExpandedFacetDefinition expFacetDefinition =
|
|
|
1648 |
new ExpandedFacetDefinition(facetDefinition);
|
|
|
1649 |
|
|
|
1650 |
return expFacetDefinition;
|
|
|
1651 |
}
|
| 1314 |
rajveer |
1652 |
*/
|
| 62 |
naveen |
1653 |
/**
|
|
|
1654 |
* Returns all CategoryFacetDefinition objects in the database
|
|
|
1655 |
*
|
|
|
1656 |
* @return Map Null if category facet definitions are not imported into
|
|
|
1657 |
* definitions db (serialized java objects)
|
|
|
1658 |
*
|
|
|
1659 |
* @throws Exception
|
|
|
1660 |
*/
|
| 1050 |
rajveer |
1661 |
public Map<Long, CategoryFacetDefinition> getCategoryFacetDefinitions(){
|
| 62 |
naveen |
1662 |
return this.categoryFacetDefinitions;
|
|
|
1663 |
}
|
|
|
1664 |
|
|
|
1665 |
/**
|
|
|
1666 |
* Resolves Category-Facet Definition ID into CategoryFacetDefinition object
|
|
|
1667 |
*
|
|
|
1668 |
* @param categoryID
|
|
|
1669 |
* @return CategoryFacetDefinition
|
|
|
1670 |
* @throws Exception
|
|
|
1671 |
*/
|
| 1050 |
rajveer |
1672 |
public CategoryFacetDefinition getCategoryFacetDefinition(long categoryID){
|
|
|
1673 |
return this.categoryFacetDefinitions.get(new Long(categoryID));
|
| 62 |
naveen |
1674 |
}
|
|
|
1675 |
|
| 1050 |
rajveer |
1676 |
|
| 62 |
naveen |
1677 |
/**
|
|
|
1678 |
* Utility method to get Expanded version of CategoryFacetDefinition object
|
|
|
1679 |
*
|
|
|
1680 |
* @param categoryID
|
|
|
1681 |
* @return ExpandedCategoryFacetDefinition
|
|
|
1682 |
* @throws Exception
|
|
|
1683 |
*/
|
|
|
1684 |
public ExpandedCategoryFacetDefinition getExpandedCategoryFacetDefinition(
|
|
|
1685 |
long categoryID) throws Exception {
|
|
|
1686 |
CategoryFacetDefinition categoryFacetDef =
|
|
|
1687 |
this.getCategoryFacetDefinition(categoryID);
|
|
|
1688 |
|
|
|
1689 |
ExpandedCategoryFacetDefinition expCategoryFacetDef =
|
|
|
1690 |
new ExpandedCategoryFacetDefinition(categoryFacetDef);
|
|
|
1691 |
|
|
|
1692 |
return expCategoryFacetDef;
|
|
|
1693 |
}
|
|
|
1694 |
|
|
|
1695 |
/**
|
|
|
1696 |
* Returns all IR Data RuleDefintion objects in the database
|
|
|
1697 |
*
|
|
|
1698 |
* @return Map Null if IR data rule definitions are not imported into
|
|
|
1699 |
* definitions db (serialized java objects)
|
|
|
1700 |
*
|
|
|
1701 |
* @throws Exception
|
|
|
1702 |
*/
|
| 1050 |
rajveer |
1703 |
public Map<Long, RuleDefinition> getIrDataRuleDefinitions(){
|
| 62 |
naveen |
1704 |
return this.irDataRuleDefinitions;
|
|
|
1705 |
}
|
|
|
1706 |
|
|
|
1707 |
/**
|
|
|
1708 |
* Resolves IR Data Rule Definition ID into RuleDefinition object
|
|
|
1709 |
*
|
|
|
1710 |
* @param irDataRuleDefinitionID
|
|
|
1711 |
* @return RuleDefinition
|
|
|
1712 |
* @throws Exception
|
|
|
1713 |
*/
|
| 1050 |
rajveer |
1714 |
public RuleDefinition getIrDataRuleDefinition(long irDataRuleDefinitionID){
|
| 62 |
naveen |
1715 |
return this.irDataRuleDefinitions.get(new Long(irDataRuleDefinitionID));
|
|
|
1716 |
}
|
|
|
1717 |
|
|
|
1718 |
/**
|
|
|
1719 |
* Returns all IR Meta Data RuleDefintion objects in the database
|
|
|
1720 |
*
|
|
|
1721 |
* @return Map Null if IR meta-data rule definitions are not imported into
|
|
|
1722 |
* definitions db (serialized java objects)
|
|
|
1723 |
*
|
|
|
1724 |
* @throws Exception
|
|
|
1725 |
*/
|
| 1050 |
rajveer |
1726 |
public Map<Long, RuleDefinition> getIrMetaDataRuleDefinitions(){
|
| 62 |
naveen |
1727 |
return this.irMetaDataRuleDefinitions;
|
|
|
1728 |
}
|
|
|
1729 |
|
|
|
1730 |
/**
|
|
|
1731 |
* Resolves IR Meta Data Rule Definition ID into RuleDefinition object
|
|
|
1732 |
*
|
|
|
1733 |
* @param irMetaDataRuleDefinitionID
|
|
|
1734 |
* @return RuleDefinition
|
|
|
1735 |
* @throws Exception
|
|
|
1736 |
*/
|
| 1050 |
rajveer |
1737 |
public RuleDefinition getIrMetaDataRuleDefinition(long irMetaDataRuleDefinitionID) {
|
|
|
1738 |
return this.irMetaDataRuleDefinitions.get(new Long(irMetaDataRuleDefinitionID));
|
| 62 |
naveen |
1739 |
}
|
| 70 |
naveen |
1740 |
|
|
|
1741 |
/**
|
|
|
1742 |
* Returns all Comparison RuleDefintion objects in the database
|
|
|
1743 |
*
|
|
|
1744 |
* @return Map Null if Comparison rule definitions are not imported into
|
|
|
1745 |
* definitions db (serialized java objects)
|
|
|
1746 |
*
|
|
|
1747 |
* @throws Exception
|
|
|
1748 |
*/
|
| 1050 |
rajveer |
1749 |
public Map<Long, CMPRuleDefinition> getComparisonRuleDefinitions(){
|
| 70 |
naveen |
1750 |
return this.cmpRuleDefinitions;
|
|
|
1751 |
}
|
|
|
1752 |
|
|
|
1753 |
/**
|
|
|
1754 |
* Resolves IR Data Rule Definition ID into RuleDefinition object
|
|
|
1755 |
*
|
|
|
1756 |
* @param cmpRuleDefinitionID
|
|
|
1757 |
* @return CMPRuleDefinition
|
|
|
1758 |
* @throws Exception
|
|
|
1759 |
*/
|
| 1050 |
rajveer |
1760 |
public CMPRuleDefinition getComparisonRuleDefinition(long cmpRuleDefinitionID) {
|
| 70 |
naveen |
1761 |
return this.cmpRuleDefinitions.get(new Long(cmpRuleDefinitionID));
|
|
|
1762 |
}
|
|
|
1763 |
|
|
|
1764 |
|
|
|
1765 |
/**
|
|
|
1766 |
* Returns all ComparisonSlideRuleDefintion objects in the database
|
|
|
1767 |
*
|
|
|
1768 |
* @return Map Null if Comparison slide-rule definitions are not imported
|
|
|
1769 |
* into definitions db (serialized java objects)
|
|
|
1770 |
*
|
|
|
1771 |
* @throws Exception
|
|
|
1772 |
*/
|
| 1050 |
rajveer |
1773 |
public Map<Long, CMPSlideRuleDefinition> getComparisonSlideRuleDefinitions() {
|
| 70 |
naveen |
1774 |
return this.cmpSlideRuleDefinitions;
|
|
|
1775 |
}
|
|
|
1776 |
|
|
|
1777 |
/**
|
|
|
1778 |
* Resolves Category ID into List of CMPSlideRuleDefinition object
|
|
|
1779 |
*
|
|
|
1780 |
* @param categoryID
|
|
|
1781 |
* @return List<CMPSlideRuleDefinition>
|
|
|
1782 |
* @throws Exception
|
|
|
1783 |
*/
|
| 1050 |
rajveer |
1784 |
public CMPSlideRuleDefinition getComparisonSlideRuleDefinition(long slideDefinitionID) {
|
| 70 |
naveen |
1785 |
return this.cmpSlideRuleDefinitions.get(new Long(slideDefinitionID));
|
|
|
1786 |
}
|
|
|
1787 |
|
|
|
1788 |
|
|
|
1789 |
/**
|
|
|
1790 |
* Resolves Slide Definition ID into ExpandedCMPSlideRuleDefinition object
|
|
|
1791 |
*
|
|
|
1792 |
* @param categoryID
|
|
|
1793 |
* @return ExpandedCMPSlideRuleDefinition
|
|
|
1794 |
* @throws Exception
|
|
|
1795 |
*/
|
| 1050 |
rajveer |
1796 |
public ExpandedCMPSlideRuleDefinition getExpandedComparisonSlideRuleDefinition(long slideDefinitionID) throws Exception{
|
| 71 |
naveen |
1797 |
Utils.info("slideDefinitionID=" + slideDefinitionID);
|
| 70 |
naveen |
1798 |
|
| 1050 |
rajveer |
1799 |
CMPSlideRuleDefinition cmpSlideRuleDef = this.getComparisonSlideRuleDefinition(slideDefinitionID);
|
| 70 |
naveen |
1800 |
|
| 71 |
naveen |
1801 |
if(cmpSlideRuleDef == null) {
|
|
|
1802 |
return null;
|
|
|
1803 |
}
|
|
|
1804 |
|
| 1050 |
rajveer |
1805 |
ExpandedCMPSlideRuleDefinition expDef = new ExpandedCMPSlideRuleDefinition(cmpSlideRuleDef);
|
| 70 |
naveen |
1806 |
return expDef;
|
|
|
1807 |
}
|
| 72 |
naveen |
1808 |
|
| 70 |
naveen |
1809 |
|
| 72 |
naveen |
1810 |
/**
|
|
|
1811 |
* Returns all ComparisonSlideRuleDefintion objects in the database
|
|
|
1812 |
*
|
|
|
1813 |
* @return Map Null if Comparison slide-rule definitions are not imported
|
|
|
1814 |
* into definitions db (serialized java objects)
|
|
|
1815 |
*
|
|
|
1816 |
* @throws Exception
|
|
|
1817 |
*/
|
| 1050 |
rajveer |
1818 |
|
|
|
1819 |
public Map<Long, List<CMPBucketDefinition>> getComparisonBucketDefinitions(){
|
| 72 |
naveen |
1820 |
return this.cmpBucketDefinitions;
|
|
|
1821 |
}
|
|
|
1822 |
|
|
|
1823 |
/**
|
|
|
1824 |
* Resolves Category ID into List of CMPBucketDefinition object
|
|
|
1825 |
*
|
|
|
1826 |
* @param categoryID
|
|
|
1827 |
* @return List<CMPBucketDefinition>
|
|
|
1828 |
* @throws Exception
|
|
|
1829 |
*/
|
| 1050 |
rajveer |
1830 |
public List<CMPBucketDefinition> getComparisonBucketDefinitions(long categoryID) {
|
| 72 |
naveen |
1831 |
return this.cmpBucketDefinitions.get(new Long(categoryID));
|
|
|
1832 |
}
|
|
|
1833 |
|
|
|
1834 |
/**
|
|
|
1835 |
* Resolve comparison bucket name for a slide in a particular category
|
|
|
1836 |
*
|
|
|
1837 |
* @param categoryID
|
|
|
1838 |
* @param slideDefintionID
|
|
|
1839 |
* @return Bucket Name if found else Null
|
|
|
1840 |
* @throws Exception
|
|
|
1841 |
*/
|
|
|
1842 |
public String getComparisonBucketName(long categoryID,
|
|
|
1843 |
long slideDefinitionID) throws Exception {
|
|
|
1844 |
List<CMPBucketDefinition> cmpBuckets =
|
|
|
1845 |
this.getComparisonBucketDefinitions(categoryID);
|
| 1949 |
rajveer |
1846 |
if(cmpBuckets == null){
|
|
|
1847 |
return null;
|
|
|
1848 |
}
|
| 72 |
naveen |
1849 |
for (CMPBucketDefinition cmpBucket : cmpBuckets) {
|
|
|
1850 |
List<Long> slideDefinitionIDs = cmpBucket.getSlideDefinitionIDs();
|
|
|
1851 |
|
|
|
1852 |
if(slideDefinitionIDs.contains(new Long(slideDefinitionID))) {
|
|
|
1853 |
return cmpBucket.getName();
|
|
|
1854 |
}
|
|
|
1855 |
}
|
|
|
1856 |
return null;
|
|
|
1857 |
}
|
| 83 |
naveen |
1858 |
|
|
|
1859 |
/**
|
|
|
1860 |
* Returns list of facet definition IDs for given category ID
|
|
|
1861 |
*
|
|
|
1862 |
* @param categoryID
|
|
|
1863 |
* @return list of facet definition IDs
|
|
|
1864 |
* @throws Exception
|
|
|
1865 |
*/
|
|
|
1866 |
public List<Long> getFacetDefinitionIDs(long categoryID) throws Exception {
|
|
|
1867 |
List<Long> facetDefIDs = new ArrayList<Long>();
|
|
|
1868 |
|
|
|
1869 |
CategoryFacetDefinition categoryFacetDef =
|
|
|
1870 |
this.getCategoryFacetDefinition(categoryID);
|
| 516 |
rajveer |
1871 |
if(categoryFacetDef == null)
|
|
|
1872 |
return null;
|
| 1314 |
rajveer |
1873 |
List<FacetDefinition> facetDefs =
|
|
|
1874 |
categoryFacetDef.getFacetDefinitions();
|
| 83 |
naveen |
1875 |
|
| 1314 |
rajveer |
1876 |
for(FacetDefinition facetDef : facetDefs) {
|
|
|
1877 |
facetDefIDs.add(new Long(facetDef.getID()));
|
| 83 |
naveen |
1878 |
}
|
|
|
1879 |
|
|
|
1880 |
return facetDefIDs;
|
|
|
1881 |
}
|
|
|
1882 |
|
|
|
1883 |
/**
|
|
|
1884 |
* Returns list of feature definition IDs for given category ID
|
|
|
1885 |
*
|
|
|
1886 |
* @param categoryID
|
|
|
1887 |
* @return list of feature definition IDs
|
|
|
1888 |
* @throws Exception
|
|
|
1889 |
*/
|
|
|
1890 |
public List<Long> getFeatureDefinitionIDs(long categoryID)
|
|
|
1891 |
throws Exception {
|
|
|
1892 |
|
|
|
1893 |
List<Long> featureDefIDs = new ArrayList<Long>();
|
|
|
1894 |
|
|
|
1895 |
List<SlideDefinition> slideDefs = this.getSlideDefinitions(categoryID);
|
|
|
1896 |
|
|
|
1897 |
for(SlideDefinition slideDef : slideDefs) {
|
|
|
1898 |
List<Long> slideFeatureDefIDs =
|
|
|
1899 |
this.getFeatureDefintionIDs(slideDef);
|
|
|
1900 |
|
|
|
1901 |
featureDefIDs.addAll(slideFeatureDefIDs);
|
|
|
1902 |
}
|
|
|
1903 |
|
|
|
1904 |
return featureDefIDs;
|
|
|
1905 |
}
|
|
|
1906 |
|
|
|
1907 |
/**
|
|
|
1908 |
* Returns list of feature definition IDs for given slide definition ID
|
|
|
1909 |
*
|
|
|
1910 |
* @param slideDef
|
|
|
1911 |
* @return list of feature definition IDs
|
|
|
1912 |
*/
|
|
|
1913 |
public List<Long> getFeatureDefintionIDs(SlideDefinition slideDef) {
|
|
|
1914 |
List<Long> featureDefIDs = new ArrayList<Long>();
|
|
|
1915 |
|
|
|
1916 |
List<SlideFeatureDefinition> slideFeatureDefs =
|
|
|
1917 |
slideDef.getSlideFeatureDefinitions();
|
|
|
1918 |
|
|
|
1919 |
for(SlideFeatureDefinition slideFeatureDef : slideFeatureDefs) {
|
| 1050 |
rajveer |
1920 |
featureDefIDs.add(new Long(slideFeatureDef.getFeatureDefintionID()));
|
| 83 |
naveen |
1921 |
}
|
|
|
1922 |
|
|
|
1923 |
return featureDefIDs;
|
|
|
1924 |
}
|
| 88 |
naveen |
1925 |
|
|
|
1926 |
/**
|
|
|
1927 |
*
|
|
|
1928 |
* @param borrowedSlideDefID
|
|
|
1929 |
* @return
|
|
|
1930 |
* @throws Exception
|
|
|
1931 |
*/
|
|
|
1932 |
public boolean isValidSlideDefinitionID(long borrowedSlideDefID)
|
|
|
1933 |
throws Exception {
|
|
|
1934 |
this.getSlideDefinitions();
|
|
|
1935 |
|
|
|
1936 |
return this.slideDefinitions.containsKey(new Long(borrowedSlideDefID));
|
|
|
1937 |
}
|
|
|
1938 |
|
|
|
1939 |
/**
|
|
|
1940 |
* Returns Facet-Rule definition object defined for a category and
|
|
|
1941 |
* slide definition
|
|
|
1942 |
*
|
|
|
1943 |
* @param borrowedCategoryID
|
|
|
1944 |
* @param slideDefID
|
|
|
1945 |
* @return FacetRuleDefinition
|
|
|
1946 |
* @throws Exception
|
|
|
1947 |
*/
|
| 1314 |
rajveer |
1948 |
/*
|
| 88 |
naveen |
1949 |
public FacetRuleDefinition getFacetRuleDefinitionForSlide(long categoryID,
|
|
|
1950 |
long slideDefinitionID) throws Exception {
|
|
|
1951 |
CategoryFacetDefinition categoryFacetDef =
|
|
|
1952 |
this.getCategoryFacetDefinition(categoryID);
|
| 1073 |
chandransh |
1953 |
//FIXME Quick fix. Need to investigate
|
|
|
1954 |
if(categoryFacetDef == null){
|
|
|
1955 |
return null;
|
|
|
1956 |
}
|
| 88 |
naveen |
1957 |
List<FacetRuleDefinition> facetRuleDefs =
|
|
|
1958 |
categoryFacetDef.getFacetRuleDefinitions();
|
|
|
1959 |
|
|
|
1960 |
for(FacetRuleDefinition facetRuleDef : facetRuleDefs) {
|
|
|
1961 |
if(facetRuleDef.getSlideDefinitionID() == slideDefinitionID) {
|
|
|
1962 |
return facetRuleDef;
|
|
|
1963 |
}
|
|
|
1964 |
}
|
|
|
1965 |
|
|
|
1966 |
return null;
|
|
|
1967 |
}
|
| 1314 |
rajveer |
1968 |
*/
|
| 88 |
naveen |
1969 |
/**
|
|
|
1970 |
* Returns Facet-Rule definition object defined for a category and
|
|
|
1971 |
* feature definition
|
|
|
1972 |
*
|
|
|
1973 |
* @param categoryID
|
|
|
1974 |
* @param featureDefinitionID
|
|
|
1975 |
* @return FacetRuleDefinition
|
|
|
1976 |
* @throws Exception
|
|
|
1977 |
*/
|
| 1314 |
rajveer |
1978 |
|
|
|
1979 |
/*
|
| 88 |
naveen |
1980 |
public FacetRuleDefinition getFacetRuleDefinitionForFeature(long categoryID,
|
|
|
1981 |
long featureDefinitionID) throws Exception {
|
|
|
1982 |
CategoryFacetDefinition categoryFacetDef =
|
|
|
1983 |
this.getCategoryFacetDefinition(categoryID);
|
| 1074 |
chandransh |
1984 |
if(categoryFacetDef == null){
|
|
|
1985 |
return null;
|
|
|
1986 |
}
|
| 88 |
naveen |
1987 |
List<FacetRuleDefinition> facetRuleDefs =
|
|
|
1988 |
categoryFacetDef.getFacetRuleDefinitions();
|
|
|
1989 |
|
|
|
1990 |
for(FacetRuleDefinition facetRuleDef : facetRuleDefs) {
|
|
|
1991 |
if(facetRuleDef.getFeatureDefinitionID() == featureDefinitionID) {
|
|
|
1992 |
return facetRuleDef;
|
|
|
1993 |
}
|
|
|
1994 |
}
|
|
|
1995 |
|
|
|
1996 |
return null;
|
|
|
1997 |
}
|
| 1314 |
rajveer |
1998 |
*/
|
| 102 |
naveen |
1999 |
/**
|
|
|
2000 |
* Returns all normalization rule defined
|
|
|
2001 |
*
|
|
|
2002 |
* @return Map<Long, RuleDefinition>
|
|
|
2003 |
* @throws Exception
|
|
|
2004 |
*/
|
| 1050 |
rajveer |
2005 |
public Map<Long, RuleDefinition> getNormalizationRules() {
|
| 102 |
naveen |
2006 |
return this.normalizationRuleDefinitions;
|
|
|
2007 |
}
|
|
|
2008 |
|
|
|
2009 |
|
|
|
2010 |
/**
|
|
|
2011 |
* True if feature has normalization rule defined
|
|
|
2012 |
*
|
|
|
2013 |
* @param feature
|
|
|
2014 |
* @return boolean
|
|
|
2015 |
* @throws Exception
|
|
|
2016 |
*/
|
|
|
2017 |
public boolean needsNormalization(long featureDefinitionID)
|
|
|
2018 |
throws Exception {
|
|
|
2019 |
this.getFeatureDefinitions();
|
|
|
2020 |
|
|
|
2021 |
FeatureDefinition featureDef =
|
|
|
2022 |
this.featureDefinitions.get(new Long(featureDefinitionID));
|
|
|
2023 |
|
|
|
2024 |
if(featureDef.getNormalizationRuleDefinitionID() != 0L) {
|
|
|
2025 |
return true;
|
|
|
2026 |
}
|
|
|
2027 |
|
|
|
2028 |
return false;
|
|
|
2029 |
}
|
|
|
2030 |
|
|
|
2031 |
/**
|
|
|
2032 |
* Returns normalization rule definition for rule definition ID
|
|
|
2033 |
*
|
|
|
2034 |
* @param ruleID
|
|
|
2035 |
* @return RuleDefinition
|
|
|
2036 |
* @throws Exception
|
|
|
2037 |
*/
|
| 1050 |
rajveer |
2038 |
public RuleDefinition getNormalizationRuleDefinition(long ruleDefinitionID){
|
|
|
2039 |
return this.normalizationRuleDefinitions.get(new Long(ruleDefinitionID));
|
| 102 |
naveen |
2040 |
}
|
| 2170 |
rajveer |
2041 |
|
|
|
2042 |
public HelpDocDefinition getHelpDocDefinition(long helpDocDefinitionID){
|
|
|
2043 |
return this.helpDocDefinitions.get(helpDocDefinitionID);
|
|
|
2044 |
}
|
| 10 |
shop2020 |
2045 |
}
|