| 419 |
rajveer |
1 |
package in.shop2020.serving.controllers;
|
|
|
2 |
|
|
|
3 |
import in.shop2020.serving.controllers.BaseController;
|
|
|
4 |
import in.shop2020.serving.pages.PageContentKeys;
|
|
|
5 |
import in.shop2020.serving.pages.PageEnum;
|
|
|
6 |
import in.shop2020.serving.pages.PageManager;
|
|
|
7 |
import java.util.*;
|
|
|
8 |
|
|
|
9 |
import org.apache.juli.logging.Log;
|
|
|
10 |
import org.apache.juli.logging.LogFactory;
|
|
|
11 |
import org.apache.struts2.convention.annotation.Result;
|
|
|
12 |
import org.apache.struts2.convention.annotation.Results;
|
|
|
13 |
import org.apache.struts2.interceptor.ParameterAware;
|
|
|
14 |
import org.apache.struts2.rest.DefaultHttpHeaders;
|
|
|
15 |
import org.apache.struts2.rest.HttpHeaders;
|
|
|
16 |
|
|
|
17 |
@Results({
|
| 507 |
rajveer |
18 |
@Result(name="redirect", location="${url}", type="redirect")
|
| 419 |
rajveer |
19 |
})
|
|
|
20 |
public class OrderController extends BaseController implements ParameterAware {
|
|
|
21 |
|
|
|
22 |
private static final long serialVersionUID = 1L;
|
|
|
23 |
|
| 507 |
rajveer |
24 |
private PageManager pageManager = null;
|
| 419 |
rajveer |
25 |
private Map<String, String[]> reqparams;
|
| 507 |
rajveer |
26 |
private String redirectUrl;
|
| 419 |
rajveer |
27 |
private static Log log = LogFactory.getLog(OrderController.class);
|
| 507 |
rajveer |
28 |
private String id;
|
| 419 |
rajveer |
29 |
private Map<String,String> htmlSnippets;
|
|
|
30 |
|
|
|
31 |
public OrderController(){
|
| 507 |
rajveer |
32 |
super();
|
|
|
33 |
pageManager = PageManager.getPageManager();
|
| 419 |
rajveer |
34 |
}
|
|
|
35 |
|
|
|
36 |
|
| 507 |
rajveer |
37 |
// GET /order/ orderid
|
|
|
38 |
public String show() {
|
|
|
39 |
log.info("id=" + id);
|
| 424 |
rajveer |
40 |
if(!userinfo.isLoggedIn()){
|
| 507 |
rajveer |
41 |
this.redirectUrl = "login";
|
|
|
42 |
return "redirect";
|
| 424 |
rajveer |
43 |
}
|
| 419 |
rajveer |
44 |
|
| 507 |
rajveer |
45 |
Map<PageContentKeys, String> params = new HashMap<PageContentKeys, String>();
|
|
|
46 |
|
|
|
47 |
params.put(PageContentKeys.ORDER_ID, id);
|
|
|
48 |
params.put(PageContentKeys.USER_ID, new Long(userinfo.getUserId()).toString());
|
|
|
49 |
params.put(PageContentKeys.CART_ID, new Long(userinfo.getCartId()).toString());
|
|
|
50 |
params.put(PageContentKeys.SESSION_ID, new Long(userinfo.getSessionId()).toString());
|
|
|
51 |
params.put(PageContentKeys.USER_NAME, userinfo.getNameOfUser());
|
|
|
52 |
params.put(PageContentKeys.ITEM_COUNT, new Long(userinfo.getTotalItems()).toString());
|
|
|
53 |
|
|
|
54 |
htmlSnippets = pageManager.getPageContents(PageEnum.ORDER_DETAILS_PAGE, params);
|
|
|
55 |
return "show";
|
| 419 |
rajveer |
56 |
}
|
|
|
57 |
|
| 507 |
rajveer |
58 |
public String getId(){
|
|
|
59 |
return id;
|
|
|
60 |
}
|
| 419 |
rajveer |
61 |
|
| 507 |
rajveer |
62 |
public void setId(String id){
|
|
|
63 |
this.id = id;
|
|
|
64 |
}
|
| 419 |
rajveer |
65 |
|
| 507 |
rajveer |
66 |
@Override
|
| 419 |
rajveer |
67 |
public void setParameters(Map<String, String[]> reqmap) {
|
|
|
68 |
log.info("setParameters:" + reqmap);
|
|
|
69 |
|
|
|
70 |
this.reqparams = reqmap;
|
|
|
71 |
}
|
| 507 |
rajveer |
72 |
|
|
|
73 |
public String getHeaderSnippet(){
|
|
|
74 |
return htmlSnippets.get("HEADER");
|
|
|
75 |
}
|
| 419 |
rajveer |
76 |
|
| 507 |
rajveer |
77 |
public String getMainMenuSnippet(){
|
|
|
78 |
return htmlSnippets.get("MAIN_MENU");
|
|
|
79 |
}
|
|
|
80 |
|
|
|
81 |
public String getSearchBarSnippet(){
|
|
|
82 |
return htmlSnippets.get("SEARCH_BAR");
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
public String getCustomerServiceSnippet(){
|
|
|
87 |
return htmlSnippets.get("CUSTOMER_SERVICE");
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
public String getMyaccountHeaderSnippet(){
|
|
|
91 |
return htmlSnippets.get("MYACCOUNT_HEADER");
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
public String getOrderDetailsSnippet(){
|
|
|
95 |
return htmlSnippets.get("ORDER_DETAILS");
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
public String getMyResearchSnippet(){
|
|
|
99 |
return htmlSnippets.get("MY_RESEARCH");
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
public String getFooterSnippet(){
|
|
|
103 |
return htmlSnippets.get("FOOTER");
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
public String getJsFileSnippet(){
|
|
|
107 |
return htmlSnippets.get("JS_FILES");
|
|
|
108 |
}
|
|
|
109 |
|
|
|
110 |
public String getCssFileSnippet(){
|
|
|
111 |
return htmlSnippets.get("CSS_FILES");
|
|
|
112 |
}
|
|
|
113 |
|
| 419 |
rajveer |
114 |
}
|