| 457 |
rajveer |
1 |
package in.shop2020.util;
|
|
|
2 |
|
| 1226 |
rajveer |
3 |
import in.shop2020.metamodel.core.Bullet;
|
| 479 |
rajveer |
4 |
import in.shop2020.metamodel.core.Entity;
|
| 1226 |
rajveer |
5 |
import in.shop2020.metamodel.core.EntityState;
|
| 7129 |
amit.gupta |
6 |
import in.shop2020.metamodel.core.EntityStatus;
|
| 3873 |
mandeep.dh |
7 |
import in.shop2020.metamodel.core.EnumDataObject;
|
| 7590 |
amit.gupta |
8 |
import in.shop2020.metamodel.core.ExpertReview;
|
| 8749 |
amit.gupta |
9 |
import in.shop2020.metamodel.core.ExpertReviewSource;
|
| 1226 |
rajveer |
10 |
import in.shop2020.metamodel.core.Feature;
|
| 479 |
rajveer |
11 |
import in.shop2020.metamodel.core.FreeformContent;
|
| 8749 |
amit.gupta |
12 |
import in.shop2020.metamodel.core.Helpdoc;
|
| 5370 |
amit.gupta |
13 |
import in.shop2020.metamodel.core.Media;
|
|
|
14 |
import in.shop2020.metamodel.core.Media.Type;
|
| 1226 |
rajveer |
15 |
import in.shop2020.metamodel.core.PrimitiveDataObject;
|
| 479 |
rajveer |
16 |
import in.shop2020.metamodel.core.Slide;
|
| 8749 |
amit.gupta |
17 |
import in.shop2020.metamodel.core.SpecialPage;
|
| 580 |
rajveer |
18 |
import in.shop2020.metamodel.definitions.BulletDefinition;
|
| 457 |
rajveer |
19 |
import in.shop2020.metamodel.definitions.Catalog;
|
| 580 |
rajveer |
20 |
import in.shop2020.metamodel.definitions.Category;
|
|
|
21 |
import in.shop2020.metamodel.definitions.CategorySlideDefinition;
|
| 457 |
rajveer |
22 |
import in.shop2020.metamodel.definitions.DefinitionsContainer;
|
| 580 |
rajveer |
23 |
import in.shop2020.metamodel.definitions.FeatureDefinition;
|
|
|
24 |
import in.shop2020.metamodel.definitions.SlideDefinition;
|
|
|
25 |
import in.shop2020.metamodel.definitions.SlideFeatureDefinition;
|
| 479 |
rajveer |
26 |
import in.shop2020.metamodel.util.CreationUtils;
|
| 8749 |
amit.gupta |
27 |
import in.shop2020.metamodel.util.CreationUtils1;
|
| 2720 |
mandeep.dh |
28 |
import in.shop2020.metamodel.util.ExpandedBullet;
|
| 1739 |
rajveer |
29 |
import in.shop2020.metamodel.util.ExpandedEntity;
|
| 5945 |
mandeep.dh |
30 |
import in.shop2020.model.v1.catalog.CatalogService.Client;
|
| 2287 |
rajveer |
31 |
import in.shop2020.model.v1.catalog.Item;
|
|
|
32 |
import in.shop2020.model.v1.catalog.status;
|
| 8749 |
amit.gupta |
33 |
import in.shop2020.storage.mongo.StorageManager;
|
| 3127 |
rajveer |
34 |
import in.shop2020.thrift.clients.CatalogClient;
|
| 4706 |
amit.gupta |
35 |
import in.shop2020.utils.Logger;
|
| 457 |
rajveer |
36 |
|
| 2720 |
mandeep.dh |
37 |
import java.io.BufferedReader;
|
| 5370 |
amit.gupta |
38 |
import java.io.ByteArrayInputStream;
|
|
|
39 |
import java.io.ByteArrayOutputStream;
|
| 2720 |
mandeep.dh |
40 |
import java.io.DataInputStream;
|
|
|
41 |
import java.io.File;
|
|
|
42 |
import java.io.FileInputStream;
|
| 8014 |
amit.gupta |
43 |
import java.io.FileNotFoundException;
|
| 5370 |
amit.gupta |
44 |
import java.io.FileOutputStream;
|
| 8014 |
amit.gupta |
45 |
import java.io.FileReader;
|
| 5370 |
amit.gupta |
46 |
import java.io.InputStream;
|
| 2720 |
mandeep.dh |
47 |
import java.io.InputStreamReader;
|
| 5370 |
amit.gupta |
48 |
import java.io.ObjectInputStream;
|
|
|
49 |
import java.io.ObjectOutputStream;
|
|
|
50 |
import java.io.OutputStream;
|
| 8014 |
amit.gupta |
51 |
import java.io.Reader;
|
| 5760 |
amit.gupta |
52 |
import java.text.MessageFormat;
|
| 8749 |
amit.gupta |
53 |
import java.text.SimpleDateFormat;
|
| 2720 |
mandeep.dh |
54 |
import java.util.ArrayList;
|
| 7037 |
amit.gupta |
55 |
import java.util.Arrays;
|
| 8749 |
amit.gupta |
56 |
import java.util.Calendar;
|
| 5370 |
amit.gupta |
57 |
import java.util.Collection;
|
| 3873 |
mandeep.dh |
58 |
import java.util.Collections;
|
| 7129 |
amit.gupta |
59 |
import java.util.Date;
|
| 4706 |
amit.gupta |
60 |
import java.util.HashMap;
|
| 5671 |
amit.gupta |
61 |
import java.util.Iterator;
|
| 7123 |
amit.gupta |
62 |
import java.util.LinkedHashMap;
|
| 2720 |
mandeep.dh |
63 |
import java.util.List;
|
|
|
64 |
import java.util.Map;
|
| 7111 |
amit.gupta |
65 |
import java.util.Set;
|
| 8749 |
amit.gupta |
66 |
import java.util.TimeZone;
|
| 2720 |
mandeep.dh |
67 |
import java.util.TreeMap;
|
| 580 |
rajveer |
68 |
|
| 7932 |
amit.gupta |
69 |
import org.apache.commons.collections.CollectionUtils;
|
| 5370 |
amit.gupta |
70 |
import org.apache.commons.io.IOUtils;
|
| 4818 |
amit.gupta |
71 |
import org.apache.commons.lang.StringUtils;
|
|
|
72 |
|
| 8014 |
amit.gupta |
73 |
import com.google.gson.Gson;
|
|
|
74 |
import com.google.gson.reflect.TypeToken;
|
|
|
75 |
|
| 457 |
rajveer |
76 |
/*
|
| 7997 |
amit.gupta |
77 |
* @author rajveer
|
| 457 |
rajveer |
78 |
*
|
|
|
79 |
*
|
|
|
80 |
*/
|
|
|
81 |
|
|
|
82 |
public class ContentMigrator {
|
|
|
83 |
private String sourceDbPath;
|
|
|
84 |
private String destinationDbPath;
|
| 4964 |
amit.gupta |
85 |
|
| 457 |
rajveer |
86 |
public static void main(String[] args) throws Exception {
|
|
|
87 |
String usage = "Usage: ContentMigrator {source db path}{destination db path}";
|
| 8749 |
amit.gupta |
88 |
|
| 4964 |
amit.gupta |
89 |
String sourceDbPath = null, destinationDbPath = null;
|
|
|
90 |
String dryRun = null;
|
|
|
91 |
// if(args.length < 2) {
|
|
|
92 |
// System.out.println(usage);
|
|
|
93 |
// System.exit(-1);
|
|
|
94 |
// }else{
|
|
|
95 |
// sourceDbPath = args[0];
|
|
|
96 |
// destinationDbPath = args[1];
|
|
|
97 |
// dryRun = args[2];
|
|
|
98 |
// }
|
|
|
99 |
//
|
| 7186 |
amit.gupta |
100 |
ContentMigrator contentmigrator = new ContentMigrator(sourceDbPath,destinationDbPath);
|
| 7590 |
amit.gupta |
101 |
/*List<Long> entityId = Arrays.asList(1001674l,1002575l,1005331l,1005165l,1005164l,1005111l,1005109l,1004952l,1004940l,1004871l,1004701l,1004429l,1004197l,1006174l,1006077l,1005901l,1005757l,1005754l,1005724l,1005704l,1005598l,1005576l,1005558l,1007394l,1007230l,1007226l,1007218l,1007089l,1006925l,1006822l,1006814l,1006175l);
|
| 7507 |
amit.gupta |
102 |
for (Long eId : entityId){
|
| 7590 |
amit.gupta |
103 |
}*/
|
| 8262 |
amit.gupta |
104 |
//contentmigrator.reorderPhones();
|
| 8014 |
amit.gupta |
105 |
//System.out.println(contentmigrator.getItems().size());
|
| 8268 |
amit.gupta |
106 |
/*contentmigrator.touchEntityState(1008423l);
|
| 8262 |
amit.gupta |
107 |
contentmigrator.touchEntityState(1008424l);
|
|
|
108 |
contentmigrator.touchEntityState(1008427l);
|
| 8268 |
amit.gupta |
109 |
contentmigrator.touchEntityState(1008428l);*/
|
| 4964 |
amit.gupta |
110 |
|
| 8749 |
amit.gupta |
111 |
contentmigrator.migrateToMongo();
|
| 4964 |
amit.gupta |
112 |
}
|
| 7398 |
amit.gupta |
113 |
|
| 8749 |
amit.gupta |
114 |
private void migrateToMongo() throws Exception{
|
|
|
115 |
Map<String,Map<String,String>> m = CreationUtils1.getSynonyms();
|
|
|
116 |
CreationUtils.storeSynonyms(m);
|
|
|
117 |
|
|
|
118 |
Map<Long, Entity> entities= CreationUtils1.getEntities();
|
|
|
119 |
for(Map.Entry<Long, Entity> e : entities.entrySet()){
|
|
|
120 |
StorageManager.getStorageManager().updateEntity(e.getValue());
|
|
|
121 |
}
|
|
|
122 |
//StorageManager.getStorageManager().updateEntity(entity);
|
|
|
123 |
Map<Long,EntityState> entityStates = CreationUtils1.getEntitiesState();
|
|
|
124 |
for(Map.Entry<Long, EntityState> e : entityStates.entrySet()){
|
|
|
125 |
StorageManager.getStorageManager().updateEntityMetadata(e.getValue());
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
Map<Long,Helpdoc> helpdocs = CreationUtils1.getHelpdocs();
|
|
|
129 |
for(Map.Entry<Long, Helpdoc> h : helpdocs.entrySet()){
|
|
|
130 |
StorageManager.getStorageManager().updateHelpdoc(h.getValue());
|
|
|
131 |
}
|
|
|
132 |
|
|
|
133 |
Map<Long,SpecialPage> specialPages = CreationUtils1.getSpecialPages();
|
|
|
134 |
for(Map.Entry<Long, SpecialPage> specialPage : specialPages.entrySet()){
|
|
|
135 |
StorageManager.getStorageManager().updateSpecialPage(specialPage.getValue());
|
|
|
136 |
}
|
|
|
137 |
|
|
|
138 |
Collection<Entity> entities2 = CreationUtils1.getEntities(10006);
|
|
|
139 |
for(Entity e : entities2) {
|
|
|
140 |
Map<Long,Double> slideCmpScores = CreationUtils1.getCustomSlideComparisonScores(e.getID());
|
|
|
141 |
if(slideCmpScores!=null){
|
|
|
142 |
StorageManager.getStorageManager().storeCustomSlideScores(e.getID(), slideCmpScores);
|
|
|
143 |
}
|
|
|
144 |
}
|
|
|
145 |
|
|
|
146 |
Long time = CreationUtils1.getLastContentGenerationTime();
|
|
|
147 |
StorageManager.getStorageManager().storeDataObject("CONTENT_GENERATION_TIME", time);
|
|
|
148 |
//System.out.println(StorageManager.getStorageManager().getDataObject("CONTENT_GENERATION_TIME", Long.class));
|
|
|
149 |
|
|
|
150 |
Map<Long,Map<Long,Double>> scores = CreationUtils1.getSlideScores();
|
|
|
151 |
StorageManager.getStorageManager().storeDataObject("SLIDE_SCORES", scores);
|
|
|
152 |
|
|
|
153 |
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("IST"));
|
|
|
154 |
List<String> searchTerms=null;
|
|
|
155 |
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
156 |
int i=1;
|
|
|
157 |
while(i<=30){
|
|
|
158 |
i++;
|
|
|
159 |
cal.add(Calendar.DATE, -1);
|
|
|
160 |
String date = sdf.format(cal.getTime());
|
|
|
161 |
try {
|
|
|
162 |
searchTerms = CreationUtils1.getSearchStats(sdf.format(cal.getTime()));
|
|
|
163 |
if(searchTerms != null){
|
|
|
164 |
CreationUtils.storeSearchStats(date, searchTerms);
|
|
|
165 |
} else continue;
|
|
|
166 |
} catch (Exception e) {
|
|
|
167 |
// TODO Auto-generated catch block
|
|
|
168 |
e.printStackTrace();
|
|
|
169 |
continue;
|
|
|
170 |
}
|
|
|
171 |
}
|
|
|
172 |
|
|
|
173 |
Iterator<ExpertReviewSource> sources = CreationUtils1.getExpertReviewSources().iterator();
|
|
|
174 |
while(sources.hasNext()){
|
|
|
175 |
CreationUtils.addExpertReviewSource(sources.next());
|
|
|
176 |
}
|
|
|
177 |
|
|
|
178 |
for (Map.Entry<Long, List<ExpertReview>> entry : CreationUtils1.getExpertReviews().entrySet()){
|
|
|
179 |
CreationUtils.storeExpertReview(entry.getKey(), entry.getValue());
|
|
|
180 |
}
|
|
|
181 |
|
|
|
182 |
Map<Long, List<ExpandedBullet>> learnedBullets = CreationUtils1.getLearnedBullets();
|
|
|
183 |
CreationUtils.storeLearnedBullets(learnedBullets);
|
|
|
184 |
|
|
|
185 |
Map<Long, Map<Long, List<Long>>> relatedAccessories = CreationUtils1.getRelatedAccessories();
|
|
|
186 |
CreationUtils.storeRelatedAccessories(relatedAccessories);
|
|
|
187 |
}
|
|
|
188 |
|
|
|
189 |
private void migrateContentStore() throws Exception {
|
|
|
190 |
for (Map.Entry<Long, Entity> entry :CreationUtils.getEntities().entrySet()){
|
|
|
191 |
Entity e = entry.getValue();
|
|
|
192 |
Iterator<Slide> it = e.getSlides().iterator();
|
|
|
193 |
while(it.hasNext()){
|
|
|
194 |
Slide sl = it.next();
|
|
|
195 |
//sl.getFreeformContent().me
|
|
|
196 |
}
|
|
|
197 |
}
|
|
|
198 |
|
|
|
199 |
}
|
|
|
200 |
|
| 7590 |
amit.gupta |
201 |
private void updateSources() throws Exception{
|
|
|
202 |
Map<Long,List<ExpertReview>> erMap = CreationUtils.getExpertReviews();
|
|
|
203 |
for(Map.Entry<Long, List<ExpertReview>> erEntry : erMap.entrySet()){
|
|
|
204 |
List<ExpertReview> erList = erEntry.getValue();
|
|
|
205 |
Iterator<ExpertReview> iter = erList.iterator();
|
|
|
206 |
while (iter.hasNext()){
|
|
|
207 |
ExpertReview er = iter.next();
|
|
|
208 |
if (er.getSource().equals("iGyan")){
|
|
|
209 |
er.setSource("iGyaan");
|
|
|
210 |
System.out.println("changed to iGyaan in entity : " + erEntry.getKey());
|
|
|
211 |
}else if(er.getSource().equals("TheMobileIndian")){
|
|
|
212 |
er.setSource("The Mobile Indian");
|
|
|
213 |
System.out.println("changed to The Mobile Indian in entity : " + erEntry.getKey());
|
|
|
214 |
}
|
|
|
215 |
}
|
|
|
216 |
CreationUtils.storeExpertReview(erEntry.getKey(), erList);
|
|
|
217 |
}
|
|
|
218 |
}
|
| 7507 |
amit.gupta |
219 |
private void touchEntityState(Long eId) throws Exception {
|
|
|
220 |
EntityState es = CreationUtils.getEntityState(eId);
|
|
|
221 |
es.setMerkedReadyOn(new Date());
|
|
|
222 |
CreationUtils.updateEntityState(es);
|
| 8510 |
amit.gupta |
223 |
//System.out.println("Entity touched:" + eId);
|
| 7507 |
amit.gupta |
224 |
}
|
| 7398 |
amit.gupta |
225 |
private void updateModelForBBQ10() throws Exception{
|
|
|
226 |
Long entityId = 1007315l;
|
|
|
227 |
EntityState e1 = CreationUtils.getEntityState(entityId);
|
|
|
228 |
Entity e2 = CreationUtils.getEntity(entityId);
|
| 7403 |
amit.gupta |
229 |
e1.setModelName("Blackkberry Q10");
|
|
|
230 |
e2.setModelName("Blackberry Q10");
|
| 7398 |
amit.gupta |
231 |
CreationUtils.updateEntity(e2);
|
|
|
232 |
CreationUtils.updateEntityState(e1);
|
|
|
233 |
}
|
| 4964 |
amit.gupta |
234 |
|
| 5671 |
amit.gupta |
235 |
private void migrateWarrantyForCategory(Long catgoryId) throws Exception {
|
|
|
236 |
Collection<Entity> entities = CreationUtils.getEntities(catgoryId);
|
|
|
237 |
int count = 0;
|
|
|
238 |
for (Entity entity : entities) {
|
|
|
239 |
Slide slide = entity.getSlide(130054l);
|
|
|
240 |
if(slide!=null){
|
|
|
241 |
List<Slide> childrenSlide = slide.getChildrenSlides();
|
| 5672 |
amit.gupta |
242 |
if(childrenSlide != null){
|
|
|
243 |
Iterator<Slide> it = childrenSlide.iterator();
|
|
|
244 |
while (it.hasNext()){
|
|
|
245 |
Slide sl = it.next();
|
|
|
246 |
if (130105l == sl.getSlideDefinitionID()){
|
|
|
247 |
it.remove();
|
|
|
248 |
System.out.println("Removed warranty slide from entity:" + entity.getID());
|
|
|
249 |
break;
|
|
|
250 |
}
|
| 5671 |
amit.gupta |
251 |
}
|
| 5672 |
amit.gupta |
252 |
CreationUtils.updateEntity(entity);
|
| 5671 |
amit.gupta |
253 |
}
|
|
|
254 |
}
|
|
|
255 |
}
|
|
|
256 |
}
|
|
|
257 |
|
|
|
258 |
private void checkYouTube() throws Exception {
|
|
|
259 |
// TODO Auto-generated method stub
|
|
|
260 |
Collection<Entity> entities = CreationUtils.getEntities().values();
|
|
|
261 |
//entities = (List<Entity>)this.clone(entities);
|
|
|
262 |
for (Entity entity : entities) {
|
|
|
263 |
long entityId = entity.getID();
|
|
|
264 |
try {
|
|
|
265 |
List<Slide> entitySlides = entity.getSlides();
|
|
|
266 |
if (entity == null || entitySlides == null) {
|
|
|
267 |
continue;
|
|
|
268 |
}
|
|
|
269 |
Slide summarySlide = null;
|
|
|
270 |
FreeformContent ffc = null;
|
|
|
271 |
|
|
|
272 |
List<Slide> newEntitySlides = new ArrayList<Slide>();
|
|
|
273 |
Slide connectivitySlide = new Slide(130129);
|
|
|
274 |
Slide looknfeelSlide = new Slide(130128);
|
|
|
275 |
for (Slide slide : entitySlides) {
|
|
|
276 |
ffc = slide.getFreeformContent();
|
|
|
277 |
if(ffc != null){
|
|
|
278 |
Map<String, Media> mediaMap = ffc.getMedias();
|
|
|
279 |
if(mediaMap!=null){
|
|
|
280 |
for(Media media : mediaMap.values()){
|
|
|
281 |
if(media.getType().equals(Type.VIDEO_WITHOUT_SKIN) || media.getType().equals(Type.VIDEO_WITH_SKIN)){
|
|
|
282 |
if(media.getYoutubeId().contains("&"))
|
|
|
283 |
System.out.println(entityId + " : " + media.getLabel() + ":" + media.getYoutubeId());
|
|
|
284 |
}
|
|
|
285 |
}
|
|
|
286 |
}
|
|
|
287 |
}
|
|
|
288 |
}
|
|
|
289 |
|
|
|
290 |
}catch(Exception e){
|
|
|
291 |
System.out.println("Could not migrate " + entityId);
|
|
|
292 |
}
|
|
|
293 |
}
|
|
|
294 |
|
|
|
295 |
|
|
|
296 |
}
|
|
|
297 |
|
| 4964 |
amit.gupta |
298 |
private void renameTitles() throws Exception {
|
|
|
299 |
Map<Long, Entity> map = CreationUtils.getEntities();
|
|
|
300 |
for (Long entityId : map.keySet()) {
|
|
|
301 |
Entity entity = map.get(entityId);
|
|
|
302 |
if (entity == null || entity.getSlides() == null) {
|
|
|
303 |
continue;
|
| 1314 |
rajveer |
304 |
}
|
| 4964 |
amit.gupta |
305 |
Slide summarySlide = entity.getSlide(130054);
|
|
|
306 |
if(summarySlide != null){
|
| 5760 |
amit.gupta |
307 |
boolean isupdated = false;
|
| 4964 |
amit.gupta |
308 |
for(Feature f : summarySlide.getFeatures()){
|
| 5760 |
amit.gupta |
309 |
if(f.getFeatureDefinitionID()==120132l){
|
|
|
310 |
if(f.getBullets() == null){
|
|
|
311 |
f.setBullets(new ArrayList<Bullet>());
|
|
|
312 |
}else {
|
|
|
313 |
f.getBullets().clear();
|
| 4964 |
amit.gupta |
314 |
}
|
| 5760 |
amit.gupta |
315 |
Bullet titleBullet = new Bullet(new PrimitiveDataObject(getTitle(entity)));
|
|
|
316 |
f.getBullets().add(titleBullet);
|
|
|
317 |
isupdated = true;
|
| 4964 |
amit.gupta |
318 |
continue;
|
|
|
319 |
}
|
| 5760 |
amit.gupta |
320 |
if(f.getFeatureDefinitionID()==120133l){
|
|
|
321 |
if(f.getBullets() == null){
|
|
|
322 |
f.setBullets(new ArrayList<Bullet>());
|
|
|
323 |
}else {
|
|
|
324 |
f.getBullets().clear();
|
|
|
325 |
}
|
|
|
326 |
Bullet metaDescBullet = new Bullet(new PrimitiveDataObject(getMetaDescription(new ExpandedEntity(entity))));
|
|
|
327 |
f.getBullets().add(metaDescBullet);
|
|
|
328 |
isupdated = true;
|
|
|
329 |
continue;
|
|
|
330 |
}
|
| 4964 |
amit.gupta |
331 |
}
|
| 5760 |
amit.gupta |
332 |
if(isupdated){
|
|
|
333 |
CreationUtils.updateEntity(entity);
|
|
|
334 |
System.out.println("Updated entity : " + entity.getID());
|
|
|
335 |
}
|
| 4964 |
amit.gupta |
336 |
}
|
| 1314 |
rajveer |
337 |
}
|
| 457 |
rajveer |
338 |
}
|
|
|
339 |
|
| 4818 |
amit.gupta |
340 |
private void migrateNetwork() throws Exception {
|
|
|
341 |
Map<Long, Entity> map = CreationUtils.getEntities();
|
| 4964 |
amit.gupta |
342 |
for (Long entityId : map.keySet()) {
|
|
|
343 |
Entity entity = map.get(entityId);
|
|
|
344 |
if (entity == null || entity.getSlides() == null) {
|
|
|
345 |
continue;
|
|
|
346 |
}
|
| 4818 |
amit.gupta |
347 |
|
| 4964 |
amit.gupta |
348 |
for (Slide slide : entity.getSlides()) {
|
| 5281 |
amit.gupta |
349 |
if (slide.getSlideDefinitionID() == 130095) {
|
|
|
350 |
List<Slide> slides = slide.getChildrenSlides();
|
|
|
351 |
for(Slide slide1 : slides){
|
|
|
352 |
if(slide1.getSlideDefinitionID() == 130096){
|
|
|
353 |
List<Feature> features = slide1.getFeatures();
|
|
|
354 |
for (Feature f : features) {
|
|
|
355 |
if (f.getFeatureDefinitionID() == 120175) {
|
|
|
356 |
List<Bullet> bs = f.getBullets();
|
|
|
357 |
for (Bullet b : bs) {
|
|
|
358 |
Long enumValueId = ((EnumDataObject) b
|
|
|
359 |
.getDataObject()).getEnumValueID();
|
|
|
360 |
String value = Catalog.getInstance().getDefinitionsContainer().getEnumValue(enumValueId).getValue();
|
|
|
361 |
if (value.trim().equals("")) {
|
|
|
362 |
continue;
|
|
|
363 |
}
|
|
|
364 |
System.out.println(value);
|
|
|
365 |
|
|
|
366 |
}
|
| 4964 |
amit.gupta |
367 |
}
|
|
|
368 |
}
|
|
|
369 |
}
|
|
|
370 |
}
|
|
|
371 |
}
|
|
|
372 |
|
|
|
373 |
}
|
|
|
374 |
|
|
|
375 |
CreationUtils.updateEntity(entity);
|
|
|
376 |
}
|
| 4818 |
amit.gupta |
377 |
}
|
| 5370 |
amit.gupta |
378 |
private void migrateHeadSet() throws Exception {
|
|
|
379 |
|
|
|
380 |
//Starting entity id for new Category with 10000
|
|
|
381 |
long newCounter = 77777000;
|
|
|
382 |
Collection<Entity> entities = CreationUtils.getEntities(10015);
|
|
|
383 |
|
|
|
384 |
//entities = (List<Entity>)this.clone(entities);
|
|
|
385 |
for (Entity entity : entities) {
|
|
|
386 |
long entityId = entity.getID();
|
|
|
387 |
try {
|
|
|
388 |
List<Slide> entitySlides = entity.getSlides();
|
|
|
389 |
if (entity == null || entitySlides == null) {
|
|
|
390 |
continue;
|
|
|
391 |
}
|
|
|
392 |
Slide summarySlide = null;
|
|
|
393 |
FreeformContent ffc = null;
|
|
|
394 |
|
|
|
395 |
List<Slide> newEntitySlides = new ArrayList<Slide>();
|
|
|
396 |
Slide connectivitySlide = new Slide(130129);
|
|
|
397 |
Slide looknfeelSlide = new Slide(130128);
|
|
|
398 |
for (Slide slide : entitySlides) {
|
|
|
399 |
slide=(Slide)this.clone(slide);
|
|
|
400 |
if (slide.getSlideDefinitionID() == 130068) {
|
|
|
401 |
List<Feature> connectivityFeatures = new ArrayList<Feature>();
|
|
|
402 |
List<Feature> looknfeelFeatures = new ArrayList<Feature>();
|
|
|
403 |
List<Feature> features = slide.getFeatures();
|
|
|
404 |
for (Feature f : features) {
|
|
|
405 |
if (f.getFeatureDefinitionID() == 120105) {
|
|
|
406 |
connectivityFeatures.add(f);
|
|
|
407 |
}
|
|
|
408 |
if (f.getFeatureDefinitionID() == 120106) {
|
|
|
409 |
looknfeelFeatures.add(f);
|
|
|
410 |
}
|
|
|
411 |
}
|
|
|
412 |
ffc = slide.getFreeformContent();
|
|
|
413 |
if(ffc != null){
|
|
|
414 |
Map<String, Media> mediaMap = ffc.getMedias();
|
|
|
415 |
if(mediaMap!=null){
|
|
|
416 |
for(Media media : mediaMap.values()){
|
|
|
417 |
if(media.getType().equals(Type.IMAGE) || media.getType().equals(Type.DOCUMENT)){
|
|
|
418 |
copyMedia(String.valueOf(newCounter), String.valueOf(entityId),media);
|
|
|
419 |
}
|
|
|
420 |
}
|
|
|
421 |
}
|
|
|
422 |
}
|
|
|
423 |
connectivitySlide.setFeatures(connectivityFeatures);
|
|
|
424 |
looknfeelSlide.setFeatures(looknfeelFeatures);
|
|
|
425 |
looknfeelSlide.setFreeformContent(ffc);
|
|
|
426 |
}
|
|
|
427 |
//Summary slide
|
|
|
428 |
if(slide.getSlideDefinitionID() == 130054) {
|
|
|
429 |
summarySlide = slide;
|
|
|
430 |
FreeformContent ffc1 = slide.getFreeformContent();
|
|
|
431 |
if(ffc1 != null){
|
|
|
432 |
Map<String, Media> mediaMap = ffc1.getMedias();
|
|
|
433 |
if(mediaMap==null){
|
|
|
434 |
continue;
|
|
|
435 |
}
|
|
|
436 |
for(Media media : mediaMap.values()){
|
|
|
437 |
if(media.getType().equals(Type.IMAGE) || media.getType().equals(Type.DOCUMENT)){
|
|
|
438 |
copyMedia(String.valueOf(newCounter), String.valueOf(entityId),media);
|
|
|
439 |
}
|
|
|
440 |
}
|
|
|
441 |
}
|
|
|
442 |
}
|
|
|
443 |
|
|
|
444 |
}
|
|
|
445 |
|
|
|
446 |
Entity newEntity = new Entity(newCounter, 10099);
|
| 5374 |
amit.gupta |
447 |
List<Long> newSlideSequence = new ArrayList<Long>();
|
|
|
448 |
newSlideSequence.add(130128L);
|
|
|
449 |
newSlideSequence.add(130129L);
|
|
|
450 |
newSlideSequence.add(130054L);
|
|
|
451 |
newEntity.setSlideSequence(newSlideSequence);
|
| 5370 |
amit.gupta |
452 |
newEntity.setBrand(entity.getBrand());
|
|
|
453 |
newEntity.setModelName(entity.getModelName());
|
|
|
454 |
newEntity.setModelNumber(entity.getModelNumber());
|
|
|
455 |
//entitySlides.remove(featureSlide);
|
|
|
456 |
newEntitySlides.add(connectivitySlide);
|
|
|
457 |
newEntitySlides.add(looknfeelSlide);
|
|
|
458 |
newEntitySlides.add(summarySlide);
|
|
|
459 |
newEntity.setSlides(newEntitySlides);
|
|
|
460 |
EntityState es = new EntityState(newCounter, 10099, "admin");
|
|
|
461 |
es.setBrand(entity.getBrand());
|
|
|
462 |
es.setModelName(entity.getModelName());
|
|
|
463 |
es.setModelNumber(entity.getModelNumber());
|
|
|
464 |
CreationUtils.createEntity(newEntity, es);
|
|
|
465 |
System.out.println("New entity : " + newCounter + " created using : " + entityId);
|
|
|
466 |
System.out.println(CreationUtils.getEntity(newCounter));
|
|
|
467 |
newCounter++;
|
|
|
468 |
}catch(Exception e){
|
|
|
469 |
System.out.println("Could not migrate " + entityId);
|
|
|
470 |
}
|
|
|
471 |
}
|
|
|
472 |
|
|
|
473 |
}
|
| 4818 |
amit.gupta |
474 |
|
|
|
475 |
private long getEnumValueForNetwork(String value, Long entityLong) {
|
|
|
476 |
value = value.toLowerCase().replaceAll(" ", "");
|
|
|
477 |
Map<String, Long> map = new HashMap<String, Long>();
|
| 4964 |
amit.gupta |
478 |
map.put("quadband(gsm850/900/1800/1900)", 110382L);
|
| 4818 |
amit.gupta |
479 |
map.put("quadband(gsm850/900/1800/1900)-sim1", 110383l);
|
|
|
480 |
map.put("quadband(gsm850/900/1800/1900)-sim2", 110384l);
|
|
|
481 |
map.put("triband(gsm900/1800/1900)", 110385l);
|
|
|
482 |
map.put("triband(gsm900/1800/1900)-sim1", 110386l);
|
|
|
483 |
map.put("triband(gsm900/1800/1900)-sim2", 110387l);
|
|
|
484 |
map.put("dualband(gsm900/1800)", 110388l);
|
|
|
485 |
map.put("dualband(gsm900/1800)-sim1", 110389l);
|
|
|
486 |
map.put("dualband(gsm900/1800)-sim2", 110390l);
|
| 4964 |
amit.gupta |
487 |
map.put("cdma800", 110391l); // CDMA 800
|
|
|
488 |
map.put("cdma800-sim2", 110392l); // CDMA 800-SIM 2
|
|
|
489 |
map.put("cdma800-sim3", 110393l); // CDMA 800-SIM 3
|
|
|
490 |
|
|
|
491 |
if (!StringUtils.contains(value, "sim")
|
|
|
492 |
&& StringUtils.contains(value, "850/900/1800/1900")) {
|
| 4818 |
amit.gupta |
493 |
return map.get("quadband(gsm850/900/1800/1900)");
|
|
|
494 |
}
|
| 4964 |
amit.gupta |
495 |
if (StringUtils.contains(value, "sim1")
|
|
|
496 |
&& StringUtils.contains(value, "850/900/1800/1900")) {
|
| 4818 |
amit.gupta |
497 |
return map.get("quadband(gsm850/900/1800/1900)-sim1");
|
|
|
498 |
}
|
| 4964 |
amit.gupta |
499 |
if (StringUtils.contains(value, "sim2")
|
|
|
500 |
&& StringUtils.contains(value, "850/900/1800/1900")) {
|
| 4818 |
amit.gupta |
501 |
return map.get("quadband(gsm850/900/1800/1900)-sim2");
|
|
|
502 |
}
|
| 4964 |
amit.gupta |
503 |
if (!StringUtils.contains(value, "sim")
|
|
|
504 |
&& StringUtils.contains(value, "900/1800/1900")) {
|
| 4818 |
amit.gupta |
505 |
return map.get("triband(gsm900/1800/1900)");
|
|
|
506 |
}
|
| 4964 |
amit.gupta |
507 |
if (StringUtils.contains(value, "sim1")
|
|
|
508 |
&& StringUtils.contains(value, "900/1800/1900")) {
|
| 4818 |
amit.gupta |
509 |
return map.get("triband(gsm900/1800/1900)-sim1");
|
|
|
510 |
}
|
| 4964 |
amit.gupta |
511 |
if (StringUtils.contains(value, "sim2")
|
|
|
512 |
&& StringUtils.contains(value, "900/1800/1900")) {
|
| 4818 |
amit.gupta |
513 |
return map.get("triband(gsm900/1800/1900)-sim2");
|
|
|
514 |
}
|
| 4964 |
amit.gupta |
515 |
if (!StringUtils.contains(value, "sim")
|
|
|
516 |
&& StringUtils.contains(value, "900/1800")) {
|
| 4818 |
amit.gupta |
517 |
return map.get("dualband(gsm900/1800)");
|
|
|
518 |
}
|
| 4964 |
amit.gupta |
519 |
if (StringUtils.contains(value, "sim1")
|
|
|
520 |
&& StringUtils.contains(value, "900/1800")) {
|
| 4818 |
amit.gupta |
521 |
return map.get("dualband(gsm900/1800)-sim1");
|
|
|
522 |
}
|
| 4964 |
amit.gupta |
523 |
if (StringUtils.contains(value, "sim2")
|
|
|
524 |
&& StringUtils.contains(value, "900/1800")) {
|
| 4818 |
amit.gupta |
525 |
return map.get("dualband(gsm900/1800)-sim2");
|
|
|
526 |
}
|
| 4964 |
amit.gupta |
527 |
if (StringUtils.contains(value, "cdma")) {
|
|
|
528 |
if (StringUtils.contains(value, "sim2")) {
|
| 4818 |
amit.gupta |
529 |
return map.get("cdma800-sim2");
|
|
|
530 |
}
|
| 4964 |
amit.gupta |
531 |
if (StringUtils.contains(value, "sim3")) {
|
| 4818 |
amit.gupta |
532 |
return map.get("cdma800-sim3");
|
|
|
533 |
}
|
|
|
534 |
return map.get("cdma800");
|
| 4964 |
amit.gupta |
535 |
} else {
|
|
|
536 |
System.out.println("Unknown networks: " + value + " : "
|
|
|
537 |
+ entityLong);
|
| 4818 |
amit.gupta |
538 |
return 0;
|
|
|
539 |
}
|
|
|
540 |
}
|
|
|
541 |
|
| 457 |
rajveer |
542 |
public ContentMigrator(String sourceDbPath, String destinationDbPath) {
|
| 4964 |
amit.gupta |
543 |
this.sourceDbPath = sourceDbPath;
|
| 457 |
rajveer |
544 |
this.destinationDbPath = destinationDbPath;
|
|
|
545 |
}
|
| 2720 |
mandeep.dh |
546 |
|
| 3873 |
mandeep.dh |
547 |
public void migrateWarrantyType() throws Exception {
|
| 4964 |
amit.gupta |
548 |
Map<Long, Entity> map = CreationUtils.getEntities();
|
|
|
549 |
for (Long entityId : map.keySet()) {
|
|
|
550 |
Entity entity = map.get(entityId);
|
|
|
551 |
if (entity == null || entity.getSlides() == null) {
|
|
|
552 |
continue;
|
|
|
553 |
}
|
|
|
554 |
for (Slide slide : entity.getSlides()) {
|
|
|
555 |
if (slide.getSlideDefinitionID() == 130054) {
|
|
|
556 |
Slide warrantySlide = new Slide(130105);
|
|
|
557 |
warrantySlide.setFeatures(new ArrayList<Feature>());
|
| 3873 |
mandeep.dh |
558 |
|
| 4964 |
amit.gupta |
559 |
Feature feature = new Feature(120219);
|
|
|
560 |
feature.setBullets(Collections.singletonList(new Bullet(
|
|
|
561 |
new EnumDataObject(110299))));
|
|
|
562 |
warrantySlide.getFeatures().add(feature);
|
| 3873 |
mandeep.dh |
563 |
|
| 4964 |
amit.gupta |
564 |
Feature existingWarrantyFeature = null;
|
|
|
565 |
for (Feature summaryFeature : slide.getFeatures()) {
|
|
|
566 |
if (summaryFeature.getFeatureDefinitionID() == 120125) {
|
|
|
567 |
existingWarrantyFeature = summaryFeature;
|
|
|
568 |
warrantySlide.getFeatures().add(summaryFeature);
|
|
|
569 |
break;
|
|
|
570 |
}
|
|
|
571 |
}
|
| 3873 |
mandeep.dh |
572 |
|
| 4964 |
amit.gupta |
573 |
slide.getFeatures().remove(existingWarrantyFeature);
|
|
|
574 |
slide.addChild(warrantySlide);
|
|
|
575 |
break;
|
|
|
576 |
}
|
|
|
577 |
|
|
|
578 |
}
|
|
|
579 |
|
|
|
580 |
CreationUtils.updateEntity(entity);
|
|
|
581 |
}
|
| 3873 |
mandeep.dh |
582 |
}
|
|
|
583 |
|
| 2720 |
mandeep.dh |
584 |
public void migrateMedia() throws Exception {
|
| 4964 |
amit.gupta |
585 |
Map<Long, Entity> map = CreationUtils.getEntities();
|
|
|
586 |
for (Long entityId : map.keySet()) {
|
|
|
587 |
Entity entity = map.get(entityId);
|
|
|
588 |
if (entity == null || entity.getSlides() == null) {
|
|
|
589 |
continue;
|
|
|
590 |
}
|
|
|
591 |
for (Slide slide : entity.getSlides()) {
|
|
|
592 |
FreeformContent ffc = slide.getFreeformContent();
|
| 2720 |
mandeep.dh |
593 |
|
| 4964 |
amit.gupta |
594 |
// if (ffc == null || ffc.getMediasNew() == null) {
|
|
|
595 |
// continue;
|
|
|
596 |
// }
|
|
|
597 |
//
|
|
|
598 |
// Map<String, Media> newMap = new LinkedHashMap<String,
|
|
|
599 |
// Media>();
|
|
|
600 |
// Media media = null;
|
|
|
601 |
// for (String label : ffc.getMediasNew().keySet()) {
|
|
|
602 |
// MediaNew m = ffc.getMediasNew().get(label);
|
|
|
603 |
// media = new Media(m.getLabel(), Media.Type.valueOf(m
|
|
|
604 |
// .getType().name()), m.getLocation());
|
|
|
605 |
// media.setTitle(m.getTitle());
|
|
|
606 |
// media.setFileName(m.getFileName());
|
|
|
607 |
// newMap.put(label, media);
|
|
|
608 |
// }
|
|
|
609 |
// ffc.setMedias(newMap);
|
|
|
610 |
// ffc.setMediasNew(null);
|
| 2720 |
mandeep.dh |
611 |
|
| 4964 |
amit.gupta |
612 |
// if (ffc == null || ffc.getMedias() == null) {
|
|
|
613 |
// continue;
|
|
|
614 |
// }
|
|
|
615 |
// Map<String, MediaNew> newMap = new LinkedHashMap<String,
|
|
|
616 |
// MediaNew>();
|
|
|
617 |
// MediaNew mediaNew = null;
|
|
|
618 |
// for (String label : ffc.getMedias().keySet()) {
|
|
|
619 |
// Media m = ffc.getMedias().get(label);
|
|
|
620 |
// if (m.getType().equalsIgnoreCase("image")) {
|
|
|
621 |
// mediaNew = new MediaNew(m.getLabel(),
|
|
|
622 |
// MediaNew.Type.IMAGE, m.getLocation());
|
|
|
623 |
// mediaNew.setFileName(m.getFileName());
|
|
|
624 |
// } else if (m.getType().equalsIgnoreCase("youtube")) {
|
|
|
625 |
// if (m.getVideoType().equalsIgnoreCase("withskin")) {
|
|
|
626 |
// mediaNew = new MediaNew(m.getLabel(),
|
|
|
627 |
// MediaNew.Type.VIDEO_WITH_SKIN,
|
|
|
628 |
// m.getLocation());
|
|
|
629 |
// } else {
|
|
|
630 |
// mediaNew = new MediaNew(m.getLabel(),
|
|
|
631 |
// MediaNew.Type.VIDEO_WITHOUT_SKIN,
|
|
|
632 |
// m.getLocation());
|
|
|
633 |
// }
|
|
|
634 |
// }
|
|
|
635 |
//
|
|
|
636 |
// if (mediaNew != null) {
|
|
|
637 |
// mediaNew.setTitle(m.getTitle());
|
|
|
638 |
// newMap.put(label, mediaNew);
|
|
|
639 |
// }
|
|
|
640 |
// }
|
|
|
641 |
// ffc.setMediasNew(newMap);
|
|
|
642 |
// ffc.setMedias(null);
|
|
|
643 |
}
|
|
|
644 |
}
|
| 2720 |
mandeep.dh |
645 |
}
|
|
|
646 |
|
| 4964 |
amit.gupta |
647 |
public boolean populateHelpdocEntityIds() throws Exception {
|
|
|
648 |
for (Entity entity : CreationUtils.getEntities().values()) {
|
| 2471 |
rajveer |
649 |
CreationUtils.updateEntity(entity);
|
|
|
650 |
}
|
|
|
651 |
return true;
|
|
|
652 |
}
|
| 2720 |
mandeep.dh |
653 |
|
| 4964 |
amit.gupta |
654 |
public boolean migrateBrandModel(String dryRun) throws Exception {
|
| 3127 |
rajveer |
655 |
CatalogClient catalogServiceClient = new CatalogClient();
|
| 2287 |
rajveer |
656 |
Client client = catalogServiceClient.getClient();
|
|
|
657 |
List<Item> items = client.getAllItemsByStatus(status.ACTIVE);
|
|
|
658 |
items.addAll(client.getAllItemsByStatus(status.PAUSED));
|
|
|
659 |
items.addAll(client.getAllItemsByStatus(status.CONTENT_COMPLETE));
|
|
|
660 |
Map<Long, Entity> entities = CreationUtils.getEntities();
|
|
|
661 |
long count = 0;
|
|
|
662 |
StringBuffer sb = new StringBuffer();
|
| 4964 |
amit.gupta |
663 |
for (Item item : items) {
|
| 2287 |
rajveer |
664 |
long entityId = item.getCatalogItemId();
|
|
|
665 |
Entity entity = entities.get(entityId);
|
| 4964 |
amit.gupta |
666 |
if (entity == null) {
|
| 2292 |
rajveer |
667 |
continue;
|
|
|
668 |
}
|
| 2294 |
rajveer |
669 |
String itemBrand = item.getBrand().trim();
|
| 2287 |
rajveer |
670 |
String itemModelName = item.getModelName();
|
| 4964 |
amit.gupta |
671 |
if (itemModelName != null) {
|
| 2294 |
rajveer |
672 |
itemModelName = itemModelName.trim();
|
|
|
673 |
}
|
|
|
674 |
String itemModelNumber = item.getModelNumber().trim();
|
|
|
675 |
String entityBrand = entity.getBrand().trim();
|
|
|
676 |
String entityModelName = entity.getModelName().trim();
|
| 4964 |
amit.gupta |
677 |
if (entityModelName != null) {
|
| 2294 |
rajveer |
678 |
entityModelName = entityModelName.trim();
|
|
|
679 |
}
|
|
|
680 |
String entityModelNumber = entity.getModelNumber().trim();
|
| 4964 |
amit.gupta |
681 |
|
|
|
682 |
if (itemBrand.equals(entityBrand)
|
|
|
683 |
&& itemModelNumber.equals(entityModelNumber)) {
|
|
|
684 |
if (itemModelName != null && entityModelName != null
|
|
|
685 |
&& itemModelName.equals(entityModelName)) {
|
| 2292 |
rajveer |
686 |
continue;
|
| 4964 |
amit.gupta |
687 |
} else if (itemModelName == null && entityModelName == null) {
|
|
|
688 |
continue;
|
| 2292 |
rajveer |
689 |
}
|
| 4964 |
amit.gupta |
690 |
|
| 2287 |
rajveer |
691 |
}
|
|
|
692 |
count++;
|
| 4964 |
amit.gupta |
693 |
sb.append(count + ") Item: " + itemBrand + "\t" + itemModelName
|
|
|
694 |
+ "\t" + itemModelNumber + "\t" + item.getId() + "\n");
|
|
|
695 |
sb.append(count + ") Entity: " + entityBrand + "\t"
|
|
|
696 |
+ entityModelName + "\t" + entityModelNumber + "\t"
|
|
|
697 |
+ entity.getID() + "\n");
|
|
|
698 |
|
|
|
699 |
if (dryRun.equals("false")) {
|
| 2294 |
rajveer |
700 |
item.setBrand(entityBrand);
|
|
|
701 |
item.setModelName(entityModelName);
|
|
|
702 |
item.setModelNumber(entityModelNumber);
|
| 4964 |
amit.gupta |
703 |
client.updateItem(item);
|
| 2287 |
rajveer |
704 |
}
|
|
|
705 |
}
|
|
|
706 |
System.out.println(sb.toString());
|
|
|
707 |
return true;
|
|
|
708 |
}
|
| 2720 |
mandeep.dh |
709 |
|
| 473 |
rajveer |
710 |
/**
|
| 4964 |
amit.gupta |
711 |
* this function will read source definition and source entities, and will
|
|
|
712 |
* convert source entities to destination entities according to destination
|
|
|
713 |
* definitions.
|
| 473 |
rajveer |
714 |
*
|
|
|
715 |
* @return boolean
|
| 4964 |
amit.gupta |
716 |
* @throws Exception
|
| 473 |
rajveer |
717 |
*/
|
| 1226 |
rajveer |
718 |
|
| 4964 |
amit.gupta |
719 |
public void printSlides() throws Exception {
|
|
|
720 |
DefinitionsContainer defc = Catalog.getInstance()
|
|
|
721 |
.getDefinitionsContainer();
|
|
|
722 |
for (Category category : defc.getCategories().values()) {
|
|
|
723 |
if (category.getChildrenCategory() != null)
|
|
|
724 |
continue;
|
|
|
725 |
System.out.println(category.getID() + "\t" + category.getLabel());
|
|
|
726 |
for (CategorySlideDefinition defs : defc
|
|
|
727 |
.getCategorySlideDefinitions(category.getID())) {
|
|
|
728 |
System.out.println(defs.getSlideDefintionID()
|
|
|
729 |
+ "\t"
|
|
|
730 |
+ defs.getEditorialImportance()
|
|
|
731 |
+ "\t"
|
|
|
732 |
+ defc.getSlideDefinition(defs.getSlideDefintionID())
|
|
|
733 |
.getLabel()
|
|
|
734 |
+ "\t"
|
|
|
735 |
+ defc.getSlideDefinition(defs.getSlideDefintionID())
|
|
|
736 |
.getChildrenSlideDefinitionIDs());
|
| 1226 |
rajveer |
737 |
}
|
|
|
738 |
}
|
|
|
739 |
}
|
| 4964 |
amit.gupta |
740 |
|
|
|
741 |
public void removeBrowserBullets() throws Exception {
|
|
|
742 |
Map<Long, List<ExpandedBullet>> learnedBullets = CreationUtils
|
|
|
743 |
.getLearnedBullets();
|
| 1226 |
rajveer |
744 |
learnedBullets.get(new Long(120076));
|
|
|
745 |
learnedBullets.remove(new Long(120076));
|
|
|
746 |
CreationUtils.storeLearnedBullets(learnedBullets);
|
| 4964 |
amit.gupta |
747 |
|
| 1226 |
rajveer |
748 |
}
|
| 4964 |
amit.gupta |
749 |
|
|
|
750 |
public boolean changeEntityState() throws Exception {
|
| 1226 |
rajveer |
751 |
Map<Long, EntityState> entitiesState = CreationUtils.getEntitiesState();
|
| 8548 |
amit.gupta |
752 |
Entity entity;
|
| 4964 |
amit.gupta |
753 |
for (Long entityId : entitiesState.keySet()) {
|
| 1226 |
rajveer |
754 |
EntityState state = entitiesState.get(entityId);
|
| 8548 |
amit.gupta |
755 |
entity = CreationUtils.getEntity(entityId);
|
|
|
756 |
if (state.getCategoryID() == 10006) {
|
|
|
757 |
//state.setCategoryID(10006);
|
|
|
758 |
entity.setCategoryID(10006);
|
|
|
759 |
//CreationUtils.updateEntityState(state);
|
|
|
760 |
CreationUtils.updateEntity(entity);
|
| 8510 |
amit.gupta |
761 |
touchEntityState(entityId);
|
| 1226 |
rajveer |
762 |
}
|
|
|
763 |
}
|
|
|
764 |
return true;
|
|
|
765 |
}
|
| 1739 |
rajveer |
766 |
|
| 4964 |
amit.gupta |
767 |
public boolean migrateDataBack() throws Exception {
|
| 1226 |
rajveer |
768 |
Map<Long, Entity> entities = CreationUtils.getEntities();
|
| 4964 |
amit.gupta |
769 |
for (Entity entity : entities.values()) {
|
|
|
770 |
if (entity == null) {
|
|
|
771 |
continue;
|
|
|
772 |
}
|
| 1226 |
rajveer |
773 |
List<Slide> slides = entity.getSlides();
|
| 4964 |
amit.gupta |
774 |
if (slides != null) {
|
|
|
775 |
for (Slide slide : slides) {
|
|
|
776 |
if (slide.getSlideDefinitionID() == 130054) {
|
|
|
777 |
List<Feature> features = slide.getFeatures();
|
|
|
778 |
int length = features.size();
|
|
|
779 |
features.remove(length - 1);
|
|
|
780 |
features.remove(length - 2);
|
|
|
781 |
features.remove(length - 3);
|
|
|
782 |
/*
|
|
|
783 |
* boolean a = false,b=false,c=false; for(Feature
|
|
|
784 |
* feature: features){ switch
|
|
|
785 |
* ((int)feature.getFeatureDefinitionID()) { case
|
|
|
786 |
* 120132: if(a){
|
|
|
787 |
*
|
|
|
788 |
* }else{ a=true; } break; case 120133: break; case
|
|
|
789 |
* 120134: break; default: break; } }
|
|
|
790 |
*/
|
|
|
791 |
CreationUtils.updateEntity(entity);
|
| 1226 |
rajveer |
792 |
}
|
|
|
793 |
}
|
|
|
794 |
}
|
|
|
795 |
}
|
| 4964 |
amit.gupta |
796 |
return true;
|
| 1226 |
rajveer |
797 |
}
|
| 4964 |
amit.gupta |
798 |
|
|
|
799 |
public boolean migrateData() throws Exception {
|
| 1226 |
rajveer |
800 |
Map<Long, Entity> entities = CreationUtils.getEntities();
|
| 4964 |
amit.gupta |
801 |
for (Entity entity : entities.values()) {
|
|
|
802 |
ExpandedEntity expEntity = new ExpandedEntity(entity);
|
| 1226 |
rajveer |
803 |
List<Slide> slides = entity.getSlides();
|
| 4964 |
amit.gupta |
804 |
if (slides != null) {
|
|
|
805 |
for (Slide slide : slides) {
|
|
|
806 |
if (slide.getSlideDefinitionID() == 130054) {
|
|
|
807 |
List<Feature> features = slide.getFeatures();
|
|
|
808 |
String title = expEntity.getBrand() + " "
|
|
|
809 |
+ expEntity.getModelName() + " "
|
|
|
810 |
+ expEntity.getModelNumber();
|
|
|
811 |
if (expEntity.getCategory().getParentCategory().getID() == 10001) {
|
|
|
812 |
title += " | " + expEntity.getBrand()
|
|
|
813 |
+ " Mobile Phones";
|
| 1226 |
rajveer |
814 |
}
|
| 4964 |
amit.gupta |
815 |
if (expEntity.getCategory().getParentCategory().getID() == 10011) {
|
|
|
816 |
title += " " + expEntity.getCategory().getLabel()
|
|
|
817 |
+ " | " + expEntity.getBrand()
|
|
|
818 |
+ " Mobile Phone Accessories";
|
| 1226 |
rajveer |
819 |
}
|
| 4964 |
amit.gupta |
820 |
title += " | Saholic.com";
|
|
|
821 |
|
|
|
822 |
// Add page title
|
|
|
823 |
Feature feature1 = new Feature(120132);
|
|
|
824 |
PrimitiveDataObject pdo1 = new PrimitiveDataObject(
|
|
|
825 |
title);
|
|
|
826 |
List<Bullet> bullets1 = new ArrayList<Bullet>();
|
|
|
827 |
Bullet bullet1 = new Bullet(pdo1);
|
|
|
828 |
bullets1.add(bullet1);
|
|
|
829 |
feature1.setBullets(bullets1);
|
|
|
830 |
features.add(feature1);
|
|
|
831 |
|
|
|
832 |
String description = "Best Price "
|
|
|
833 |
+ expEntity.getBrand() + " "
|
|
|
834 |
+ expEntity.getModelName() + " "
|
|
|
835 |
+ expEntity.getModelNumber() + " ";
|
|
|
836 |
|
|
|
837 |
if (expEntity.getCategory().getParentCategory().getID() == 10011) {
|
|
|
838 |
description += expEntity.getCategory().getLabel()
|
|
|
839 |
+ " in India.";
|
|
|
840 |
} else {
|
|
|
841 |
description += ".";
|
| 1226 |
rajveer |
842 |
}
|
| 4964 |
amit.gupta |
843 |
description += " Experience n' buy online. FREE Next Day delivery."
|
|
|
844 |
+ " Original product - Full manufacturer warranty. Comprehensive reviews.";
|
| 1226 |
rajveer |
845 |
|
| 4964 |
amit.gupta |
846 |
description = description.replaceAll("--", "-");
|
|
|
847 |
|
|
|
848 |
// Add meta description
|
|
|
849 |
Feature feature2 = new Feature(120133);
|
|
|
850 |
PrimitiveDataObject pdo2 = new PrimitiveDataObject(
|
|
|
851 |
description);
|
|
|
852 |
List<Bullet> bullets2 = new ArrayList<Bullet>();
|
|
|
853 |
Bullet bullet2 = new Bullet(pdo2);
|
|
|
854 |
bullets2.add(bullet2);
|
|
|
855 |
feature2.setBullets(bullets2);
|
|
|
856 |
|
|
|
857 |
features.add(feature2);
|
|
|
858 |
|
|
|
859 |
String keywords = expEntity.getBrand() + " "
|
|
|
860 |
+ expEntity.getModelName() + " "
|
|
|
861 |
+ expEntity.getModelNumber() + ", ";
|
|
|
862 |
if (expEntity.getCategory().getParentCategory().getID() == 10001) {
|
|
|
863 |
keywords += expEntity.getBrand()
|
|
|
864 |
+ " mobile phones, ";
|
| 1226 |
rajveer |
865 |
}
|
| 4964 |
amit.gupta |
866 |
if (expEntity.getCategory().getParentCategory().getID() == 10011) {
|
|
|
867 |
keywords += "phone accessories, ";
|
| 1226 |
rajveer |
868 |
}
|
| 4964 |
amit.gupta |
869 |
keywords += expEntity.getBrand() + " "
|
|
|
870 |
+ expEntity.getModelName() + " "
|
|
|
871 |
+ expEntity.getModelNumber() + " Price, ";
|
|
|
872 |
keywords += expEntity.getBrand() + " "
|
|
|
873 |
+ expEntity.getModelName() + " "
|
|
|
874 |
+ expEntity.getModelNumber() + " India, ";
|
|
|
875 |
if (expEntity.getCategory().getParentCategory().getID() == 10001) {
|
|
|
876 |
keywords += expEntity.getBrand() + " "
|
|
|
877 |
+ expEntity.getModelName() + " "
|
|
|
878 |
+ expEntity.getModelNumber() + " Review, ";
|
| 1226 |
rajveer |
879 |
}
|
| 4964 |
amit.gupta |
880 |
// Add meta keyborad
|
|
|
881 |
Feature feature3 = new Feature(120134);
|
|
|
882 |
PrimitiveDataObject pdo3 = new PrimitiveDataObject(
|
|
|
883 |
keywords);
|
|
|
884 |
List<Bullet> bullets3 = new ArrayList<Bullet>();
|
|
|
885 |
Bullet bullet3 = new Bullet(pdo3);
|
|
|
886 |
bullets3.add(bullet3);
|
|
|
887 |
feature3.setBullets(bullets3);
|
|
|
888 |
|
|
|
889 |
features.add(feature3);
|
|
|
890 |
|
|
|
891 |
CreationUtils.updateEntity(entity);
|
|
|
892 |
}
|
|
|
893 |
}
|
|
|
894 |
}
|
|
|
895 |
}
|
|
|
896 |
return true;
|
|
|
897 |
}
|
|
|
898 |
|
|
|
899 |
public boolean migrateModel2() throws Exception {
|
|
|
900 |
Map<Long, Entity> entities = CreationUtils.getEntities();
|
|
|
901 |
for (Entity entity : entities.values()) {
|
|
|
902 |
List<Slide> slides = entity.getSlides();
|
|
|
903 |
if (slides != null) {
|
|
|
904 |
for (Slide slide : slides) {
|
|
|
905 |
if (slide.getSlideDefinitionID() == 130011) {
|
|
|
906 |
for (Feature feature : slide.getFeatures()) {
|
|
|
907 |
if (feature.getFeatureDefinitionID() == 120054) {
|
|
|
908 |
// feature.setFeatureDefinitionID(120030);
|
|
|
909 |
System.out.println("* " + entity.getID() + ":"
|
|
|
910 |
+ entity.getCategoryID());
|
| 1226 |
rajveer |
911 |
}
|
|
|
912 |
}
|
| 4964 |
amit.gupta |
913 |
}
|
| 1226 |
rajveer |
914 |
|
| 4964 |
amit.gupta |
915 |
if (slide.getSlideDefinitionID() == 130029) {
|
|
|
916 |
// System.out.println("** " + entity.getID() + ":" +
|
|
|
917 |
// entity.getCategoryID());
|
|
|
918 |
if (entity.getCategoryID() == 10002) {
|
|
|
919 |
Feature feature = new Feature(120051);
|
|
|
920 |
slide.getFeatures().add(feature);
|
|
|
921 |
System.out.println("** " + entity.getID() + ":"
|
|
|
922 |
+ entity.getCategoryID());
|
| 1226 |
rajveer |
923 |
}
|
|
|
924 |
}
|
|
|
925 |
|
|
|
926 |
}
|
|
|
927 |
}
|
| 4964 |
amit.gupta |
928 |
CreationUtils.updateEntity(entity);
|
| 1226 |
rajveer |
929 |
}
|
|
|
930 |
return true;
|
|
|
931 |
}
|
| 4964 |
amit.gupta |
932 |
|
|
|
933 |
/*
|
|
|
934 |
* public boolean migrateModel1() throws Exception{ //DefinitionsContainer
|
|
|
935 |
* oldDfc = new DefinitionsContainer(Utils.CONTENT_DB_PATH +
|
|
|
936 |
* "olddefinitions" + File.separator); //DefinitionsContainer newDfc = new
|
|
|
937 |
* DefinitionsContainer(Utils.CONTENT_DB_PATH + "olddefinitions" +
|
|
|
938 |
* File.separator);
|
|
|
939 |
*
|
|
|
940 |
* Map<Long, Entity> entities = CreationUtils.getEntities(); for(Entity
|
|
|
941 |
* entity: entities.values()){ List<Long> slideSequence =
|
|
|
942 |
* entity.getSlideSequence(); Map<Long,Long> removeMap = new HashMap<Long,
|
|
|
943 |
* Long>(); List<Slide> slides = entity.getSlides(); if(slides!=null){
|
|
|
944 |
* for(Slide slide: slides){ List<Feature> features; Slide childSlide;
|
|
|
945 |
* switch ((int)slide.getSlideDefinitionID()) {
|
|
|
946 |
*
|
|
|
947 |
* //Keyboard case 130004: case 130026: case 130027: case 130057:
|
|
|
948 |
* removeMap.put(slide.getSlideDefinitionID(), (long)130026);
|
|
|
949 |
* slide.setSlideDefinitionID(130026); break;
|
|
|
950 |
*
|
|
|
951 |
* //Voice Calling case 130005: removeMap.put(slide.getSlideDefinitionID(),
|
|
|
952 |
* (long)130005); slide.setSlideDefinitionID(130005); features = new
|
|
|
953 |
* ArrayList<Feature>(); features.addAll(slide.getFeatures()); childSlide =
|
|
|
954 |
* slide.getChildrenSlides().get(0);
|
|
|
955 |
* features.addAll(childSlide.getFeatures());
|
|
|
956 |
* if(childSlide.getFreeformContent()!=null){
|
|
|
957 |
* System.out.println("Voice Calling : HAS FFC : " +
|
|
|
958 |
* childSlide.getFreeformContent().getFreeformText() +
|
|
|
959 |
* childSlide.getFreeformContent().getMedias()); }
|
|
|
960 |
* slide.setChildrenSlides(null); slide.setFeatures(features); break; case
|
|
|
961 |
* 130035: removeMap.put(slide.getSlideDefinitionID(), (long)130005);
|
|
|
962 |
* slide.setSlideDefinitionID(130005); for(Feature feata:
|
|
|
963 |
* slide.getFeatures()){ if(feata.getFeatureDefinitionID()==120055){
|
|
|
964 |
* feata.setFeatureDefinitionID(120012); } } break;
|
|
|
965 |
*
|
|
|
966 |
* //Data Connectivity case 130007: case 130028:
|
|
|
967 |
* removeMap.put(slide.getSlideDefinitionID(), (long)130007);
|
|
|
968 |
* slide.setSlideDefinitionID(130007); break;
|
|
|
969 |
*
|
|
|
970 |
* //Music case 130029: case 130030: case 130008:
|
|
|
971 |
* removeMap.put(slide.getSlideDefinitionID(), (long)130029);
|
|
|
972 |
* slide.setSlideDefinitionID(130029); break;
|
|
|
973 |
*
|
|
|
974 |
* //Video case 130031: case 130009:
|
|
|
975 |
* removeMap.put(slide.getSlideDefinitionID(), (long)130031);
|
|
|
976 |
* slide.setSlideDefinitionID(130031); break;
|
|
|
977 |
*
|
|
|
978 |
* //Camera case 130010: case 130036: case 130037:
|
|
|
979 |
* removeMap.put(slide.getSlideDefinitionID(), (long)130010);
|
|
|
980 |
* slide.setSlideDefinitionID(130010); break; case 130060:
|
|
|
981 |
* removeMap.put(slide.getSlideDefinitionID(), (long)130010);
|
|
|
982 |
* slide.setSlideDefinitionID(130010);
|
|
|
983 |
*
|
|
|
984 |
* features = slide.getFeatures(); // Just to add camera feature in basic
|
|
|
985 |
* phones Feature feature = new Feature(120056); List<Bullet> bullets = new
|
|
|
986 |
* ArrayList<Bullet>(); PrimitiveDataObject pdo = new
|
|
|
987 |
* PrimitiveDataObject("1"); Bullet bullet = new Bullet(pdo);
|
|
|
988 |
* bullets.add(bullet); feature.setBullets(bullets); features.add(feature);
|
|
|
989 |
* //Created new feature break;
|
|
|
990 |
*
|
|
|
991 |
* //Memory case 130011: removeMap.put(slide.getSlideDefinitionID(),
|
|
|
992 |
* (long)130011); slide.setSlideDefinitionID(130011); break; case 130032:
|
|
|
993 |
* case 130061: removeMap.put(slide.getSlideDefinitionID(), (long)130011);
|
|
|
994 |
* slide.setSlideDefinitionID(130011); features = slide.getFeatures();
|
|
|
995 |
* for(Feature feat: features){ if(feat.getFeatureDefinitionID() == 120054){
|
|
|
996 |
* feat.setFeatureDefinitionID(120030); } } break;
|
|
|
997 |
*
|
|
|
998 |
* //Battery case 130044: removeMap.put(slide.getSlideDefinitionID(),
|
|
|
999 |
* (long)130043); slide.setSlideDefinitionID(130043);
|
|
|
1000 |
* if(slide.getChildrenSlides().get(0).getSlideDefinitionID() == 130047){
|
|
|
1001 |
* slide.getChildrenSlides().get(0).setSlideDefinitionID(130046); } break;
|
|
|
1002 |
*
|
|
|
1003 |
* case 130042: removeMap.put(slide.getSlideDefinitionID(), (long)130043);
|
|
|
1004 |
* slide.setSlideDefinitionID(130043); childSlide =
|
|
|
1005 |
* slide.getChildrenSlides().get(0); if(childSlide.getSlideDefinitionID() ==
|
|
|
1006 |
* 130045){ childSlide.setSlideDefinitionID(130046); }
|
|
|
1007 |
*
|
|
|
1008 |
* List<Feature> childFeatures1 = new ArrayList<Feature>(); List<Feature>
|
|
|
1009 |
* childFeatures2 = new ArrayList<Feature>(); Slide childChildSlide1 = new
|
|
|
1010 |
* Slide(130048); Slide childChildSlide2 = new Slide(130049);
|
|
|
1011 |
*
|
|
|
1012 |
* childChildSlide1.setFeatures(childFeatures1);
|
|
|
1013 |
* childChildSlide2.setFeatures(childFeatures2);
|
|
|
1014 |
*
|
|
|
1015 |
* childSlide.addChild(childChildSlide1);
|
|
|
1016 |
* childSlide.addChild(childChildSlide2);
|
|
|
1017 |
*
|
|
|
1018 |
*
|
|
|
1019 |
* for(Feature f: childSlide.getFeatures()){ if(f.getFeatureDefinitionID()
|
|
|
1020 |
* == 120063){ f.setFeatureDefinitionID(120068); childFeatures1.add(f); }
|
|
|
1021 |
* if(f.getFeatureDefinitionID() == 120064){
|
|
|
1022 |
* f.setFeatureDefinitionID(120069); childFeatures2.add(f); } }
|
|
|
1023 |
*
|
|
|
1024 |
* childSlide.setFeatures(null);
|
|
|
1025 |
*
|
|
|
1026 |
* break;
|
|
|
1027 |
*
|
|
|
1028 |
* case 130062: removeMap.put(slide.getSlideDefinitionID(), (long)130043);
|
|
|
1029 |
* slide.setSlideDefinitionID(130043);
|
|
|
1030 |
*
|
|
|
1031 |
* childSlide = new Slide(130046); features = new ArrayList<Feature>();
|
|
|
1032 |
*
|
|
|
1033 |
* slide.addChild(childSlide);
|
|
|
1034 |
*
|
|
|
1035 |
* List<Feature> childFeatures11 = new ArrayList<Feature>(); List<Feature>
|
|
|
1036 |
* childFeatures21 = new ArrayList<Feature>(); Slide childChildSlide11 = new
|
|
|
1037 |
* Slide(130048); Slide childChildSlide21 = new Slide(130049);
|
|
|
1038 |
*
|
|
|
1039 |
* childChildSlide11.setFeatures(childFeatures11);
|
|
|
1040 |
* childChildSlide21.setFeatures(childFeatures21);
|
|
|
1041 |
*
|
|
|
1042 |
* childSlide.addChild(childChildSlide11);
|
|
|
1043 |
* childSlide.addChild(childChildSlide21); for(Feature f:
|
|
|
1044 |
* slide.getFeatures()){ if(f.getFeatureDefinitionID() == 120072){
|
|
|
1045 |
* features.add(f); } if(f.getFeatureDefinitionID() == 120073){
|
|
|
1046 |
* features.add(f); } if(f.getFeatureDefinitionID() == 120063){
|
|
|
1047 |
* f.setFeatureDefinitionID(120068); childFeatures11.add(f); }
|
|
|
1048 |
* if(f.getFeatureDefinitionID() == 120064){
|
|
|
1049 |
* f.setFeatureDefinitionID(120069); childFeatures21.add(f); } }
|
|
|
1050 |
* slide.setFeatures(features); break;
|
|
|
1051 |
*
|
|
|
1052 |
*
|
|
|
1053 |
* //Mail n Msg case 130041: case 130063:
|
|
|
1054 |
* removeMap.put(slide.getSlideDefinitionID(), (long)130039);
|
|
|
1055 |
* slide.setSlideDefinitionID(130039); break; case 130039:
|
|
|
1056 |
* removeMap.put(slide.getSlideDefinitionID(), (long)130039);
|
|
|
1057 |
* slide.setSlideDefinitionID(130039);
|
|
|
1058 |
*
|
|
|
1059 |
* childSlide = slide.getChildrenSlides().get(0);
|
|
|
1060 |
* slide.setFeatures(childSlide.getFeatures());
|
|
|
1061 |
* if(childSlide.getFreeformContent()!=null){
|
|
|
1062 |
* System.out.println("Mail n Msg : HAS FFC : " +
|
|
|
1063 |
* childSlide.getFreeformContent().getFreeformText() +
|
|
|
1064 |
* childSlide.getFreeformContent().getMedias()); }
|
|
|
1065 |
* slide.setChildrenSlides(null); break;
|
|
|
1066 |
*
|
|
|
1067 |
* //Software case 130020: case 130034:
|
|
|
1068 |
* removeMap.put(slide.getSlideDefinitionID(), (long)130020);
|
|
|
1069 |
* slide.setSlideDefinitionID(130020); break;
|
|
|
1070 |
*
|
|
|
1071 |
*
|
|
|
1072 |
* //Internet case 130050: removeMap.put(slide.getSlideDefinitionID(),
|
|
|
1073 |
* (long)130050); slide.setSlideDefinitionID(130050);
|
|
|
1074 |
* slide.setFeatures(slide.getChildrenSlides().get(0).getFeatures());
|
|
|
1075 |
*
|
|
|
1076 |
* if(slide.getChildrenSlides().get(0).getFreeformContent()!=null){ String
|
|
|
1077 |
* ffc = slide.getFreeformContent().getFreeformText();
|
|
|
1078 |
* if(slide.getChildrenSlides
|
|
|
1079 |
* ().get(0).getFreeformContent().getFreeformText()!=null){
|
|
|
1080 |
* if(slide.getChildrenSlides
|
|
|
1081 |
* ().get(0).getFreeformContent().getFreeformText().trim()!=""){ ffc = ffc +
|
|
|
1082 |
* "\n ********* " +
|
|
|
1083 |
* slide.getChildrenSlides().get(0).getFreeformContent().getFreeformText();
|
|
|
1084 |
* System.out.println("**************" +
|
|
|
1085 |
* slide.getChildrenSlides().get(0).getFreeformContent().getFreeformText());
|
|
|
1086 |
* } }
|
|
|
1087 |
*
|
|
|
1088 |
* List<String> ffcs = new ArrayList<String>(); ffcs.add(ffc);
|
|
|
1089 |
* slide.getFreeformContent().setFreeformTexts(ffcs); }
|
|
|
1090 |
*
|
|
|
1091 |
* slide.setChildrenSlides(null); //System.out.println("Slide: 130050");
|
|
|
1092 |
* //printSlideContent(slide); break;
|
|
|
1093 |
*
|
|
|
1094 |
* case 130052: removeMap.put(slide.getSlideDefinitionID(), (long)130050);
|
|
|
1095 |
* slide.setSlideDefinitionID(130050);
|
|
|
1096 |
*
|
|
|
1097 |
* for(Feature f2: slide.getFeatures()){ if(f2.getFeatureDefinitionID() ==
|
|
|
1098 |
* 120077){ f2.setFeatureDefinitionID(120074); // List<Bullet> newBullets =
|
|
|
1099 |
* new ArrayList<Bullet>(); // for(Bullet bul: f2.getBullets()){ //
|
|
|
1100 |
* CompositeDataObject cdo = (CompositeDataObject) bul.getDataObject(); //
|
|
|
1101 |
* for(PrimitiveDataObject pdo1: cdo.getPrimitiveDataObjects()){ //
|
|
|
1102 |
* pdo1.getValue(); // BulletDataObject bdo2 = new
|
|
|
1103 |
* EnumDataObject(enumValueID); // Bullet newbul = new Bullet(bdo2); //
|
|
|
1104 |
* newBullets.add(newbul); // } // // } // f2.setBullets(newBullets); }
|
|
|
1105 |
* if(f2.getFeatureDefinitionID() == 120078){
|
|
|
1106 |
* f2.setFeatureDefinitionID(120075); } } //
|
|
|
1107 |
* slide.setFeatures(slide.getChildrenSlides().get(0).getFeatures()); //
|
|
|
1108 |
* slide.setChildrenSlides(null); //System.out.println("Slide: 130052");
|
|
|
1109 |
*
|
|
|
1110 |
* //printSlideContent(slide); break;
|
|
|
1111 |
*
|
|
|
1112 |
* case 130051: removeMap.put(slide.getSlideDefinitionID(), (long)130050);
|
|
|
1113 |
* slide.setSlideDefinitionID(130050); // System.out.println(slide);
|
|
|
1114 |
* //System.out.println("Slide 130051:"); // printSlideContent(slide);
|
|
|
1115 |
* break;
|
|
|
1116 |
*
|
|
|
1117 |
* default: break; }
|
|
|
1118 |
*
|
|
|
1119 |
* } List<Long> newSequence = new ArrayList<Long>(); for(Long id:
|
|
|
1120 |
* slideSequence){ if(removeMap.containsKey(id)){
|
|
|
1121 |
* newSequence.add(removeMap.get(id)); }else{ newSequence.add(id); } }
|
|
|
1122 |
* entity.setSlideSequence(newSequence); CreationUtils.updateEntity(entity);
|
|
|
1123 |
* } }
|
|
|
1124 |
*
|
|
|
1125 |
* return true; }
|
|
|
1126 |
*/
|
|
|
1127 |
|
|
|
1128 |
public void printSlideContent(Slide slide) {
|
|
|
1129 |
|
|
|
1130 |
System.out.println("Slide: "
|
|
|
1131 |
+ slide.getFreeformContent().getFreeformText());
|
|
|
1132 |
if (slide.getFeatures() != null) {
|
|
|
1133 |
for (Feature feature : slide.getFeatures()) {
|
|
|
1134 |
if (feature.getBullets() != null) {
|
|
|
1135 |
for (Bullet bullet : feature.getBullets()) {
|
|
|
1136 |
// System.out.println(bullet.getDataObject().toString());
|
|
|
1137 |
// System.out.println(bullet.getFreeformContent());
|
| 1226 |
rajveer |
1138 |
}
|
|
|
1139 |
}
|
| 4964 |
amit.gupta |
1140 |
if (feature.getFreeformContent() != null) {
|
|
|
1141 |
System.out.println("Feature: "
|
|
|
1142 |
+ feature.getFreeformContent().getFreeformText());
|
| 1226 |
rajveer |
1143 |
}
|
|
|
1144 |
}
|
|
|
1145 |
}
|
| 4964 |
amit.gupta |
1146 |
if (slide.getChildrenSlides() != null) {
|
|
|
1147 |
for (Slide sl : slide.getChildrenSlides()) {
|
| 1226 |
rajveer |
1148 |
System.out.println("Child1: ");
|
|
|
1149 |
printSlideContent(sl);
|
|
|
1150 |
System.out.println("Child2: ");
|
|
|
1151 |
}
|
|
|
1152 |
}
|
| 4964 |
amit.gupta |
1153 |
|
| 1226 |
rajveer |
1154 |
}
|
| 4964 |
amit.gupta |
1155 |
|
| 1230 |
rajveer |
1156 |
/*
|
| 4964 |
amit.gupta |
1157 |
* public boolean migrateModel() throws Exception{ //DefinitionsContainer
|
|
|
1158 |
* oldDfc = new DefinitionsContainer(Utils.CONTENT_DB_PATH +
|
|
|
1159 |
* "olddefinitions" + File.separator); //DefinitionsContainer newDfc = new
|
|
|
1160 |
* DefinitionsContainer(Utils.CONTENT_DB_PATH + "olddefinitions" +
|
|
|
1161 |
* File.separator);
|
|
|
1162 |
*
|
|
|
1163 |
* Map<Long, Entity> entities = CreationUtils.getEntities(); for(Entity
|
|
|
1164 |
* entity: entities.values()){ List<Slide> slides = entity.getSlides();
|
|
|
1165 |
* if(slides!=null){ List<Slide> newSlides = new ArrayList<Slide>();
|
|
|
1166 |
* for(Slide slide: slides){ Slide newSlide; List<Feature> features; Slide
|
|
|
1167 |
* childSlide; switch ((int)slide.getSlideDefinitionID()) {
|
|
|
1168 |
*
|
|
|
1169 |
* //Keyboard case 130004: case 130026: case 130027: case 130057: newSlide =
|
|
|
1170 |
* new Slide(130026); newSlide.setChildrenSlides(slide.getChildrenSlides());
|
|
|
1171 |
* newSlide.setFeatures(slide.getFeatures());
|
|
|
1172 |
* newSlide.setFreeformContent(slide.getFreeformContent());
|
|
|
1173 |
* newSlides.add(newSlide); break;
|
|
|
1174 |
*
|
|
|
1175 |
* //Voice Calling case 130005: newSlide = new Slide(130005);
|
|
|
1176 |
* newSlide.setChildrenSlides(null); features = new ArrayList<Feature>();
|
|
|
1177 |
* features.addAll(slide.getFeatures()); childSlide =
|
|
|
1178 |
* slide.getChildrenSlides().get(0);
|
|
|
1179 |
* features.addAll(childSlide.getFeatures());
|
|
|
1180 |
* if(childSlide.getFreeformContent()!=null){
|
|
|
1181 |
* System.out.println("Voice Calling : HAS FFC : " +
|
|
|
1182 |
* childSlide.getFreeformContent().getFreeformText() +
|
|
|
1183 |
* childSlide.getFreeformContent().getMedias()); }
|
|
|
1184 |
* newSlide.setFeatures(features);
|
|
|
1185 |
* newSlide.setFreeformContent(slide.getFreeformContent());
|
|
|
1186 |
* newSlides.add(newSlide); break; case 130035: newSlide = new
|
|
|
1187 |
* Slide(130035); newSlide.setChildrenSlides(slide.getChildrenSlides());
|
|
|
1188 |
* for(Feature feata: slide.getFeatures()){
|
|
|
1189 |
* if(feata.getFeatureDefinitionID()==120055){
|
|
|
1190 |
* feata.setFeatureDefinitionID(120012); } }
|
|
|
1191 |
* newSlide.setFeatures(slide.getFeatures());
|
|
|
1192 |
* newSlide.setFreeformContent(slide.getFreeformContent());
|
|
|
1193 |
* newSlides.add(newSlide); break;
|
|
|
1194 |
*
|
|
|
1195 |
* //Data Connectivity case 130007: case 130028: newSlide = new
|
|
|
1196 |
* Slide(130007); newSlide.setChildrenSlides(slide.getChildrenSlides());
|
|
|
1197 |
* newSlide.setFeatures(slide.getFeatures());
|
|
|
1198 |
* newSlide.setFreeformContent(slide.getFreeformContent());
|
|
|
1199 |
* newSlides.add(newSlide); break;
|
|
|
1200 |
*
|
|
|
1201 |
* //Music case 130029: case 130030: case 130008: newSlide = new
|
|
|
1202 |
* Slide(130029); newSlide.setChildrenSlides(slide.getChildrenSlides());
|
|
|
1203 |
* newSlide.setFeatures(slide.getFeatures());
|
|
|
1204 |
* newSlide.setFreeformContent(slide.getFreeformContent());
|
|
|
1205 |
* newSlides.add(newSlide); break;
|
|
|
1206 |
*
|
|
|
1207 |
* //Video case 130031: case 130009: newSlide = new Slide(130031);
|
|
|
1208 |
* newSlide.setChildrenSlides(slide.getChildrenSlides());
|
|
|
1209 |
* newSlide.setFeatures(slide.getFeatures());
|
|
|
1210 |
* newSlide.setFreeformContent(slide.getFreeformContent());
|
|
|
1211 |
* newSlides.add(newSlide); break;
|
|
|
1212 |
*
|
|
|
1213 |
* //Camera case 130010: case 130036: case 130037: newSlide = new
|
|
|
1214 |
* Slide(130010); newSlide.setChildrenSlides(slide.getChildrenSlides());
|
|
|
1215 |
* newSlide.setFeatures(slide.getFeatures());
|
|
|
1216 |
* newSlide.setFreeformContent(slide.getFreeformContent());
|
|
|
1217 |
* newSlides.add(newSlide); break; case 130060: newSlide = new
|
|
|
1218 |
* Slide(130010); newSlide.setChildrenSlides(slide.getChildrenSlides());
|
|
|
1219 |
* features = slide.getFeatures(); // Just to add camera feature in basic
|
|
|
1220 |
* phones Feature feature = new Feature(120056); List<Bullet> bullets = new
|
|
|
1221 |
* ArrayList<Bullet>(); PrimitiveDataObject pdo = new
|
|
|
1222 |
* PrimitiveDataObject("1"); Bullet bullet = new Bullet(pdo);
|
|
|
1223 |
* bullets.add(bullet); feature.setBullets(bullets); features.add(feature);
|
|
|
1224 |
* //Created new feature newSlide.setFeatures(features);
|
|
|
1225 |
* newSlide.setFreeformContent(slide.getFreeformContent());
|
|
|
1226 |
* newSlides.add(newSlide); break;
|
|
|
1227 |
*
|
|
|
1228 |
* //Memory case 130011: newSlide = new Slide(130011);
|
|
|
1229 |
* newSlide.setChildrenSlides(slide.getChildrenSlides());
|
|
|
1230 |
* newSlide.setFeatures(slide.getFeatures());
|
|
|
1231 |
* newSlide.setFreeformContent(slide.getFreeformContent());
|
|
|
1232 |
* newSlides.add(newSlide); break; case 130032: case 130061: newSlide = new
|
|
|
1233 |
* Slide(130011); newSlide.setChildrenSlides(slide.getChildrenSlides());
|
|
|
1234 |
* features = slide.getFeatures(); for(Feature feat: features){
|
|
|
1235 |
* if(feat.getFeatureDefinitionID() == 130054){
|
|
|
1236 |
* feat.setFeatureDefinitionID(120030); } }
|
|
|
1237 |
* newSlide.setFeatures(slide.getFeatures());
|
|
|
1238 |
* newSlide.setFreeformContent(slide.getFreeformContent());
|
|
|
1239 |
* newSlides.add(newSlide); break;
|
|
|
1240 |
*
|
|
|
1241 |
* //Battery case 130044: newSlide = new Slide(130043);
|
|
|
1242 |
* if(slide.getChildrenSlides().get(0).getSlideDefinitionID() == 130047){
|
|
|
1243 |
* slide.getChildrenSlides().get(0).setSlideDefinitionID(130046); }
|
|
|
1244 |
* newSlide.setChildrenSlides(slide.getChildrenSlides());
|
|
|
1245 |
* newSlide.setFeatures(slide.getFeatures());
|
|
|
1246 |
* newSlide.setFreeformContent(slide.getFreeformContent());
|
|
|
1247 |
* newSlides.add(newSlide); break;
|
|
|
1248 |
*
|
|
|
1249 |
* case 130042: newSlide = new Slide(130043); childSlide =
|
|
|
1250 |
* slide.getChildrenSlides().get(0); if(childSlide.getSlideDefinitionID() ==
|
|
|
1251 |
* 130045){ childSlide.setSlideDefinitionID(130046); }
|
|
|
1252 |
* newSlide.setChildrenSlides(slide.getChildrenSlides());
|
|
|
1253 |
*
|
|
|
1254 |
* List<Feature> childFeatures1 = new ArrayList<Feature>(); List<Feature>
|
|
|
1255 |
* childFeatures2 = new ArrayList<Feature>(); Slide childChildSlide1 = new
|
|
|
1256 |
* Slide(130048); Slide childChildSlide2 = new Slide(130049);
|
|
|
1257 |
*
|
|
|
1258 |
* childChildSlide1.setFeatures(childFeatures1);
|
|
|
1259 |
* childChildSlide2.setFeatures(childFeatures2);
|
|
|
1260 |
*
|
|
|
1261 |
* childSlide.addChild(childChildSlide1);
|
|
|
1262 |
* childSlide.addChild(childChildSlide2);
|
|
|
1263 |
*
|
|
|
1264 |
*
|
|
|
1265 |
* for(Feature f: childSlide.getFeatures()){ if(f.getFeatureDefinitionID()
|
|
|
1266 |
* == 120063){ f.setFeatureDefinitionID(120068); childFeatures1.add(f); }
|
|
|
1267 |
* if(f.getFeatureDefinitionID() == 120064){
|
|
|
1268 |
* f.setFeatureDefinitionID(120069); childFeatures2.add(f); } }
|
|
|
1269 |
*
|
|
|
1270 |
* childSlide.setFeatures(null);
|
|
|
1271 |
*
|
|
|
1272 |
* newSlide.setFeatures(slide.getFeatures());
|
|
|
1273 |
* newSlide.setFreeformContent(slide.getFreeformContent());
|
|
|
1274 |
* newSlides.add(newSlide); break;
|
|
|
1275 |
*
|
|
|
1276 |
* case 130062: newSlide = new Slide(130043);
|
|
|
1277 |
* newSlide.setChildrenSlides(slide.getChildrenSlides()); childSlide = new
|
|
|
1278 |
* Slide(130046); features = new ArrayList<Feature>();
|
|
|
1279 |
* newSlide.setFeatures(features); newSlide.addChild(childSlide);
|
|
|
1280 |
*
|
|
|
1281 |
* List<Feature> childFeatures11 = new ArrayList<Feature>(); List<Feature>
|
|
|
1282 |
* childFeatures21 = new ArrayList<Feature>(); Slide childChildSlide11 = new
|
|
|
1283 |
* Slide(130048); Slide childChildSlide21 = new Slide(130049);
|
|
|
1284 |
*
|
|
|
1285 |
* childChildSlide11.setFeatures(childFeatures11);
|
|
|
1286 |
* childChildSlide21.setFeatures(childFeatures21);
|
|
|
1287 |
*
|
|
|
1288 |
* childSlide.addChild(childChildSlide11);
|
|
|
1289 |
* childSlide.addChild(childChildSlide21); for(Feature f:
|
|
|
1290 |
* slide.getFeatures()){ if(f.getFeatureDefinitionID() == 120072){
|
|
|
1291 |
* features.add(f); } if(f.getFeatureDefinitionID() == 120073){
|
|
|
1292 |
* features.add(f); } if(f.getFeatureDefinitionID() == 120063){
|
|
|
1293 |
* f.setFeatureDefinitionID(120068); childFeatures11.add(f); }
|
|
|
1294 |
* if(f.getFeatureDefinitionID() == 120064){
|
|
|
1295 |
* f.setFeatureDefinitionID(120069); childFeatures21.add(f); } }
|
|
|
1296 |
*
|
|
|
1297 |
* newSlide.setFeatures(slide.getFeatures());
|
|
|
1298 |
* newSlide.setFreeformContent(slide.getFreeformContent());
|
|
|
1299 |
* newSlides.add(newSlide); break;
|
|
|
1300 |
*
|
|
|
1301 |
*
|
|
|
1302 |
* //Mail n Msg case 130041: case 130063: newSlide = new Slide(130039);
|
|
|
1303 |
* newSlide.setChildrenSlides(slide.getChildrenSlides());
|
|
|
1304 |
* newSlide.setFeatures(slide.getFeatures());
|
|
|
1305 |
* newSlide.setFreeformContent(slide.getFreeformContent());
|
|
|
1306 |
* newSlides.add(newSlide); break; case 130039: newSlide = new
|
|
|
1307 |
* Slide(130039); //newSlide.setChildrenSlides(slide.getChildrenSlides());
|
|
|
1308 |
* childSlide = slide.getChildrenSlides().get(0);
|
|
|
1309 |
* newSlide.setFeatures(childSlide.getFeatures());
|
|
|
1310 |
* if(childSlide.getFreeformContent()!=null){
|
|
|
1311 |
* System.out.println("Mail n Msg : HAS FFC : " +
|
|
|
1312 |
* childSlide.getFreeformContent().getFreeformText() +
|
|
|
1313 |
* childSlide.getFreeformContent().getMedias()); }
|
|
|
1314 |
* newSlide.setFreeformContent(slide.getFreeformContent());
|
|
|
1315 |
* newSlides.add(newSlide); break;
|
|
|
1316 |
*
|
|
|
1317 |
* //Software case 130020: case 130034: newSlide = new Slide(130034);
|
|
|
1318 |
* newSlide.setChildrenSlides(slide.getChildrenSlides()); features =
|
|
|
1319 |
* slide.getFeatures(); newSlide.setFeatures(slide.getFeatures());
|
|
|
1320 |
* newSlide.setFreeformContent(slide.getFreeformContent());
|
|
|
1321 |
* newSlides.add(newSlide); break;
|
|
|
1322 |
*
|
|
|
1323 |
*
|
|
|
1324 |
* default: newSlides.add(slide); break; } } entity.setSlides(newSlides);
|
|
|
1325 |
* CreationUtils.updateEntity(entity); } }
|
|
|
1326 |
*
|
|
|
1327 |
* return true; }
|
|
|
1328 |
*/
|
|
|
1329 |
public boolean migrateRemoveBorrowedCategoryIdFromSlide() throws Exception {
|
| 1226 |
rajveer |
1330 |
Map<Long, Entity> entities = CreationUtils.getEntities();
|
| 4964 |
amit.gupta |
1331 |
for (Entity entity : entities.values()) {
|
|
|
1332 |
if (entity.getID() == 0) {
|
| 1226 |
rajveer |
1333 |
CreationUtils.deleteEntity(entity.getID());
|
|
|
1334 |
}
|
|
|
1335 |
List<Slide> slides = entity.getSlides();
|
| 4964 |
amit.gupta |
1336 |
if (slides != null) {
|
| 1226 |
rajveer |
1337 |
List<Slide> newSlides = new ArrayList<Slide>();
|
| 4964 |
amit.gupta |
1338 |
for (Slide slide : slides) {
|
| 1226 |
rajveer |
1339 |
Slide newSlide = new Slide(slide.getSlideDefinitionID());
|
|
|
1340 |
newSlide.setChildrenSlides(slide.getChildrenSlides());
|
|
|
1341 |
newSlide.setFeatures(slide.getFeatures());
|
|
|
1342 |
newSlide.setFreeformContent(slide.getFreeformContent());
|
|
|
1343 |
newSlides.add(newSlide);
|
|
|
1344 |
}
|
|
|
1345 |
entity.setSlides(newSlides);
|
|
|
1346 |
CreationUtils.updateEntity(entity);
|
|
|
1347 |
}
|
|
|
1348 |
}
|
|
|
1349 |
return true;
|
|
|
1350 |
}
|
| 479 |
rajveer |
1351 |
|
| 4964 |
amit.gupta |
1352 |
public boolean migrate() throws Exception {
|
| 580 |
rajveer |
1353 |
/*
|
| 4964 |
amit.gupta |
1354 |
* DefinitionsContainer sourceDefs = new
|
|
|
1355 |
* DefinitionsContainer(sourceDbPath); DefinitionsContainer
|
|
|
1356 |
* destinationDefs = new DefinitionsContainer(destinationDbPath);
|
|
|
1357 |
* EntityContainer sourceEnts = new EntityContainer(sourceDbPath);
|
|
|
1358 |
* EntityContainer destinationEnts = new
|
|
|
1359 |
* EntityContainer(destinationDbPath);
|
|
|
1360 |
*
|
|
|
1361 |
* Map<Long, Entity> entities = sourceEnts.getEntities();
|
|
|
1362 |
*
|
|
|
1363 |
* File f = new File("/home/rajveer/Desktop/info.txt"); FileWriter
|
|
|
1364 |
* fstream = new FileWriter(f); BufferedWriter out = new
|
|
|
1365 |
* BufferedWriter(fstream); StringBuilder sb = new StringBuilder();
|
|
|
1366 |
*
|
|
|
1367 |
*
|
|
|
1368 |
* for(Entity entity: entities.values()){ List<Slide> slides =
|
|
|
1369 |
* entity.getSlides();
|
|
|
1370 |
*
|
|
|
1371 |
* //List<String> vidLabels =
|
|
|
1372 |
* CreationUtils.getMediaLabels(entity.getID(),"youtube");
|
|
|
1373 |
* //List<String> imgLabels =
|
|
|
1374 |
* CreationUtils.getMediaLabels(entity.getID(),"image");
|
|
|
1375 |
*
|
|
|
1376 |
* //Map<String, Media> rawMedia =
|
|
|
1377 |
* CreationUtils.getRawMedia(entity.getID());
|
|
|
1378 |
*
|
|
|
1379 |
*
|
|
|
1380 |
* // List<String> vidLabels =
|
|
|
1381 |
* OldCreationUtils.getMediaLabels(entity.getID(),"youtube"); //
|
|
|
1382 |
* List<String> imgLabels =
|
|
|
1383 |
* OldCreationUtils.getMediaLabels(entity.getID(),"image");
|
|
|
1384 |
*
|
|
|
1385 |
* Entity newEntity = new Entity(entity.getID(),
|
|
|
1386 |
* entity.getCategoryID()); newEntity.setBrand(entity.getBrand());
|
|
|
1387 |
* newEntity.setModelName(entity.getModelName());
|
|
|
1388 |
* newEntity.setModelNumber(entity.getModelNumber());
|
|
|
1389 |
*
|
|
|
1390 |
*
|
|
|
1391 |
* Map<String, in.shop2020.creation.util.Media> rawMedia =
|
|
|
1392 |
* OldCreationUtils.getRawMedia(entity.getID());
|
|
|
1393 |
*
|
|
|
1394 |
* Map<String, Media> newrawMedia = new HashMap<String, Media>();
|
|
|
1395 |
*
|
|
|
1396 |
*
|
|
|
1397 |
* int totalRawVideos = 0; int totalRawImages = 0;
|
|
|
1398 |
*
|
|
|
1399 |
* if(rawMedia!=null){ for(String label: rawMedia.keySet()){
|
|
|
1400 |
* in.shop2020.creation.util.Media media = rawMedia.get(label);
|
|
|
1401 |
*
|
|
|
1402 |
* label = media.getLabel(); String type = media.getType(); String
|
|
|
1403 |
* location = media.getLocation();
|
|
|
1404 |
*
|
|
|
1405 |
* Media newMedia = new Media(label, type, location);
|
|
|
1406 |
*
|
|
|
1407 |
* newMedia.setTitle("Title"); if(type.equals("image")){
|
|
|
1408 |
* totalRawImages++; newMedia.setFileName(media.getFileName());
|
|
|
1409 |
* newMedia.setVideoType(""); }else{ totalRawVideos++;
|
|
|
1410 |
* newMedia.setVideoType("withoutskin"); newMedia.setFileName(""); }
|
|
|
1411 |
*
|
|
|
1412 |
* newrawMedia.put(label, newMedia); System.out.println("old " +
|
|
|
1413 |
* media.toString()); // System.out.println("new " +
|
|
|
1414 |
* newMedia.toString()); // OldCreationUtils.removeMedia(entity.getID(),
|
|
|
1415 |
* label); // CreationUtils.addMedia(entity.getID(), newMedia); } }
|
|
|
1416 |
*
|
|
|
1417 |
* int totalVideos = 0; int totalImages = 0; if(rawMedia==null){
|
|
|
1418 |
* for(Slide slide: slides ){
|
|
|
1419 |
*/
|
|
|
1420 |
/*
|
|
|
1421 |
* FreeformContent ffc = slide.getFreeformContent(); List<String>
|
|
|
1422 |
* vidList = new ArrayList<String>(); List<String> imgList = new
|
|
|
1423 |
* ArrayList<String>();
|
|
|
1424 |
*
|
|
|
1425 |
* if(ffc!=null){ List<String> vidFfcLabels = ffc.getYoutubeRefs();
|
|
|
1426 |
* if(vidFfcLabels!=null){ for(String vidFfcLabel: vidFfcLabels){
|
|
|
1427 |
* StringTokenizer strTkn = new StringTokenizer(vidFfcLabel,"~!~");
|
|
|
1428 |
* String vidLabel = null; if(strTkn.hasMoreTokens()){ vidLabel =
|
|
|
1429 |
* strTkn.nextToken(); vidList.add(vidFfcLabel);
|
|
|
1430 |
*
|
|
|
1431 |
* // ffc.removeMedia("youtube", vidFfcLabel); //
|
|
|
1432 |
* ffc.addMedia("youtube", vidLabel); } if(vidLabel == null){
|
|
|
1433 |
* System.out.println("Something is really breaking .. bu ha ha !!!"); }
|
|
|
1434 |
* totalVideos++; } } List<String> imgFfcLabels = ffc.getImageRefs();
|
|
|
1435 |
* if(imgFfcLabels!=null){ for(String imgFfcLabel: imgFfcLabels){
|
|
|
1436 |
* StringTokenizer strTkn = new StringTokenizer(imgFfcLabel,"~!~");
|
|
|
1437 |
* String imgLabel = null; if(strTkn.hasMoreTokens()){ imgLabel =
|
|
|
1438 |
* strTkn.nextToken(); imgList.add(imgFfcLabel);
|
|
|
1439 |
*
|
|
|
1440 |
* // ffc.removeMedia("image", imgFfcLabel); // ffc.addMedia("image",
|
|
|
1441 |
* imgLabel); } if(imgLabel == null){
|
|
|
1442 |
* System.out.println("Something is really breaking .. bu ha ha !!!"); }
|
|
|
1443 |
* totalImages++; } }
|
|
|
1444 |
*
|
|
|
1445 |
* for(String vidlab : vidList){ ffc.removeMedia("youtube", vidlab);
|
|
|
1446 |
* ffc.addMedia("youtube", (new StringTokenizer(vidlab,
|
|
|
1447 |
* "~!~")).nextToken()); } for(String imglab : imgList){
|
|
|
1448 |
* ffc.removeMedia("image",imglab); ffc.addMedia("image", (new
|
|
|
1449 |
* StringTokenizer(imglab, "~!~")).nextToken()); }
|
|
|
1450 |
* slide.setFreeformContent(ffc); System.out.println("Slide id is " +
|
|
|
1451 |
* slide.getSlideDefinitionID() + " vid labels: " + vidFfcLabels +
|
|
|
1452 |
* " img labels" + imgFfcLabels); }
|
|
|
1453 |
*/
|
|
|
1454 |
/*
|
|
|
1455 |
* newEntity.addSlide(slide); }
|
|
|
1456 |
*
|
|
|
1457 |
* // System.out.println("entity:"+ entity.getID() + ":trv:" +
|
|
|
1458 |
* totalRawVideos + ":tri:" + totalRawImages +":tv:" + totalVideos
|
|
|
1459 |
* +":ti:" + totalImages); // sb.append("entity:"+ entity.getID() +
|
|
|
1460 |
* ":trv:" + totalRawVideos + ":tri:" + totalRawImages +":tv:" +
|
|
|
1461 |
* totalVideos +":ti:" + totalImages+ ":tr:"
|
|
|
1462 |
* +(totalRawVideos+totalRawImages) + ":t:" +(totalVideos+totalImages) +
|
|
|
1463 |
* ":vd:" +(totalRawVideos-totalVideos) + ":id:"
|
|
|
1464 |
* +(totalRawImages-totalImages) + "\n"); sb.append(entity.getID() +
|
|
|
1465 |
* "\n");
|
|
|
1466 |
*
|
|
|
1467 |
*
|
|
|
1468 |
* destinationEnts.updateEntity(newEntity);
|
|
|
1469 |
* CreationUtils.storeEntity(newEntity);
|
|
|
1470 |
*
|
|
|
1471 |
* Map<Long, List<Entity>> entitiesByCategory =
|
|
|
1472 |
* sourceEnts.getEntitiesbyCategory();
|
|
|
1473 |
*
|
|
|
1474 |
* Map<Long, Entity> xentities = destinationEnts.getEntities();
|
|
|
1475 |
*
|
|
|
1476 |
* CreationUtils.rewriteRepository(xentities, entitiesByCategory); }
|
|
|
1477 |
* else{ sb.append(" " + entity.getID() + "\n"); } }
|
|
|
1478 |
*
|
|
|
1479 |
*
|
|
|
1480 |
* out.write(sb.toString()); out.close();
|
|
|
1481 |
*/
|
| 457 |
rajveer |
1482 |
return true;
|
|
|
1483 |
}
|
| 4964 |
amit.gupta |
1484 |
|
|
|
1485 |
private boolean makeEntitiesObject() throws Exception {
|
|
|
1486 |
// DefinitionsContainer sourceDefs = new
|
|
|
1487 |
// DefinitionsContainer(sourceDbPath);
|
|
|
1488 |
// DefinitionsContainer destinationDefs = new
|
|
|
1489 |
// DefinitionsContainer(destinationDbPath);
|
|
|
1490 |
// EntityContainer sourceEnts = new EntityContainer(sourceDbPath);
|
|
|
1491 |
// EntityContainer destinationEnts = new
|
|
|
1492 |
// EntityContainer(destinationDbPath);
|
|
|
1493 |
|
|
|
1494 |
/*
|
|
|
1495 |
* Map<Long, List<Entity>> catEntities =
|
|
|
1496 |
* sourceEnts.getEntitiesbyCategory();
|
|
|
1497 |
*
|
|
|
1498 |
* Map<Long, Entity> entities = sourceEnts.getEntities(); for(Long
|
|
|
1499 |
* catId: catEntities.keySet()){ List<Entity> ents =
|
|
|
1500 |
* catEntities.get(catId); for(Entity entity: ents){
|
|
|
1501 |
* entities.put(entity.getID(), entity);
|
|
|
1502 |
* System.out.println(entity.getID() + ":" + entity.getCategoryID() +
|
|
|
1503 |
* ":"+ entity.getBrand() + " "+ entity.getModelName() + " " +
|
|
|
1504 |
* entity.getModelNumber()); } }
|
|
|
1505 |
*/
|
|
|
1506 |
|
| 791 |
rajveer |
1507 |
Map<Long, List<Entity>> catEntities = new TreeMap<Long, List<Entity>>();
|
|
|
1508 |
Map<Long, Entity> entities = new TreeMap<Long, Entity>();
|
| 2720 |
mandeep.dh |
1509 |
|
| 4964 |
amit.gupta |
1510 |
FileInputStream fstream = new FileInputStream("/home/rajveer/Desktop/1");
|
|
|
1511 |
DataInputStream in = new DataInputStream(fstream);
|
|
|
1512 |
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
|
|
1513 |
String strLine;
|
| 2720 |
mandeep.dh |
1514 |
|
| 4964 |
amit.gupta |
1515 |
while ((strLine = br.readLine()) != null) {
|
|
|
1516 |
long entityID = Long.parseLong(strLine);
|
|
|
1517 |
String entityDBFile = sourceDbPath + "entities" + File.separator
|
|
|
1518 |
+ entityID + "/entity.ser";
|
|
|
1519 |
System.out.println(entityDBFile);
|
|
|
1520 |
Entity entity = (Entity) DBUtils.read(entityDBFile);
|
|
|
1521 |
entities.put(entityID, entity);
|
| 2720 |
mandeep.dh |
1522 |
|
| 4964 |
amit.gupta |
1523 |
List<Entity> catent = catEntities.get(entity.getCategoryID());
|
|
|
1524 |
if (catent == null) {
|
|
|
1525 |
catent = new ArrayList<Entity>();
|
|
|
1526 |
}
|
|
|
1527 |
catent.add(entity);
|
|
|
1528 |
catEntities.put(entity.getCategoryID(), catent);
|
|
|
1529 |
}
|
|
|
1530 |
in.close();
|
|
|
1531 |
|
|
|
1532 |
String entitiesDBFile = sourceDbPath + "entities" + File.separator
|
|
|
1533 |
+ "entities.ser";
|
|
|
1534 |
String entitiesbycategoryDBFile = sourceDbPath + "entities"
|
|
|
1535 |
+ File.separator + "entitiesbycategory.ser";
|
|
|
1536 |
|
| 791 |
rajveer |
1537 |
DBUtils.delete(entitiesDBFile);
|
|
|
1538 |
DBUtils.store(entities, entitiesDBFile);
|
| 2720 |
mandeep.dh |
1539 |
|
| 4964 |
amit.gupta |
1540 |
// Remove existing
|
| 791 |
rajveer |
1541 |
DBUtils.delete(entitiesbycategoryDBFile);
|
|
|
1542 |
DBUtils.store(catEntities, entitiesbycategoryDBFile);
|
| 2720 |
mandeep.dh |
1543 |
|
| 4964 |
amit.gupta |
1544 |
return false;
|
| 791 |
rajveer |
1545 |
}
|
| 2720 |
mandeep.dh |
1546 |
|
| 4964 |
amit.gupta |
1547 |
private boolean printDataModel() throws Exception {
|
|
|
1548 |
DefinitionsContainer dfc = Catalog.getInstance()
|
|
|
1549 |
.getDefinitionsContainer();
|
| 1226 |
rajveer |
1550 |
StringBuilder sb = new StringBuilder();
|
| 2720 |
mandeep.dh |
1551 |
|
| 1226 |
rajveer |
1552 |
Map<Long, SlideDefinition> allSlideDefs = dfc.getSlideDefinitions();
|
| 4964 |
amit.gupta |
1553 |
for (Long slideDefId : allSlideDefs.keySet()) {
|
| 1226 |
rajveer |
1554 |
SlideDefinition slideDef = allSlideDefs.get(slideDefId);
|
|
|
1555 |
sb.append(slideDefId + " - " + slideDef.getLabel() + "\n");
|
| 4964 |
amit.gupta |
1556 |
if (!slideDef.getChildrenSlideDefinitionIDs().isEmpty()) {
|
|
|
1557 |
sb.append("Child Slides are: \t"
|
|
|
1558 |
+ slideDef.getChildrenSlideDefinitionIDs() + "\n");
|
| 1226 |
rajveer |
1559 |
}
|
| 4964 |
amit.gupta |
1560 |
List<SlideFeatureDefinition> featureDefs = slideDef
|
|
|
1561 |
.getSlideFeatureDefinitions();
|
|
|
1562 |
for (SlideFeatureDefinition featureDef : featureDefs) {
|
|
|
1563 |
sb.append("\t"
|
|
|
1564 |
+ featureDef.getFeatureDefintionID()
|
|
|
1565 |
+ "\t"
|
|
|
1566 |
+ dfc.getFeatureDefinition(
|
|
|
1567 |
featureDef.getFeatureDefintionID()).getLabel()
|
|
|
1568 |
+ "\t" + featureDef.getEditorialImportance() + "\n");
|
| 1226 |
rajveer |
1569 |
}
|
|
|
1570 |
}
|
|
|
1571 |
System.out.println(sb.toString());
|
| 580 |
rajveer |
1572 |
Map<Long, Category> categories = dfc.getCategories();
|
| 4964 |
amit.gupta |
1573 |
if (categories != null) {
|
| 1226 |
rajveer |
1574 |
return true;
|
|
|
1575 |
}
|
| 4964 |
amit.gupta |
1576 |
for (Category category : categories.values()) {
|
|
|
1577 |
if (category.getChildrenCategory() != null) {
|
| 580 |
rajveer |
1578 |
continue;
|
|
|
1579 |
}
|
| 1226 |
rajveer |
1580 |
sb.append(category.getLabel() + "\n");
|
| 4964 |
amit.gupta |
1581 |
List<CategorySlideDefinition> slideDefs = dfc
|
|
|
1582 |
.getCategorySlideDefinitions(category.getID());
|
|
|
1583 |
List<Long> slideSequence = dfc.getCategorySlideSequence(category
|
|
|
1584 |
.getID());
|
|
|
1585 |
for (CategorySlideDefinition slideDef : slideDefs) {
|
|
|
1586 |
sb.append("\t"
|
|
|
1587 |
+ dfc.getSlideDefinition(slideDef.getSlideDefintionID())
|
|
|
1588 |
.getLabel() + "\t"
|
|
|
1589 |
+ slideDef.getEditorialImportance() + "\n");
|
|
|
1590 |
// List<FeatureDefinition> featureDefs =
|
|
|
1591 |
// dfc.getFeatureDefinitions(slideDef.getSlideDefintionID());
|
|
|
1592 |
|
|
|
1593 |
List<SlideFeatureDefinition> slideFeatureDefs = dfc
|
|
|
1594 |
.getSlideDefinition(slideDef.getSlideDefintionID())
|
|
|
1595 |
.getSlideFeatureDefinitions();
|
|
|
1596 |
|
|
|
1597 |
for (SlideFeatureDefinition slideFeatureDef : slideFeatureDefs) {
|
|
|
1598 |
FeatureDefinition featureDef = dfc
|
|
|
1599 |
.getFeatureDefinition(slideFeatureDef
|
|
|
1600 |
.getFeatureDefintionID());
|
|
|
1601 |
BulletDefinition bulletDef = featureDef
|
|
|
1602 |
.getBulletDefinition();
|
|
|
1603 |
sb.append("\t\t\t" + featureDef.getLabel() + "\t"
|
|
|
1604 |
+ slideFeatureDef.getEditorialImportance() + "\t"
|
|
|
1605 |
+ featureDef.allowsBlank() + "\t"
|
|
|
1606 |
+ bulletDef.isLearned() + "\t"
|
|
|
1607 |
+ bulletDef.isMultivalue());
|
| 580 |
rajveer |
1608 |
List<Long> units = bulletDef.getUnitIDs();
|
| 4964 |
amit.gupta |
1609 |
if (bulletDef.getDatatypeDefinitionID() != null) {
|
|
|
1610 |
sb.append("\t"
|
|
|
1611 |
+ dfc.getDatatypeDefinition(
|
|
|
1612 |
bulletDef.getDatatypeDefinitionID())
|
|
|
1613 |
.getName());
|
|
|
1614 |
|
| 1226 |
rajveer |
1615 |
}
|
| 4964 |
amit.gupta |
1616 |
if (units != null) {
|
|
|
1617 |
for (Long unit : units) {
|
|
|
1618 |
sb.append("\t" + dfc.getUnit(unit).getFullForm()
|
|
|
1619 |
+ "\t" + dfc.getUnit(unit).getShortForm());
|
| 580 |
rajveer |
1620 |
}
|
|
|
1621 |
}
|
| 1226 |
rajveer |
1622 |
sb.append("\n");
|
| 580 |
rajveer |
1623 |
}
|
| 4964 |
amit.gupta |
1624 |
|
| 580 |
rajveer |
1625 |
/*
|
| 4964 |
amit.gupta |
1626 |
* for(FeatureDefinition featureDef: featureDefs){
|
|
|
1627 |
* BulletDefinition bulletDef =
|
|
|
1628 |
* featureDef.getBulletDefinition(); System.out.println(" " +
|
|
|
1629 |
* featureDef.getLabel() + " " + featureDef.allowsBlank() + " "
|
|
|
1630 |
* + bulletDef.isLearned() + " " + bulletDef.isMultivalue());
|
|
|
1631 |
* List<Long> units = bulletDef.getUnitIDs(); if(units!=null){
|
|
|
1632 |
* for(Long unit: units){ System.out.println(" "+
|
|
|
1633 |
* dfc.getUnit(unit).getFullForm() + " "+
|
|
|
1634 |
* dfc.getUnit(unit).getShortForm()); } }
|
|
|
1635 |
* if(bulletDef.getDatatypeDefinitionID()!=null){
|
|
|
1636 |
* System.out.println(" " +
|
|
|
1637 |
* dfc.getDatatypeDefinition(bulletDef
|
|
|
1638 |
* .getDatatypeDefinitionID()).getName());
|
|
|
1639 |
*
|
|
|
1640 |
* } }
|
|
|
1641 |
*/
|
| 580 |
rajveer |
1642 |
}
|
|
|
1643 |
}
|
| 1226 |
rajveer |
1644 |
System.out.println(sb.toString());
|
| 580 |
rajveer |
1645 |
return true;
|
|
|
1646 |
}
|
| 4964 |
amit.gupta |
1647 |
|
|
|
1648 |
public boolean migrateOS() throws Exception {
|
| 4706 |
amit.gupta |
1649 |
Map<Long, Entity> map = CreationUtils.getEntities();
|
| 4964 |
amit.gupta |
1650 |
for (Long entityId : map.keySet()) {
|
|
|
1651 |
Entity entity = map.get(entityId);
|
|
|
1652 |
if (entity == null || entity.getSlides() == null) {
|
|
|
1653 |
continue;
|
|
|
1654 |
}
|
|
|
1655 |
|
|
|
1656 |
for (Slide slide : entity.getSlides()) {
|
|
|
1657 |
if (slide.getSlideDefinitionID() == 130020) {
|
|
|
1658 |
List<Feature> features = slide.getFeatures();
|
|
|
1659 |
for (Feature f : features) {
|
|
|
1660 |
if (f.getFeatureDefinitionID() == 120043) {
|
|
|
1661 |
Bullet b = f.getBullets().get(0);
|
|
|
1662 |
String value = ((PrimitiveDataObject) b
|
|
|
1663 |
.getDataObject()).getValue();
|
|
|
1664 |
long enumValueID = getEnumValueForOS(value);
|
|
|
1665 |
if (enumValueID == 110371L) {
|
|
|
1666 |
Logger.log("Set entity:" + entityId
|
|
|
1667 |
+ " as proprietary software", entity);
|
|
|
1668 |
}
|
| 4706 |
amit.gupta |
1669 |
b.setDataObject(new EnumDataObject(enumValueID));
|
| 4964 |
amit.gupta |
1670 |
}
|
|
|
1671 |
}
|
|
|
1672 |
}
|
| 4706 |
amit.gupta |
1673 |
|
| 4964 |
amit.gupta |
1674 |
}
|
|
|
1675 |
|
|
|
1676 |
CreationUtils.updateEntity(entity);
|
|
|
1677 |
}
|
|
|
1678 |
return true;
|
| 4706 |
amit.gupta |
1679 |
}
|
|
|
1680 |
|
|
|
1681 |
private long getEnumValueForOS(String value) {
|
|
|
1682 |
value = value.toLowerCase();
|
|
|
1683 |
Map<String, Long> map = getOSEnumMap();
|
| 4964 |
amit.gupta |
1684 |
String os = "Proprietary software";
|
|
|
1685 |
if (value.contains("android")) {
|
|
|
1686 |
if (value.contains("1.5")) {
|
|
|
1687 |
os = "Android v1.5 (Cupcake)";
|
|
|
1688 |
}
|
|
|
1689 |
if (value.contains("1.6")) {
|
|
|
1690 |
os = "Android v1.6 (Donut)";
|
|
|
1691 |
}
|
|
|
1692 |
if (value.contains("2.1")) {
|
|
|
1693 |
os = "Android v2.1 (Eclair)";
|
|
|
1694 |
}
|
|
|
1695 |
if (value.contains("2.2")) {
|
|
|
1696 |
os = "Android v2.2 (Froyo)";
|
|
|
1697 |
}
|
|
|
1698 |
if (value.contains("2.3")) {
|
|
|
1699 |
os = "Android v2.3 (Gingerbread)";
|
|
|
1700 |
}
|
|
|
1701 |
if (value.contains("3.0")) {
|
|
|
1702 |
os = "Android v3.0 (Honeycomb)";
|
|
|
1703 |
}
|
|
|
1704 |
if (value.contains("3.1")) {
|
|
|
1705 |
os = "Android v3.1 (Honeycomb)";
|
|
|
1706 |
}
|
|
|
1707 |
if (value.contains("3.2")) {
|
|
|
1708 |
os = "Android v3.2 (Honeycomb)";
|
|
|
1709 |
}
|
| 4706 |
amit.gupta |
1710 |
}
|
| 4964 |
amit.gupta |
1711 |
if (value.contains("blackberry")) {
|
|
|
1712 |
if (value.contains("os")) {
|
| 4706 |
amit.gupta |
1713 |
os = "BlackBerry OS";
|
|
|
1714 |
}
|
| 4964 |
amit.gupta |
1715 |
if (value.contains("5.0")) {
|
| 4706 |
amit.gupta |
1716 |
os = "BlackBerry OS 5.0";
|
|
|
1717 |
}
|
| 4964 |
amit.gupta |
1718 |
if (value.contains("6.0")) {
|
| 4706 |
amit.gupta |
1719 |
os = "BlackBerry OS 6.0";
|
|
|
1720 |
}
|
| 4964 |
amit.gupta |
1721 |
if (value.contains("7.0")) {
|
| 4706 |
amit.gupta |
1722 |
os = "BlackBerry OS 7.0";
|
|
|
1723 |
}
|
| 4964 |
amit.gupta |
1724 |
if (value.contains("tablet os")) {
|
| 4706 |
amit.gupta |
1725 |
os = "BlackBerry Tablet OS";
|
|
|
1726 |
}
|
|
|
1727 |
}
|
| 4964 |
amit.gupta |
1728 |
if (value.contains("brew mobile platform")) {
|
| 4706 |
amit.gupta |
1729 |
os = "Brew Mobile Platform";
|
|
|
1730 |
}
|
| 4964 |
amit.gupta |
1731 |
if (value.contains("maemo 5")) {
|
| 4706 |
amit.gupta |
1732 |
os = "Maemo 5";
|
|
|
1733 |
}
|
| 4964 |
amit.gupta |
1734 |
if (value.contains("windows phone 7")) {
|
| 4706 |
amit.gupta |
1735 |
os = "Windows Phone 7";
|
|
|
1736 |
}
|
| 4964 |
amit.gupta |
1737 |
if (value.contains("windows phone 7.5 mango")) {
|
| 4706 |
amit.gupta |
1738 |
os = "Windows Phone 7.5 Mango";
|
|
|
1739 |
}
|
| 4964 |
amit.gupta |
1740 |
if (value.contains("proprietary")) {
|
|
|
1741 |
if (value.contains("lg"))
|
| 4706 |
amit.gupta |
1742 |
os = "Proprietary LG software";
|
| 4964 |
amit.gupta |
1743 |
else if (value.contains("micromax")) {
|
| 4706 |
amit.gupta |
1744 |
os = "Proprietary Micromax software";
|
| 4964 |
amit.gupta |
1745 |
} else if (value.contains("samsung")) {
|
| 4706 |
amit.gupta |
1746 |
os = "Proprietary Samsung software";
|
| 4964 |
amit.gupta |
1747 |
} else if (value.contains("sony ericsson")) {
|
| 4706 |
amit.gupta |
1748 |
os = "Proprietary Sony Ericsson software";
|
| 4964 |
amit.gupta |
1749 |
} else if (value.contains("spice")) {
|
| 4706 |
amit.gupta |
1750 |
os = "Proprietary Spice software";
|
| 4964 |
amit.gupta |
1751 |
} else if (value.contains("lava")) {
|
| 4706 |
amit.gupta |
1752 |
os = "Proprietary Lava software";
|
| 4964 |
amit.gupta |
1753 |
} else if (value.contains("alcatel")) {
|
| 4706 |
amit.gupta |
1754 |
os = "Proprietary Alcatel software";
|
| 4964 |
amit.gupta |
1755 |
} else if (value.contains("motorola")) {
|
| 4706 |
amit.gupta |
1756 |
os = "Proprietary Motorola software";
|
| 4964 |
amit.gupta |
1757 |
} else if (value.contains("karbonn")) {
|
| 4706 |
amit.gupta |
1758 |
os = "Proprietary Karbonn software";
|
| 4964 |
amit.gupta |
1759 |
} else {
|
| 4706 |
amit.gupta |
1760 |
os = "Proprietary software";
|
|
|
1761 |
}
|
|
|
1762 |
}
|
| 4964 |
amit.gupta |
1763 |
if (value.contains("mmp")) {
|
| 4706 |
amit.gupta |
1764 |
os = "Proprietary Samsung software";
|
|
|
1765 |
}
|
| 4964 |
amit.gupta |
1766 |
if (value.contains("samsung")) {
|
|
|
1767 |
if (value.contains("bada")) {
|
|
|
1768 |
os = "Samsung bada";
|
|
|
1769 |
}
|
|
|
1770 |
if (value.contains("bada 1.2")) {
|
|
|
1771 |
os = "Samsung bada 1.2";
|
|
|
1772 |
}
|
| 4706 |
amit.gupta |
1773 |
}
|
| 4964 |
amit.gupta |
1774 |
if (value.contains("sony ericsson java platform 8")) {
|
| 4706 |
amit.gupta |
1775 |
os = "Proprietary Sony Ericsson software";
|
|
|
1776 |
}
|
| 4964 |
amit.gupta |
1777 |
if (value.contains("s60")) {
|
| 4706 |
amit.gupta |
1778 |
os = "Symbian 60";
|
|
|
1779 |
}
|
| 4964 |
amit.gupta |
1780 |
if (value.contains("symbian")) {
|
|
|
1781 |
if (value.contains("40")) {
|
| 4706 |
amit.gupta |
1782 |
os = "Symbian 40";
|
|
|
1783 |
}
|
| 4964 |
amit.gupta |
1784 |
if (value.contains("60")) {
|
| 4706 |
amit.gupta |
1785 |
os = "Symbian 60";
|
|
|
1786 |
}
|
| 4964 |
amit.gupta |
1787 |
if (value.contains("^3")) {
|
| 4706 |
amit.gupta |
1788 |
os = "Symbian^3";
|
|
|
1789 |
}
|
| 4964 |
amit.gupta |
1790 |
if (value.contains("anna")) {
|
| 4706 |
amit.gupta |
1791 |
os = "Symbian Anna";
|
|
|
1792 |
}
|
| 4964 |
amit.gupta |
1793 |
if (value.contains("belle")) {
|
| 4706 |
amit.gupta |
1794 |
os = "Symbian Belle";
|
|
|
1795 |
}
|
|
|
1796 |
}
|
| 4964 |
amit.gupta |
1797 |
if (value.contains("ios 4")) {
|
| 4706 |
amit.gupta |
1798 |
os = "iOS 4";
|
|
|
1799 |
}
|
| 4964 |
amit.gupta |
1800 |
if (value.contains("ios 5")) {
|
| 4706 |
amit.gupta |
1801 |
os = "iOS 5";
|
|
|
1802 |
}
|
|
|
1803 |
return map.get(os);
|
|
|
1804 |
}
|
| 4964 |
amit.gupta |
1805 |
|
|
|
1806 |
private Map<String, Long> getOSEnumMap() {
|
| 4706 |
amit.gupta |
1807 |
Map<String, Long> map = new HashMap<String, Long>();
|
|
|
1808 |
map.put("Android v1.5 (Cupcake)", 110335L);
|
|
|
1809 |
map.put("Android v1.6 (Donut)", 110336L);
|
|
|
1810 |
map.put("Android v2.1 (Eclair)", 110337L);
|
|
|
1811 |
map.put("Android v2.2 (Froyo)", 110338L);
|
|
|
1812 |
map.put("Android v2.3 (Gingerbread)", 110339L);
|
|
|
1813 |
map.put("Android v3.0 (Honeycomb)", 110340L);
|
|
|
1814 |
map.put("Android v3.1 (Honeycomb)", 110341L);
|
| 4964 |
amit.gupta |
1815 |
map.put("Android v3.2 (Honeycomb)", 110342L);
|
| 4706 |
amit.gupta |
1816 |
map.put("BlackBerry OS", 110343L);
|
|
|
1817 |
map.put("BlackBerry OS 5.0", 110344L);
|
|
|
1818 |
map.put("BlackBerry OS 6.0", 110345L);
|
|
|
1819 |
map.put("BlackBerry OS 7.0", 110346L);
|
|
|
1820 |
map.put("BlackBerry Tablet OS", 110347L);
|
|
|
1821 |
map.put("Brew Mobile Platform", 110348L);
|
|
|
1822 |
map.put("Maemo 5", 110349L);
|
|
|
1823 |
map.put("Windows Phone 7", 110350L);
|
|
|
1824 |
map.put("Windows Phone 7.5 Mango", 110351L);
|
|
|
1825 |
map.put("Proprietary LG software", 110352L);
|
|
|
1826 |
map.put("Proprietary Micromax software", 110353L);
|
|
|
1827 |
map.put("Proprietary Samsung software", 110354L);
|
|
|
1828 |
map.put("Proprietary Sony Ericsson software", 110355L);
|
|
|
1829 |
map.put("Proprietary Spice software", 110356L);
|
|
|
1830 |
map.put("Proprietary Lava software", 110367L);
|
|
|
1831 |
map.put("Proprietary Karbonn software", 110368L);
|
|
|
1832 |
map.put("Proprietary Motorola software", 110369L);
|
|
|
1833 |
map.put("Proprietary Alcatel software", 110370L);
|
| 4964 |
amit.gupta |
1834 |
map.put("Proprietary software", 110371L);
|
| 4706 |
amit.gupta |
1835 |
map.put("Samsung bada", 110357L);
|
|
|
1836 |
map.put("Samsung bada 1.2", 110358L);
|
|
|
1837 |
map.put("Symbian 40", 110360L);
|
|
|
1838 |
map.put("Symbian 60", 110361L);
|
|
|
1839 |
map.put("Symbian^3", 110362L);
|
|
|
1840 |
map.put("Symbian Anna", 110363L);
|
|
|
1841 |
map.put("Symbian Belle", 110364L);
|
|
|
1842 |
map.put("iOS 4", 110365L);
|
|
|
1843 |
map.put("iOS 5", 110366L);
|
| 4964 |
amit.gupta |
1844 |
|
| 4706 |
amit.gupta |
1845 |
return map;
|
| 4964 |
amit.gupta |
1846 |
|
| 4706 |
amit.gupta |
1847 |
}
|
| 5370 |
amit.gupta |
1848 |
|
|
|
1849 |
private Object clone(Object object) throws Exception{
|
|
|
1850 |
// Serializing and deserializing to clone the slide
|
|
|
1851 |
// serialize
|
|
|
1852 |
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
|
|
1853 |
ObjectOutputStream out = new ObjectOutputStream(bos);
|
|
|
1854 |
out.writeObject(object);
|
| 4964 |
amit.gupta |
1855 |
|
| 5370 |
amit.gupta |
1856 |
// De-serialization
|
|
|
1857 |
ByteArrayInputStream bis = new ByteArrayInputStream(
|
|
|
1858 |
bos.toByteArray());
|
|
|
1859 |
ObjectInputStream in = new ObjectInputStream(bis);
|
|
|
1860 |
return in.readObject();
|
|
|
1861 |
|
|
|
1862 |
}
|
|
|
1863 |
|
|
|
1864 |
/**
|
|
|
1865 |
*
|
|
|
1866 |
* @throws Exception
|
|
|
1867 |
*/
|
|
|
1868 |
private void copyMedia(String newEntityId, String oldEntityId, Media media) throws Exception {
|
|
|
1869 |
String mediaDirPath = Utils.CONTENT_DB_PATH + "media" + File.separator + newEntityId;
|
|
|
1870 |
File mediaDir = new File(mediaDirPath);
|
|
|
1871 |
if(!mediaDir.exists()) {
|
|
|
1872 |
mediaDir.mkdir();
|
|
|
1873 |
}
|
|
|
1874 |
|
|
|
1875 |
String mediaFilePath = mediaDirPath + File.separator + media.getFileName();
|
|
|
1876 |
String oldMediaFilePath = media.getLocation();
|
|
|
1877 |
|
|
|
1878 |
File mediaFile = new File(mediaFilePath);
|
|
|
1879 |
mediaFile.createNewFile();
|
|
|
1880 |
|
|
|
1881 |
File oldMediaFile = new File(oldMediaFilePath);
|
|
|
1882 |
|
|
|
1883 |
InputStream in = new FileInputStream(oldMediaFile);
|
|
|
1884 |
|
|
|
1885 |
// appending output stream
|
|
|
1886 |
// @rajveer : replacing the existing file
|
|
|
1887 |
OutputStream out = new FileOutputStream(mediaFile);
|
|
|
1888 |
|
|
|
1889 |
try {
|
|
|
1890 |
IOUtils.copy(in, out);
|
|
|
1891 |
}
|
|
|
1892 |
finally {
|
|
|
1893 |
IOUtils.closeQuietly(in);
|
|
|
1894 |
IOUtils.closeQuietly(out);
|
|
|
1895 |
}
|
|
|
1896 |
media.setLocation(mediaFilePath);
|
|
|
1897 |
}
|
| 5396 |
amit.gupta |
1898 |
|
|
|
1899 |
private void migrateHeadSetBack() throws Exception {
|
|
|
1900 |
Map<Long, Long>migratorMap = new HashMap<Long, Long>();
|
|
|
1901 |
migratorMap.put(77777000L,1000291L);
|
|
|
1902 |
migratorMap.put(77777001L,1000292L);
|
|
|
1903 |
migratorMap.put(77777002L,1000293L);
|
|
|
1904 |
migratorMap.put(77777003L,1000294L);
|
|
|
1905 |
migratorMap.put(77777004L,1000295L);
|
|
|
1906 |
migratorMap.put(77777005L,1000296L);
|
|
|
1907 |
migratorMap.put(77777006L,1000297L);
|
|
|
1908 |
migratorMap.put(77777007L,1000298L);
|
|
|
1909 |
migratorMap.put(77777008L,1000299L);
|
|
|
1910 |
migratorMap.put(77777009L,1000300L);
|
|
|
1911 |
migratorMap.put(77777010L,1000301L);
|
|
|
1912 |
migratorMap.put(77777011L,1000302L);
|
|
|
1913 |
migratorMap.put(77777012L,1000303L);
|
|
|
1914 |
migratorMap.put(77777013L,1000304L);
|
|
|
1915 |
migratorMap.put(77777014L,1000305L);
|
|
|
1916 |
migratorMap.put(77777015L,1000306L);
|
|
|
1917 |
migratorMap.put(77777016L,1000351L);
|
|
|
1918 |
migratorMap.put(77777017L,1000352L);
|
|
|
1919 |
migratorMap.put(77777018L,1000353L);
|
|
|
1920 |
migratorMap.put(77777019L,1000363L);
|
|
|
1921 |
migratorMap.put(77777020L,1000364L);
|
|
|
1922 |
migratorMap.put(77777021L,1000365L);
|
|
|
1923 |
migratorMap.put(77777022L,1000425L);
|
|
|
1924 |
migratorMap.put(77777023L,1000426L);
|
|
|
1925 |
migratorMap.put(77777024L,1000430L);
|
|
|
1926 |
migratorMap.put(77777025L,1000434L);
|
|
|
1927 |
migratorMap.put(77777026L,1000435L);
|
|
|
1928 |
migratorMap.put(77777027L,1000436L);
|
|
|
1929 |
migratorMap.put(77777028L,1000437L);
|
|
|
1930 |
migratorMap.put(77777029L,1000438L);
|
|
|
1931 |
migratorMap.put(77777030L,1000439L);
|
|
|
1932 |
migratorMap.put(77777031L,1000440L);
|
|
|
1933 |
migratorMap.put(77777032L,1000441L);
|
|
|
1934 |
migratorMap.put(77777033L,1000442L);
|
|
|
1935 |
migratorMap.put(77777034L,1000443L);
|
|
|
1936 |
migratorMap.put(77777035L,1000444L);
|
|
|
1937 |
migratorMap.put(77777036L,1000445L);
|
|
|
1938 |
migratorMap.put(77777037L,1000446L);
|
|
|
1939 |
migratorMap.put(77777038L,1000447L);
|
|
|
1940 |
migratorMap.put(77777039L,1000449L);
|
|
|
1941 |
migratorMap.put(77777040L,1000450L);
|
|
|
1942 |
migratorMap.put(77777041L,1000451L);
|
|
|
1943 |
migratorMap.put(77777042L,1000452L);
|
|
|
1944 |
migratorMap.put(77777043L,1000453L);
|
|
|
1945 |
migratorMap.put(77777044L,1000454L);
|
|
|
1946 |
migratorMap.put(77777045L,1000455L);
|
|
|
1947 |
migratorMap.put(77777046L,1000518L);
|
|
|
1948 |
migratorMap.put(77777047L,1000521L);
|
|
|
1949 |
migratorMap.put(77777048L,1000572L);
|
|
|
1950 |
migratorMap.put(77777049L,1000575L);
|
|
|
1951 |
migratorMap.put(77777050L,1000623L);
|
|
|
1952 |
migratorMap.put(77777051L,1000625L);
|
|
|
1953 |
migratorMap.put(77777052L,1000626L);
|
|
|
1954 |
migratorMap.put(77777053L,1000627L);
|
|
|
1955 |
migratorMap.put(77777054L,1000628L);
|
|
|
1956 |
migratorMap.put(77777055L,1000874L);
|
|
|
1957 |
migratorMap.put(77777056L,1001200L);
|
|
|
1958 |
migratorMap.put(77777057L,1001375L);
|
|
|
1959 |
migratorMap.put(77777058L,1001376L);
|
|
|
1960 |
migratorMap.put(77777059L,1001378L);
|
|
|
1961 |
migratorMap.put(77777060L,1001382L);
|
|
|
1962 |
migratorMap.put(77777061L,1001808L);
|
|
|
1963 |
migratorMap.put(77777062L,1001809L);
|
|
|
1964 |
migratorMap.put(77777063L,1001810L);
|
|
|
1965 |
migratorMap.put(77777064L,1001811L);
|
|
|
1966 |
migratorMap.put(77777065L,1001812L);
|
|
|
1967 |
migratorMap.put(77777066L,1001814L);
|
|
|
1968 |
migratorMap.put(77777067L,1001815L);
|
|
|
1969 |
migratorMap.put(77777068L,1001816L);
|
|
|
1970 |
migratorMap.put(77777069L,1001817L);
|
|
|
1971 |
migratorMap.put(77777070L,1001818L);
|
|
|
1972 |
migratorMap.put(77777071L,1001819L);
|
|
|
1973 |
migratorMap.put(77777072L,1001820L);
|
|
|
1974 |
migratorMap.put(77777073L,1001821L);
|
|
|
1975 |
migratorMap.put(77777074L,1001822L);
|
|
|
1976 |
migratorMap.put(77777075L,1001823L);
|
|
|
1977 |
migratorMap.put(77777076L,1001824L);
|
|
|
1978 |
migratorMap.put(77777077L,1001825L);
|
|
|
1979 |
migratorMap.put(77777078L,1002318L);
|
|
|
1980 |
migratorMap.put(77777079L,1002320L);
|
|
|
1981 |
migratorMap.put(77777080L,1003852L);
|
|
|
1982 |
migratorMap.put(77777081L,1003853L);
|
|
|
1983 |
migratorMap.put(77777082L,1003854L);
|
|
|
1984 |
migratorMap.put(77777083L,1003855L);
|
|
|
1985 |
migratorMap.put(77777084L,1003856L);
|
|
|
1986 |
migratorMap.put(77777085L,1003857L);
|
|
|
1987 |
migratorMap.put(77777086L,1003916L);
|
|
|
1988 |
migratorMap.put(77777087L,1003917L);
|
|
|
1989 |
migratorMap.put(77777088L,1003918L);
|
|
|
1990 |
migratorMap.put(77777089L,1003919L);
|
|
|
1991 |
migratorMap.put(77777090L,1003920L);
|
|
|
1992 |
migratorMap.put(77777091L,1003921L);
|
|
|
1993 |
migratorMap.put(77777092L,1003922L);
|
|
|
1994 |
migratorMap.put(77777093L,1003923L);
|
|
|
1995 |
migratorMap.put(77777094L,1003924L);
|
|
|
1996 |
migratorMap.put(77777095L,1003925L);
|
|
|
1997 |
migratorMap.put(77777096L,1003926L);
|
|
|
1998 |
migratorMap.put(77777097L,1003927L);
|
|
|
1999 |
migratorMap.put(77777098L,1004087L);
|
|
|
2000 |
migratorMap.put(77777099L,1004088L);
|
|
|
2001 |
migratorMap.put(77777100L,1004089L);
|
|
|
2002 |
migratorMap.put(77777101L,1004134L);
|
|
|
2003 |
migratorMap.put(77777102L,1004135L);
|
|
|
2004 |
migratorMap.put(77777103L,1004139L);
|
|
|
2005 |
|
|
|
2006 |
for(Map.Entry<Long, Long> entry : migratorMap.entrySet()) {
|
|
|
2007 |
Long newId = entry.getKey();
|
|
|
2008 |
Long validId = entry.getValue();
|
|
|
2009 |
Entity entity = CreationUtils.getEntity(newId);
|
|
|
2010 |
EntityState es = CreationUtils.getEntityState(newId);
|
|
|
2011 |
Slide sl = entity.getSlide(130130);
|
| 5397 |
amit.gupta |
2012 |
/*entity.setID(validId);
|
|
|
2013 |
es.setID(validId);*/
|
| 5396 |
amit.gupta |
2014 |
|
| 7129 |
amit.gupta |
2015 |
|
| 5370 |
amit.gupta |
2016 |
|
| 5396 |
amit.gupta |
2017 |
CreationUtils.updateEntity(entity);
|
|
|
2018 |
CreationUtils.updateEntityState(es);
|
|
|
2019 |
CreationUtils.deleteEntity(newId);
|
|
|
2020 |
System.out.println(validId + " : " + es.getCategoryID() + ", removed entity id:" + newId);
|
|
|
2021 |
|
|
|
2022 |
}
|
|
|
2023 |
|
|
|
2024 |
}
|
| 7129 |
amit.gupta |
2025 |
|
|
|
2026 |
private void migrateTabletsBack() throws Exception {
|
| 7131 |
amit.gupta |
2027 |
//This entity is created after migration have to be deleted. Vrinda have to rmk it
|
|
|
2028 |
CreationUtils.deleteEntity(1006812);
|
| 7129 |
amit.gupta |
2029 |
Date now = new Date();
|
|
|
2030 |
Collection<Entity> entities = CreationUtils.getEntities(20010);
|
|
|
2031 |
//entities = (List<Entity>)this.clone(entities);
|
|
|
2032 |
for (Entity entity : entities) {
|
|
|
2033 |
long entityId = entity.getID();
|
|
|
2034 |
if(entityId>9999999){
|
|
|
2035 |
long oldEntityId = entityId%10000000;
|
|
|
2036 |
System.out.println(oldEntityId);
|
|
|
2037 |
EntityState es = CreationUtils.getEntityState(entityId);
|
|
|
2038 |
if(es != null) {
|
|
|
2039 |
if (es.getStatus().equals(EntityStatus.READY) || es.getStatus().equals(EntityStatus.COMPLETE)){
|
|
|
2040 |
es.setStatus(EntityStatus.READY);
|
|
|
2041 |
es.setMerkedReadyOn(now);
|
|
|
2042 |
}
|
|
|
2043 |
es.setID(oldEntityId);
|
|
|
2044 |
entity.setID(oldEntityId);
|
|
|
2045 |
entity.setCategoryID(10010);
|
|
|
2046 |
es.setCategoryID(10010);
|
|
|
2047 |
CreationUtils.updateEntity(entity);
|
|
|
2048 |
CreationUtils.updateEntityState(es);
|
|
|
2049 |
CreationUtils.deleteEntity(entityId);
|
|
|
2050 |
System.out.println(entityId + " moved back");
|
|
|
2051 |
|
|
|
2052 |
} else {
|
|
|
2053 |
CreationUtils.deleteEntity(entityId);
|
|
|
2054 |
System.out.println("Deleted " + entityId + " due to incomplete tablets");
|
|
|
2055 |
}
|
|
|
2056 |
}else {
|
|
|
2057 |
entity.setCategoryID(10010);
|
|
|
2058 |
EntityState es = CreationUtils.getEntityState(entityId);
|
|
|
2059 |
es.setCategoryID(10010);
|
|
|
2060 |
CreationUtils.updateEntity(entity);
|
|
|
2061 |
CreationUtils.updateEntityState(es);
|
|
|
2062 |
}
|
|
|
2063 |
|
|
|
2064 |
|
|
|
2065 |
}
|
|
|
2066 |
|
|
|
2067 |
}
|
| 5760 |
amit.gupta |
2068 |
|
|
|
2069 |
public String getTitle(Entity entity){
|
|
|
2070 |
String brand = entity.getBrand();
|
|
|
2071 |
String modelName = entity.getModelName();
|
|
|
2072 |
String modelNumber = entity.getModelNumber();
|
|
|
2073 |
String titleString = "";
|
|
|
2074 |
if(StringUtils.isEmpty(modelName)){
|
|
|
2075 |
titleString = brand + " " + modelNumber + " Price in India | Specifications, Features and Reviews";
|
|
|
2076 |
}else {
|
|
|
2077 |
titleString = brand + " " + modelName + " Price in India | " + modelNumber + " Specifications, Features and Reviews";
|
|
|
2078 |
}
|
|
|
2079 |
return titleString;
|
|
|
2080 |
}
|
|
|
2081 |
|
|
|
2082 |
public String getMetaDescription(ExpandedEntity expEntity){
|
|
|
2083 |
Category parentCategory= expEntity.getCategory().getParentCategory();
|
|
|
2084 |
String categoryName = parentCategory.getLabel();
|
|
|
2085 |
if (parentCategory.getID()== Utils.MOBILE_ACCESSORIES_CATEGORY){
|
|
|
2086 |
categoryName = expEntity.getCategory().getLabel();
|
|
|
2087 |
}
|
|
|
2088 |
String template = "Buy {0} {1} {2} at $minPriceItem.getSellingPrice(). All {3} are 100% Original and carry full Manufacturers Warranty since we procure directly from the Brand. Free Next Day Delivery.";
|
|
|
2089 |
return MessageFormat.format(template, expEntity.getBrand(), expEntity.getModelName(), expEntity.getModelNumber(), categoryName.toLowerCase());
|
|
|
2090 |
}
|
| 7037 |
amit.gupta |
2091 |
|
|
|
2092 |
public void migrateTablets() throws Exception {
|
|
|
2093 |
|
|
|
2094 |
//Starting entity id for new Category with 10000
|
|
|
2095 |
Collection<Entity> entities = CreationUtils.getEntities(10010);
|
|
|
2096 |
long newCounter;
|
|
|
2097 |
//entities = (List<Entity>)this.clone(entities);
|
|
|
2098 |
for (Entity entity : entities) {
|
|
|
2099 |
long entityId = entity.getID();
|
|
|
2100 |
newCounter = Long.parseLong("1" + String.valueOf(entityId));
|
|
|
2101 |
Entity newEntity = new Entity(newCounter, 20010);
|
|
|
2102 |
try {
|
|
|
2103 |
List<Slide> entitySlides = entity.getSlides();
|
|
|
2104 |
if (entity == null || entitySlides == null) {
|
|
|
2105 |
continue;
|
|
|
2106 |
}
|
|
|
2107 |
List<Slide> newEntitySlides = new ArrayList<Slide>();
|
|
|
2108 |
/*Slide introSlide = entity.getSlide(130001);
|
|
|
2109 |
Slide summarySlide = entity.getSlide(130054);
|
|
|
2110 |
Slide packageContents = entity.getSlide(130025);*/
|
|
|
2111 |
for (Slide slide : entitySlides) {
|
|
|
2112 |
if (Arrays.asList(130054L, 130025L, 130001L).contains(slide.getSlideDefinitionID())) {
|
|
|
2113 |
slide=(Slide)this.clone(slide);
|
|
|
2114 |
newEntitySlides.add(slide);
|
|
|
2115 |
}
|
|
|
2116 |
FreeformContent ffc1 = slide.getFreeformContent();
|
|
|
2117 |
if(ffc1 != null){
|
|
|
2118 |
Map<String, Media> mediaMap = ffc1.getMedias();
|
|
|
2119 |
if(mediaMap==null){
|
|
|
2120 |
continue;
|
|
|
2121 |
}
|
|
|
2122 |
for(Media media : mediaMap.values()){
|
|
|
2123 |
if(media.getType().equals(Type.IMAGE) || media.getType().equals(Type.DOCUMENT)){
|
|
|
2124 |
copyMedia(String.valueOf(newCounter), String.valueOf(entityId),media);
|
|
|
2125 |
}
|
|
|
2126 |
}
|
|
|
2127 |
}
|
|
|
2128 |
}
|
|
|
2129 |
|
|
|
2130 |
List<Long> newSlideSequence = new ArrayList<Long>();
|
|
|
2131 |
newSlideSequence.add(130001L);
|
|
|
2132 |
newSlideSequence.add(130054L);
|
|
|
2133 |
newSlideSequence.add(130172L);
|
|
|
2134 |
newSlideSequence.add(130173L);
|
|
|
2135 |
newSlideSequence.add(130174L);
|
|
|
2136 |
newSlideSequence.add(130175L);
|
|
|
2137 |
newSlideSequence.add(130176L);
|
|
|
2138 |
newSlideSequence.add(130177L);
|
|
|
2139 |
newSlideSequence.add(130178L);
|
|
|
2140 |
newSlideSequence.add(130180L);
|
|
|
2141 |
newSlideSequence.add(130183L);
|
|
|
2142 |
newSlideSequence.add(130025L);
|
|
|
2143 |
|
|
|
2144 |
newEntity.setSlideSequence(newSlideSequence);
|
|
|
2145 |
newEntity.setBrand(entity.getBrand());
|
|
|
2146 |
newEntity.setModelName(entity.getModelName());
|
|
|
2147 |
newEntity.setModelNumber(entity.getModelNumber());
|
|
|
2148 |
//entitySlides.remove(featureSlide);
|
|
|
2149 |
newEntity.setSlides(newEntitySlides);
|
|
|
2150 |
EntityState es = new EntityState(newCounter, 20010, "admin");
|
|
|
2151 |
es.setBrand(entity.getBrand());
|
|
|
2152 |
es.setModelName(entity.getModelName());
|
|
|
2153 |
es.setModelNumber(entity.getModelNumber());
|
|
|
2154 |
CreationUtils.createEntity(newEntity, es);
|
|
|
2155 |
System.out.println("New entity : " + newCounter + " created using : " + entityId);
|
|
|
2156 |
System.out.println(CreationUtils.getEntity(newCounter));
|
|
|
2157 |
newCounter++;
|
|
|
2158 |
}catch(Exception e){
|
|
|
2159 |
System.out.println("Could not migrate " + entityId);
|
|
|
2160 |
}
|
|
|
2161 |
}
|
|
|
2162 |
|
|
|
2163 |
}
|
| 5396 |
amit.gupta |
2164 |
|
| 7111 |
amit.gupta |
2165 |
public void migrateImagesInTablets() throws Exception {
|
|
|
2166 |
|
|
|
2167 |
//Starting entity id for new Category with 10000
|
|
|
2168 |
Collection<Entity> entities = CreationUtils.getEntities(10010);
|
|
|
2169 |
long newCounter;
|
|
|
2170 |
//entities = (List<Entity>)this.clone(entities);
|
|
|
2171 |
for (Entity entity : entities) {
|
|
|
2172 |
long entityId = entity.getID();
|
|
|
2173 |
newCounter = Long.parseLong("1" + String.valueOf(entityId));
|
|
|
2174 |
Entity newEntity = CreationUtils.getEntity(newCounter);
|
|
|
2175 |
try {
|
|
|
2176 |
if (newEntity == null) {
|
|
|
2177 |
continue;
|
|
|
2178 |
}
|
|
|
2179 |
Slide introSlide = newEntity.getSlide(130001L);
|
|
|
2180 |
Slide looknfeelSlide = entity.getSlide(130002L);
|
|
|
2181 |
/*
|
|
|
2182 |
* Slide introSlide = entity.getSlide(130001); Slide
|
|
|
2183 |
* summarySlide = entity.getSlide(130054); Slide packageContents
|
|
|
2184 |
* = entity.getSlide(130025);
|
|
|
2185 |
*/
|
| 7037 |
amit.gupta |
2186 |
|
| 7111 |
amit.gupta |
2187 |
if (looknfeelSlide != null) {
|
|
|
2188 |
FreeformContent ffc1 = looknfeelSlide.getFreeformContent();
|
|
|
2189 |
if (ffc1 != null) {
|
|
|
2190 |
Map<String, Media> mediaMap = ffc1.getMedias();
|
|
|
2191 |
if (mediaMap == null) {
|
|
|
2192 |
continue;
|
|
|
2193 |
}
|
|
|
2194 |
FreeformContent introFfc = introSlide
|
|
|
2195 |
.getFreeformContent();
|
| 7123 |
amit.gupta |
2196 |
Map<String, Media> introMediaMap = new LinkedHashMap<String, Media>();
|
|
|
2197 |
introFfc.setMedias(introMediaMap);
|
| 7111 |
amit.gupta |
2198 |
Set<String> introMediaMapKeys = introMediaMap.keySet();
|
| 7123 |
amit.gupta |
2199 |
for (Map.Entry<String, Media> entry : mediaMap.entrySet()) {
|
| 7111 |
amit.gupta |
2200 |
Media entryValue = entry.getValue();
|
|
|
2201 |
String entryKey = entry.getKey();
|
|
|
2202 |
if (!introMediaMapKeys.contains(entryKey)) {
|
|
|
2203 |
introMediaMap.put(entryKey,
|
|
|
2204 |
(Media) clone(entryValue));
|
|
|
2205 |
if (entryValue.getType().equals(Type.IMAGE)
|
|
|
2206 |
|| entryValue.equals(Type.DOCUMENT)) {
|
|
|
2207 |
try {
|
|
|
2208 |
copyMedia(String.valueOf(newCounter),
|
|
|
2209 |
String.valueOf(entityId),
|
|
|
2210 |
entryValue);
|
|
|
2211 |
} catch (Exception e) {
|
|
|
2212 |
System.out
|
|
|
2213 |
.println("could not copy file "
|
|
|
2214 |
+ entityId);
|
|
|
2215 |
}
|
|
|
2216 |
}
|
|
|
2217 |
}
|
|
|
2218 |
}
|
|
|
2219 |
}
|
|
|
2220 |
}
|
|
|
2221 |
|
|
|
2222 |
CreationUtils.updateEntity(newEntity);
|
|
|
2223 |
System.out.println("New entity : " + newCounter
|
|
|
2224 |
+ " created using : " + entityId);
|
|
|
2225 |
} catch (Exception e) {
|
|
|
2226 |
e.printStackTrace();
|
|
|
2227 |
System.out.println("Could not migrate " + entityId);
|
|
|
2228 |
}
|
|
|
2229 |
}
|
|
|
2230 |
|
| 7917 |
amit.gupta |
2231 |
|
| 457 |
rajveer |
2232 |
}
|
| 7917 |
amit.gupta |
2233 |
private void miscilleniousPopulate() throws Exception{
|
|
|
2234 |
|
|
|
2235 |
DefinitionsContainer defContainer = Catalog.getInstance().getDefinitionsContainer();
|
|
|
2236 |
|
|
|
2237 |
//Get All Enum Values of Communication facilities 70114;
|
|
|
2238 |
Map <Long, Entity> allEntities = CreationUtils.getEntities();
|
|
|
2239 |
/*Map <Long, Entity> allEntities =new HashMap<Long, Entity>();
|
|
|
2240 |
allEntities.put(1000069l, CreationUtils.getEntity(1000069l));*/
|
|
|
2241 |
for (Map.Entry<Long, Entity> entry:allEntities.entrySet()){
|
|
|
2242 |
Entity entity = entry.getValue();
|
|
|
2243 |
Long categoryId = entity.getCategoryID();
|
|
|
2244 |
EntityState es = CreationUtils.getEntityState(entity.getID());
|
|
|
2245 |
if ((categoryId == 10002 || categoryId == 10003 || categoryId == 10004 || categoryId == 10005)
|
|
|
2246 |
&& (es != null && es.getStatus().equals(EntityStatus.READY))) {
|
|
|
2247 |
ExpandedEntity expEntity = new ExpandedEntity(entity);
|
|
|
2248 |
Slide miscSlide = expEntity.getSlide(130024l);
|
| 7932 |
amit.gupta |
2249 |
if(miscSlide != null) {
|
|
|
2250 |
List<Feature> miscFeatures = miscSlide.getFeatures();
|
|
|
2251 |
if(CollectionUtils.isNotEmpty(miscFeatures)){
|
| 7933 |
amit.gupta |
2252 |
Iterator<Feature> iter = miscFeatures.iterator();
|
|
|
2253 |
while(iter.hasNext()) {
|
|
|
2254 |
Feature f =iter.next();
|
|
|
2255 |
if (f.getFeatureDefinitionID() == 120484l || f.getFeatureDefinitionID() == 120483l || f.getFeatureDefinitionID() == 1204821 || f.getFeatureDefinitionID() == 120481l){
|
| 7932 |
amit.gupta |
2256 |
List<Bullet> bulletList = f.getBullets();
|
|
|
2257 |
PrimitiveDataObject b = (PrimitiveDataObject)bulletList.get(0).getDataObject();
|
|
|
2258 |
String bulletValue = b.getValue();
|
|
|
2259 |
String newString = bulletValue;
|
| 7933 |
amit.gupta |
2260 |
if(bulletValue.startsWith(", ") || bulletValue.contains(",,") || bulletValue.contains("<li>")){
|
| 7932 |
amit.gupta |
2261 |
System.out.println(entity.getID());
|
|
|
2262 |
bulletList = new ArrayList<Bullet>();
|
| 7933 |
amit.gupta |
2263 |
newString = bulletValue.replaceAll("<li>|</li>|<ul>|</ul>", ",").replaceAll(",,", ",").replaceAll(", ,", ", ").replaceAll(", $", "");
|
|
|
2264 |
|
|
|
2265 |
System.out.println(newString);
|
| 7932 |
amit.gupta |
2266 |
if(newString.startsWith(", ") ){
|
|
|
2267 |
newString = newString.replaceFirst(", ", "");
|
| 7917 |
amit.gupta |
2268 |
}
|
| 7932 |
amit.gupta |
2269 |
bulletList.add(new Bullet(new PrimitiveDataObject(newString)));
|
|
|
2270 |
f.setBullets(bulletList);
|
|
|
2271 |
System.out.println(newString);
|
| 7917 |
amit.gupta |
2272 |
}
|
| 7932 |
amit.gupta |
2273 |
if ( newString.equals(" ") || newString.equals("") || newString.equals(" ") || newString.equals(" ")){
|
| 7933 |
amit.gupta |
2274 |
iter.remove();
|
| 7917 |
amit.gupta |
2275 |
}
|
|
|
2276 |
}
|
| 7932 |
amit.gupta |
2277 |
}
|
| 7933 |
amit.gupta |
2278 |
CreationUtils.updateEntity(entity);
|
|
|
2279 |
touchEntityState(entity.getID());
|
| 7917 |
amit.gupta |
2280 |
}
|
|
|
2281 |
}
|
| 7932 |
amit.gupta |
2282 |
//touchEntityState(entity.getID());
|
|
|
2283 |
}
|
| 7917 |
amit.gupta |
2284 |
}
|
|
|
2285 |
}
|
| 7973 |
amit.gupta |
2286 |
|
|
|
2287 |
private void step2() throws Exception {
|
|
|
2288 |
//Get All Enum Values of Communication facilities 70114;
|
| 7975 |
amit.gupta |
2289 |
//Map <Long, Entity> allEntities = CreationUtils.getEntities();
|
|
|
2290 |
Map <Long, Entity> allEntities =new HashMap<Long, Entity>();
|
|
|
2291 |
allEntities.put(1007937l, CreationUtils.getEntity(1007937l));
|
|
|
2292 |
allEntities.put(1007932l, CreationUtils.getEntity(1007932l));
|
|
|
2293 |
allEntities.put(1007930l, CreationUtils.getEntity(1007930l));
|
|
|
2294 |
allEntities.put(1007934l, CreationUtils.getEntity(1007934l));
|
|
|
2295 |
allEntities.put(1007936l, CreationUtils.getEntity(1007936l));
|
|
|
2296 |
allEntities.put(1007935l, CreationUtils.getEntity(1007935l));
|
| 7973 |
amit.gupta |
2297 |
for (Map.Entry<Long, Entity> entry:allEntities.entrySet()){
|
|
|
2298 |
Entity entity = entry.getValue();
|
|
|
2299 |
Long categoryId = entity.getCategoryID();
|
|
|
2300 |
EntityState es = CreationUtils.getEntityState(entity.getID());
|
| 7975 |
amit.gupta |
2301 |
if ((categoryId == 10002 || categoryId == 10003 || categoryId == 10004 || categoryId == 10005) && es != null ) {
|
| 7973 |
amit.gupta |
2302 |
List<Slide> allSlides = entity.getSlides();
|
|
|
2303 |
Slide slMaps = entity.getSlide(130022l);
|
|
|
2304 |
Slide slConnectivity = (categoryId == 10005 ? entity.getSlide(130058l) : entity.getSlide(130007l));
|
|
|
2305 |
if(slConnectivity != null){
|
|
|
2306 |
if(slConnectivity.getSlideDefinitionID() ==130058l){
|
|
|
2307 |
Slide newSlide = new Slide(130007l);
|
|
|
2308 |
newSlide.setFeatures(slConnectivity.getFeatures());
|
|
|
2309 |
allSlides.remove(slConnectivity);
|
|
|
2310 |
allSlides.add(newSlide);
|
|
|
2311 |
slConnectivity = newSlide;
|
|
|
2312 |
|
|
|
2313 |
List<Long> slideSequence = entity.getSlideSequence();
|
|
|
2314 |
int index =slideSequence.indexOf(130058l);
|
|
|
2315 |
slideSequence.remove(index);;
|
|
|
2316 |
slideSequence.add(index, 130007l);
|
|
|
2317 |
}
|
|
|
2318 |
if(slMaps != null) {
|
|
|
2319 |
List<Feature> mapsFeatures = slMaps.getFeatures();
|
|
|
2320 |
allSlides.remove(slMaps);
|
|
|
2321 |
if(mapsFeatures != null){
|
|
|
2322 |
for (Feature mapsFeature : mapsFeatures){
|
|
|
2323 |
if(mapsFeature.getFeatureDefinitionID() == 120046l){
|
|
|
2324 |
slConnectivity.getFeatures().add(mapsFeature);
|
|
|
2325 |
break;
|
|
|
2326 |
}
|
|
|
2327 |
}
|
|
|
2328 |
|
|
|
2329 |
}
|
|
|
2330 |
}
|
|
|
2331 |
|
|
|
2332 |
}
|
|
|
2333 |
|
|
|
2334 |
Slide slKeyBoard = entity.getSlide(130026l);
|
|
|
2335 |
Slide slDisplay = entity.getSlide(130003l);
|
|
|
2336 |
Slide slSummary = entity.getSlide(130054l);
|
|
|
2337 |
Slide slLookNFeel = entity.getSlide(130002l);
|
|
|
2338 |
Feature hardkeysFeature = null;
|
|
|
2339 |
if (slKeyBoard != null) {
|
|
|
2340 |
List<Feature> keyBoardFeatures = slKeyBoard.getFeatures();
|
|
|
2341 |
Iterator<Feature> iter = keyBoardFeatures.iterator();
|
|
|
2342 |
while(iter.hasNext()){
|
|
|
2343 |
Feature feature = iter.next();
|
|
|
2344 |
if(feature.getFeatureDefinitionID() == 120010l){
|
| 7975 |
amit.gupta |
2345 |
if(slSummary!=null){
|
| 7984 |
amit.gupta |
2346 |
slSummary.getFeatures().add(feature);
|
| 7975 |
amit.gupta |
2347 |
}
|
| 7973 |
amit.gupta |
2348 |
iter.remove();
|
|
|
2349 |
}
|
|
|
2350 |
if(feature.getFeatureDefinitionID() == 120082l){
|
|
|
2351 |
slDisplay.getFeatures().add(feature);
|
|
|
2352 |
iter.remove();
|
|
|
2353 |
}
|
|
|
2354 |
if(feature.getFeatureDefinitionID() == 120009l){
|
|
|
2355 |
slLookNFeel.getFeatures().add(feature);
|
|
|
2356 |
iter.remove();
|
|
|
2357 |
}
|
|
|
2358 |
if(feature.getFeatureDefinitionID() == 120048l ){
|
|
|
2359 |
if(hardkeysFeature == null) {
|
|
|
2360 |
hardkeysFeature = feature;
|
|
|
2361 |
}else {
|
|
|
2362 |
if(feature.getBullets() != null){
|
|
|
2363 |
hardkeysFeature.getBullets().addAll(feature.getBullets());
|
|
|
2364 |
slLookNFeel.getFeatures().add(hardkeysFeature);
|
|
|
2365 |
}
|
|
|
2366 |
}
|
|
|
2367 |
iter.remove();
|
|
|
2368 |
}
|
|
|
2369 |
if(feature.getFeatureDefinitionID() == 120049l ){
|
|
|
2370 |
if(hardkeysFeature == null){
|
|
|
2371 |
hardkeysFeature = new Feature(120048l);
|
|
|
2372 |
hardkeysFeature.setBullets(feature.getBullets());
|
|
|
2373 |
} else {
|
|
|
2374 |
if(feature.getBullets() != null){
|
|
|
2375 |
hardkeysFeature.getBullets().addAll(feature.getBullets());
|
|
|
2376 |
slLookNFeel.getFeatures().add(hardkeysFeature);
|
|
|
2377 |
}
|
|
|
2378 |
}
|
|
|
2379 |
iter.remove();
|
|
|
2380 |
}
|
|
|
2381 |
}
|
|
|
2382 |
|
|
|
2383 |
allSlides.remove(slKeyBoard);
|
|
|
2384 |
}
|
|
|
2385 |
CreationUtils.updateEntity(entity);
|
| 7975 |
amit.gupta |
2386 |
//touchEntityState(entity.getID());
|
| 7973 |
amit.gupta |
2387 |
}
|
|
|
2388 |
}
|
|
|
2389 |
|
|
|
2390 |
}
|
| 7984 |
amit.gupta |
2391 |
|
|
|
2392 |
private void step4() throws Exception {
|
|
|
2393 |
//Get All Enum Values of Communication facilities 70114;
|
|
|
2394 |
Map <Long, Entity> allEntities = CreationUtils.getEntities();
|
|
|
2395 |
/*Map <Long, Entity> allEntities = new HashMap<Long, Entity>();
|
|
|
2396 |
allEntities.put(1002529l, CreationUtils.getEntity(1002529l));
|
|
|
2397 |
allEntities.put(1007932l, CreationUtils.getEntity(1007932l));
|
|
|
2398 |
allEntities.put(1007930l, CreationUtils.getEntity(1007930l));
|
|
|
2399 |
allEntities.put(1007934l, CreationUtils.getEntity(1007934l));
|
|
|
2400 |
allEntities.put(1007936l, CreationUtils.getEntity(1007936l));
|
|
|
2401 |
allEntities.put(1007935l, CreationUtils.getEntity(1007935l));*/
|
|
|
2402 |
for (Map.Entry<Long, Entity> entry:allEntities.entrySet()){
|
|
|
2403 |
Entity entity = entry.getValue();
|
|
|
2404 |
Long categoryId = entity.getCategoryID();
|
|
|
2405 |
EntityState es = CreationUtils.getEntityState(entity.getID());
|
|
|
2406 |
if ((categoryId == 10002 || categoryId == 10003 || categoryId == 10004 || categoryId == 10005) && es != null && !es.getStatus().equals(EntityStatus.UNASSIGNED)) {
|
|
|
2407 |
List<Slide> allSlides = entity.getSlides();
|
|
|
2408 |
if(allSlides != null){
|
|
|
2409 |
for(Slide slide:allSlides) {
|
|
|
2410 |
if(slide!=null){
|
|
|
2411 |
List <Feature> features = slide.getFeatures();
|
|
|
2412 |
Iterator<Feature> fIterator = features.iterator();
|
|
|
2413 |
while (fIterator.hasNext()){
|
|
|
2414 |
Feature f = fIterator.next();
|
|
|
2415 |
long fId = f.getFeatureDefinitionID();
|
|
|
2416 |
if(fId == 120011 || fId == 120020 || fId == 120051 || fId == 120025 || fId == 120056 || fId == 120216 || fId == 120045 || fId == 120010){
|
|
|
2417 |
fIterator.remove();
|
|
|
2418 |
}
|
|
|
2419 |
if(fId==120144){
|
|
|
2420 |
String value = "Adobe flash player";
|
|
|
2421 |
List<Bullet> flashb = f.getBullets();
|
|
|
2422 |
if(flashb !=null && flashb.size() > 0){
|
|
|
2423 |
value = ((PrimitiveDataObject)flashb.get(0).getDataObject()).getValue();
|
|
|
2424 |
}
|
|
|
2425 |
Slide miscSlide1 = entity.getSlide(130024l);
|
|
|
2426 |
if(miscSlide1 != null){
|
|
|
2427 |
List <Feature> mfeatures = miscSlide1.getFeatures();
|
|
|
2428 |
Iterator<Feature> mIterator = mfeatures.iterator();
|
|
|
2429 |
while (mIterator.hasNext()){
|
|
|
2430 |
Feature mf = mIterator.next();
|
|
|
2431 |
if(mf != null){
|
|
|
2432 |
if(mf.getFeatureDefinitionID() == 120484l){
|
|
|
2433 |
Bullet b = mf.getBullets().get(0);
|
|
|
2434 |
String finalValue = ((PrimitiveDataObject)b.getDataObject()).getValue() + ", " + value;
|
|
|
2435 |
b.setDataObject(new PrimitiveDataObject(finalValue));
|
|
|
2436 |
}
|
|
|
2437 |
}
|
|
|
2438 |
}
|
|
|
2439 |
} else {
|
|
|
2440 |
System.out.println("no misc for entity : " + entity.getID());
|
|
|
2441 |
}
|
|
|
2442 |
fIterator.remove();
|
|
|
2443 |
}
|
|
|
2444 |
}
|
|
|
2445 |
}
|
|
|
2446 |
}
|
|
|
2447 |
try{
|
|
|
2448 |
CreationUtils.updateEntity(entity);
|
|
|
2449 |
}catch (Exception e){
|
|
|
2450 |
System.out.println("Could not update entity : " + entity.getID());
|
|
|
2451 |
}
|
|
|
2452 |
touchEntityState(entity.getID());
|
|
|
2453 |
}
|
|
|
2454 |
}
|
|
|
2455 |
}
|
|
|
2456 |
}
|
| 7997 |
amit.gupta |
2457 |
private void step6() throws Exception {
|
|
|
2458 |
//Get All Enum Values of Communication facilities 70114;
|
| 8014 |
amit.gupta |
2459 |
DefinitionsContainer defc = Catalog.getInstance().getDefinitionsContainer();
|
|
|
2460 |
Map <Long, Long> allEntities = getValues();
|
|
|
2461 |
for (Map.Entry<Long, Long> entry:allEntities.entrySet()){
|
|
|
2462 |
Long entityId = entry.getKey();
|
|
|
2463 |
Entity entity = CreationUtils.getEntity(entityId);
|
| 7997 |
amit.gupta |
2464 |
Long categoryId = entity.getCategoryID();
|
| 8014 |
amit.gupta |
2465 |
boolean found = false;
|
| 7997 |
amit.gupta |
2466 |
//System.out.println("entity : " + entity.getID());
|
|
|
2467 |
EntityState es = CreationUtils.getEntityState(entity.getID());
|
|
|
2468 |
if(!es.getStatus().equals(EntityStatus.UNASSIGNED)) {
|
|
|
2469 |
if ((categoryId == 10002 || categoryId == 10003 || categoryId == 10004 || categoryId == 10005)
|
|
|
2470 |
&& es != null) {
|
| 8009 |
amit.gupta |
2471 |
|
| 7997 |
amit.gupta |
2472 |
Slide videoSlide = entity.getSlide(130031l);
|
|
|
2473 |
if(videoSlide != null){
|
| 8014 |
amit.gupta |
2474 |
List<Feature> features = videoSlide.getFeatures();
|
|
|
2475 |
if(features != null) {
|
|
|
2476 |
Iterator<Feature> iter = features.iterator();
|
|
|
2477 |
while(iter.hasNext()){
|
|
|
2478 |
Feature f = iter.next();
|
|
|
2479 |
if(f.getFeatureDefinitionID() == 120475l){
|
|
|
2480 |
found = true;
|
|
|
2481 |
if(!entry.getValue().equals(((EnumDataObject)f.getBullets().get(0).getDataObject()).getEnumValueID())){
|
|
|
2482 |
f.getBullets().get(0).setDataObject(new EnumDataObject(entry.getValue()));
|
|
|
2483 |
try{
|
|
|
2484 |
System.out.println("Recording feature updated:" + entityId);
|
|
|
2485 |
CreationUtils.updateEntity(entity);
|
|
|
2486 |
touchEntityState(entityId);
|
|
|
2487 |
}catch (Exception e){
|
|
|
2488 |
System.out.println("Could not update entity : " + entity.getID());
|
|
|
2489 |
}
|
|
|
2490 |
}
|
|
|
2491 |
break;
|
|
|
2492 |
}
|
| 8009 |
amit.gupta |
2493 |
}
|
| 8014 |
amit.gupta |
2494 |
|
|
|
2495 |
if(!found){
|
|
|
2496 |
Feature f = new Feature(120475l);
|
|
|
2497 |
f.setBullets(Arrays.asList(new Bullet(new EnumDataObject(entry.getValue()))));
|
|
|
2498 |
features.add(f);
|
|
|
2499 |
try{
|
|
|
2500 |
System.out.println("Recording feature created:" + entityId);
|
|
|
2501 |
CreationUtils.updateEntity(entity);
|
|
|
2502 |
touchEntityState(entityId);
|
|
|
2503 |
}catch (Exception e){
|
|
|
2504 |
System.out.println("Could not update entity : " + entity.getID());
|
|
|
2505 |
}
|
|
|
2506 |
}
|
| 7997 |
amit.gupta |
2507 |
}
|
|
|
2508 |
}
|
|
|
2509 |
}
|
|
|
2510 |
|
|
|
2511 |
}
|
|
|
2512 |
}
|
|
|
2513 |
}
|
| 8014 |
amit.gupta |
2514 |
|
|
|
2515 |
private Map<Long,Long> getValues() {
|
|
|
2516 |
try {
|
|
|
2517 |
Reader reader = new FileReader("/root/sample.json");
|
|
|
2518 |
return new Gson().fromJson(reader, new TypeToken<Map<Long,Long>>() {}.getType());
|
|
|
2519 |
} catch (FileNotFoundException e) {
|
|
|
2520 |
e.printStackTrace();
|
|
|
2521 |
return new HashMap<Long, Long>();
|
|
|
2522 |
}
|
|
|
2523 |
}
|
| 8077 |
amit.gupta |
2524 |
|
|
|
2525 |
private void reorderPhones() throws Exception {
|
|
|
2526 |
DefinitionsContainer defc = Catalog.getInstance().getDefinitionsContainer();
|
|
|
2527 |
List<Long> slideSequence = defc.getCategorySlideSequence().get(10003l);
|
|
|
2528 |
Map <Long, Entity> allEntities = CreationUtils.getEntities();
|
|
|
2529 |
for (Map.Entry<Long, Entity> entry:allEntities.entrySet()){
|
|
|
2530 |
Long entityId = entry.getKey();
|
|
|
2531 |
Entity entity = entry.getValue();
|
|
|
2532 |
Long categoryId = entity.getCategoryID();
|
|
|
2533 |
//System.out.println("entity : " + entity.getID());
|
|
|
2534 |
EntityState es = CreationUtils.getEntityState(entity.getID());
|
|
|
2535 |
if(!es.getStatus().equals(EntityStatus.UNASSIGNED)) {
|
|
|
2536 |
if ((categoryId == 10002 || categoryId == 10003 || categoryId == 10004 || categoryId == 10005)
|
|
|
2537 |
&& es != null) {
|
|
|
2538 |
entity.setSlideSequence(slideSequence);
|
|
|
2539 |
CreationUtils.updateEntity(entity);
|
|
|
2540 |
touchEntityState(entityId);
|
|
|
2541 |
}
|
|
|
2542 |
}
|
|
|
2543 |
}
|
|
|
2544 |
}
|
| 7111 |
amit.gupta |
2545 |
}
|
|
|
2546 |
|