| 2652 |
rajveer |
1 |
package in.shop2020.serving.controllers;
|
|
|
2 |
|
| 3599 |
rajveer |
3 |
import in.shop2020.serving.services.ContentServingService;
|
|
|
4 |
import in.shop2020.serving.utils.SnippetType;
|
| 2652 |
rajveer |
5 |
|
|
|
6 |
import org.apache.log4j.Logger;
|
| 3052 |
vikas |
7 |
import org.apache.struts2.convention.annotation.Action;
|
|
|
8 |
import org.apache.struts2.convention.annotation.InterceptorRef;
|
| 2652 |
rajveer |
9 |
|
|
|
10 |
@SuppressWarnings("serial")
|
|
|
11 |
public class RelatedAccessoriesController extends BaseController {
|
|
|
12 |
|
|
|
13 |
private static Logger logger = Logger.getLogger(RelatedAccessoriesController.class);
|
|
|
14 |
private String id;
|
|
|
15 |
private String snippets="";
|
|
|
16 |
|
|
|
17 |
public RelatedAccessoriesController(){
|
|
|
18 |
super();
|
|
|
19 |
}
|
|
|
20 |
|
| 3052 |
vikas |
21 |
@Action(interceptorRefs={@InterceptorRef("caching"),@InterceptorRef("myDefault")})
|
| 2652 |
rajveer |
22 |
public String show() {
|
|
|
23 |
return "show";
|
|
|
24 |
}
|
|
|
25 |
|
|
|
26 |
public void setId(String id) {
|
|
|
27 |
this.id = id;
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
public String getSnippets(){
|
|
|
31 |
String itemIds = "";
|
| 3599 |
rajveer |
32 |
itemIds = ContentServingService.getSnippet(SnippetType.RELATED_ACCESSORIES_SNIPPET, id, sourceId);
|
| 2652 |
rajveer |
33 |
if(!itemIds.equals("")){
|
|
|
34 |
String[] items = itemIds.split("\\s|\\n|\\t");
|
|
|
35 |
for(String item: items){
|
| 2662 |
rajveer |
36 |
logger.info("Getting widget snippet for item: " + item);
|
| 3599 |
rajveer |
37 |
snippets = snippets + ContentServingService.getSnippet(SnippetType.WIDGET_SNIPPET, item, sourceId);
|
| 2652 |
rajveer |
38 |
}
|
|
|
39 |
}
|
|
|
40 |
return snippets;
|
|
|
41 |
}
|
|
|
42 |
}
|