Rev 424 | Blame | Last modification | View Log | RSS feed
package in.shop2020.serving.controllers;import in.shop2020.serving.controllers.BaseController;import in.shop2020.serving.pages.PageContentKeys;import in.shop2020.serving.pages.PageEnum;import in.shop2020.serving.pages.PageManager;import java.util.*;import org.apache.juli.logging.Log;import org.apache.juli.logging.LogFactory;import org.apache.struts2.convention.annotation.Result;import org.apache.struts2.convention.annotation.Results;import org.apache.struts2.interceptor.ParameterAware;import org.apache.struts2.rest.DefaultHttpHeaders;import org.apache.struts2.rest.HttpHeaders;@Results({@Result(name="redirect", location="${url}", type="redirect")})public class OrderController extends BaseController implements ParameterAware {private static final long serialVersionUID = 1L;private PageManager pageManager = null;private Map<String, String[]> reqparams;private String redirectUrl;private static Log log = LogFactory.getLog(OrderController.class);private String id;private Map<String,String> htmlSnippets;public OrderController(){super();pageManager = PageManager.getPageManager();}// GET /order/ orderidpublic String show() {log.info("id=" + id);if(!userinfo.isLoggedIn()){this.redirectUrl = "login";return "redirect";}Map<PageContentKeys, String> params = new HashMap<PageContentKeys, String>();params.put(PageContentKeys.ORDER_ID, id);params.put(PageContentKeys.USER_ID, new Long(userinfo.getUserId()).toString());params.put(PageContentKeys.CART_ID, new Long(userinfo.getCartId()).toString());params.put(PageContentKeys.SESSION_ID, new Long(userinfo.getSessionId()).toString());params.put(PageContentKeys.USER_NAME, userinfo.getNameOfUser());params.put(PageContentKeys.ITEM_COUNT, new Long(userinfo.getTotalItems()).toString());htmlSnippets = pageManager.getPageContents(PageEnum.ORDER_DETAILS_PAGE, params);return "show";}public String getId(){return id;}public void setId(String id){this.id = id;}@Overridepublic void setParameters(Map<String, String[]> reqmap) {log.info("setParameters:" + reqmap);this.reqparams = reqmap;}public String getHeaderSnippet(){return htmlSnippets.get("HEADER");}public String getMainMenuSnippet(){return htmlSnippets.get("MAIN_MENU");}public String getSearchBarSnippet(){return htmlSnippets.get("SEARCH_BAR");}public String getCustomerServiceSnippet(){return htmlSnippets.get("CUSTOMER_SERVICE");}public String getMyaccountHeaderSnippet(){return htmlSnippets.get("MYACCOUNT_HEADER");}public String getOrderDetailsSnippet(){return htmlSnippets.get("ORDER_DETAILS");}public String getMyResearchSnippet(){return htmlSnippets.get("MY_RESEARCH");}public String getFooterSnippet(){return htmlSnippets.get("FOOTER");}public String getJsFileSnippet(){return htmlSnippets.get("JS_FILES");}public String getCssFileSnippet(){return htmlSnippets.get("CSS_FILES");}}