Subversion Repositories SmartDukaan

Rev

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

Rev 1050 Rev 1055
Line 16... Line 16...
16
import in.shop2020.metamodel.core.Entity;
16
import in.shop2020.metamodel.core.Entity;
17
import in.shop2020.metamodel.core.EntityState;
17
import in.shop2020.metamodel.core.EntityState;
18
import in.shop2020.metamodel.core.FreeformContent;
18
import in.shop2020.metamodel.core.FreeformContent;
19
import in.shop2020.metamodel.core.Media;
19
import in.shop2020.metamodel.core.Media;
20
import in.shop2020.metamodel.core.Slide;
20
import in.shop2020.metamodel.core.Slide;
21
import in.shop2020.metamodel.definitions.OldEntityContainer;
21
//import in.shop2020.metamodel.definitions.OldEntityContainer;
22
import in.shop2020.metamodel.util.CreationUtils;
22
import in.shop2020.metamodel.util.CreationUtils;
23
import in.shop2020.metamodel.util.ExpandedBullet;
23
import in.shop2020.metamodel.util.ExpandedBullet;
24
import in.shop2020.metamodel.util.OldCreationUtils;
24
//import in.shop2020.metamodel.util.OldCreationUtils;
25
import in.shop2020.storage.bdb.StorageManager;
25
import in.shop2020.storage.bdb.StorageManager;
26
 
26
 
27
 
27
 
28
/*
28
/*
29
 * @author rajveer 
29
 * @author rajveer 
Line 50... Line 50...
50
		//StorageManager.getStorageManager().close();
50
		//StorageManager.getStorageManager().close();
51
		
51
		
52
		ContentMigratorToBDB contentmigrator = new ContentMigratorToBDB(sourceDbPath, destinationDbPath);
52
		ContentMigratorToBDB contentmigrator = new ContentMigratorToBDB(sourceDbPath, destinationDbPath);
53
		//boolean result = contentmigrator.addMedia();
53
		//boolean result = contentmigrator.addMedia();
54
//		boolean result = contentmigrator.addLearnedFields();
54
//		boolean result = contentmigrator.addLearnedFields();
55
		boolean result = contentmigrator.migrate();
55
		//boolean result = contentmigrator.migrate();
56
		System.out.println("Content migration status:  "+ result);
56
		//System.out.println("Content migration status:  "+ result);
57
	}
57
	}
58
 
58
 
59
	public ContentMigratorToBDB(String sourceDbPath, String destinationDbPath) {
59
	public ContentMigratorToBDB(String sourceDbPath, String destinationDbPath) {
60
		this.sourceDbPath = sourceDbPath;
60
		this.sourceDbPath = sourceDbPath;
61
		this.destinationDbPath = destinationDbPath;
61
		this.destinationDbPath = destinationDbPath;
62
	}
62
	}
63
	
63
	/*
64
	public boolean addLearnedFields() throws Exception{
64
	public boolean addLearnedFields() throws Exception{
65
		OldEntityContainer oldEnts = new OldEntityContainer(sourceDbPath);
65
		OldEntityContainer oldEnts = new OldEntityContainer(sourceDbPath);
66
		Map<Long, List<ExpandedBullet>> learnedBullets = oldEnts.getLearnedBullets();
66
		Map<Long, List<ExpandedBullet>> learnedBullets = oldEnts.getLearnedBullets();
67
		CreationUtils.storeLearnedBullets(learnedBullets);
67
		CreationUtils.storeLearnedBullets(learnedBullets);
68
		return true;
68
		return true;
Line 104... Line 104...
104
	    	StorageManager.getStorageManager().updateEntity(entity);
104
	    	StorageManager.getStorageManager().updateEntity(entity);
105
	    }
105
	    }
106
	    in.close();
106
	    in.close();
107
	    return true;
107
	    return true;
108
}
108
}
109
 
109
*/
110
	/**
110
	/**
111
	 * this function will read source definition and source entities, and will convert
111
	 * this function will read source definition and source entities, and will convert
112
	 * source entities to destination entities according to destination definitions.  
112
	 * source entities to destination entities according to destination definitions.  
113
	 * 
113
	 * 
114
	 * @return boolean
114
	 * @return boolean
115
	 * @throws Exception 
115
	 * @throws Exception 
116
	 */
116
	 */
117
	
117
	/*
118
	public boolean migrate() throws Exception{
118
	public boolean migrate() throws Exception{
119
		OldEntityContainer sourceEnts = new OldEntityContainer(sourceDbPath);
119
		OldEntityContainer sourceEnts = new OldEntityContainer(sourceDbPath);
120
		
120
		
121
		StringBuilder sb = new StringBuilder();
121
		StringBuilder sb = new StringBuilder();
122
		Map<Long, Entity> entities = sourceEnts.getEntities();
122
		Map<Long, Entity> entities = sourceEnts.getEntities();
Line 167... Line 167...
167
		
167
		
168
		//StorageManager.getStorageManager().close();
168
		//StorageManager.getStorageManager().close();
169
		System.out.println(sb.toString());
169
		System.out.println(sb.toString());
170
		return true;
170
		return true;
171
	}
171
	}
-
 
172
	*/
172
}
173
}