Subversion Repositories SmartDukaan

Rev

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

Rev 5180 Rev 5760
Line 33... Line 33...
33
import in.shop2020.model.v1.catalog.Item;
33
import in.shop2020.model.v1.catalog.Item;
34
import in.shop2020.model.v1.catalog.status;
34
import in.shop2020.model.v1.catalog.status;
35
import in.shop2020.thrift.clients.CatalogClient;
35
import in.shop2020.thrift.clients.CatalogClient;
36
import in.shop2020.util.Utils;
36
import in.shop2020.util.Utils;
37
 
37
 
-
 
38
import java.text.MessageFormat;
38
import java.text.SimpleDateFormat;
39
import java.text.SimpleDateFormat;
39
import java.util.ArrayList;
40
import java.util.ArrayList;
40
import java.util.Arrays;
41
import java.util.Arrays;
41
import java.util.Collection;
42
import java.util.Collection;
42
import java.util.Date;
43
import java.util.Date;
Line 347... Line 348...
347
				EntityState entityState = CreationUtils.getEntityState(entity.getID());
348
				EntityState entityState = CreationUtils.getEntityState(entity.getID());
348
				entityState.setCategoryID(Long.parseLong(categoryID));
349
				entityState.setCategoryID(Long.parseLong(categoryID));
349
				entityState.setBrand((this.reqparams.get("brand")[0]).trim());
350
				entityState.setBrand((this.reqparams.get("brand")[0]).trim());
350
				entityState.setModelName((this.reqparams.get("modelname")[0]).trim());
351
				entityState.setModelName((this.reqparams.get("modelname")[0]).trim());
351
				entityState.setModelNumber((this.reqparams.get("modelnumber")[0]).trim());
352
				entityState.setModelNumber((this.reqparams.get("modelnumber")[0]).trim());
352
				
353
				updateTitleAndMetaDescription();
353
				CreationUtils.updateEntity(entity);
354
				CreationUtils.updateEntity(entity);
354
				CreationUtils.updateEntityState(entityState);
355
				CreationUtils.updateEntityState(entityState);
355
				
356
				
356
				this.redirectURL = "/slides/" + this.getId() + "/edit";
357
				this.redirectURL = "/slides/" + this.getId() + "/edit";
357
				return "redirect";
358
				return "redirect";
Line 623... Line 624...
623
    	}
624
    	}
624
    	
625
    	
625
        return "success";
626
        return "success";
626
    }
627
    }
627
	
628
	
-
 
629
    private void updateTitleAndMetaDescription() {
-
 
630
		Slide summarySlide = entity.getSlide(130054l);
-
 
631
		if (summarySlide != null){
-
 
632
			List<Feature> features = summarySlide.getFeatures();
-
 
633
			if(features != null){
-
 
634
				for(Feature f : features) {
-
 
635
					if(f.getFeatureDefinitionID()==120132l){
-
 
636
						if(f.getBullets() == null){
-
 
637
							f.setBullets(new ArrayList<Bullet>());
-
 
638
						}else {
-
 
639
							f.getBullets().clear();
-
 
640
						}
-
 
641
						Bullet titleBullet = new Bullet(new PrimitiveDataObject(getTitle()));
-
 
642
						f.getBullets().add(titleBullet);
-
 
643
					}
-
 
644
					else if(f.getFeatureDefinitionID()==120133l){
-
 
645
						if(f.getBullets() == null){
-
 
646
							f.setBullets(new ArrayList<Bullet>());
-
 
647
						}else {
-
 
648
							f.getBullets().clear();
-
 
649
						}
-
 
650
						Bullet metaDescBullet = new Bullet(new PrimitiveDataObject(getMetaDescription()));
-
 
651
						f.getBullets().add(metaDescBullet);
-
 
652
					}
-
 
653
				}
-
 
654
			}
-
 
655
		}
-
 
656
	}
-
 
657
    
-
 
658
    public String getTitle(){
-
 
659
    	String brand = entity.getBrand();
-
 
660
    	String modelName = entity.getModelName();
-
 
661
    	String modelNumber = entity.getModelNumber();
-
 
662
    	String titleString = "";
-
 
663
    	if(StringUtils.isEmpty(modelName)){
-
 
664
    		titleString = brand + " " + modelNumber + " Price in India | Specifications, Features and Reviews";
-
 
665
    	}else {
-
 
666
    		titleString = brand + " " + modelName + " Price in India | " + modelNumber + " Specifications, Features and Reviews";
-
 
667
    	}
-
 
668
    	return titleString;
-
 
669
    }
-
 
670
    
-
 
671
    public String getMetaDescription(){
-
 
672
    	Category parentCategory= expEntity.getCategory().getParentCategory();
-
 
673
    	String categoryName = parentCategory.getLabel();
-
 
674
    	if (parentCategory.getID()== Utils.MOBILE_ACCESSORIES_CATEGORY){
-
 
675
    		categoryName = expEntity.getCategory().getLabel();
628
    /**
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.";
-
 
678
    	return MessageFormat.format(template, entity.getBrand(), entity.getModelName(), entity.getModelNumber(), categoryName.toLowerCase());
-
 
679
    }
-
 
680
 
-
 
681
	/**
629
     * 
682
     * 
630
     * @param entityID
683
     * @param entityID
631
     * @return
684
     * @return
632
     * @throws Exception 
685
     * @throws Exception 
633
     */
686
     */