Subversion Repositories SmartDukaan

Rev

Rev 388 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 388 Rev 449
Line 2... Line 2...
2
 * 
2
 * 
3
 */
3
 */
4
package in.shop2020.serving.controllers;
4
package in.shop2020.serving.controllers;
5
 
5
 
6
 
6
 
-
 
7
import in.shop2020.model.v1.widgets.WidgetService.Client;
-
 
8
import in.shop2020.serving.page.SessionInfo;
7
import in.shop2020.serving.pages.PageContentKeys;
9
import in.shop2020.serving.pages.PageContentKeys;
8
import in.shop2020.serving.pages.PageEnum;
10
import in.shop2020.serving.pages.PageEnum;
9
import in.shop2020.serving.pages.PageManager;
11
import in.shop2020.serving.pages.PageManager;
-
 
12
import in.shop2020.thrift.clients.WidgetServiceClient;
10
 
13
 
11
import java.io.IOException;
14
import java.io.IOException;
12
import java.util.HashMap;
15
import java.util.HashMap;
13
import java.util.Map;
16
import java.util.Map;
14
 
17
 
Line 63... Line 66...
63
	}
66
	}
64
    // GET /entity/1000001
67
    // GET /entity/1000001
65
    public HttpHeaders show() throws SecurityException, IOException {
68
    public HttpHeaders show() throws SecurityException, IOException {
66
    	log.info("id=" + id);
69
    	log.info("id=" + id);
67
    	Map<PageContentKeys, String> params = new HashMap<PageContentKeys, String>();
70
    	Map<PageContentKeys, String> params = new HashMap<PageContentKeys, String>();
-
 
71
    	
68
    	params.put(PageContentKeys.ENTITY_ID, id);
72
    	params.put(PageContentKeys.ENTITY_ID, id);
-
 
73
    	params.put(PageContentKeys.USER_ID, new Long(userinfo.getUserId()).toString());
-
 
74
    	params.put(PageContentKeys.CART_ID, new Long(userinfo.getCartId()).toString());
69
    	Map<String,String> contents = pageManager.getPageContents(PageEnum.PRODUCT_PAGE, params);
75
    	params.put(PageContentKeys.SESSION_ID, new Long(userinfo.getSessionId()).toString());
-
 
76
    	params.put(PageContentKeys.USER_NAME, userinfo.getNameOfUser());
-
 
77
    	
70
    	htmlSnippets = pageManager.getPageContents(PageEnum.PRODUCT_PAGE, params); 
78
    	htmlSnippets = pageManager.getPageContents(PageEnum.PRODUCT_PAGE, params);
-
 
79
    	
71
    	
80
    	
72
    	System.out.println(htmlSnippets);
81
    	System.out.println(htmlSnippets);
-
 
82
    	// To update the browse history of the user
-
 
83
    	try {
-
 
84
			WidgetServiceClient widgetServiceClient = new WidgetServiceClient();
-
 
85
			Client client = widgetServiceClient.getClient();
-
 
86
			long item_id = Long.parseLong(id);
-
 
87
			boolean isSessionId = userinfo.isSessionId();
-
 
88
			long user_id = 0;
-
 
89
			if(userinfo.isLoggedIn())
-
 
90
				user_id = userinfo.getUserId();
-
 
91
			else
-
 
92
				user_id = userinfo.getSessionId();
-
 
93
			client.updateBrowseHistory(user_id, item_id, isSessionId);
-
 
94
			
-
 
95
		} catch (Exception e) {
-
 
96
			// TODO Auto-generated catch block
-
 
97
			e.printStackTrace();
-
 
98
		}
-
 
99
    	
73
    	/*
100
    	/*
74
    	String contextPath = this.servletContext.getContextPath();
101
    	String contextPath = this.servletContext.getContextPath();
75
    	log.info("contextPath=" + contextPath);
102
    	log.info("contextPath=" + contextPath);
76
    	
103
    	
77
    	String realPath = this.servletContext.getRealPath("/");
104
    	String realPath = this.servletContext.getRealPath("/");
Line 120... Line 147...
120
	public Map<String,String> getHtmlSnippets(){
147
	public Map<String,String> getHtmlSnippets(){
121
		System.out.println(" getHtmlSnippets  is called");
148
		System.out.println(" getHtmlSnippets  is called");
122
		return htmlSnippets;
149
		return htmlSnippets;
123
	}
150
	}
124
	
151
	
125
	public String getPriceSnippets(){
152
	public String getHeaderSnippet(){
126
		return htmlSnippets.get("PRICE_DIV");
153
		return htmlSnippets.get("HEADER");
127
	}
154
	}
128
 
155
 
129
	public String getSlideGuideSnippets(){
156
	public String getSlideGuideSnippet(){
130
		return htmlSnippets.get("SLIDE_GUIDE");
157
		return htmlSnippets.get("SLIDE_GUIDE");
131
	}
158
	}
132
 
159
 
-
 
160
	public String getMainMenuSnippet(){
-
 
161
		return htmlSnippets.get("MAIN_MENU");
-
 
162
	}
-
 
163
	
-
 
164
	public String getSearchBarSnippet(){
-
 
165
		return htmlSnippets.get("SEARCH_BAR");
-
 
166
	}
-
 
167
    		
-
 
168
	public String getProductSummarySnippet(){
-
 
169
		return htmlSnippets.get("PRODUCT_SUMMARY");
-
 
170
	}
-
 
171
	
-
 
172
	public String getSocialUtilsSnippet(){
-
 
173
		return htmlSnippets.get("SOCIAL_UTILS"); 
-
 
174
	}
-
 
175
	
-
 
176
	public String getLocatorSnippet(){
-
 
177
		return htmlSnippets.get("LOCATOR");
-
 
178
	}
-
 
179
	
-
 
180
	public String getReviewsSnippet(){
-
 
181
		return htmlSnippets.get("REVIEWS");
-
 
182
	}
-
 
183
	
-
 
184
	public String getCustomerServiceSnippet(){
-
 
185
		return htmlSnippets.get("CUSTOMER_SERVICE");
-
 
186
	}
-
 
187
	
-
 
188
	public String getMyResearchSnippet(){
-
 
189
		return htmlSnippets.get("MY_RESEARCH");
-
 
190
	}
-
 
191
	
-
 
192
 
-
 
193
	public String getRecommendationsSnippet(){
-
 
194
		return htmlSnippets.get("RECOMMENDATIONS");
-
 
195
	}
-
 
196
 
-
 
197
	public String getSimilarProductsSnippet(){
-
 
198
		return htmlSnippets.get("SIMILAR_PRODUCTS");
-
 
199
	}
-
 
200
			
-
 
201
	public String getAccessoriesSnippet(){
-
 
202
		return htmlSnippets.get("ACCESSORIES");
-
 
203
	}
-
 
204
	 
133
	public String getWidgetSnippets(){
205
	public String getFooterSnippet(){
134
		return htmlSnippets.get("WIDGET_DIV");
206
		return htmlSnippets.get("FOOTER");
135
	}
207
	}
136
 
208
 
-
 
209
	public String getJsFileSnippet(){
-
 
210
		return htmlSnippets.get("JS_FILES");
-
 
211
	}
-
 
212
	
-
 
213
	public String getCssFileSnippet(){
-
 
214
		return htmlSnippets.get("CSS_FILES");
-
 
215
	}
-
 
216
	
137
}
217
}