Subversion Repositories SmartDukaan

Rev

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

Rev 5763 Rev 5930
Line 390... Line 390...
390
            props.put("entityUrl", entityUrl);
390
            props.put("entityUrl", entityUrl);
391
            props.put("title", title);
391
            props.put("title", title);
392
            props.put("name", EntityUtils.getProductName(expEntity));
392
            props.put("name", EntityUtils.getProductName(expEntity));
393
            boolean displayAccessories;
393
            boolean displayAccessories;
394
            
394
            
395
            Category parentCategory = expEntity.getCategory().getParentCategory();
395
            Category parentCategory = category.getParentCategory();
396
            props.put("parentCategory", parentCategory.getLabel());
396
            props.put("parentCategory", parentCategory.getLabel());
397
            if(parentCategory.isHasAccessories()){
397
            if(parentCategory.isHasAccessories()){
398
                props.put("displayAccessories", "TRUE");
398
                props.put("displayAccessories", "TRUE");
399
                displayAccessories = true;
399
                displayAccessories = true;
400
            }else{
400
            }else{
401
                props.put("displayAccessories", "FALSE" );
401
                props.put("displayAccessories", "FALSE" );
402
                displayAccessories = false;
402
                displayAccessories = false;
403
            }  
403
            }  
404
           
404
           
405
            props.put("categoryName", categoryName);
405
            props.put("categoryName", categoryName);
-
 
406
            props.put("compareCategory", parentCategory.isComparable() ? parentCategory.getLabel() : categoryName);
406
            props.put("categoryUrl", categoryName.replaceAll(SPACE, "-").toLowerCase() + "/" + category.getID());
407
            props.put("categoryUrl", categoryName.replaceAll(SPACE, "-").toLowerCase() + "/" + category.getID());
407
            String categoryUrl = categoryName.replaceAll(SPACE, "-").toLowerCase() + "/" + category.getID();
408
            String categoryUrl = categoryName.replaceAll(SPACE, "-").toLowerCase() + "/" + category.getID();
408
           
409
           
409
            String brandUrl = expEntity.getBrand().toLowerCase().replace(' ', '-');
410
            String brandUrl = expEntity.getBrand().toLowerCase().replace(' ', '-');
410
           
411
           
Line 461... Line 462...
461
        		+ "\n");
462
        		+ "\n");
462
 
463
 
463
        Map<Long, Double> slideScores = CreationUtils
464
        Map<Long, Double> slideScores = CreationUtils
464
                .getSlideComparisonScores(catalogId);
465
                .getSlideComparisonScores(catalogId);
465
 
466
 
-
 
467
        DecimalFormat oneDForm = new DecimalFormat("#.#");
466
        for (ExpandedSlide expSlide : expEntity.getExpandedSlides()) {
468
        for (ExpandedSlide expSlide : expEntity.getExpandedSlides()) {
467
            if (expSlide.getSlideDefinitionID() == Utils.SUMMARY_SLIDE_DEFINITION_ID
469
            if (expSlide.getSlideDefinitionID() == Utils.SUMMARY_SLIDE_DEFINITION_ID
468
                    || expSlide.getSlideDefinitionID() == Utils.AFTER_SALES_SLIDE_DEFINITION_ID) {
470
                    || expSlide.getSlideDefinitionID() == Utils.AFTER_SALES_SLIDE_DEFINITION_ID) {
469
                continue;
471
                continue;
470
            }
472
            }
471
            slideNames.append(expSlide.getSlideDefinition().getLabel() + "!!!");
473
            slideNames.append(expSlide.getSlideDefinition().getLabel() + "!!!");
472
 
474
 
473
            String bucketName = "None";
-
 
474
            if (Catalog
-
 
475
                    .getInstance()
-
 
476
                    .getDefinitionsContainer()
-
 
477
                    .getComparisonBucketName(expEntity.getCategoryID(),
475
            String bucketName = Catalog.getInstance().getDefinitionsContainer().getComparisonBucketName(expEntity.getCategoryID(), expSlide.getSlideDefinitionID());
478
                            expSlide.getSlideDefinitionID()) != null) {
-
 
479
                bucketName = Catalog
476
            if ( bucketName == null) {
480
                        .getInstance()
477
                bucketName = "None"; 
481
                        .getDefinitionsContainer()
-
 
482
                        .getComparisonBucketName(expEntity.getCategoryID(),
-
 
483
                                expSlide.getSlideDefinitionID());
-
 
484
            }
478
            }
485
            slideNames.append(bucketName + "!!!");
479
            slideNames.append(bucketName + "!!!");
486
 
480
 
487
            double score = 0;
481
            double score = 0;
488
            if (slideScores.get(expSlide.getSlideDefinitionID()) != null) {
482
            if (slideScores != null && slideScores.get(expSlide.getSlideDefinitionID()) != null) {
489
                score = slideScores.get(expSlide.getSlideDefinitionID());
483
                score = slideScores.get(expSlide.getSlideDefinitionID());
490
            }
484
            }
491
 
485
 
492
            DecimalFormat oneDForm = new DecimalFormat("#.#");
-
 
493
            score = Double.valueOf(oneDForm.format(score));
486
            score = Double.valueOf(oneDForm.format(score));
494
 
487
 
495
            slideNames.append(score + "\n");
488
            slideNames.append(score + "\n");
496
        }
489
        }
