| 449 |
rajveer |
1 |
package in.shop2020.serving.controllers;
|
|
|
2 |
|
|
|
3 |
import in.shop2020.serving.pages.PageContentKeys;
|
|
|
4 |
import in.shop2020.serving.pages.PageEnum;
|
|
|
5 |
import in.shop2020.serving.pages.PageManager;
|
|
|
6 |
|
|
|
7 |
import java.io.UnsupportedEncodingException;
|
|
|
8 |
import java.util.HashMap;
|
|
|
9 |
import java.util.Map;
|
|
|
10 |
import java.util.StringTokenizer;
|
|
|
11 |
|
|
|
12 |
import org.apache.juli.logging.Log;
|
|
|
13 |
import org.apache.juli.logging.LogFactory;
|
|
|
14 |
import org.apache.struts2.rest.DefaultHttpHeaders;
|
|
|
15 |
import org.apache.struts2.rest.HttpHeaders;
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
public class AddtocartController extends BaseController{
|
|
|
21 |
|
|
|
22 |
/**
|
|
|
23 |
*
|
|
|
24 |
*/
|
|
|
25 |
private static Log log = LogFactory.getLog(AddtocartController.class);
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
//id is in format xyz where xyz is abc is entityid
|
|
|
30 |
private String id;
|
|
|
31 |
|
|
|
32 |
//private String customer_id;
|
|
|
33 |
|
|
|
34 |
private String entity_id;
|
|
|
35 |
|
|
|
36 |
// GET /test
|
|
|
37 |
public HttpHeaders index() throws UnsupportedEncodingException {
|
|
|
38 |
log.info("this.request=" + this.request);
|
|
|
39 |
|
|
|
40 |
return new DefaultHttpHeaders("show")
|
|
|
41 |
.disableCaching();
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
//Handle /myresearch/{id}
|
|
|
46 |
public HttpHeaders show(){
|
|
|
47 |
getFields();
|
|
|
48 |
Map<PageContentKeys, String> params = new HashMap<PageContentKeys, String>();
|
|
|
49 |
params.put(PageContentKeys.ENTITY_ID, entity_id);
|
|
|
50 |
params.put(PageContentKeys.CUSTOMER_ID, userinfo.getUserId()+"");
|
|
|
51 |
PageManager.getPageManager().getPageContents(PageEnum.MY_RESEARCH_PAGE, params);
|
|
|
52 |
//return new DefaultHttpHeaders("index").disableCaching();
|
|
|
53 |
return new DefaultHttpHeaders("success");
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
private void getFields(){
|
|
|
57 |
StringTokenizer tokenizer = new StringTokenizer(id,"_");
|
|
|
58 |
//customer_id = tokenizer.nextToken();
|
|
|
59 |
entity_id = tokenizer.nextToken();
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
/**
|
|
|
63 |
*
|
|
|
64 |
* @param id
|
|
|
65 |
*/
|
|
|
66 |
public void setId(String id) {
|
|
|
67 |
this.id = id;
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
}
|