| Line 1... |
Line 1... |
| 1 |
/**
|
1 |
/**
|
| 2 |
*
|
2 |
*
|
| 3 |
*/
|
3 |
*/
|
| 4 |
package in.shop2020.serving.controllers;
|
4 |
package in.shop2020.serving.controllers;
|
| 5 |
|
5 |
|
| 6 |
import in.shop2020.model.v1.catalog.InventoryServiceException;
|
6 |
import in.shop2020.model.v1.catalog.CatalogServiceException;
|
| 7 |
import in.shop2020.serving.cache.EhcacheWrapper;
|
7 |
import in.shop2020.serving.cache.EhcacheWrapper;
|
| 8 |
import in.shop2020.serving.services.ContentServingService;
|
8 |
import in.shop2020.serving.services.ContentServingService;
|
| 9 |
import in.shop2020.serving.utils.SnippetType;
|
9 |
import in.shop2020.serving.utils.SnippetType;
|
| 10 |
import in.shop2020.thrift.clients.CatalogClient;
|
10 |
import in.shop2020.thrift.clients.CatalogClient;
|
| 11 |
|
11 |
|
| Line 61... |
Line 61... |
| 61 |
String brandName = request.getParameter("brand");
|
61 |
String brandName = request.getParameter("brand");
|
| 62 |
//Right now if we have brand name, we can just send back data for all categories
|
62 |
//Right now if we have brand name, we can just send back data for all categories
|
| 63 |
if(brandName != null){
|
63 |
if(brandName != null){
|
| 64 |
categoryId = -1;
|
64 |
categoryId = -1;
|
| 65 |
}
|
65 |
}
|
| 66 |
in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
|
66 |
in.shop2020.model.v1.catalog.CatalogService.Client client = catalogClientService.getClient();
|
| 67 |
this.items = client.getComingSoonCatalogIds(beginIndex, windowSize, brandName, categoryId);
|
67 |
this.items = client.getComingSoonCatalogIds(beginIndex, windowSize, brandName, categoryId);
|
| 68 |
setSnippets();
|
68 |
setSnippets();
|
| 69 |
return new DefaultHttpHeaders("index");
|
69 |
return new DefaultHttpHeaders("index");
|
| 70 |
}
|
70 |
}
|
| 71 |
|
71 |
|
| Line 81... |
Line 81... |
| 81 |
log.info("Using Cache.");
|
81 |
log.info("Using Cache.");
|
| 82 |
return new DefaultHttpHeaders("show");
|
82 |
return new DefaultHttpHeaders("show");
|
| 83 |
}
|
83 |
}
|
| 84 |
}
|
84 |
}
|
| 85 |
log.info("Getting coming soon products snippets.");
|
85 |
log.info("Getting coming soon products snippets.");
|
| 86 |
in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
|
86 |
in.shop2020.model.v1.catalog.CatalogService.Client client = catalogClientService.getClient();
|
| 87 |
try {
|
87 |
try {
|
| 88 |
this.setTotalItems(client.getComingSoonCount());
|
88 |
this.setTotalItems(client.getComingSoonCount());
|
| 89 |
if(sourceId == -1){
|
89 |
if(sourceId == -1){
|
| 90 |
showcasePageSnippetsCache.put(COMING_SOON_COUNT_CACHE_KEY, this.totalItems);
|
90 |
showcasePageSnippetsCache.put(COMING_SOON_COUNT_CACHE_KEY, this.totalItems);
|
| 91 |
}
|
91 |
}
|
| 92 |
this.items = client.getComingSoonCatalogIds(beginIndex, windowSize, null, -1);
|
92 |
this.items = client.getComingSoonCatalogIds(beginIndex, windowSize, null, -1);
|
| 93 |
setSnippets();
|
93 |
setSnippets();
|
| 94 |
if(sourceId == -1){
|
94 |
if(sourceId == -1){
|
| 95 |
showcasePageSnippetsCache.put(COMING_SOON_CACHE_KEY + beginIndex, this.snippets);
|
95 |
showcasePageSnippetsCache.put(COMING_SOON_CACHE_KEY + beginIndex, this.snippets);
|
| 96 |
}
|
96 |
}
|
| 97 |
} catch (InventoryServiceException e) {
|
97 |
} catch (CatalogServiceException e) {
|
| 98 |
log.error("Unable to get coming soon products from inventory service.", e);
|
98 |
log.error("Unable to get coming soon products from inventory service.", e);
|
| 99 |
} catch (TException e) {
|
99 |
} catch (TException e) {
|
| 100 |
log.error("Unable to get coming soon products from inventory service.", e);
|
100 |
log.error("Unable to get coming soon products from inventory service.", e);
|
| 101 |
}
|
101 |
}
|
| 102 |
return new DefaultHttpHeaders("show");
|
102 |
return new DefaultHttpHeaders("show");
|