| Line 1... |
Line 1... |
| 1 |
package in.shop2020.serving.controllers;
|
1 |
package in.shop2020.serving.controllers;
|
| 2 |
|
2 |
|
| 3 |
import in.shop2020.model.v1.user.UserContextService;
|
3 |
import in.shop2020.model.v1.user.UserContextService;
|
| 4 |
import in.shop2020.model.v1.user.Widget;
|
- |
|
| 5 |
import in.shop2020.model.v1.user.WidgetException;
|
4 |
import in.shop2020.model.v1.user.WidgetException;
|
| 6 |
import in.shop2020.model.v1.user.WidgetItem;
|
- |
|
| 7 |
import in.shop2020.serving.utils.FileUtils;
|
5 |
import in.shop2020.serving.utils.FileUtils;
|
| 8 |
import in.shop2020.serving.utils.Utils;
|
6 |
import in.shop2020.serving.utils.Utils;
|
| 9 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
7 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
| 10 |
|
8 |
|
| 11 |
import java.io.File;
|
9 |
import java.io.File;
|
| Line 48... |
Line 46... |
| 48 |
}
|
46 |
}
|
| 49 |
try {
|
47 |
try {
|
| 50 |
JSONArray itemsJson = new JSONArray();
|
48 |
JSONArray itemsJson = new JSONArray();
|
| 51 |
UserContextServiceClient userServiceClient = new UserContextServiceClient();
|
49 |
UserContextServiceClient userServiceClient = new UserContextServiceClient();
|
| 52 |
UserContextService.Client userClient = userServiceClient.getClient();
|
50 |
UserContextService.Client userClient = userServiceClient.getClient();
|
| 53 |
Widget resWidget = userClient.getBrowseHistory(userinfo.getUserId());
|
51 |
List<Long> widgetItemIds = userClient.getBrowseHistoryItems(userinfo.getUserId());
|
| 54 |
List<WidgetItem> widgetItems = resWidget.getItems();
|
- |
|
| 55 |
for (WidgetItem wItem : widgetItems) {
|
52 |
for (Long itemId : widgetItemIds) {
|
| 56 |
itemsJson.put(wItem.getItem_id());
|
53 |
itemsJson.put(itemId);
|
| 57 |
}
|
54 |
}
|
| 58 |
itemsInJson = itemsJson.toString();
|
55 |
itemsInJson = itemsJson.toString();
|
| 59 |
} catch (WidgetException e) {
|
56 |
} catch (WidgetException e) {
|
| 60 |
log.error("Unable to create the browse history widget because of: ", e);
|
57 |
log.error("Unable to create the browse history widget because of: ", e);
|
| 61 |
} catch (TException e) {
|
58 |
} catch (TException e) {
|