Subversion Repositories SmartDukaan

Rev

Rev 11569 | Rev 12242 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11569 Rev 12230
Line 102... Line 102...
102
		// destinationDbPath = args[1];
102
		// destinationDbPath = args[1];
103
		// dryRun = args[2];
103
		// dryRun = args[2];
104
		// }
104
		// }
105
		//
105
		//
106
		ContentMigrator contentmigrator = new ContentMigrator(sourceDbPath,destinationDbPath);
106
		ContentMigrator contentmigrator = new ContentMigrator(sourceDbPath,destinationDbPath);
107
		
-
 
108
		
-
 
109
		/*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);
107
		contentmigrator.renameTitles();
110
		for (Long eId : entityId){
-
 
111
		}*/
-
 
112
		//contentmigrator.reorderPhones();
-
 
113
		//System.out.println(contentmigrator.getItems().size());
-
 
114
		/*contentmigrator.touchEntityState(1008423l);
-
 
115
		contentmigrator.touchEntityState(1008424l);
-
 
116
		contentmigrator.touchEntityState(1008427l);
-
 
117
		contentmigrator.touchEntityState(1008428l);*/
-
 
118
 
-
 
119
		//contentmigrator.migrateToMongo();
-
 
120
		//contentmigrator.getEditedEntities();
-
 
121
		/*contentmigrator.touchEntityState(1008706l);
-
 
122
		contentmigrator.touchEntityState(1008707l);
-
 
123
		contentmigrator.touchEntityState(1008708l);
-
 
124
		contentmigrator.touchEntityState(1008709l);
-
 
125
		contentmigrator.touchEntityState(1008710l);
-
 
126
		contentmigrator.touchEntityState(1008711l);
-
 
127
		contentmigrator.touchEntityState(1008714l);
-
 
128
		contentmigrator.touchEntityState(1008715l);
-
 
129
		contentmigrator.touchEntityState(1005505l);
-
 
130
		contentmigrator.touchEntityState(1006864l);*/
-
 
131
		//contentmigrator.clearEmptyPrimitiveBullets();
-
 
132
		//contentmigrator.migrateSoftCategories();
-
 
133
		//contentmigrator.updateSummaryMediaLabel();
-
 
134
		//contentmigrator.migrateReviews();
-
 
135
		//contentmigrator.test1();
-
 
136
		contentmigrator.testProd();
-
 
137
		
108
		
138
	}
109
	}
139
	
110
	
-
 
111
	
