Subversion Repositories SmartDukaan

Rev

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

Rev 7629 Rev 7630
Line 510... Line 510...
510
		String productXMLFilename = Utils.EXPORT_JAVASCRIPT_CONTENT_PATH + "saholicmobilephones.js";
510
		String productXMLFilename = Utils.EXPORT_JAVASCRIPT_CONTENT_PATH + "saholicmobilephones.js";
511
		DBUtils.store(productsJavascript.toString(), productXMLFilename);
511
		DBUtils.store(productsJavascript.toString(), productXMLFilename);
512
	}
512
	}
513
 
513
 
514
    private void populateEntityIdItemMap(List<Item> items){
514
    private void populateEntityIdItemMap(List<Item> items){
515
        Date toDate = new Date();
515
    	entityIdItemMap = new HashMap<Long, List<Item>>(); 
516
        for(Item item: items){
516
        for(Item item: items){
517
            //TODO Can be removed as we are checking in calling function
517
            //TODO Can be removed as we are checking in calling function
518
            if(!(item.getItemStatus()==status.ACTIVE || item.getItemStatus() == status.PAUSED)){
518
            if(!(item.getItemStatus()==status.ACTIVE || item.getItemStatus() == status.PAUSED)){
519
                continue;
519
                continue;
520
            }
520
            }
Line 526... Line 526...
526
                itemList = new ArrayList<Item>();
526
                itemList = new ArrayList<Item>();
527
            }
527
            }
528
            itemList.add(item);
528
            itemList.add(item);
529
            entityIdItemMap.put(item.getCatalogItemId(), itemList);
529
            entityIdItemMap.put(item.getCatalogItemId(), itemList);
530
        }
530
        }
531
 
-
 
532
        //Remove all items which have not been updated since last content generation.
-
 
533
        List<Long> removeEntities = new ArrayList<Long>();
-
 
534
        for(Long entityId:entityIdItemMap.keySet()){
-
 
535
            boolean isValidEntity = false;
-
 
536
            //If any one of the items has been updated before current timestamp, than we generate content for whole entity
-
 
537
            for(Item item: entityIdItemMap.get(entityId)){
-
 
538
                if(item.getUpdatedOn() > 0){
-
 
539
                    isValidEntity = true;
-
 
540
                }
-
 
541
            }
-
 
542
            if(!isValidEntity){
-
 
543
                removeEntities.add(entityId);
-
 
544
            }
-
 
545
        }
-
 
546
        for(Long entityId: removeEntities){
-
 
547
            entityIdItemMap.remove(entityId);
-
 
548
        }
-
 
549
    }
531
    }
550
    
532
    
551
    /**
533
    /**
552
     * Generate XML feed for mobile site
534
     * Generate XML feed for mobile site
553
     * @throws Exception
535
     * @throws Exception