Rev 555 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package in.shop2020.serving.services;import in.shop2020.serving.utils.Utils;import java.util.Date;public class UserSessionInfo {private boolean isLoggedIn;private long userId;private long sessionId;private String email;private String nameOfUser;private int totalItems;private long cartId;public UserSessionInfo(){this.isLoggedIn = false;this.userId = -1;this.sessionId = (new Date()).getTime();this.email = "";this.nameOfUser = "";this.totalItems = 0;this.cartId = -1;}public UserSessionInfo(long userId, boolean isSessionId){if(!isSessionId){this.isLoggedIn = true;this.userId = userId;this.sessionId = (new Date()).getTime();this.email = Utils.getEmailId(userId);this.nameOfUser = Utils.getNameOfUser(userId);//this.totalItems = 0;//this.cartId = -1;this.cartId = Utils.getCartId(userId);this.totalItems = Utils.getNumberOfItemsInCart(this.cartId);}else{this.isLoggedIn = false;this.userId = -1;this.sessionId = userId;this.email = "";this.nameOfUser = "";this.totalItems = 0;this.cartId = -1;}}public boolean isSessionId() {return !isLoggedIn;}public boolean isLoggedIn() {return isLoggedIn;}public void setLoggedIn(boolean isLoggedIn) {this.isLoggedIn = isLoggedIn;}public long getUserId() {return userId;}public void setUserId(long userId) {this.userId = userId;}public long getSessionId() {return sessionId;}public void setSessionId(long sessionId) {this.sessionId = sessionId;}public String getEmail() {return email;}public void setEmail(String email) {this.email = email;}public String getNameOfUser() {return nameOfUser;}public void setNameOfUser(String nameOfUser) {this.nameOfUser = nameOfUser;}public int getTotalItems() {return totalItems;}public void setTotalItems(int totalItems) {this.totalItems = totalItems;}public long getCartId() {return cartId;}public void setCartId(long cartId) {this.cartId = cartId;}}