| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
import in.shop2020.model.v1.user.User;
|
3 |
import in.shop2020.model.v1.user.User;
|
| 4 |
import in.shop2020.model.v1.user.UserContextException;
|
4 |
import in.shop2020.model.v1.user.UserContextException;
|
| 5 |
import in.shop2020.serving.interceptors.UserInterceptor;
|
5 |
import in.shop2020.serving.interceptors.UserInterceptor;
|
| 6 |
import in.shop2020.serving.utils.DesEncrypter;
|
6 |
import in.shop2020.serving.utils.DesEncrypter;
|
| 7 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
7 |
import in.shop2020.thrift.clients.UserClient;
|
| 8 |
|
8 |
|
| 9 |
import java.io.Serializable;
|
9 |
import java.io.Serializable;
|
| 10 |
|
10 |
|
| 11 |
import org.apache.log4j.Logger;
|
11 |
import org.apache.log4j.Logger;
|
| 12 |
import org.apache.thrift.TException;
|
12 |
import org.apache.thrift.TException;
|
| Line 50... |
Line 50... |
| 50 |
}
|
50 |
}
|
| 51 |
|
51 |
|
| 52 |
public UserSessionInfo(long userId, String jsessionId){
|
52 |
public UserSessionInfo(long userId, String jsessionId){
|
| 53 |
this();
|
53 |
this();
|
| 54 |
try {
|
54 |
try {
|
| 55 |
UserContextServiceClient ucsc = new UserContextServiceClient();
|
55 |
UserClient ucsc = new UserClient();
|
| 56 |
in.shop2020.model.v1.user.UserContextService.Client userClient = ucsc.getClient();
|
56 |
in.shop2020.model.v1.user.UserContextService.Client userClient = ucsc.getClient();
|
| 57 |
User existingUser = userClient.getUserById(userId);
|
57 |
User existingUser = userClient.getUserById(userId);
|
| 58 |
if(existingUser != null && existingUser.getUserId() != -1){
|
58 |
if(existingUser != null && existingUser.getUserId() != -1){
|
| 59 |
totalItems = userClient.getCart(existingUser.getActiveCartId()).getLinesSize();
|
59 |
totalItems = userClient.getCart(existingUser.getActiveCartId()).getLinesSize();
|
| 60 |
pincode = userClient.getDefaultPincode(existingUser.getUserId());
|
60 |
pincode = userClient.getDefaultPincode(existingUser.getUserId());
|
| Line 69... |
Line 69... |
| 69 |
}
|
69 |
}
|
| 70 |
}
|
70 |
}
|
| 71 |
|
71 |
|
| 72 |
public UserSessionInfo(String jsessionId) {
|
72 |
public UserSessionInfo(String jsessionId) {
|
| 73 |
this();
|
73 |
this();
|
| 74 |
UserContextServiceClient ucsc = null;
|
74 |
UserClient ucsc = null;
|
| 75 |
try {
|
75 |
try {
|
| 76 |
ucsc = new UserContextServiceClient();
|
76 |
ucsc = new UserClient();
|
| 77 |
in.shop2020.model.v1.user.UserContextService.Client userClient = ucsc.getClient();
|
77 |
in.shop2020.model.v1.user.UserContextService.Client userClient = ucsc.getClient();
|
| 78 |
User anonUser = userClient.createAnonymousUser(jsessionId);
|
78 |
User anonUser = userClient.createAnonymousUser(jsessionId);
|
| 79 |
int totalItems= userClient.getCart(anonUser.getActiveCartId()).getLinesSize();
|
79 |
int totalItems= userClient.getCart(anonUser.getActiveCartId()).getLinesSize();
|
| 80 |
pincode = userClient.getDefaultPincode(anonUser.getUserId());
|
80 |
pincode = userClient.getDefaultPincode(anonUser.getUserId());
|
| 81 |
initialize(anonUser, totalItems, pincode);
|
81 |
initialize(anonUser, totalItems, pincode);
|