497
 
490
 
Line 668... Line 661...
668
            prodName = expEntity.getBrand().trim()
661
            prodName = expEntity.getBrand().trim()
669
                    + SPACE
662
                    + SPACE
670
                    + ((expEntity.getModelName() != null) ? expEntity
663
                    + ((expEntity.getModelName() != null) ? expEntity
671
                            .getModelName().trim() : "");
664
                            .getModelName().trim() : "");
672
        }
665
        }
-
 
666
        Category cat = expEntity.getCategory();
-
 
667
        
673
        Category parentCategory = expEntity.getCategory().getParentCategory();
668
        Category parentCategory = cat.getParentCategory();
674
        
669
        
675
        String categoryName = expEntity.getCategory().getLabel();
670
        String categoryName = cat.getLabel();
676
        String tagline = "";
671
        String tagline = "";
677
        String warranty = "";
672
        String warranty = "";
678
        String tinySnippet = "";
673
        String tinySnippet = "";
679
        List<Feature> features = expEntity.getSlide(130054).getFeatures();
674
        List<Feature> features = expEntity.getSlide(130054).getFeatures();
680
        for (Feature feature : features) {
675
        for (Feature feature : features) {
Line 736... Line 731...
736
                        warranty += SPACE + HYPHON + SPACE + expBullet.getExpandedEnumDataObject().getEnumValue().getValue();
731
                        warranty += SPACE + HYPHON + SPACE + expBullet.getExpandedEnumDataObject().getEnumValue().getValue();
737
                    }
732
                    }
738
                }
733
                }
739
            }
734
            }
740
        }
735
        }
741
 
-
 
742
        long categoryId = expEntity.getCategory().getID();
736
        long categoryId = cat.getID();
743
        params.put("PROD_NAME", prodName);
737
        params.put("PROD_NAME", prodName);
744
        params.put("URL", EntityUtils.getEntityURL(expEntity));
738
        params.put("URL", EntityUtils.getEntityURL(expEntity));
745
        params.put("TITLE", title);
739
        params.put("TITLE", title);
746
        params.put("BRAND_NAME", brandName);
740
        params.put("BRAND_NAME", brandName);
747
        params.put("PRODUCT_NAME", productName);
741
        params.put("PRODUCT_NAME", productName);
748
        params.put("CATEGORY_ID", ((int) categoryId) + "");
742
        params.put("CATEGORY_ID", ((int) categoryId) + "");
749
        params.put("CATEGORY_NAME", categoryName);
743
        params.put("CATEGORY_NAME", categoryName);
750
        params.put("PARENT_CATEGORY", expEntity.getCategory().getParentCategory().getLabel());
744
        params.put("PARENT_CATEGORY", parentCategory.getLabel());
-
 
745
        params.put("COMPARE_CATEGORY", parentCategory.isComparable() ? 
-
 
746
        			parentCategory.getLabel(): cat.getLabel());
751
        params.put("CATEGORY_URL", categoryName.replaceAll(SPACE, HYPHON)
747
        params.put("CATEGORY_URL", categoryName.replaceAll(SPACE, HYPHON)
752
                .toLowerCase() + "/" + categoryId);
748
                .toLowerCase() + "/" + categoryId);
