| Line 39... |
Line 39... |
| 39 |
|
39 |
|
| 40 |
List<Long> bestDealCatalogIds = null;
|
40 |
List<Long> bestDealCatalogIds = null;
|
| 41 |
List<Long> bestSellerCatalogIds = null;
|
41 |
List<Long> bestSellerCatalogIds = null;
|
| 42 |
List<Long> latestArrivalCatalogIds = null;
|
42 |
List<Long> latestArrivalCatalogIds = null;
|
| 43 |
|
43 |
|
| - |
|
44 |
int bestSellerCount = 4;
|
| - |
|
45 |
int latestArrivalCount = 4;
|
| - |
|
46 |
|
| 44 |
try {
|
47 |
try {
|
| 45 |
CatalogServiceClient catalogServiceClient = new CatalogServiceClient();
|
48 |
CatalogServiceClient catalogServiceClient = new CatalogServiceClient();
|
| 46 |
Client client = catalogServiceClient.getClient();
|
49 |
Client client = catalogServiceClient.getClient();
|
| 47 |
|
50 |
|
| 48 |
//Get top 4 best deals
|
51 |
//Get top 4 best deals
|
| 49 |
bestDealCatalogIds = client.getBestDealsCatalogIds(0,4, null, -1);
|
52 |
bestDealCatalogIds = client.getBestDealsCatalogIds(0,4, null, -1);
|
| 50 |
|
53 |
|
| 51 |
//Get top 8 best deals b'coz 4 of them may overlap with best deals.
|
54 |
//Get top 8 best deals b'coz 4 of them may overlap with best deals.
|
| 52 |
bestSellerCatalogIds = client.getBestSellersCatalogIds(0, 8, null, -1);
|
55 |
bestSellerCatalogIds = client.getBestSellersCatalogIds(0, 8, null, -1);
|
| 53 |
bestSellerCatalogIds.removeAll(bestDealCatalogIds);
|
56 |
bestSellerCatalogIds.removeAll(bestDealCatalogIds);
|
| - |
|
57 |
if(bestSellerCatalogIds.size() < bestSellerCount)
|
| - |
|
58 |
bestSellerCount = bestSellerCatalogIds.size();
|
| 54 |
|
59 |
|
| 55 |
//Get top 12 latest arrivals b'coz 4 of them may overlap with best deals
|
60 |
//Get top 12 latest arrivals b'coz 4 of them may overlap with best deals
|
| 56 |
//while another 4 may overlap with best sellers.
|
61 |
//while another 4 may overlap with best sellers.
|
| 57 |
latestArrivalCatalogIds = client.getLatestArrivalsCatalogIds(0, 12, null, 10003);
|
62 |
latestArrivalCatalogIds = client.getLatestArrivalsCatalogIds(0, 12, null, 10003);
|
| 58 |
latestArrivalCatalogIds.removeAll(bestDealCatalogIds);
|
63 |
latestArrivalCatalogIds.removeAll(bestDealCatalogIds);
|
| 59 |
latestArrivalCatalogIds.removeAll(bestSellerCatalogIds.subList(0, 4)); //We're only considering the first 4 best sellers for removal.
|
64 |
latestArrivalCatalogIds.removeAll(bestSellerCatalogIds.subList(0, bestSellerCount)); //We're only considering the first 4 best sellers for removal.
|
| - |
|
65 |
if(latestArrivalCatalogIds.size() < latestArrivalCount)
|
| - |
|
66 |
latestArrivalCount = latestArrivalCatalogIds.size();
|
| 60 |
} catch (InventoryServiceException e) {
|
67 |
} catch (InventoryServiceException e) {
|
| 61 |
logger.error("Error while fetching data from the catalog service", e);
|
68 |
logger.error("Error while fetching data from the catalog service", e);
|
| 62 |
} catch (TException e) {
|
69 |
} catch (TException e) {
|
| 63 |
logger.error("Error while fetching data from the catalog service", e);
|
70 |
logger.error("Error while fetching data from the catalog service", e);
|
| 64 |
} catch (Exception e) {
|
71 |
} catch (Exception e) {
|
| 65 |
logger.error("Unexpected exception", e);
|
72 |
logger.error("Unexpected exception", e);
|
| 66 |
}
|
73 |
}
|
| 67 |
|
74 |
|
| 68 |
bestDealSnippets = getSnippets(bestDealCatalogIds);
|
75 |
bestDealSnippets = getSnippets(bestDealCatalogIds);
|
| 69 |
bestSellerSnippets = getSnippets(bestSellerCatalogIds.subList(0, 4));
|
76 |
bestSellerSnippets = getSnippets(bestSellerCatalogIds.subList(0, bestSellerCount));
|
| 70 |
latestArrivalSnippets = getSnippets(latestArrivalCatalogIds).subList(0, 4);
|
77 |
latestArrivalSnippets = getSnippets(latestArrivalCatalogIds).subList(0, latestArrivalCount);
|
| 71 |
|
78 |
|
| 72 |
htmlSnippets.put("MAIN_BANNER", pageLoader.getMainBannerHtml());
|
79 |
htmlSnippets.put("MAIN_BANNER", pageLoader.getMainBannerHtml());
|
| 73 |
return "index";
|
80 |
return "index";
|
| 74 |
}
|
81 |
}
|
| 75 |
|
82 |
|