| Line 33... |
Line 33... |
| 33 |
public class MyresearchController extends BaseController {
|
33 |
public class MyresearchController extends BaseController {
|
| 34 |
|
34 |
|
| 35 |
private UserContextServiceClient userServiceClient = null;
|
35 |
private UserContextServiceClient userServiceClient = null;
|
| 36 |
private Client client;
|
36 |
private Client client;
|
| 37 |
private static Logger log = Logger.getLogger(MyresearchController.class);
|
37 |
private static Logger log = Logger.getLogger(MyresearchController.class);
|
| - |
|
38 |
private static final String htmlSnippetFileName = "MyResearchSnippet.html";
|
| 38 |
private String htmlSnippet = "";
|
39 |
private String htmlSnippet = "";
|
| 39 |
private String snippets="";
|
40 |
private String snippets="";
|
| 40 |
private List<String> items;
|
41 |
private List<String> items;
|
| 41 |
private String itemsInJson;
|
42 |
private String itemsInJson;
|
| 42 |
private int totalItems = 0;
|
43 |
private int totalItems = 0;
|
| Line 73... |
Line 74... |
| 73 |
@Action(value="myresearch",interceptorRefs={@InterceptorRef("myDefault")})
|
74 |
@Action(value="myresearch",interceptorRefs={@InterceptorRef("myDefault")})
|
| 74 |
public String show() {
|
75 |
public String show() {
|
| 75 |
if(items != null){
|
76 |
if(items != null){
|
| 76 |
for(String itemId: items){
|
77 |
for(String itemId: items){
|
| 77 |
try {
|
78 |
try {
|
| 78 |
snippets = snippets + FileUtils.read( Utils.EXPORT_ENTITIES_PATH + itemId + File.separator +"WidgetSnippet.html");
|
79 |
snippets = snippets + FileUtils.read( Utils.EXPORT_ENTITIES_PATH + itemId + File.separator + htmlSnippetFileName);
|
| 79 |
totalItems++;
|
80 |
totalItems++;
|
| 80 |
}
|
81 |
}
|
| 81 |
catch (FileNotFoundException e) {
|
82 |
catch (FileNotFoundException e) {
|
| 82 |
log.error("File not found : " + Utils.EXPORT_ENTITIES_PATH + itemId + File.separator +"WidgetSnippet.html");
|
83 |
log.error("File not found : " + Utils.EXPORT_ENTITIES_PATH + itemId + File.separator + htmlSnippetFileName);
|
| 83 |
}
|
84 |
}
|
| 84 |
catch (IOException e) {
|
85 |
catch (IOException e) {
|
| 85 |
log.error("IO exception : " + Utils.EXPORT_ENTITIES_PATH + itemId + File.separator +"WidgetSnippet.html");
|
86 |
log.error("IO exception : " + Utils.EXPORT_ENTITIES_PATH + itemId + File.separator + htmlSnippetFileName);
|
| 86 |
}
|
87 |
}
|
| 87 |
}
|
88 |
}
|
| 88 |
}
|
89 |
}
|
| 89 |
return "show";
|
90 |
return "show";
|
| 90 |
}
|
91 |
}
|
| Line 96... |
Line 97... |
| 96 |
for (String item : items){
|
97 |
for (String item : items){
|
| 97 |
long itemId = Long.parseLong(item);
|
98 |
long itemId = Long.parseLong(item);
|
| 98 |
boolean isNew = client.updateMyResearch(userinfo.getUserId(), itemId);
|
99 |
boolean isNew = client.updateMyResearch(userinfo.getUserId(), itemId);
|
| 99 |
if(isNew){
|
100 |
if(isNew){
|
| 100 |
try {
|
101 |
try {
|
| 101 |
htmlSnippet = htmlSnippet + FileUtils.read( Utils.EXPORT_ENTITIES_PATH + itemId + File.separator +"WidgetSnippet.html");
|
102 |
htmlSnippet = htmlSnippet + FileUtils.read( Utils.EXPORT_ENTITIES_PATH + itemId + File.separator + htmlSnippetFileName);
|
| 102 |
}
|
103 |
}
|
| 103 |
catch (FileNotFoundException e) {
|
104 |
catch (FileNotFoundException e) {
|
| 104 |
log.error("File not found : " + Utils.EXPORT_ENTITIES_PATH + itemId + File.separator +"WidgetSnippet.html");
|
105 |
log.error("File not found : " + Utils.EXPORT_ENTITIES_PATH + itemId + File.separator + htmlSnippetFileName);
|
| 105 |
}
|
106 |
}
|
| 106 |
catch (IOException e) {
|
107 |
catch (IOException e) {
|
| 107 |
log.error("IO exception : " + Utils.EXPORT_ENTITIES_PATH + itemId + File.separator +"WidgetSnippet.html");
|
108 |
log.error("IO exception : " + Utils.EXPORT_ENTITIES_PATH + itemId + File.separator + htmlSnippetFileName);
|
| 108 |
}
|
109 |
}
|
| 109 |
DataLogger.logData(EventType.RESEARCH_ADD, session.getId(), userinfo.getUserId(), userinfo.getEmail(), StringUtils.join(items, "_"));
|
110 |
DataLogger.logData(EventType.RESEARCH_ADD, session.getId(), userinfo.getUserId(), userinfo.getEmail(), StringUtils.join(items, "_"));
|
| 110 |
}
|
111 |
}
|
| 111 |
}
|
112 |
}
|
| 112 |
}
|
113 |
}
|