Subversion Repositories SmartDukaan

Rev

Rev 3830 | Rev 11808 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3830 Rev 4453
Line 33... Line 33...
33
	 * 
33
	 * 
34
	 */
34
	 */
35
	private boolean isLoggedIn;
35
	private boolean isLoggedIn;
36
	private long userId;
36
	private long userId;
37
	private String email;
37
	private String email;
38
	private String nameOfUser;
-
 
39
	private int totalItems;
38
	private int totalItems;
40
	private long cartId;
39
	private long cartId;
41
	private String pincode;
40
	private String pincode;
42
	private double totalAmount;
41
	private double totalAmount;
43
	
42
	
44
	public UserSessionInfo(){
43
	public UserSessionInfo(){
45
		this.isLoggedIn = false;
44
		this.isLoggedIn = false;
46
		this.userId = -1;
45
		this.userId = -1;
47
		this.email = "";
46
		this.email = "";
48
		this.nameOfUser = "";
-
 
49
		this.totalItems = 0;
47
		this.totalItems = 0;
50
		this.cartId = -1;
48
		this.cartId = -1;
51
		this.pincode = "110001";
49
		this.pincode = "110001";
52
		this.totalAmount = 0;
50
		this.totalAmount = 0;
53
	}
51
	}
Line 98... Line 96...
98
	private void initialize(User user, int totalItems, String pincode, double totalAmount){
96
	private void initialize(User user, int totalItems, String pincode, double totalAmount){
99
		if(user!=null){
97
		if(user!=null){
100
			this.isLoggedIn = !user.isIsAnonymous();
98
			this.isLoggedIn = !user.isIsAnonymous();
101
			this.userId = user.getUserId();
99
			this.userId = user.getUserId();
102
			this.email = user.getEmail();
100
			this.email = user.getEmail();
103
			this.nameOfUser = user.getName();
-
 
104
			this.cartId = user.getActiveCartId();
101
			this.cartId = user.getActiveCartId();
105
			this.totalItems = totalItems;
102
			this.totalItems = totalItems;
106
			this.pincode = pincode;
103
			this.pincode = pincode;
107
			this.totalAmount = totalAmount;
104
			this.totalAmount = totalAmount;
108
		}else{
105
		}else{
109
			this.isLoggedIn = false;
106
			this.isLoggedIn = false;
110
			this.userId = -1;
107
			this.userId = -1;
111
			this.email = "";
108
			this.email = "";
112
			this.nameOfUser = "";
-
 
113
			this.totalItems = 0;
109
			this.totalItems = 0;
114
			this.cartId = -1;
110
			this.cartId = -1;
115
			this.pincode = pincode;
111
			this.pincode = pincode;
116
			this.totalAmount = 0;
112
			this.totalAmount = 0;
117
		}			
113
		}			
Line 143... Line 139...
143
 
139
 
144
	public void setEmail(String email) {
140
	public void setEmail(String email) {
145
		this.email = email;
141
		this.email = email;
146
	}
142
	}
147
	
143
	
148
	public String getNameOfUser() {
-
 
149
		return nameOfUser;
-
 
150
	}
-
 
151
 
-
 
152
	public void setNameOfUser(String nameOfUser) {
-
 
153
		this.nameOfUser = nameOfUser;
-
 
154
	}
-
 
155
 
-
 
156
	public int getTotalItems() {
144
	public int getTotalItems() {
157
		return totalItems;
145
		return totalItems;
158
	}
146
	}
159
 
147
 
160
	public void setTotalItems(int totalItems) {
148
	public void setTotalItems(int totalItems) {
Line 217... Line 205...
217
		return userinfo;
205
		return userinfo;
218
	}
206
	}
219
	
207
	
220
	@Override
208
	@Override
221
	public String toString() {
209
	public String toString() {
222
		return "UserSessionInfo [isLoggedIn=" + isLoggedIn + ", userId="
210
		return "UserSessionInfo [isLoggedIn=" + isLoggedIn + ", userId=" + userId + ", email=" + email
223
				+ userId + ", email=" + email + ", nameOfUser=" + nameOfUser
-
 
224
				+ ", totalItems=" + totalItems + ", cartId=" + cartId
211
				+ ", totalItems=" + totalItems + ", cartId=" + cartId
225
				+ ", pincode=" + pincode + ", totalAmount=" + totalAmount + "]";
212
				+ ", pincode=" + pincode + ", totalAmount=" + totalAmount + "]";
226
	}
213
	}
227
 
214
 
228
	public static void main(String[] args) {
215
	public static void main(String[] args) {
229
		System.out.println();
216
		System.out.println();
230
		String cookieValue = "fG0CKt4DUD_D9iP1Ero0v2Io1AgVLoGqXDp0NWAPkzZuw3zHKot5owJK6IodZQfE2aS-obOK3BwXUNRirVHDyd-ycsyG4GfBPd0Ypl1MkxuVBmY4csB0FEg_IgWUm9GaGEzvtmmiZ5bE24XlpUPqR4AoTUAp8d92DDTG61FOFktDIGg3L0Tyk4qpVlAU3xQ3";
217
		String cookieValue = "fG0CKt4DUD_D9iP1Ero0v2Io1AgVLoGqXDp0NWAPkzZuw3zHKot5owJK6IodZQfE2aS-obOK3BwXUNRirVHDyd-ycsyG4GfBPd0Ypl1MkxuVBmY4csB0FEg_IgWUm9GaGEzvtmmiZ5bE24XlpUPqR4AoTUAp8d92DDTG61FOFktDIGg3L0Tyk4qpVlAU3xQ3";
231
		UserSessionInfo uinfo = UserSessionInfo.getUserSessionInfoFromCookieValue(cookieValue);
218
		UserSessionInfo uinfo = UserSessionInfo.getUserSessionInfoFromCookieValue(cookieValue);
232
		System.out.println(uinfo);
219
		System.out.println(uinfo);
233
	}
220
	}
234
	
-
 
235
 
-
 
236
}
221
}
237
222