Subversion Repositories SmartDukaan

Rev

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

Rev 323 Rev 457
Line 50... Line 50...
50
import in.shop2020.metamodel.jaxb.facets.IRDefinitionType;
50
import in.shop2020.metamodel.jaxb.facets.IRDefinitionType;
51
import in.shop2020.metamodel.jaxb.facets.RuleDefinitionType;
51
import in.shop2020.metamodel.jaxb.facets.RuleDefinitionType;
52
import in.shop2020.util.DBUtils;
52
import in.shop2020.util.DBUtils;
53
import in.shop2020.util.Utils;
53
import in.shop2020.util.Utils;
54
 
54
 
-
 
55
import java.io.File;
55
import java.io.FileInputStream;
56
import java.io.FileInputStream;
56
import java.util.ArrayList;
57
import java.util.ArrayList;
57
import java.util.HashMap;
58
import java.util.HashMap;
58
import java.util.Iterator;
59
import java.util.Iterator;
59
import java.util.List;
60
import java.util.List;
Line 207... Line 208...
207
	public MM(String definitionSetName) {
208
	public MM(String definitionSetName) {
208
		this.definitionSetName = definitionSetName;
209
		this.definitionSetName = definitionSetName;
209
		this.srcFile = Utils.DEFINITIONS_SRC_PATH + this.definitionSetName + 
210
		this.srcFile = Utils.DEFINITIONS_SRC_PATH + this.definitionSetName + 
210
			".xml";
211
			".xml";
211
		
212
		
212
		this.dbFile = Utils.DEFINITIONS_DB_PATH + this.definitionSetName + 
213
		this.dbFile = Utils.CONTENT_DB_PATH + "definitions" + File.separator + this.definitionSetName + 
213
			".ser";
214
			".ser";
214
	}
215
	}
215
	
216
	
216
	/**
217
	/**
217
	 * 
218
	 * 
Line 278... Line 279...
278
			//Utils.info(categoriesMap);
279
			//Utils.info(categoriesMap);
279
			//Utils.info(root);
280
			//Utils.info(root);
280
			//System.exit(0);
281
			//System.exit(0);
281
			
282
			
282
			// Tree
283
			// Tree
283
			String categoryTreeDBFile = Utils.DEFINITIONS_DB_PATH + 
284
			String categoryTreeDBFile = Utils.CONTENT_DB_PATH + "definitions" + File.separator + 
284
				"categorytree.ser";
285
				"categorytree.ser";
285
			
286
			
286
			if(root != null) {
287
			if(root != null) {
287
				DBUtils.store(root, categoryTreeDBFile);
288
				DBUtils.store(root, categoryTreeDBFile);
288
			}
289
			}
Line 295... Line 296...
295
		else if(this.definitionSetName.equals("datatypedefinitions")) {
296
		else if(this.definitionSetName.equals("datatypedefinitions")) {
296
			Map<Long, DatatypeDefinition> datatypeDefsMap = 
297
			Map<Long, DatatypeDefinition> datatypeDefsMap = 
297
				this.convertDatatypeDefinition(defType);
298
				this.convertDatatypeDefinition(defType);
298
			
299
			
299
			// Store enum value id to value map separately
300
			// Store enum value id to value map separately
300
			String enumValueDBFile = Utils.DEFINITIONS_DB_PATH + "enumvalues" + 
301
			String enumValueDBFile = Utils.CONTENT_DB_PATH + "definitions" + File.separator  + "enumvalues" + 
301
				".ser";
302
				".ser";
302
			
303
			
303
			// RE-VISIT - May not be optimal
304
			// RE-VISIT - May not be optimal
304
			Map<Long, EnumValue> enumValuesMap = new TreeMap<Long, EnumValue>();
305
			Map<Long, EnumValue> enumValuesMap = new TreeMap<Long, EnumValue>();
305
			for(Long datatypeDefID : datatypeDefsMap.keySet()) {
306
			for(Long datatypeDefID : datatypeDefsMap.keySet()) {
Line 472... Line 473...
472
	public void showDefinitionSet() throws Exception {
473
	public void showDefinitionSet() throws Exception {
473
		Object obj = DBUtils.read(this.dbFile);
474
		Object obj = DBUtils.read(this.dbFile);
474
		Utils.info(obj.toString());
475
		Utils.info(obj.toString());
475
		
476
		
476
		if(this.definitionSetName.equals("categories")) {
477
		if(this.definitionSetName.equals("categories")) {
477
			String categoryTreeDBFile = Utils.DEFINITIONS_DB_PATH + 
478
			String categoryTreeDBFile = Utils.CONTENT_DB_PATH + "definitions" + File.separator + 
478
				"categorytree" + ".ser";
479
				"categorytree" + ".ser";
479
			
480
			
480
			Category root = (Category)DBUtils.read(categoryTreeDBFile);
481
			Category root = (Category)DBUtils.read(categoryTreeDBFile);
481
			Utils.info(root.toString());
482
			Utils.info(root.toString());
482
			//Utils.info("root.getChildrenCategory().size: " + 
483
			//Utils.info("root.getChildrenCategory().size: " +