Subversion Repositories SmartDukaan

Rev

Rev 102 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 102 Rev 199
Line 5... Line 5...
5
 
5
 
6
import in.shop2020.metamodel.util.ExpandedCMPSlideRuleDefinition;
6
import in.shop2020.metamodel.util.ExpandedCMPSlideRuleDefinition;
7
import in.shop2020.metamodel.util.ExpandedCategory;
7
import in.shop2020.metamodel.util.ExpandedCategory;
8
import in.shop2020.metamodel.util.ExpandedCategoryFacetDefinition;
8
import in.shop2020.metamodel.util.ExpandedCategoryFacetDefinition;
9
import in.shop2020.metamodel.util.ExpandedFacetDefinition;
9
import in.shop2020.metamodel.util.ExpandedFacetDefinition;
-
 
10
import in.shop2020.metamodel.util.ExpandedSlideDefinition;
10
import in.shop2020.util.DBUtils;
11
import in.shop2020.util.DBUtils;
11
import in.shop2020.util.Utils;
12
import in.shop2020.util.Utils;
12
 
13
 
13
import java.io.Serializable;
14
import java.io.Serializable;
14
import java.util.ArrayList;
15
import java.util.ArrayList;
Line 98... Line 99...
98
 
99
 
99
	/**
100
	/**
100
	 * Hashtable of feature definition ID to normalization rule definition ID
101
	 * Hashtable of feature definition ID to normalization rule definition ID
101
	 */
102
	 */
102
	private Map<Long, RuleDefinition> normalizationRuleDefinitions;
103
	private Map<Long, RuleDefinition> normalizationRuleDefinitions;
-
 
104
 
-
 
105
	/**
-
 
106
	 * Hashtable of feature definition ID to normalization rule definition ID
-
 
107
	 */
-
 
108
	private Map<Long, List<Long>> categorySlideSequence;
103
	
109
	
104
	/**
110
	/**
105
	 * Empty constructor. Data structures are initialised as needed
111
	 * Empty constructor. Data structures are initialised as needed
106
	 */
112
	 */
107
	public DefinitionsContainer() {
113
	public DefinitionsContainer() {
108
		// Lazy initialization
114
		// Lazy initialization
109
	}
115
	}
110
	
116
	
111
	/**
117
	/**
-
 
118
	 * Returns Slide sequence for a category in the database
-
 
119
	 * 
-
 
120
	 * @return Map Null if Category-Slide definitions are not imported into 
-
 
121
	 * definitions db 
-
 
122
	 * (serialized java objects)
-
 
123
	 * 
-
 
124
	 * @throws Exception 
-
 
125
	 */
-
 
126
	@SuppressWarnings("unchecked")
-
 
127
	public Map<Long, List<Long>> getCategorySlideSequence() throws Exception {		
-
 
128
		// De-serialize
-
 
129
		if(this.categorySlideSequence == null) {
-
 
130
			String dbFile = Utils.DEFINITIONS_DB_PATH + "categoryslidesequence"+
-
 
131
				".ser";
-
 
132
			
-
 
133
			this.categorySlideSequence = (Map<Long, List<Long>>) 
-
 
134
				DBUtils.read(dbFile);
-
 
135
		}
-
 
136
		
-
 
137
		return this.categorySlideSequence;
-
 
138
	}
-
 
139
 
-
 
140
	/**
-
 
141
	 * Given a category ID, returns all slide definition IDs in sequence 
-
 
142
	 * provided by content editor
-
 
143
	 * 
-
 
144
	 * @param categoryID
-
 
145
	 * @return List of Slide Definition IDs
-
 
146
	 * @throws Exception
-
 
147
	 */
-
 
148
	public List<Long> getCategorySlideSequence(long categoryID) 
-
 
149
		throws Exception {	
-
 
150
		this.getCategorySlideSequence();
-
 
151
 
-
 
152
		return this.categorySlideSequence.get(new Long(categoryID));
-
 
153
	}
-
 
154
	
-
 
155
	/**
112
	 * Returns all Unit objects in the database
156
	 * Returns all Unit objects in the database
113
	 * 
157
	 * 
114
	 * @return Map Null if units are not imported into definitions db 
158
	 * @return Map Null if units are not imported into definitions db 
115
	 * (serialized java objects)
159
	 * (serialized java objects)
116
	 * 
160
	 * 
Line 330... Line 374...
330
		
374
		
331
		return this.slideDefinitions.get(new Long(id));
375
		return this.slideDefinitions.get(new Long(id));
332
	}
376
	}
333
	
377
	
334
	/**
378
	/**
-
 
379
	 * 
-
 
380
	 * @param slideID
-
 
381
	 * @return ExpandedSlideDefinition 
-
 
382
	 * @throws Exception 
-
 
383
	 */
-
 
384
	public ExpandedSlideDefinition getExpandedSlideDefinition(long slideID) 
-
 
385
		throws Exception {
-
 
386
		SlideDefinition slideDef = this.getSlideDefinition(slideID);
-
 
387
		
-
 
388
		return new ExpandedSlideDefinition(slideDef);
-
 
389
	}
-
 
390
	
-
 
391
	/**
335
	 * Returns SlideDefinition objects for a category and matching slide label
392
	 * Returns SlideDefinition objects for a category and matching slide label
336
	 * 
393
	 * 
337
	 * @param label
394
	 * @param label
338
	 * @return List<SlideDefinition>
395
	 * @return List<SlideDefinition>
339
	 * @throws Exception
396
	 * @throws Exception