Subversion Repositories SmartDukaan

Rev

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

Rev 2726 Rev 2733
Line 377... Line 377...
377
        writer.write(sb.toString());
377
        writer.write(sb.toString());
378
        writer.flush();
378
        writer.flush();
379
        writer.close();
379
        writer.close();
380
	    
380
	    
381
	}
381
	}
-
 
382
 
382
    
383
    
383
    /**
384
    /**
-
 
385
	 * Get most compared phones
-
 
386
	 * @param expEntity
-
 
387
	 * @param exportPath
-
 
388
	 * @throws Exception
-
 
389
	 */
-
 
390
    private void getMostComparedProducts(ExpandedEntity expEntity, String exportPath) throws Exception{
-
 
391
	    long catalogId = expEntity.getID();
-
 
392
        
-
 
393
	    Map<Long, Long> comparedPhones = CreationUtils.getComparisonStats().get(catalogId);
-
 
394
	    StringBuffer sb = new StringBuffer();
-
 
395
	    int maxCount = 10;
-
 
396
	    int count = 0;
-
 
397
	    for(Long entityID: comparedPhones.keySet()){
-
 
398
	    	if(count > maxCount){
-
 
399
				break;
-
 
400
			}
-
 
401
			sb.append(entityID + "\n");
-
 
402
			count++;
-
 
403
	    }
-
 
404
	    
-
 
405
        String exportFileName = exportPath + catalogId + File.separator + "MostComparedProducts.vm";
-
 
406
        File exportFile = new File(exportFileName);
-
 
407
        if(!exportFile.exists()) {
-
 
408
            exportFile.createNewFile();
-
 
409
        }
-
 
410
        
-
 
411
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(exportFile)));
-
 
412
 
-
 
413
        writer.write(sb.toString());
-
 
414
        writer.flush();
-
 
415
        writer.close();
-
 
416
	    
-
 
417
	}
-
 
418
 
-
 
419
    /**
384
     * Get the name of the product from entity. It considers null values also
420
     * Get the name of the product from entity. It considers null values also
385
     * @param expEntity
421
     * @param expEntity
386
     * @return
422
     * @return
387
     */
423
     */
388
	public static String getProductName(ExpandedEntity expEntity){
424
	public static String getProductName(ExpandedEntity expEntity){
Line 561... Line 597...
561
			filenames.add("ComparisonSnippet");
597
			filenames.add("ComparisonSnippet");
562
			filenames.add("CompareProductSummarySnippet");
598
			filenames.add("CompareProductSummarySnippet");
563
			// This method wont use any velocity file, So calling directly
599
			// This method wont use any velocity file, So calling directly
564
			getSlidenamesSnippet(expEntity, exportPath);
600
			getSlidenamesSnippet(expEntity, exportPath);
565
			getRelatedAccessories(expEntity, exportPath);
601
			getRelatedAccessories(expEntity, exportPath);
-
 
602
			getMostComparedProducts(expEntity, exportPath);
566
		}
603
		}
567
		
604
		
568
		
605
		
569
		// This method wont use any velocity file, So calling directly
606
		// This method wont use any velocity file, So calling directly
570
		getProductPropertiesSnippet(expEntity, exportPath);
607
		getProductPropertiesSnippet(expEntity, exportPath);