Subversion Repositories SmartDukaan

Rev

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

Rev 2547 Rev 2651
Line 244... Line 244...
244
            props.put("metaDescription", metaDescription);
244
            props.put("metaDescription", metaDescription);
245
            props.put("metaKeywords", metaKeywords);
245
            props.put("metaKeywords", metaKeywords);
246
            props.put("entityUrl", entityUrl);
246
            props.put("entityUrl", entityUrl);
247
            props.put("title", title);
247
            props.put("title", title);
248
            props.put("name", getProductName(expEntity));
248
            props.put("name", getProductName(expEntity));
-
 
249
            if(expEntity.getCategory().getParentCategory().getID() != Utils.MOBILE_ACCESSORIES_CATEGORY){
-
 
250
            	props.put("displayAccessories", "TRUE");	
-
 
251
    		}else{
-
 
252
    			props.put("displayAccessories", "FALSE" );
-
 
253
    		}   
-
 
254
            
249
            
255
            
250
            String exportFileName = exportPath + catalogId + File.separator
256
            String exportFileName = exportPath + catalogId + File.separator
251
                    + "ProductPropertiesSnippet.vm";
257
                    + "ProductPropertiesSnippet.vm";
252
            File exportFile = new File(exportFileName);
258
            File exportFile = new File(exportFileName);
253
            if (!exportFile.exists()) {
259
            if (!exportFile.exists()) {
Line 316... Line 322...
316
        writer.write(slideNames.toString());
322
        writer.write(slideNames.toString());
317
        writer.flush();
323
        writer.flush();
318
        writer.close();
324
        writer.close();
319
	    
325
	    
320
	}
326
	}
-
 
327
 
-
 
328
    
-
 
329
	/**
-
 
330
	 * Get related accessories
-
 
331
	 * @param expEntity
-
 
332
	 * @param exportPath
-
 
333
	 * @throws Exception
-
 
334
	 */
-
 
335
    private void getRelatedAccessories(ExpandedEntity expEntity, String exportPath) throws Exception{
-
 
336
	    long catalogId = expEntity.getID();
-
 
337
        
-
 
338
	    Map<Long, List<Long>> relatedAccessories = CreationUtils.getRelatedAccessories().get(catalogId);
-
 
339
	    List<Long> priorityList = new ArrayList<Long>();
-
 
340
	    int individualLimit = 3;
-
 
341
	    int totalLimit = 10;
-
 
342
	    priorityList.add(Utils.CARRYING_CASE);
-
 
343
	    priorityList.add(Utils.SCREEN_GUARD);
-
 
344
	    priorityList.add(Utils.BATTERY);
-
 
345
	    priorityList.add(Utils.MEMORY_CARD);
-
 
346
	    priorityList.add(Utils.BLUETOOTH_HEADSET);
-
 
347
	    priorityList.add(Utils.HEADSET);
-
 
348
	    priorityList.add(Utils.CHARGER);
-
 
349
	    
-
 
350
	    StringBuffer sb = new StringBuffer();
-
 
351
	    int totalCount = 0;
-
 
352
	    for(Long catID: priorityList){
-
 
353
	    	int individualCount = 0;
-
 
354
	    	List<Long> ents = relatedAccessories.get(catID);
-
 
355
	    	if(ents != null && !ents.isEmpty()){
-
 
356
	    		if(ents.size()>individualLimit){
-
 
357
	    			ents = ents.subList(0, individualLimit);
-
 
358
	    		}
-
 
359
	    		for(Long entID: ents){
-
 
360
	    			if(totalLimit > totalCount){
-
 
361
	    				sb.append(entID + "\n");
-
 
362
	    				individualCount++;
-
 
363
	    				totalCount++;
-
 
364
	    			}
-
 
365
	    		}
-
 
366
	    	}
-
 
367
	    }
-
 
368
	    
-
 
369
        String exportFileName = exportPath + catalogId + File.separator + "RelatedAccessories.vm";
-
 
370
        File exportFile = new File(exportFileName);
-
 
371
        if(!exportFile.exists()) {
-
 
372
            exportFile.createNewFile();
-
 
373
        }
-
 
374
        
-
 
375
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(exportFile)));
-
 
376
 
-
 
377
        writer.write(sb.toString());
-
 
378
        writer.flush();
-
 
379
        writer.close();
-
 
380
	    
-
 
381
	}
321
    
382
    
322
    /**
383
    /**
323
     * Get the name of the product from entity. It considers null values also
384
     * Get the name of the product from entity. It considers null values also
324
     * @param expEntity
385
     * @param expEntity
325
     * @return
386
     * @return
Line 498... Line 559...
498
			filenames.add("CompareProductSnippet");
559
			filenames.add("CompareProductSnippet");
499
			filenames.add("ComparisonSnippet");
560
			filenames.add("ComparisonSnippet");
500
			filenames.add("CompareProductSummarySnippet");
561
			filenames.add("CompareProductSummarySnippet");
501
			// This method wont use any velocity file, So calling directly
562
			// This method wont use any velocity file, So calling directly
502
			getSlidenamesSnippet(expEntity, exportPath);
563
			getSlidenamesSnippet(expEntity, exportPath);
-
 
564
			getRelatedAccessories(expEntity, exportPath);
503
		}
565
		}
504
		
566
		
505
		
567
		
506
		// This method wont use any velocity file, So calling directly
568
		// This method wont use any velocity file, So calling directly
507
		getProductPropertiesSnippet(expEntity, exportPath);
569
		getProductPropertiesSnippet(expEntity, exportPath);