Subversion Repositories SmartDukaan

Rev

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

Rev 569 Rev 650
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.user.Phone;
-
 
8
import in.shop2020.model.v1.user.PhoneType;
-
 
9
import in.shop2020.model.v1.user.Sex;
7
import in.shop2020.model.v1.user.Sex;
10
import in.shop2020.model.v1.user.User;
8
import in.shop2020.model.v1.user.User;
11
import in.shop2020.model.v1.user.UserState;
-
 
12
import in.shop2020.serving.pages.PageContentKeys;
-
 
13
import in.shop2020.serving.pages.PageEnum;
-
 
14
import in.shop2020.serving.pages.PageManager;
-
 
15
import in.shop2020.serving.utils.Utils;
9
import in.shop2020.serving.utils.Utils;
16
import in.shop2020.thrift.clients.UserContextServiceClient;
10
import in.shop2020.thrift.clients.UserContextServiceClient;
17
 
11
 
18
import java.io.IOException;
12
import java.io.IOException;
19
import java.util.Date;
13
import java.util.Date;
20
import java.util.GregorianCalendar;
-
 
21
import java.util.HashMap;
-
 
22
import java.util.HashSet;
-
 
23
import java.util.Map;
-
 
24
import java.util.Set;
-
 
25
import java.util.StringTokenizer;
-
 
26
 
-
 
27
import javax.servlet.ServletContext;
-
 
28
import javax.servlet.http.Cookie;
-
 
29
 
14
 
30
import org.apache.juli.logging.Log;
15
import org.apache.juli.logging.Log;
31
import org.apache.juli.logging.LogFactory;
16
import org.apache.juli.logging.LogFactory;
32
import org.apache.struts2.convention.annotation.Action;
-
 
33
import org.apache.struts2.convention.annotation.Actions;
-
 
34
import org.apache.struts2.convention.annotation.Result;
17
import org.apache.struts2.convention.annotation.Result;
35
import org.apache.struts2.convention.annotation.Results;
18
import org.apache.struts2.convention.annotation.Results;
36
import org.apache.struts2.interceptor.ParameterAware;
-
 
37
import org.apache.struts2.rest.DefaultHttpHeaders;
-
 
38
import org.apache.struts2.rest.HttpHeaders;
-
 
39
import org.apache.struts2.util.ServletContextAware;
-
 
40
 
-
 
41
import com.opensymphony.xwork2.ModelDriven;
-
 
42
 
19
 
43
/**
20
/**
44
 * 
21
 * 
45
 * @author rajveer
22
 * @author rajveer
46
 *
23
 *
Line 49... Line 26...
49
@Results({
26
@Results({
50
    @Result(name="success", type="redirectAction", 
27
    @Result(name="success", type="redirectAction", 
51
    		params = {"actionName" , "home"})
28
    		params = {"actionName" , "home"})
52
})
29
})
53
public class RegisterController extends BaseController{
30
public class RegisterController extends BaseController{
54
		  
31
		
55
	private PageManager pageManager = null;
32
	private static final long serialVersionUID = 1L;
56
	
-
 
57
	/**
-
 
58
	 * 
-
 
59
	 */
-
 
60
	private static Log log = LogFactory.getLog(RegisterController.class);
33
	private static Log log = LogFactory.getLog(RegisterController.class);
61
	
34
	
62
	private Map<String,String> htmlSnippets;
-
 
63
	
-
 
64
	
-
 
65
	public RegisterController(){
35
	public RegisterController(){
66
		super();
36
		super();
67
		pageManager = PageManager.getPageManager();
-
 
68
	}
37
	}
69
 
38
 
70
 
39
 
71
    public HttpHeaders index() throws SecurityException, IOException {
40
    public String index() throws SecurityException, IOException {
72
    	Map<PageContentKeys, String> params = new HashMap<PageContentKeys, String>();
-
 
73
    	
-
 
74
    	params.put(PageContentKeys.USER_ID, new Long(userinfo.getUserId()).toString());
41
    	htmlSnippets.put("REGISTRATION_HEADER",pageLoader.getRegistrationHeaderHtml());
75
    	params.put(PageContentKeys.CART_ID, new Long(userinfo.getCartId()).toString());
-
 
76
    	params.put(PageContentKeys.ITEM_COUNT, new Long(userinfo.getTotalItems()).toString());
-
 
77
    	htmlSnippets = pageManager.getPageContents(PageEnum.REGISTRATION_PAGE, params);
42
    	htmlSnippets.put("REGISTRATION_FORM",pageLoader.getRegistrationFormHtml());
78
    	
-
 
79
        return new DefaultHttpHeaders("index");
43
    	return "index";
80
    }
44
    }
81
 
45
 
82
    public String create() throws SecurityException, Exception {
46
    public String create() throws SecurityException, Exception {
83
    	
47
    	
84
    	if(registerUser())
48
    	if(registerUser())
Line 146... Line 110...
146
		userinfo.setTotalItems(Utils.getNumberOfItemsInCart(userinfo.getCartId()));
110
		userinfo.setTotalItems(Utils.getNumberOfItemsInCart(userinfo.getCartId()));
147
 
111
 
148
		return true;
112
		return true;
149
    }
113
    }
150
 
114
 
151
	public Map<String,String> getHtmlSnippets(){
-
 
152
		System.out.println(" getHtmlSnippets  is called");
-
 
153
		return htmlSnippets;
-
 
154
	}
-
 
155
	
-
 
156
	public String getHeaderSnippet(){
-
 
157
		return htmlSnippets.get("HEADER");
-
 
158
	}
-
 
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
 
-
 
169
	public String getCustomerServiceSnippet(){
-
 
170
		return htmlSnippets.get("CUSTOMER_SERVICE");
-
 
171
	}
-
 
172
	
-
 
173
	public String getRegistrationHeaderSnippet(){
115
	public String getRegistrationHeaderSnippet(){
174
		return htmlSnippets.get("REGISTRATION_HEADER");
116
		return htmlSnippets.get("REGISTRATION_HEADER");
175
	}
117
	}
176
	
118
	
177
	public String getRegistrationFormSnippet(){
119
	public String getRegistrationFormSnippet(){
178
		return htmlSnippets.get("REGISTRATION_FORM");
120
		return htmlSnippets.get("REGISTRATION_FORM");
179
	}
121
	}
180
 
122
 
181
	public String getRecommendationsSnippet(){
-
 
182
		return htmlSnippets.get("RECOMMENDATIONS");
-
 
183
	}
-
 
184
 
-
 
185
	public String getBrowseHistorySnippet(){
-
 
186
		return htmlSnippets.get("BROWSE_HISTORY");
-
 
187
	}
-
 
188
			
-
 
189
	public String getFooterSnippet(){
-
 
190
		return htmlSnippets.get("FOOTER");
-
 
191
	}
-
 
192
 
-
 
193
	public String getJsFileSnippet(){
-
 
194
		return htmlSnippets.get("JS_FILES");
-
 
195
	}
-
 
196
	
-
 
197
	public String getCssFileSnippet(){
-
 
198
		return htmlSnippets.get("CSS_FILES");
-
 
199
	}
-
 
200
 
-
 
201
}
123
}