| 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.Catalog;
|
| - |
|
22 |
import in.shop2020.metamodel.definitions.DefinitionsContainer;
|
| 21 |
//import in.shop2020.metamodel.definitions.OldEntityContainer;
|
23 |
//import in.shop2020.metamodel.definitions.OldEntityContainer;
|
| 22 |
import in.shop2020.metamodel.util.CreationUtils;
|
24 |
import in.shop2020.metamodel.util.CreationUtils;
|
| 23 |
import in.shop2020.metamodel.util.ExpandedBullet;
|
25 |
import in.shop2020.metamodel.util.ExpandedBullet;
|
| 24 |
//import in.shop2020.metamodel.util.OldCreationUtils;
|
26 |
//import in.shop2020.metamodel.util.OldCreationUtils;
|
| 25 |
import in.shop2020.storage.bdb.StorageManager;
|
27 |
import in.shop2020.storage.bdb.StorageManager;
|
| Line 54... |
Line 56... |
| 54 |
//boolean result = contentmigrator.addMedia();
|
56 |
//boolean result = contentmigrator.addMedia();
|
| 55 |
//boolean result = contentmigrator.addLearnedFields();
|
57 |
//boolean result = contentmigrator.addLearnedFields();
|
| 56 |
//boolean result = contentmigrator.migrate();
|
58 |
//boolean result = contentmigrator.migrate();
|
| 57 |
//System.out.println("Content migration status: "+ result);
|
59 |
//System.out.println("Content migration status: "+ result);
|
| 58 |
|
60 |
|
| 59 |
boolean result = contentmigrator.migrateEntityState();
|
61 |
//boolean result = contentmigrator.migrateEntityState();
|
| - |
|
62 |
boolean result = contentmigrator.migrateRemoveBorrowedCategoryIdFromSlide();
|
| - |
|
63 |
//System.out.println(CreationUtils.getEntity(1000471).getSlide(130011));
|
| - |
|
64 |
//System.out.println(CreationUtils.getFacetValues());
|
| - |
|
65 |
|
| 60 |
}
|
66 |
}
|
| 61 |
|
67 |
|
| 62 |
public ContentMigratorToBDB(String sourceDbPath, String destinationDbPath) {
|
68 |
public ContentMigratorToBDB(String sourceDbPath, String destinationDbPath) {
|
| 63 |
this.sourceDbPath = sourceDbPath;
|
69 |
this.sourceDbPath = sourceDbPath;
|
| 64 |
this.destinationDbPath = destinationDbPath;
|
70 |
this.destinationDbPath = destinationDbPath;
|
| 65 |
}
|
71 |
}
|
| 66 |
|
72 |
|
| - |
|
73 |
public boolean migrateRemoveBorrowedCategoryIdFromSlide() throws Exception{
|
| - |
|
74 |
DefinitionsContainer dfc = Catalog.getInstance().getDefinitionsContainer();
|
| - |
|
75 |
Map<Long, Entity> entities = CreationUtils.getEntities();
|
| - |
|
76 |
for(Long entityId: entities.keySet()){
|
| - |
|
77 |
Entity entity = entities.get(entityId);
|
| - |
|
78 |
if(entity.getSlides()!=null){
|
| - |
|
79 |
for(Slide slide:entity.getSlides()){
|
| - |
|
80 |
if(CreationUtils.isBorrowedSlide(slide.getSlideDefinitionID(), entity.getCategoryID())){
|
| - |
|
81 |
System.out.println(entity.getID() + "\t" + slide.getSlideDefinitionID() + "\t"+ dfc.getCategory(entity.getCategoryID()).getLabel() + "\t" + dfc.getSlideDefinition(slide.getSlideDefinitionID()).getLabel() + "\t" + dfc.getCategory(CreationUtils.getBorrowedCategoryID(slide.getSlideDefinitionID(), entity.getCategoryID())).getLabel() );
|
| - |
|
82 |
}
|
| - |
|
83 |
}
|
| - |
|
84 |
}
|
| - |
|
85 |
}
|
| - |
|
86 |
return true;
|
| - |
|
87 |
}
|
| - |
|
88 |
|
| 67 |
public boolean migrateEntityState() throws Exception{
|
89 |
public boolean migrateEntityState() throws Exception{
|
| 68 |
Map<Long, Entity> entities = CreationUtils.getEntities();
|
90 |
Map<Long, Entity> entities = CreationUtils.getEntities();
|
| 69 |
for(Long entityId: entities.keySet()){
|
91 |
for(Long entityId: entities.keySet()){
|
| 70 |
Entity entity = entities.get(entityId);
|
92 |
Entity entity = entities.get(entityId);
|
| 71 |
EntityState oldState = CreationUtils.getEntityState(entityId);
|
93 |
EntityState oldState = CreationUtils.getEntityState(entityId);
|