| Line 36... |
Line 36... |
| 36 |
import in.shop2020.metamodel.definitions.FacetDefinition;
|
36 |
import in.shop2020.metamodel.definitions.FacetDefinition;
|
| 37 |
import in.shop2020.metamodel.definitions.FeatureDefinition;
|
37 |
import in.shop2020.metamodel.definitions.FeatureDefinition;
|
| 38 |
import in.shop2020.metamodel.definitions.SlideDefinition;
|
38 |
import in.shop2020.metamodel.definitions.SlideDefinition;
|
| 39 |
import in.shop2020.metamodel.definitions.SlideFeatureDefinition;
|
39 |
import in.shop2020.metamodel.definitions.SlideFeatureDefinition;
|
| 40 |
import in.shop2020.metamodel.util.CreationUtils;
|
40 |
import in.shop2020.metamodel.util.CreationUtils;
|
| - |
|
41 |
import in.shop2020.metamodel.util.ExpandedEntity;
|
| 41 |
//import in.shop2020.metamodel.util.OldCreationUtils;
|
42 |
//import in.shop2020.metamodel.util.OldCreationUtils;
|
| 42 |
//import in.shop2020.metamodel.util.OldCreationUtils;
|
43 |
//import in.shop2020.metamodel.util.OldCreationUtils;
|
| 43 |
import in.shop2020.metamodel.util.ExpandedBullet;
|
44 |
import in.shop2020.metamodel.util.ExpandedBullet;
|
| 44 |
|
45 |
|
| 45 |
|
46 |
|
| Line 64... |
Line 65... |
| 64 |
sourceDbPath = args[0];
|
65 |
sourceDbPath = args[0];
|
| 65 |
destinationDbPath = args[1];
|
66 |
destinationDbPath = args[1];
|
| 66 |
}
|
67 |
}
|
| 67 |
|
68 |
|
| 68 |
ContentMigrator contentmigrator = new ContentMigrator(sourceDbPath, destinationDbPath);
|
69 |
ContentMigrator contentmigrator = new ContentMigrator(sourceDbPath, destinationDbPath);
|
| - |
|
70 |
contentmigrator.migrateData();
|
| 69 |
//contentmigrator.migrateRemoveBorrowedCategoryIdFromSlide();
|
71 |
//contentmigrator.migrateRemoveBorrowedCategoryIdFromSlide();
|
| 70 |
//contentmigrator.migrateModel1();
|
72 |
//contentmigrator.migrateModel1();
|
| 71 |
//contentmigrator.changeEntityState();
|
73 |
//contentmigrator.changeEntityState();
|
| 72 |
//contentmigrator.removeBrowserBullets();
|
74 |
//contentmigrator.removeBrowserBullets();
|
| 73 |
//contentmigrator.migrateModel2();
|
75 |
//contentmigrator.migrateModel2();
|
| 74 |
//contentmigrator.printDataModel();
|
76 |
//contentmigrator.printDataModel();
|
| 75 |
//contentmigrator.makeEntitiesObject();
|
77 |
//contentmigrator.makeEntitiesObject();
|
| 76 |
//contentmigrator.printSlides();
|
78 |
//contentmigrator.printSlides();
|
| - |
|
79 |
/*
|
| 77 |
DefinitionsContainer dfc = Catalog.getInstance().getDefinitionsContainer();
|
80 |
DefinitionsContainer dfc = Catalog.getInstance().getDefinitionsContainer();
|
| 78 |
for(Long fid: dfc.getCategoryFacetDefinitions().keySet()){
|
81 |
for(Long fid: dfc.getCategoryFacetDefinitions().keySet()){
|
| 79 |
for(FacetDefinition facetDef: dfc.getCategoryFacetDefinitions().get(fid).getFacetDefinitions()){
|
82 |
for(FacetDefinition facetDef: dfc.getCategoryFacetDefinitions().get(fid).getFacetDefinitions()){
|
| 80 |
System.out.println("***" + fid + " *** " + facetDef.getID() + facetDef.getTarget() );
|
83 |
System.out.println("***" + fid + " *** " + facetDef.getID() + facetDef.getTarget() );
|
| 81 |
}
|
84 |
}
|
| 82 |
|
85 |
|
| - |
|
86 |
}*/
|
| 83 |
}
|
87 |
|
| 84 |
//System.out.println("**********" + dfc.getCategoryFacetDefinitions());
|
88 |
//System.out.println("**********" + dfc.getCategoryFacetDefinitions());
|
| 85 |
//System.out.println("**********" + dfc.getSlideFacetDefinitions());
|
89 |
//System.out.println("**********" + dfc.getSlideFacetDefinitions());
|
| 86 |
|
90 |
|
| - |
|
91 |
/*
|
| 87 |
for(Long defID : dfc.getSlideFacetDefinitions().keySet()){
|
92 |
for(Long defID : dfc.getSlideFacetDefinitions().keySet()){
|
| 88 |
for(FacetDefinition facetDef: dfc.getSlideFacetDefinitions().get(defID)){
|
93 |
for(FacetDefinition facetDef: dfc.getSlideFacetDefinitions().get(defID)){
|
| 89 |
System.out.println(defID + "****" + facetDef.getID() + facetDef.getDescription());
|
94 |
System.out.println(defID + "****" + facetDef.getID() + facetDef.getDescription());
|
| 90 |
}
|
95 |
}
|
| 91 |
|
96 |
|
| 92 |
}
|
97 |
}
|
| - |
|
98 |
*/
|
| 93 |
|
99 |
|
| 94 |
/*
|
100 |
/*
|
| 95 |
System.out.println(OldCreationUtils.getSlideSequence(1000194));
|
101 |
System.out.println(OldCreationUtils.getSlideSequence(1000194));
|
| 96 |
List<Slide> slides = OldCreationUtils.getEntity(1000194).getSlides();
|
102 |
List<Slide> slides = OldCreationUtils.getEntity(1000194).getSlides();
|
| 97 |
for(Slide slide: slides){
|
103 |
for(Slide slide: slides){
|
| Line 149... |
Line 155... |
| 149 |
CreationUtils.updateEntityState(state);
|
155 |
CreationUtils.updateEntityState(state);
|
| 150 |
}
|
156 |
}
|
| 151 |
return true;
|
157 |
return true;
|
| 152 |
}
|
158 |
}
|
| 153 |
|
159 |
|
| 154 |
|
160 |
|
| - |
|
161 |
public boolean migrateData() throws Exception{
|
| - |
|
162 |
Map<Long, Entity> entities = CreationUtils.getEntities();
|
| - |
|
163 |
for(Entity entity: entities.values()){
|
| - |
|
164 |
ExpandedEntity expEntity = new ExpandedEntity(entity);
|
| - |
|
165 |
List<Slide> slides = entity.getSlides();
|
| - |
|
166 |
if(slides!=null){
|
| - |
|
167 |
for(Slide slide: slides){
|
| - |
|
168 |
if(slide.getSlideDefinitionID() == 130054){
|
| - |
|
169 |
List<Feature> features = slide.getFeatures();
|
| - |
|
170 |
String title = expEntity.getBrand() + " " + expEntity.getModelName()+ " "
|
| - |
|
171 |
+ expEntity.getModelNumber();
|
| - |
|
172 |
if(expEntity.getCategory().getParentCategory().getID() == 10001) {
|
| - |
|
173 |
title += " | " + expEntity.getBrand() + " Mobile Phones";
|
| - |
|
174 |
}
|
| - |
|
175 |
if(expEntity.getCategory().getParentCategory().getID() == 10011) {
|
| - |
|
176 |
title += " " + expEntity.getCategory().getLabel()
|
| - |
|
177 |
+ " | " + expEntity.getBrand() + " Mobile Phone Accessories";
|
| - |
|
178 |
}
|
| - |
|
179 |
title += " | Saholic.com";
|
| - |
|
180 |
|
| - |
|
181 |
//Add page title
|
| - |
|
182 |
Feature feature1 = new Feature(120132);
|
| - |
|
183 |
PrimitiveDataObject pdo1 = new PrimitiveDataObject(title);
|
| - |
|
184 |
List<Bullet> bullets1 = new ArrayList<Bullet>();
|
| - |
|
185 |
Bullet bullet1 = new Bullet(pdo1);
|
| - |
|
186 |
bullets1.add(bullet1);
|
| - |
|
187 |
feature1.setBullets(bullets1);
|
| - |
|
188 |
features.add(feature1);
|
| - |
|
189 |
|
| - |
|
190 |
|
| - |
|
191 |
String description = "Best Price " + expEntity.getBrand() + " " + expEntity.getModelName()
|
| - |
|
192 |
+ " " + expEntity.getModelNumber() + " ";
|
| - |
|
193 |
|
| - |
|
194 |
if(expEntity.getCategory().getParentCategory().getID() == 10011) {
|
| - |
|
195 |
description += expEntity.getCategory().getLabel() + " in India.";
|
| - |
|
196 |
}
|
| - |
|
197 |
else {
|
| - |
|
198 |
description += ".";
|
| - |
|
199 |
}
|
| - |
|
200 |
description += " Experience n' buy online. FREE Next Day delivery."
|
| - |
|
201 |
+ " Original product - Full manufacturer warranty. Comprehensive reviews.";
|
| - |
|
202 |
|
| - |
|
203 |
description = description.replaceAll("--", "-");
|
| - |
|
204 |
|
| - |
|
205 |
//Add meta description
|
| - |
|
206 |
Feature feature2 = new Feature(120133);
|
| - |
|
207 |
PrimitiveDataObject pdo2 = new PrimitiveDataObject(description);
|
| - |
|
208 |
List<Bullet> bullets2 = new ArrayList<Bullet>();
|
| - |
|
209 |
Bullet bullet2 = new Bullet(pdo2);
|
| - |
|
210 |
bullets2.add(bullet2);
|
| - |
|
211 |
feature2.setBullets(bullets2);
|
| - |
|
212 |
|
| - |
|
213 |
features.add(feature2);
|
| - |
|
214 |
|
| - |
|
215 |
|
| - |
|
216 |
String keywords = expEntity.getBrand() + " " + expEntity.getModelName() + " " + expEntity.getModelNumber() + ", ";
|
| - |
|
217 |
if(expEntity.getCategory().getParentCategory().getID() == 10001) {
|
| - |
|
218 |
keywords += expEntity.getBrand() + " mobile phones, ";
|
| - |
|
219 |
}
|
| - |
|
220 |
if(expEntity.getCategory().getParentCategory().getID() == 10011) {
|
| - |
|
221 |
keywords += "phone accessories, ";
|
| - |
|
222 |
}
|
| - |
|
223 |
keywords += expEntity.getBrand() + " " + expEntity.getModelName() + " " + expEntity.getModelNumber() + " Price, ";
|
| - |
|
224 |
keywords += expEntity.getBrand() + " " + expEntity.getModelName() + " " + expEntity.getModelNumber() + " India, ";
|
| - |
|
225 |
if(expEntity.getCategory().getParentCategory().getID() == 10001) {
|
| - |
|
226 |
keywords += expEntity.getBrand() + " " + expEntity.getModelName() + " " + expEntity.getModelNumber() + " Review, ";
|
| - |
|
227 |
}
|
| - |
|
228 |
//Add meta keyborad
|
| - |
|
229 |
Feature feature3 = new Feature(120134);
|
| - |
|
230 |
PrimitiveDataObject pdo3 = new PrimitiveDataObject(keywords);
|
| - |
|
231 |
List<Bullet> bullets3 = new ArrayList<Bullet>();
|
| - |
|
232 |
Bullet bullet3 = new Bullet(pdo3);
|
| - |
|
233 |
bullets3.add(bullet3);
|
| - |
|
234 |
feature3.setBullets(bullets3);
|
| - |
|
235 |
|
| - |
|
236 |
features.add(feature3);
|
| - |
|
237 |
|
| - |
|
238 |
CreationUtils.updateEntity(entity);
|
| - |
|
239 |
}
|
| - |
|
240 |
}
|
| - |
|
241 |
}
|
| - |
|
242 |
}
|
| - |
|
243 |
return true;
|
| - |
|
244 |
}
|
| - |
|
245 |
|
| 155 |
public boolean migrateModel2() throws Exception{
|
246 |
public boolean migrateModel2() throws Exception{
|
| 156 |
Map<Long, Entity> entities = CreationUtils.getEntities();
|
247 |
Map<Long, Entity> entities = CreationUtils.getEntities();
|
| 157 |
for(Entity entity: entities.values()){
|
248 |
for(Entity entity: entities.values()){
|
| 158 |
List<Slide> slides = entity.getSlides();
|
249 |
List<Slide> slides = entity.getSlides();
|
| 159 |
if(slides!=null){
|
250 |
if(slides!=null){
|