| 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 |
|
- |
|
| 7 |
import in.shop2020.model.v1.widgets.WidgetService.Client;
|
- |
|
| 8 |
import in.shop2020.serving.pages.PageContentKeys;
|
6 |
import in.shop2020.serving.pages.PageContentKeys;
|
| 9 |
import in.shop2020.serving.pages.PageEnum;
|
7 |
import in.shop2020.serving.pages.PageEnum;
|
| 10 |
import in.shop2020.serving.pages.PageManager;
|
8 |
import in.shop2020.serving.pages.PageManager;
|
| 11 |
import in.shop2020.thrift.clients.WidgetServiceClient;
|
9 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
| - |
|
10 |
import in.shop2020.model.v1.user.UserContextService.Client;
|
| 12 |
|
11 |
|
| 13 |
import java.io.IOException;
|
12 |
import java.io.IOException;
|
| 14 |
import java.util.HashMap;
|
13 |
import java.util.HashMap;
|
| 15 |
import java.util.Map;
|
14 |
import java.util.Map;
|
| 16 |
import java.util.StringTokenizer;
|
15 |
import java.util.StringTokenizer;
|
| Line 78... |
Line 77... |
| 78 |
Map<PageContentKeys, String> params = new HashMap<PageContentKeys, String>();
|
77 |
Map<PageContentKeys, String> params = new HashMap<PageContentKeys, String>();
|
| 79 |
|
78 |
|
| 80 |
params.put(PageContentKeys.ENTITY_ID, id);
|
79 |
params.put(PageContentKeys.ENTITY_ID, id);
|
| 81 |
params.put(PageContentKeys.USER_ID, new Long(userinfo.getUserId()).toString());
|
80 |
params.put(PageContentKeys.USER_ID, new Long(userinfo.getUserId()).toString());
|
| 82 |
params.put(PageContentKeys.CART_ID, new Long(userinfo.getCartId()).toString());
|
81 |
params.put(PageContentKeys.CART_ID, new Long(userinfo.getCartId()).toString());
|
| 83 |
params.put(PageContentKeys.SESSION_ID, new Long(userinfo.getSessionId()).toString());
|
- |
|
| 84 |
params.put(PageContentKeys.USER_NAME, userinfo.getNameOfUser());
|
82 |
params.put(PageContentKeys.USER_NAME, userinfo.getNameOfUser());
|
| 85 |
params.put(PageContentKeys.ITEM_COUNT, new Long(userinfo.getTotalItems()).toString());
|
83 |
params.put(PageContentKeys.ITEM_COUNT, new Long(userinfo.getTotalItems()).toString());
|
| 86 |
|
84 |
|
| 87 |
htmlSnippets = pageManager.getPageContents(PageEnum.PRODUCT_PAGE, params);
|
85 |
htmlSnippets = pageManager.getPageContents(PageEnum.PRODUCT_PAGE, params);
|
| 88 |
|
86 |
|
| 89 |
|
87 |
|
| 90 |
System.out.println(htmlSnippets);
|
88 |
System.out.println(htmlSnippets);
|
| 91 |
// To update the browse history of the user
|
89 |
// To update the browse history of the user
|
| 92 |
try {
|
90 |
try {
|
| 93 |
WidgetServiceClient widgetServiceClient = new WidgetServiceClient();
|
91 |
UserContextServiceClient userServiceClient = new UserContextServiceClient();
|
| 94 |
Client client = widgetServiceClient.getClient();
|
92 |
Client client = userServiceClient.getClient();
|
| 95 |
long item_id = Long.parseLong(id);
|
93 |
long item_id = Long.parseLong(id);
|
| 96 |
boolean isSessionId = userinfo.isSessionId();
|
94 |
boolean isSessionId = userinfo.isSessionId();
|
| 97 |
long user_id = 0;
|
95 |
long user_id = 0;
|
| 98 |
if(userinfo.isLoggedIn())
|
96 |
if(userinfo.isLoggedIn())
|
| 99 |
user_id = userinfo.getUserId();
|
97 |
user_id = userinfo.getUserId();
|
| 100 |
else
|
98 |
else
|
| 101 |
user_id = userinfo.getSessionId();
|
99 |
user_id = userinfo.getUserId();
|
| 102 |
client.updateBrowseHistory(user_id, item_id, isSessionId);
|
100 |
client.updateBrowseHistory(user_id, item_id, isSessionId);
|
| 103 |
|
101 |
|
| 104 |
} catch (Exception e) {
|
102 |
} catch (Exception e) {
|
| 105 |
// TODO Auto-generated catch block
|
103 |
// TODO Auto-generated catch block
|
| 106 |
e.printStackTrace();
|
104 |
e.printStackTrace();
|