753
        params.put(
749
        params.put(
754
                "PRODUCT_URL",
750
                "PRODUCT_URL",
755
                URLEncoder.encode("http://www.", "UTF-8")
751
                URLEncoder.encode("http://www.", "UTF-8")
756
                        + "${domain}"
752
                        + "${domain}"
757
                        + URLEncoder.encode(
753
                        + URLEncoder.encode(
758
                                EntityUtils.getEntityURL(expEntity), "UTF-8"));
754
                                EntityUtils.getEntityURL(expEntity), "UTF-8"));
759
        
755
        
760
        if (parentCategory.isComparable())	{
756
        if (cat.isComparable())	{
761
        	params.put("IS_COMPARABLE", "TRUE");
757
        	params.put("IS_COMPARABLE", "TRUE");
762
        } else	{
758
        } else	{
763
        	params.put("IS_COMPARABLE", "FALSE");
759
        	params.put("IS_COMPARABLE", "FALSE");
764
        }
760
        }
765
        
761
        
Line 811... Line 807...
811
        }
807
        }
812
 
808
 
813
        VelocityContext context = new VelocityContext();
809
        VelocityContext context = new VelocityContext();
814
 
810
 
815
        Category parentCategory = expEntity.getCategory().getParentCategory();
811
        Category parentCategory = expEntity.getCategory().getParentCategory();
816
        Boolean isComparable = parentCategory.isComparable();
812
        Boolean isComparable = expEntity.getCategory().isComparable();
817
        String mediaPrefix = EntityUtils.getMediaPrefix(expEntity);
813
        String mediaPrefix = EntityUtils.getMediaPrefix(expEntity);
818
        context.put("mediaPrefix", mediaPrefix);
814
        context.put("mediaPrefix", mediaPrefix);
819
        context.put("expentity", expEntity);
815
        context.put("expentity", expEntity);
820
        context.put("contentVersion", this.contentVersion);
816
        context.put("contentVersion", this.contentVersion);
821
        context.put("defs", Catalog.getInstance().getDefinitionsContainer());
817
        context.put("defs", Catalog.getInstance().getDefinitionsContainer());
Line 828... Line 824...
828
        filenames.add("WidgetSnippet");
824
        filenames.add("WidgetSnippet");
829
        filenames.add("HomeSnippet");
825
        filenames.add("HomeSnippet");
830
        filenames.add("SearchSnippet");
826
        filenames.add("SearchSnippet");
831
        filenames.add("CategorySnippet");
827
        filenames.add("CategorySnippet");
832
        filenames.add("SlideGuide");
828
        filenames.add("SlideGuide");
833
        filenames.add("MyResearchSnippet");
-
 
834
        filenames.add("AfterSales");
829
        filenames.add("AfterSales");
-
 
830
        filenames.add("CompareProductSnippet");
-
 
831
        filenames.add("ComparisonSnippet");
-
 
832
        getSlidenamesSnippet(expEntity, exportPath);
835
        
833
        filenames.add("MyResearchSnippet");
836
        if(isComparable){
834
        if(isComparable){
837
        	filenames.add("CompareProductSnippet");
-
 
838
        	filenames.add("ComparisonSnippet");
-
 
839
        	filenames.add("CompareProductSummarySnippet");
835
        	filenames.add("CompareProductSummarySnippet");
840
        	filenames.add("MostComparedSnippet");
836
        	filenames.add("MostComparedSnippet");
841
        	getMostComparedProducts(expEntity, exportPath);
837
        	getMostComparedProducts(expEntity, exportPath);
842
        	getSlidenamesSnippet(expEntity, exportPath);
-
 
843
        }
838
        }
844
        if(parentCategory.isHasAccessories()){
839
        if(parentCategory.isHasAccessories()){
845
        	getRelatedAccessories(expEntity, exportPath);
840
        	getRelatedAccessories(expEntity, exportPath);
846
        }
841
        }
847
        if(parentCategory.getID()==Utils.MOBILE_PHONES_CATAGORY){
842
        if(parentCategory.getID()==Utils.MOBILE_PHONES_CATAGORY){