| Line 45... |
Line 45... |
| 45 |
}else{
|
45 |
}else{
|
| 46 |
sourceDbPath = args[0];
|
46 |
sourceDbPath = args[0];
|
| 47 |
destinationDbPath = args[1];
|
47 |
destinationDbPath = args[1];
|
| 48 |
}
|
48 |
}
|
| 49 |
|
49 |
|
| - |
|
50 |
|
| 50 |
StorageManager.getStorageManager().close();
|
51 |
//StorageManager.getStorageManager().close();
|
| 51 |
|
52 |
|
| 52 |
ContentMigratorToBDB contentmigrator = new ContentMigratorToBDB(sourceDbPath, destinationDbPath);
|
53 |
ContentMigratorToBDB contentmigrator = new ContentMigratorToBDB(sourceDbPath, destinationDbPath);
|
| 53 |
//boolean result = contentmigrator.addMedia();
|
54 |
//boolean result = contentmigrator.addMedia();
|
| 54 |
//boolean result = contentmigrator.addLearnedFields();
|
55 |
//boolean result = contentmigrator.addLearnedFields();
|
| 55 |
//boolean result = contentmigrator.migrate();
|
56 |
//boolean result = contentmigrator.migrate();
|
| 56 |
//System.out.println("Content migration status: "+ result);
|
57 |
//System.out.println("Content migration status: "+ result);
|
| - |
|
58 |
|
| - |
|
59 |
boolean result = contentmigrator.migrateEntityState();
|
| 57 |
}
|
60 |
}
|
| 58 |
|
61 |
|
| 59 |
public ContentMigratorToBDB(String sourceDbPath, String destinationDbPath) {
|
62 |
public ContentMigratorToBDB(String sourceDbPath, String destinationDbPath) {
|
| 60 |
this.sourceDbPath = sourceDbPath;
|
63 |
this.sourceDbPath = sourceDbPath;
|
| 61 |
this.destinationDbPath = destinationDbPath;
|
64 |
this.destinationDbPath = destinationDbPath;
|
| 62 |
}
|
65 |
}
|
| 63 |
|
66 |
|
| - |
|
67 |
public boolean migrateEntityState() throws Exception{
|
| - |
|
68 |
Map<Long, Entity> entities = CreationUtils.getEntities();
|
| - |
|
69 |
for(Long entityId: entities.keySet()){
|
| - |
|
70 |
Entity entity = entities.get(entityId);
|
| - |
|
71 |
EntityState oldState = CreationUtils.getEntityState(entityId);
|
| - |
|
72 |
EntityState newState = new EntityState(oldState.getID(), entity.getCategoryID(), oldState.getCreatedBy());
|
| - |
|
73 |
|
| - |
|
74 |
newState.setBrand(entity.getBrand());
|
| - |
|
75 |
newState.setModelName(entity.getModelName());
|
| - |
|
76 |
newState.setModelNumber(entity.getModelNumber());
|
| - |
|
77 |
|
| - |
|
78 |
newState.setStatus(oldState.getStatus());
|
| - |
|
79 |
newState.setAssignedBy(oldState.getAssignedBy());
|
| - |
|
80 |
newState.setAssignedTo(oldState.getAssignedTo());
|
| - |
|
81 |
newState.setAssignedOn(oldState.getAssignedOn());
|
| - |
|
82 |
|
| - |
|
83 |
newState.setCreatedBy(oldState.getCreatedBy());
|
| - |
|
84 |
newState.setCreatedOn(oldState.getCreatedOn());
|
| - |
|
85 |
|
| - |
|
86 |
newState.setCompletedOn(oldState.getCompletedOn());
|
| - |
|
87 |
newState.setCompletedBy(oldState.getCompletedBy());
|
| - |
|
88 |
|
| - |
|
89 |
newState.setMerkedReadyBy(oldState.getMerkedReadyBy());
|
| - |
|
90 |
newState.setMerkedReadyOn(oldState.getMerkedReadyOn());
|
| - |
|
91 |
CreationUtils.updateEntityState(newState);
|
| - |
|
92 |
}
|
| - |
|
93 |
return true;
|
| - |
|
94 |
}
|
| 64 |
// public boolean addLearnedFields() throws Exception{
|
95 |
// public boolean addLearnedFields() throws Exception{
|
| 65 |
// OldEntityContainer oldEnts = new OldEntityContainer(sourceDbPath);
|
96 |
// OldEntityContainer oldEnts = new OldEntityContainer(sourceDbPath);
|
| 66 |
// Map<Long, List<ExpandedBullet>> learnedBullets = oldEnts.getLearnedBullets();
|
97 |
// Map<Long, List<ExpandedBullet>> learnedBullets = oldEnts.getLearnedBullets();
|
| 67 |
// CreationUtils.storeLearnedBullets(learnedBullets);
|
98 |
// CreationUtils.storeLearnedBullets(learnedBullets);
|
| 68 |
// return true;
|
99 |
// return true;
|