| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
import in.shop2020.model.v1.user.Widget;
|
3 |
import in.shop2020.model.v1.user.Widget;
|
| 4 |
import in.shop2020.model.v1.user.WidgetException;
|
4 |
import in.shop2020.model.v1.user.WidgetException;
|
| 5 |
import in.shop2020.model.v1.user.UserContextService.Client;
|
5 |
import in.shop2020.model.v1.user.UserContextService.Client;
|
| 6 |
import in.shop2020.model.v1.user.WidgetItem;
|
6 |
import in.shop2020.model.v1.user.WidgetItem;
|
| - |
|
7 |
import in.shop2020.serving.utils.DataLogger;
|
| 7 |
import in.shop2020.serving.utils.FileUtils;
|
8 |
import in.shop2020.serving.utils.FileUtils;
|
| 8 |
import in.shop2020.serving.utils.Utils;
|
9 |
import in.shop2020.serving.utils.Utils;
|
| - |
|
10 |
import in.shop2020.serving.utils.DataLogger.Event;
|
| 9 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
11 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
| 10 |
|
12 |
|
| 11 |
import java.io.File;
|
13 |
import java.io.File;
|
| 12 |
import java.io.FileNotFoundException;
|
14 |
import java.io.FileNotFoundException;
|
| 13 |
import java.io.IOException;
|
15 |
import java.io.IOException;
|
| 14 |
import java.util.ArrayList;
|
16 |
import java.util.ArrayList;
|
| 15 |
import java.util.List;
|
17 |
import java.util.List;
|
| 16 |
|
18 |
|
| - |
|
19 |
import org.apache.commons.lang.StringUtils;
|
| 17 |
import org.apache.log4j.Logger;
|
20 |
import org.apache.log4j.Logger;
|
| 18 |
import org.apache.struts2.convention.annotation.Action;
|
21 |
import org.apache.struts2.convention.annotation.Action;
|
| 19 |
import org.apache.struts2.convention.annotation.InterceptorRef;
|
22 |
import org.apache.struts2.convention.annotation.InterceptorRef;
|
| 20 |
import org.apache.struts2.convention.annotation.Result;
|
23 |
import org.apache.struts2.convention.annotation.Result;
|
| 21 |
import org.apache.struts2.convention.annotation.Results;
|
24 |
import org.apache.struts2.convention.annotation.Results;
|
| Line 29... |
Line 32... |
| 29 |
public class MyresearchController extends BaseController {
|
32 |
public class MyresearchController extends BaseController {
|
| 30 |
|
33 |
|
| 31 |
private UserContextServiceClient userServiceClient = null;
|
34 |
private UserContextServiceClient userServiceClient = null;
|
| 32 |
private Client client;
|
35 |
private Client client;
|
| 33 |
private static Logger log = Logger.getLogger(MyresearchController.class);
|
36 |
private static Logger log = Logger.getLogger(MyresearchController.class);
|
| - |
|
37 |
private static Logger dataLog = DataLogger.getLogger();
|
| 34 |
private String htmlSnippet = "";
|
38 |
private String htmlSnippet = "";
|
| 35 |
private String snippets="";
|
39 |
private String snippets="";
|
| 36 |
private List<String> items;
|
40 |
private List<String> items;
|
| 37 |
private String itemsInJson;
|
41 |
private String itemsInJson;
|
| 38 |
private int totalItems = 0;
|
42 |
private int totalItems = 0;
|
| Line 100... |
Line 104... |
| 100 |
log.error("File not found : " + Utils.EXPORT_ENTITIES_PATH + itemId + File.separator +"WidgetSnippet.html");
|
104 |
log.error("File not found : " + Utils.EXPORT_ENTITIES_PATH + itemId + File.separator +"WidgetSnippet.html");
|
| 101 |
}
|
105 |
}
|
| 102 |
catch (IOException e) {
|
106 |
catch (IOException e) {
|
| 103 |
log.error("IO exception : " + Utils.EXPORT_ENTITIES_PATH + itemId + File.separator +"WidgetSnippet.html");
|
107 |
log.error("IO exception : " + Utils.EXPORT_ENTITIES_PATH + itemId + File.separator +"WidgetSnippet.html");
|
| 104 |
}
|
108 |
}
|
| - |
|
109 |
dataLog.info(StringUtils.join(
|
| - |
|
110 |
new String[] { Event.RESEARCH_ADD.name(),
|
| - |
|
111 |
StringUtils.join(items, "_") }, ", "));
|
| 105 |
}
|
112 |
}
|
| 106 |
}
|
113 |
}
|
| 107 |
}
|
114 |
}
|
| 108 |
return "success";
|
115 |
return "success";
|
| 109 |
}
|
116 |
}
|
| 110 |
|
117 |
|
| 111 |
@Action(value="deletefromresearch",interceptorRefs={@InterceptorRef("createuser"),@InterceptorRef("myDefault")})
|
118 |
@Action(value="deletefromresearch",interceptorRefs={@InterceptorRef("createuser"),@InterceptorRef("myDefault")})
|
| 112 |
public String destroy(){
|
119 |
public String destroy(){
|
| 113 |
for (String item : items){
|
120 |
for (String item : items){
|
| 114 |
long itemId = Long.parseLong(item);
|
121 |
long itemId = Long.parseLong(item);
|
| 115 |
deleteFromMyResearch(userinfo.getUserId(), itemId);
|
122 |
deleteFromMyResearch(userinfo.getUserId(), itemId);
|
| - |
|
123 |
dataLog.info(StringUtils.join(
|
| - |
|
124 |
new String[] { Event.RESEARCH_DELETE.name(),
|
| - |
|
125 |
StringUtils.join(items, "_") }, ", "));
|
| 116 |
}
|
126 |
}
|
| 117 |
return "success";
|
127 |
return "success";
|
| 118 |
}
|
128 |
}
|
| 119 |
|
129 |
|
| 120 |
private void deleteFromMyResearch(long userId, long itemId) {
|
130 |
private void deleteFromMyResearch(long userId, long itemId) {
|