| Line 6... |
Line 6... |
| 6 |
|
6 |
|
| 7 |
import in.shop2020.datalogger.EventType;
|
7 |
import in.shop2020.datalogger.EventType;
|
| 8 |
import in.shop2020.model.v1.catalog.Item;
|
8 |
import in.shop2020.model.v1.catalog.Item;
|
| 9 |
import in.shop2020.model.v1.user.UserContextService.Client;
|
9 |
import in.shop2020.model.v1.user.UserContextService.Client;
|
| 10 |
import in.shop2020.serving.cache.EhcacheWrapper;
|
10 |
import in.shop2020.serving.cache.EhcacheWrapper;
|
| - |
|
11 |
import in.shop2020.serving.services.ContentServingService;
|
| - |
|
12 |
import in.shop2020.serving.utils.SnippetType;
|
| 11 |
import in.shop2020.thrift.clients.CatalogClient;
|
13 |
import in.shop2020.thrift.clients.CatalogClient;
|
| 12 |
import in.shop2020.thrift.clients.UserClient;
|
14 |
import in.shop2020.thrift.clients.UserClient;
|
| 13 |
import in.shop2020.utils.DataLogger;
|
15 |
import in.shop2020.utils.DataLogger;
|
| 14 |
|
16 |
|
| 15 |
import java.io.IOException;
|
17 |
import java.io.IOException;
|
| Line 212... |
Line 214... |
| 212 |
}
|
214 |
}
|
| 213 |
|
215 |
|
| 214 |
private void setSnippets() {
|
216 |
private void setSnippets() {
|
| 215 |
EhcacheWrapper<Long, Map<String, String>> productSnippetsCache = new EhcacheWrapper<Long, Map<String, String>>(
|
217 |
EhcacheWrapper<Long, Map<String, String>> productSnippetsCache = new EhcacheWrapper<Long, Map<String, String>>(
|
| 216 |
EhcacheWrapper.PRODUCT_PAGE_SNIPPET_CACHE_NAME, CacheManager.create());
|
218 |
EhcacheWrapper.PRODUCT_PAGE_SNIPPET_CACHE_NAME, CacheManager.create());
|
| - |
|
219 |
if(sourceId == -1){
|
| 217 |
snippets = productSnippetsCache.get(productId);
|
220 |
snippets = productSnippetsCache.get(productId);
|
| - |
|
221 |
}
|
| 218 |
if (snippets == null) {
|
222 |
if (snippets == null) {
|
| 219 |
log.info("Getting product snippet for :" + productId);
|
223 |
log.info("Getting product snippet for :" + productId);
|
| 220 |
snippets = new HashMap<String, String>();
|
224 |
snippets = new HashMap<String, String>();
|
| 221 |
snippets.put(PRODUCT_PROERTIES_SNIPPET_KEY, pageLoader.getProductPropertiesHtml(productId).trim());
|
225 |
snippets.put(PRODUCT_PROERTIES_SNIPPET_KEY, ContentServingService.getSnippet(SnippetType.PRODUCT_PROPERTIES_SNIPPET, productId+"", sourceId));
|
| 222 |
snippets.put(PRODUCT_SUMMARY_SNIPPET_KEY, pageLoader.getProductSummaryHtml(productId));
|
226 |
snippets.put(PRODUCT_SUMMARY_SNIPPET_KEY, ContentServingService.getSnippet(SnippetType.PRODUCT_DETAIL_SNIPPET, productId+"", sourceId));
|
| 223 |
snippets.put(PRODUCT_SLIDEGUIDE_KEY, pageLoader.getSlideGuideHtml(productId));
|
227 |
snippets.put(PRODUCT_SLIDEGUIDE_KEY, ContentServingService.getSnippet(SnippetType.SLIDE_GUIDE_SNIPPET, productId+"", sourceId));
|
| - |
|
228 |
if(sourceId == -1){
|
| 224 |
productSnippetsCache.put(productId, snippets);
|
229 |
productSnippetsCache.put(productId, snippets);
|
| - |
|
230 |
}
|
| 225 |
return;
|
231 |
return;
|
| 226 |
}
|
232 |
}
|
| 227 |
log.info("Loaded from cache product snippet for :" + productId);
|
233 |
log.info("Loaded from cache product snippet for :" + productId);
|
| 228 |
}
|
234 |
}
|
| 229 |
|
235 |
|