140
	private void testProd() throws Exception{
112
	private void testProd() throws Exception {
141
		Map<Long, EntityState> es1 = StorageManager.getStorageManager().getEntitiesMetadata();
113
		Map<Long, EntityState> es1 = StorageManager.getStorageManager().getEntitiesMetadata();
142
		for(Map.Entry<Long, EntityState> estate : es1.entrySet()){		
114
		for(Map.Entry<Long, EntityState> estate : es1.entrySet()){		
143
			EntityState es = estate.getValue();
115
			EntityState es = estate.getValue();
144
			if(es.getCategoryID()==10006l && es.getStatus().equals(EntityStatus.READY)) {
116
			if(es.getCategoryID()==10006l && es.getStatus().equals(EntityStatus.READY)) {
145
				ContentPojo cp = StorageManager.getById(StorageManager.views.siteContent, estate.getKey(), ContentPojo.class);
117
				ContentPojo cp = StorageManager.getById(StorageManager.views.siteContent, estate.getKey(), ContentPojo.class);
146
				if(cp.getDetailedSpecs()!= null){
118
				if(cp != null && cp.getDetailedSpecs()!= null){
147
					List<SpecificationGroup> sgs = cp.getDetailedSpecs();
119
					List<SpecificationGroup> sgs = cp.getDetailedSpecs();
148
					System.out.println(es.getBrand() + " "  +  es.getModelName() + " " +es.getModelNumber());
120
					System.out.println(es.getBrand() + " "  +  es.getModelName() + " " +es.getModelNumber());
149
					for(SpecificationGroup sg : sgs) {
121
					for(SpecificationGroup sg : sgs) {
150
						String title = sg.getTitle();
122
						String title = sg.getTitle();
151
						if(title.equals("Look n feel")){
123
						if(title.equals("Look n feel")){
Line 439... Line 411...
439
				boolean isupdated = false;
411
				boolean isupdated = false;
440
				for(Feature f : summarySlide.getFeatures()){
412
				for(Feature f : summarySlide.getFeatures()){
441
					if(f.getFeatureDefinitionID()==120132l){
413
					if(f.getFeatureDefinitionID()==120132l){
442
						if(f.getBullets() == null){
414
						if(f.getBullets() == null){
443
							f.setBullets(new ArrayList<Bullet>());
415
							f.setBullets(new ArrayList<Bullet>());
-
 
416
							System.out.println("Found null for : " + entityId);
444
						}else {
417
						}else {
-
 
418
							if(((PrimitiveDataObject)f.getBullets().get(0).getDataObject()).getValue().equals("")){
-
 
419
								System.out.println("Found null for : " + entityId);
-
 
420
							}
445
							f.getBullets().clear();
421
							f.getBullets().clear();
446
						}
422
						}
447
						Bullet titleBullet = new Bullet(new PrimitiveDataObject(getTitle(entity)));
423
						Bullet titleBullet = new Bullet(new PrimitiveDataObject(getTitle(entity)));
448
						f.getBullets().add(titleBullet);
424
						f.getBullets().add(titleBullet);
449
						isupdated = true;
425
						isupdated = true;
450
						continue;
426
						continue;
451
					}
427
					}
452
					if(f.getFeatureDefinitionID()==120133l){
428
					if(f.getFeatureDefinitionID()==120133l){
453
						if(f.getBullets() == null){
429
						if(f.getBullets() == null){
454
							f.setBullets(new ArrayList<Bullet>());
430
							f.setBullets(new ArrayList<Bullet>());
-
 
431
							System.out.println("Found null for : " + entityId);
455
						}else {
432
						}else {
-
 
433
							if(((PrimitiveDataObject)f.getBullets().get(0).getDataObject()).getValue().equals("")){
-
 
434
								System.out.println("Found null for : " + entityId);
-
 
435
							}
456
							f.getBullets().clear();
436
							f.getBullets().clear();
457
						}
437
						}
458
						Bullet metaDescBullet = new Bullet(new PrimitiveDataObject(getMetaDescription(new ExpandedEntity(entity))));
438
						Bullet metaDescBullet = new Bullet(new PrimitiveDataObject(getMetaDescription(new ExpandedEntity(entity))));
459
						f.getBullets().add(metaDescBullet);
439
						f.getBullets().add(metaDescBullet);
460
						isupdated = true;
440
						isupdated = true;
Line 2210... Line 2190...
2210
    	}
2190
    	}
2211
    	return titleString;
2191
    	return titleString;
2212
    }
2192
    }
2213
    
2193
    
2214
    public String getMetaDescription(ExpandedEntity expEntity){
2194
    public String getMetaDescription(ExpandedEntity expEntity){
-
 
2195
    	
-
 
2196
    	Category parentCategory;
-
 
2197
    	Category category = expEntity.getCategory();
-
 
2198
    	if(category!=null){
2215
    	Category parentCategory= expEntity.getCategory().getParentCategory();
2199
    		parentCategory = category.getParentCategory();
2216
    	String categoryName = parentCategory.getLabel();
2200
    		String categoryName = parentCategory.getLabel();
2217
    	if (parentCategory.getID()== Utils.MOBILE_ACCESSORIES_CATEGORY){
2201
    		if (parentCategory.getID()== Utils.MOBILE_ACCESSORIES_CATEGORY){
2218
    		categoryName = expEntity.getCategory().getLabel();
2202
    			categoryName = expEntity.getCategory().getLabel();
-
 
2203
    		}
-
 
2204
    		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.";
-
 
2205
    		return MessageFormat.format(template, expEntity.getBrand(), expEntity.getModelName(), expEntity.getModelNumber(), categoryName.toLowerCase());
-
 
2206
    	} else {
-
 
2207
    		System.out.println("category is null for : " + expEntity.getID());
-
 
2208
    		return "";
2219
    	}
2209
    	}
2220
    	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.";
-
 
2221
    	return MessageFormat.format(template, expEntity.getBrand(), expEntity.getModelName(), expEntity.getModelNumber(), categoryName.toLowerCase());
-
 
2222
    }
2210
    }
2223
    
2211
    
2224
public void migrateTablets() throws Exception {
2212
public void migrateTablets() throws Exception {
2225
		
2213
		
2226
		//Starting entity id for new Category with 10000
2214
		//Starting entity id for new Category with 10000
Line 3047... Line 3035...
3047
		        }
3035
		        }
3048
		    }
3036
		    }
3049
		}
3037
		}
3050
		return params;
3038
		return params;
3051
    }
3039
    }
3052
	
-
 
3053
}
3040
}
3054
 
3041