Subversion Repositories SmartDukaan

Rev

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

Rev 5760 Rev 5906
Line 348... Line 348...
348
				EntityState entityState = CreationUtils.getEntityState(entity.getID());
348
				EntityState entityState = CreationUtils.getEntityState(entity.getID());
349
				entityState.setCategoryID(Long.parseLong(categoryID));
349
				entityState.setCategoryID(Long.parseLong(categoryID));
350
				entityState.setBrand((this.reqparams.get("brand")[0]).trim());
350
				entityState.setBrand((this.reqparams.get("brand")[0]).trim());
351
				entityState.setModelName((this.reqparams.get("modelname")[0]).trim());
351
				entityState.setModelName((this.reqparams.get("modelname")[0]).trim());
352
				entityState.setModelNumber((this.reqparams.get("modelnumber")[0]).trim());
352
				entityState.setModelNumber((this.reqparams.get("modelnumber")[0]).trim());
353
				updateTitleAndMetaDescription();
353
				updateTitleAndMetaDescription(entity);
354
				CreationUtils.updateEntity(entity);
354
				CreationUtils.updateEntity(entity);
355
				CreationUtils.updateEntityState(entityState);
355
				CreationUtils.updateEntityState(entityState);
356
				
356
				
357
				this.redirectURL = "/slides/" + this.getId() + "/edit";
357
				this.redirectURL = "/slides/" + this.getId() + "/edit";
358
				return "redirect";
358
				return "redirect";
Line 624... Line 624...
624
    	}
624
    	}
625
    	
625
    	
626
        return "success";
626
        return "success";
627
    }
627
    }
628
	
628
	
629
    private void updateTitleAndMetaDescription() {
629
    private void updateTitleAndMetaDescription(Entity entity) {
630
		Slide summarySlide = entity.getSlide(130054l);
630
		Slide summarySlide = entity.getSlide(130054l);
631
		if (summarySlide != null){
631
		if (summarySlide != null){
632
			List<Feature> features = summarySlide.getFeatures();
632
			List<Feature> features = summarySlide.getFeatures();
633
			if(features != null){
633
			if(features != null){
634
				for(Feature f : features) {
634
				for(Feature f : features) {
Line 636... Line 636...
636
						if(f.getBullets() == null){
636
						if(f.getBullets() == null){
637
							f.setBullets(new ArrayList<Bullet>());
637
							f.setBullets(new ArrayList<Bullet>());
638
						}else {
638
						}else {
639
							f.getBullets().clear();
639
							f.getBullets().clear();
640
						}
640
						}
641
						Bullet titleBullet = new Bullet(new PrimitiveDataObject(getTitle()));
641
						Bullet titleBullet = new Bullet(new PrimitiveDataObject(getTitle(entity)));
642
						f.getBullets().add(titleBullet);
642
						f.getBullets().add(titleBullet);
643
					}
643
					}
644
					else if(f.getFeatureDefinitionID()==120133l){
644
					else if(f.getFeatureDefinitionID()==120133l){
645
						if(f.getBullets() == null){
645
						if(f.getBullets() == null){
646
							f.setBullets(new ArrayList<Bullet>());
646
							f.setBullets(new ArrayList<Bullet>());
647
						}else {
647
						}else {
648
							f.getBullets().clear();
648
							f.getBullets().clear();
649
						}
649
						}
650
						Bullet metaDescBullet = new Bullet(new PrimitiveDataObject(getMetaDescription()));
650
						Bullet metaDescBullet = new Bullet(new PrimitiveDataObject(getMetaDescription(entity)));
651
						f.getBullets().add(metaDescBullet);
651
						f.getBullets().add(metaDescBullet);
652
					}
652
					}
653
				}
653
				}
654
			}
654
			}
655
		}
655
		}
656
	}
656
	}
657
    
657
    
658
    public String getTitle(){
658
    public String getTitle(Entity entity){
659
    	String brand = entity.getBrand();
659
    	String brand = entity.getBrand();
660
    	String modelName = entity.getModelName();
660
    	String modelName = entity.getModelName();
661
    	String modelNumber = entity.getModelNumber();
661
    	String modelNumber = entity.getModelNumber();
662
    	String titleString = "";
662
    	String titleString = "";
663
    	if(StringUtils.isEmpty(modelName)){
663
    	if(StringUtils.isEmpty(modelName)){
Line 666... Line 666...
666
    		titleString = brand + " " + modelName + " Price in India | " + modelNumber + " Specifications, Features and Reviews";
666
    		titleString = brand + " " + modelName + " Price in India | " + modelNumber + " Specifications, Features and Reviews";
667
    	}
667
    	}
668
    	return titleString;
668
    	return titleString;
669
    }
669
    }
670
    
670
    
671
    public String getMetaDescription(){
671
    public String getMetaDescription(Entity entity){
672
    	Category parentCategory= expEntity.getCategory().getParentCategory();
672
    	Category parentCategory = defs.getCategory(entity.getCategoryID()).getParentCategory();
673
    	String categoryName = parentCategory.getLabel();
673
    	String categoryName = parentCategory.getLabel();
674
    	if (parentCategory.getID()== Utils.MOBILE_ACCESSORIES_CATEGORY){
674
    	if (parentCategory.getID()== Utils.MOBILE_ACCESSORIES_CATEGORY){
675
    		categoryName = expEntity.getCategory().getLabel();
675
    		categoryName = expEntity.getCategory().getLabel();
676
    	}
676
    	}
677
    	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.";
677
    	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.";