| 405 |
rajveer |
1 |
/**
|
|
|
2 |
*
|
|
|
3 |
*/
|
|
|
4 |
package in.shop2020.serving.controllers;
|
|
|
5 |
|
|
|
6 |
import in.shop2020.serving.pages.PageContentKeys;
|
|
|
7 |
import in.shop2020.serving.pages.PageEnum;
|
|
|
8 |
import in.shop2020.serving.pages.PageManager;
|
|
|
9 |
|
|
|
10 |
import java.io.UnsupportedEncodingException;
|
|
|
11 |
import java.net.URLEncoder;
|
|
|
12 |
import java.util.ArrayList;
|
|
|
13 |
import java.util.Arrays;
|
|
|
14 |
import java.util.HashMap;
|
|
|
15 |
import java.util.LinkedHashMap;
|
|
|
16 |
import java.util.List;
|
|
|
17 |
import java.util.Map;
|
|
|
18 |
|
|
|
19 |
import javax.servlet.http.HttpServletRequest;
|
|
|
20 |
|
|
|
21 |
import org.apache.commons.lang.StringUtils;
|
|
|
22 |
import org.apache.juli.logging.Log;
|
|
|
23 |
import org.apache.juli.logging.LogFactory;
|
|
|
24 |
import org.apache.struts2.interceptor.ServletRequestAware;
|
|
|
25 |
import org.apache.struts2.rest.DefaultHttpHeaders;
|
|
|
26 |
import org.apache.struts2.rest.HttpHeaders;
|
|
|
27 |
|
|
|
28 |
import com.opensymphony.xwork2.ModelDriven;
|
|
|
29 |
|
|
|
30 |
/**
|
|
|
31 |
* @author naveen
|
|
|
32 |
*
|
|
|
33 |
*/
|
|
|
34 |
public class MyaccountController extends BaseController
|
|
|
35 |
implements ServletRequestAware {
|
|
|
36 |
|
|
|
37 |
|
|
|
38 |
/**
|
|
|
39 |
*
|
|
|
40 |
*/
|
|
|
41 |
private static Log log = LogFactory.getLog(MyaccountController.class);
|
|
|
42 |
|
|
|
43 |
private Map<String,String> htmlSnippets;
|
|
|
44 |
/**
|
|
|
45 |
*
|
|
|
46 |
*/
|
|
|
47 |
private HttpServletRequest request;
|
|
|
48 |
|
|
|
49 |
private String id;
|
|
|
50 |
|
|
|
51 |
public MyaccountController() {
|
|
|
52 |
// TODO Auto-generated constructor stub
|
|
|
53 |
super();
|
|
|
54 |
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
// GET /test
|
|
|
58 |
public HttpHeaders index() throws UnsupportedEncodingException {
|
|
|
59 |
log.info("this.request=" + this.request);
|
|
|
60 |
|
|
|
61 |
return new DefaultHttpHeaders("index")
|
|
|
62 |
.disableCaching();
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
public HttpHeaders show(){
|
|
|
66 |
log.info("this.id=" + this.id);
|
|
|
67 |
|
|
|
68 |
Map<PageContentKeys, String> params = new HashMap<PageContentKeys, String>();
|
|
|
69 |
params.put(PageContentKeys.CUSTOMER_ID, id);
|
|
|
70 |
htmlSnippets = PageManager.getPageManager().getPageContents(PageEnum.MY_ACCOUNT_PAGE, params);
|
|
|
71 |
|
|
|
72 |
|
|
|
73 |
return new DefaultHttpHeaders("index")
|
|
|
74 |
.disableCaching();
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
/**
|
|
|
78 |
*
|
|
|
79 |
* @param id
|
|
|
80 |
*/
|
|
|
81 |
public void setId(String id) {
|
|
|
82 |
this.id = id;
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
/**
|
|
|
88 |
*
|
|
|
89 |
*/
|
|
|
90 |
@Override
|
|
|
91 |
public void setServletRequest(HttpServletRequest request) {
|
|
|
92 |
this.request = request;
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
|
|
|
96 |
public String getMyAccountSnippets(){
|
|
|
97 |
return htmlSnippets.get("My_ACCOUNT");
|
|
|
98 |
}
|
|
|
99 |
|
|
|
100 |
public String getMyOrdersSnippets(){
|
|
|
101 |
return htmlSnippets.get("My_ORDERS");
|
|
|
102 |
}
|
|
|
103 |
|
|
|
104 |
}
|