Subversion Repositories SmartDukaan

Rev

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

Rev 7662 Rev 7670
Line 311... Line 311...
311
        }
311
        }
312
        PriceInsertor priceInserter = new PriceInsertor();
312
        PriceInsertor priceInserter = new PriceInsertor();
313
 
313
 
314
        Map<Long,List<String>> entityTags = client.getAllEntityTags();
314
        Map<Long,List<String>> entityTags = client.getAllEntityTags();
315
        Map<Long, Integer> popularityMap = getPolularityMap();
315
        Map<Long, Integer> popularityMap = getPolularityMap();
316
        CatalogClient prod_csc = new CatalogClient(ConfigClientKeys.catalog_service_server_host_prod.toString(), ConfigClientKeys.catalog_service_server_port.toString());
-
 
317
        Client prod_client = prod_csc.getClient();
-
 
318
        Map<Long,Boolean> itemsStatus = prod_client.getItemsStatus(activeItems);
316
        List<Long> pausedByRiskItems = getRiskyActiveItems();
319
        for (Map.Entry<Long, List<Item>> entry : entityIdItemMap.entrySet()) {
317
        for (Map.Entry<Long, List<Item>> entry : entityIdItemMap.entrySet()) {
320
            long entityId = entry.getKey();
318
            long entityId = entry.getKey();
321
            List<Item> items = entry.getValue();
319
            List<Item> items = entry.getValue();
322
            double minPrice = 0d;
320
            double minPrice = 0d;
323
            
321
            
324
            //Evaluating availability
322
            //Evaluating availability
325
            String availability = "Out of Stock";
323
            String availability = "Out of Stock";
326
            for(Item i: items){
324
            for(Item i: items){
327
            	if(itemsStatus.containsKey(i.getId())) {
325
            	if(i.getItemStatus().equals(status.ACTIVE)) {
328
            		if(itemsStatus.get(i.getId())){
326
            		if(!(i.isRisky() && pausedByRiskItems.contains(i.getId()) )){
329
            			availability = "In Stock";
327
            			availability = "In Stock";
330
            			break;
328
            			break;
331
            		}
329
            		}
332
            	}else if(i.getItemStatus().equals(status.ACTIVE)){
-
 
333
            		availability = "In Stock";
-
 
334
            		break;
-
 
335
            	}
330
            	}
336
            }
331
            }
337
            StringBuilder priceString = new StringBuilder();
332
            StringBuilder priceString = new StringBuilder();
338
            StringBuilder availabilityString = new StringBuilder();
333
            StringBuilder availabilityString = new StringBuilder();
339
            boolean domainOnce = true;
334
            boolean domainOnce = true;
Line 390... Line 385...
390
			e.printStackTrace();
385
			e.printStackTrace();
391
			return new HashMap<Long, Integer>();
386
			return new HashMap<Long, Integer>();
392
		}
387
		}
393
    	
388
    	
394
	}
389
	}
-
 
390
	private List<Long> getRiskyActiveItems() {
-
 
391
		try {
-
 
392
			Reader reader = new FileReader(Utils.EXPORT_PATH + Utils.RISKY_PAUSED_JSON);
-
 
393
			return new Gson().fromJson(reader, new TypeToken<List<Integer>>() {}.getType());
-
 
394
		} catch (FileNotFoundException e) {
-
 
395
			log.error("Could not read popularity file");
-
 
396
			e.printStackTrace();
-
 
397
			return new ArrayList<Long>();
-
 
398
		}
-
 
399
		
-
 
400
	}
395
 
401
 
396
	/**
402
	/**
397
     * Generates content for the specified entity embedding links to the
403
     * Generates content for the specified entity embedding links to the
398
     * specified domain name.
404
     * specified domain name.
399
     * 
405
     *