| Line 3... |
Line 3... |
| 3 |
import in.shop2020.datalogger.EventType;
|
3 |
import in.shop2020.datalogger.EventType;
|
| 4 |
import in.shop2020.model.v1.user.UserContextService.Client;
|
4 |
import in.shop2020.model.v1.user.UserContextService.Client;
|
| 5 |
import in.shop2020.model.v1.user.WidgetException;
|
5 |
import in.shop2020.model.v1.user.WidgetException;
|
| 6 |
import in.shop2020.serving.utils.FileUtils;
|
6 |
import in.shop2020.serving.utils.FileUtils;
|
| 7 |
import in.shop2020.serving.utils.Utils;
|
7 |
import in.shop2020.serving.utils.Utils;
|
| 8 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
8 |
import in.shop2020.thrift.clients.UserClient;
|
| 9 |
import in.shop2020.utils.DataLogger;
|
9 |
import in.shop2020.utils.DataLogger;
|
| 10 |
|
10 |
|
| 11 |
import java.io.File;
|
11 |
import java.io.File;
|
| 12 |
import java.io.FileNotFoundException;
|
12 |
import java.io.FileNotFoundException;
|
| 13 |
import java.io.IOException;
|
13 |
import java.io.IOException;
|
| Line 28... |
Line 28... |
| 28 |
@Results({
|
28 |
@Results({
|
| 29 |
@Result(name="success", location="myresearch-success.vm")
|
29 |
@Result(name="success", location="myresearch-success.vm")
|
| 30 |
})
|
30 |
})
|
| 31 |
public class MyresearchController extends BaseController {
|
31 |
public class MyresearchController extends BaseController {
|
| 32 |
|
32 |
|
| 33 |
private UserContextServiceClient userServiceClient = null;
|
33 |
private UserClient userServiceClient = null;
|
| 34 |
private Client client;
|
34 |
private Client client;
|
| 35 |
private static Logger log = Logger.getLogger(MyresearchController.class);
|
35 |
private static Logger log = Logger.getLogger(MyresearchController.class);
|
| 36 |
private static final String htmlSnippetFileName = "MyResearchSnippet.html";
|
36 |
private static final String htmlSnippetFileName = "MyResearchSnippet.html";
|
| 37 |
private String htmlSnippet = "";
|
37 |
private String htmlSnippet = "";
|
| 38 |
private String snippets="";
|
38 |
private String snippets="";
|
| Line 41... |
Line 41... |
| 41 |
private int totalItems = 0;
|
41 |
private int totalItems = 0;
|
| 42 |
|
42 |
|
| 43 |
public MyresearchController(){
|
43 |
public MyresearchController(){
|
| 44 |
super();
|
44 |
super();
|
| 45 |
try {
|
45 |
try {
|
| 46 |
userServiceClient = new UserContextServiceClient();
|
46 |
userServiceClient = new UserClient();
|
| 47 |
client = userServiceClient.getClient();
|
47 |
client = userServiceClient.getClient();
|
| 48 |
} catch (Exception e) {
|
48 |
} catch (Exception e) {
|
| 49 |
log.error("Unable to initialize the user service client", e);
|
49 |
log.error("Unable to initialize the user service client", e);
|
| 50 |
}
|
50 |
}
|
| 51 |
}
|
51 |
}
|
| Line 122... |
Line 122... |
| 122 |
}
|
122 |
}
|
| 123 |
|
123 |
|
| 124 |
private void deleteFromMyResearch(long userId, long itemId) {
|
124 |
private void deleteFromMyResearch(long userId, long itemId) {
|
| 125 |
|
125 |
|
| 126 |
try {
|
126 |
try {
|
| 127 |
UserContextServiceClient userServiceClient = new UserContextServiceClient();
|
127 |
UserClient userServiceClient = new UserClient();
|
| 128 |
in.shop2020.model.v1.user.UserContextService.Client userClient = userServiceClient.getClient();
|
128 |
in.shop2020.model.v1.user.UserContextService.Client userClient = userServiceClient.getClient();
|
| 129 |
userClient.deleteItemFromMyResearch(userId, itemId);
|
129 |
userClient.deleteItemFromMyResearch(userId, itemId);
|
| 130 |
} catch (WidgetException e) {
|
130 |
} catch (WidgetException e) {
|
| 131 |
log.error("Unable to delete item from the myresearch widget", e);
|
131 |
log.error("Unable to delete item from the myresearch widget", e);
|
| 132 |
} catch (TException e) {
|
132 |
} catch (TException e) {
|