Subversion Repositories SmartDukaan

Rev

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

Rev 19 Rev 24
Line 24... Line 24...
24
	private static final long serialVersionUID = 1L;
24
	private static final long serialVersionUID = 1L;
25
	private Map<Long, Category> categories;
25
	private Map<Long, Category> categories;
26
	private Map<Long, SlideDefinition> slideDefinitions;
26
	private Map<Long, SlideDefinition> slideDefinitions;
27
	private Map<Long, FeatureDefinition> featureDefinitions;
27
	private Map<Long, FeatureDefinition> featureDefinitions;
28
	private Map<Long, DatatypeDefinition> datatypeDefinitions;
28
	private Map<Long, DatatypeDefinition> datatypeDefinitions;
-
 
29
	private Map<Long, EnumValue> enumValues;
29
	private Map<Long, Unit> units;
30
	private Map<Long, Unit> units;
30
	
31
	
31
	/**
32
	/**
32
	 * 
33
	 * 
33
	 */
34
	 */
Line 115... Line 116...
115
		
116
		
116
		// Let the callers catch ClassCastException
117
		// Let the callers catch ClassCastException
117
		EnumDefinition enumDef = 
118
		EnumDefinition enumDef = 
118
			(EnumDefinition)this.getDatatypeDefinition(datatypeDefID);
119
			(EnumDefinition)this.getDatatypeDefinition(datatypeDefID);
119
		
120
		
120
		List<EnumValue> enumValues = enumDef.getValues();
121
		List<EnumValue> enumValues = enumDef.getEnumValues();
121
		for(EnumValue enumValue : enumValues) {
122
		for(EnumValue enumValue : enumValues) {
122
			if(value.equalsIgnoreCase(enumValue.getValue())) {
123
			if(value.equalsIgnoreCase(enumValue.getValue())) {
123
				enumValueID = enumValue.getID();
124
				enumValueID = enumValue.getID();
124
				break;
125
				break;
125
			}
126
			}
Line 371... Line 372...
371
			}
372
			}
372
		}
373
		}
373
		
374
		
374
		return featureDef;
375
		return featureDef;
375
	}
376
	}
-
 
377
 
-
 
378
	/**
-
 
379
	 * @return the enumValues
-
 
380
	 * @throws Exception 
-
 
381
	 */
-
 
382
	@SuppressWarnings("unchecked")
-
 
383
	public Map<Long, EnumValue> getEnumValues() throws Exception {
-
 
384
		// De-serialise
-
 
385
		if(this.enumValues == null) {
-
 
386
			String dbFile = MM.DEFINITIONS_DB_PATH + "enumvalues" + 
-
 
387
				".ser";
-
 
388
			
-
 
389
			this.enumValues = 
-
 
390
				(Map<Long, EnumValue>) DBUtils.read(dbFile);
-
 
391
		}
-
 
392
		
-
 
393
		return this.enumValues;
-
 
394
	}
376
	
395
	
-
 
396
	/**
-
 
397
	 * 
-
 
398
	 * @param enumValueID
-
 
399
	 * @return EnumValue
-
 
400
	 * @throws Exception
-
 
401
	 */
-
 
402
	public EnumValue getEnumValue(long enumValueID) throws Exception {
-
 
403
		// Initialise
-
 
404
		if(this.enumValues == null) {
-
 
405
			this.getEnumValues();
-
 
406
		}
-
 
407
		
-
 
408
		return this.enumValues.get(new Long(enumValueID));
-
 
409
	}
377
}
410
}