Rev 1034 | Rev 1258 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
/****/package in.shop2020.serving.controllers;import in.shop2020.thrift.clients.UserContextServiceClient;import in.shop2020.model.v1.user.UserContextService.Client;import java.io.IOException;import java.util.Map;import java.util.StringTokenizer;import org.apache.log4j.Logger;import org.apache.struts2.convention.annotation.Action;import org.apache.struts2.convention.annotation.Actions;import org.apache.struts2.convention.annotation.Result;/**** @author rajveer**/@Result(name = "show", location = "entity-show.vm")public class EntityController extends BaseController {private static final long serialVersionUID = 1L;private static Logger log = Logger.getLogger(Class.class);/****/private String id;private long productId;public EntityController(){super();}// GET /*/1000001@Actions({@Action("/mobile-phones"),@Action("/mobile-accessories"),@Action("/entity")})public String show() throws SecurityException, IOException {log.info("id=" + id);htmlSnippets.put("PRODUCT_SUMMARY", pageLoader.getProductSummaryHtml(productId));htmlSnippets.put("SOCIAL_UTILS", pageLoader.getSocialUtilsHtml(productId));htmlSnippets.put("SLIDE_GUIDE", pageLoader.getSlideGuideHtml(productId));htmlSnippets.put("PAGE_TITLE", pageLoader.getPageTitleHtml(productId));htmlSnippets.put("PAGE_METADESC", pageLoader.getPageMetaDescriptionHtml(productId));htmlSnippets.put("PAGE_METAKEYWORDS", pageLoader.getPageMetaKeywordsHtml(productId));try {UserContextServiceClient userServiceClient = new UserContextServiceClient();Client client = userServiceClient.getClient();long itemId = Long.parseLong(id);long userId = userinfo.getUserId();client.updateBrowseHistory(userId, itemId);} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}return "show";}/**** @param id*/public void setId(String id) {StringTokenizer tokenizer = new StringTokenizer(id,"-");while(tokenizer.hasMoreTokens()){this.id = tokenizer.nextToken();}this.productId = Long.parseLong(this.id);}public Map<String,String> getHtmlSnippets(){System.out.println(" getHtmlSnippets is called");return htmlSnippets;}public String getSlideGuideSnippet(){return htmlSnippets.get("SLIDE_GUIDE");}public String getProductSummarySnippet(){return htmlSnippets.get("PRODUCT_SUMMARY");}public String getPageTitleSnippet(){return htmlSnippets.get("PAGE_TITLE");}public String getPageMetaDescSnippet(){return htmlSnippets.get("PAGE_METADESC");}public String getPageMetaKeywordsSnippet(){return htmlSnippets.get("PAGE_METAKEYWORDS");}public String getSocialUtilsSnippet(){return htmlSnippets.get("SOCIAL_UTILS");}public String getLocatorSnippet(){return htmlSnippets.get("LOCATOR");}public String getRecommendationsSnippet(){return htmlSnippets.get("RECOMMENDATIONS");}public String getSimilarProductsSnippet(){return htmlSnippets.get("SIMILAR_PRODUCTS");}public String getAccessoriesSnippet(){return htmlSnippets.get("ACCESSORIES");}public String getReviewsSnippet(){return htmlSnippets.get("REVIEWS");}}