| Line 20... |
Line 20... |
| 20 |
import in.shop2020.metamodel.definitions.CategorySlideDefinition;
|
20 |
import in.shop2020.metamodel.definitions.CategorySlideDefinition;
|
| 21 |
import in.shop2020.metamodel.definitions.DefinitionsContainer;
|
21 |
import in.shop2020.metamodel.definitions.DefinitionsContainer;
|
| 22 |
import in.shop2020.metamodel.definitions.FeatureDefinition;
|
22 |
import in.shop2020.metamodel.definitions.FeatureDefinition;
|
| 23 |
import in.shop2020.metamodel.definitions.SlideDefinition;
|
23 |
import in.shop2020.metamodel.definitions.SlideDefinition;
|
| 24 |
import in.shop2020.metamodel.definitions.SlideFeatureDefinition;
|
24 |
import in.shop2020.metamodel.definitions.SlideFeatureDefinition;
|
| - |
|
25 |
import in.shop2020.metamodel.util.ContentPojo;
|
| 25 |
import in.shop2020.metamodel.util.CreationUtils;
|
26 |
import in.shop2020.metamodel.util.CreationUtils;
|
| 26 |
import in.shop2020.metamodel.util.CreationUtils1;
|
27 |
import in.shop2020.metamodel.util.CreationUtils1;
|
| 27 |
import in.shop2020.metamodel.util.ExpandedBullet;
|
28 |
import in.shop2020.metamodel.util.ExpandedBullet;
|
| 28 |
import in.shop2020.metamodel.util.ExpandedEntity;
|
29 |
import in.shop2020.metamodel.util.ExpandedEntity;
|
| 29 |
import in.shop2020.metamodel.util.ExpandedFeature;
|
30 |
import in.shop2020.metamodel.util.ExpandedFeature;
|
| 30 |
import in.shop2020.metamodel.util.ExpandedSlide;
|
31 |
import in.shop2020.metamodel.util.ExpandedSlide;
|
| - |
|
32 |
import in.shop2020.metamodel.util.Specification;
|
| - |
|
33 |
import in.shop2020.metamodel.util.SpecificationGroup;
|
| 31 |
import in.shop2020.model.v1.catalog.CatalogService.Client;
|
34 |
import in.shop2020.model.v1.catalog.CatalogService.Client;
|
| 32 |
import in.shop2020.model.v1.catalog.Item;
|
35 |
import in.shop2020.model.v1.catalog.Item;
|
| 33 |
import in.shop2020.model.v1.catalog.status;
|
36 |
import in.shop2020.model.v1.catalog.status;
|
| - |
|
37 |
import in.shop2020.storage.mongo.StorageManager;
|
| 34 |
import in.shop2020.thrift.clients.CatalogClient;
|
38 |
import in.shop2020.thrift.clients.CatalogClient;
|
| 35 |
import in.shop2020.utils.Logger;
|
39 |
import in.shop2020.utils.Logger;
|
| 36 |
|
40 |
|
| 37 |
import java.io.BufferedReader;
|
41 |
import java.io.BufferedReader;
|
| 38 |
import java.io.ByteArrayInputStream;
|
42 |
import java.io.ByteArrayInputStream;
|
| Line 66... |
Line 70... |
| 66 |
import java.util.Set;
|
70 |
import java.util.Set;
|
| 67 |
import java.util.TreeMap;
|
71 |
import java.util.TreeMap;
|
| 68 |
|
72 |
|
| 69 |
import org.apache.commons.collections.CollectionUtils;
|
73 |
import org.apache.commons.collections.CollectionUtils;
|
| 70 |
import org.apache.commons.io.IOUtils;
|
74 |
import org.apache.commons.io.IOUtils;
|
| - |
|
75 |
import org.apache.commons.lang.ArrayUtils;
|
| 71 |
import org.apache.commons.lang.StringUtils;
|
76 |
import org.apache.commons.lang.StringUtils;
|
| 72 |
|
77 |
|
| 73 |
import com.google.gson.Gson;
|
78 |
import com.google.gson.Gson;
|
| 74 |
import com.google.gson.reflect.TypeToken;
|
79 |
import com.google.gson.reflect.TypeToken;
|
| 75 |
|
80 |
|
| Line 126... |
Line 131... |
| 126 |
contentmigrator.touchEntityState(1006864l);*/
|
131 |
contentmigrator.touchEntityState(1006864l);*/
|
| 127 |
//contentmigrator.clearEmptyPrimitiveBullets();
|
132 |
//contentmigrator.clearEmptyPrimitiveBullets();
|
| 128 |
//contentmigrator.migrateSoftCategories();
|
133 |
//contentmigrator.migrateSoftCategories();
|
| 129 |
//contentmigrator.updateSummaryMediaLabel();
|
134 |
//contentmigrator.updateSummaryMediaLabel();
|
| 130 |
//contentmigrator.migrateReviews();
|
135 |
//contentmigrator.migrateReviews();
|
| 131 |
contentmigrator.test1();
|
136 |
//contentmigrator.test1();
|
| - |
|
137 |
contentmigrator.testProd();
|
| 132 |
|
138 |
|
| 133 |
}
|
139 |
}
|
| 134 |
|
140 |
|
| - |
|
141 |
private void testProd() throws Exception{
|
| - |
|
142 |
Map<Long, EntityState> es1 = StorageManager.getStorageManager().getEntitiesMetadata();
|
| - |
|
143 |
for(Map.Entry<Long, EntityState> estate : es1.entrySet()){
|
| - |
|
144 |
EntityState es = estate.getValue();
|
| - |
|
145 |
if(es.getBrand().equals("Spice") && es.getCategoryID()==10006l) {
|
| - |
|
146 |
ContentPojo cp = StorageManager.getById(StorageManager.views.siteContent, estate.getKey(), ContentPojo.class);
|
| - |
|
147 |
List<SpecificationGroup> sgs = cp.getDetailedSpecs();
|
| - |
|
148 |
System.out.println(es.getBrand() + " " + es.getModelName() + " " +es.getModelNumber());
|
| - |
|
149 |
for(SpecificationGroup sg : sgs) {
|
| - |
|
150 |
String title = sg.getTitle();
|
| - |
|
151 |
if(title.equals("Look n feel")){
|
| - |
|
152 |
title = "Appearance";
|
| - |
|
153 |
}else if (title.equals("Display")){
|
| - |
|
154 |
title = "Screen";
|
| - |
|
155 |
}else if (title.equals("Hardware")){
|
| - |
|
156 |
title = "Processor";
|
| - |
|
157 |
}else if (title.equals("Communication")){
|
| - |
|
158 |
title = "Network";
|
| - |
|
159 |
}else if (title.equals("Software")){
|
| - |
|
160 |
title = "Operating System";
|
| - |
|
161 |
}else if (title.equals("Battery")){
|
| - |
|
162 |
title = "Power";
|
| - |
|
163 |
}else if (title.equals("Music")){
|
| - |
|
164 |
title = "Audio";
|
| - |
|
165 |
}else if (title.equals("Miscellaneous")){
|
| - |
|
166 |
title = "Other features";
|
| - |
|
167 |
}else if (title.equals("Package content")){
|
| - |
|
168 |
title = "Box content";
|
| - |
|
169 |
}
|
| - |
|
170 |
System.out.println(title);
|
| - |
|
171 |
for(Specification spec : sg.getSpecs()){
|
| - |
|
172 |
System.out.println("\t" + spec.getName() + "\t" + StringUtils.join(spec.getValues().toArray(), ", "));
|
| - |
|
173 |
}
|
| - |
|
174 |
|
| - |
|
175 |
System.out.println("Box content");
|
| - |
|
176 |
System.out.println("\t" + StringUtils.join(cp.getPackageContents().toArray(), ", "));
|
| - |
|
177 |
|
| - |
|
178 |
}
|
| - |
|
179 |
}
|
| - |
|
180 |
}
|
| - |
|
181 |
}
|
| - |
|
182 |
|
| 135 |
//Full run for monge Mobile content
|
183 |
//Full run for monge Mobile content
|
| 136 |
|
184 |
|
| 137 |
private void test1() throws Exception{
|
185 |
private void test1() throws Exception{
|
| 138 |
Map<Long,Entity> entities = CreationUtils.getEntities();
|
186 |
//Map<Long,Entity> entities = CreationUtils.getEntities();
|
| 139 |
System.out.println("Expert reviews:" + entities.size());
|
187 |
//System.out.println("Expert reviews:" + entities.size());
|
| 140 |
PojoCreator pc = new PojoCreator();
|
188 |
PojoCreator pc = new PojoCreator();
|
| - |
|
189 |
Entity ent = CreationUtils.getEntity(1010432l);
|
| 141 |
for(Map.Entry<Long, Entity> entry : entities.entrySet()) {
|
190 |
//for(Map.Entry<Long, Entity> entry : entities.entrySet()) {
|
| 142 |
if(CreationUtils.getEntityState(entry.getKey()).getStatus().equals(EntityStatus.READY)) {
|
191 |
//if(CreationUtils.getEntityState(entry.getKey()).getStatus().equals(EntityStatus.READY)) {
|
| 143 |
System.out.println("Updated entity:" + entry.getKey());
|
192 |
//System.out.println("Updated entity:" + entry.getKey());
|
| 144 |
ExpandedEntity expEntity = new ExpandedEntity(entry.getValue());
|
193 |
ExpandedEntity expEntity = new ExpandedEntity(ent);
|
| 145 |
Map<String, String > entityParams = getEntityParameters(expEntity);
|
194 |
Map<String, String > entityParams = getEntityParameters(expEntity);
|
| 146 |
List<ExpertReview> expertReviews = getExpertReviews(entry.getKey());
|
195 |
List<ExpertReview> expertReviews = getExpertReviews(1010432l);
|
| 147 |
//context.put("expertReviews", expertReviews);
|
196 |
//context.put("expertReviews", expertReviews);
|
| 148 |
pc.createAndStoreContentPojo(expEntity, expertReviews,entityParams.get("WARRANTY"));
|
197 |
pc.createAndStoreContentPojo(expEntity, expertReviews,entityParams.get("WARRANTY"));
|
| 149 |
}
|
198 |
//}
|
| 150 |
}
|
199 |
//}
|
| 151 |
}
|
200 |
}
|
| 152 |
|
201 |
|
| 153 |
private void test() throws Exception{
|
202 |
private void test() throws Exception{
|
| 154 |
/*PojoCreator pc = new PojoCreator();
|
203 |
/*PojoCreator pc = new PojoCreator();
|
| 155 |
List<ExpertReview> expertReviews = getExpertReviews(1007379);*/
|
204 |
List<ExpertReview> expertReviews = getExpertReviews(1007379);*/
|