| Line 5... |
Line 5... |
| 5 |
import in.shop2020.hotspot.dashbaord.shared.actions.AuthRequest;
|
5 |
import in.shop2020.hotspot.dashbaord.shared.actions.AuthRequest;
|
| 6 |
import in.shop2020.hotspot.dashbaord.shared.actions.AuthResponse;
|
6 |
import in.shop2020.hotspot.dashbaord.shared.actions.AuthResponse;
|
| 7 |
import in.shop2020.hotspot.dashbaord.shared.actions.AuthResponse.NEXT;
|
7 |
import in.shop2020.hotspot.dashbaord.shared.actions.AuthResponse.NEXT;
|
| 8 |
import in.shop2020.thrift.clients.HelperServiceClient;
|
8 |
import in.shop2020.thrift.clients.HelperServiceClient;
|
| 9 |
import in.shop2020.utils.DashboardUser;
|
9 |
import in.shop2020.utils.DashboardUser;
|
| - |
|
10 |
import in.shop2020.utils.Role;
|
| 10 |
import in.shop2020.utils.HelperService.Client;
|
11 |
import in.shop2020.utils.HelperService.Client;
|
| 11 |
import in.shop2020.utils.HelperServiceException;
|
12 |
import in.shop2020.utils.HelperServiceException;
|
| 12 |
import net.customware.gwt.dispatch.server.ActionHandler;
|
13 |
import net.customware.gwt.dispatch.server.ActionHandler;
|
| 13 |
import net.customware.gwt.dispatch.server.ExecutionContext;
|
14 |
import net.customware.gwt.dispatch.server.ExecutionContext;
|
| 14 |
import net.customware.gwt.dispatch.shared.ActionException;
|
15 |
import net.customware.gwt.dispatch.shared.ActionException;
|
| Line 21... |
Line 22... |
| 21 |
String password = request.getPassword();
|
22 |
String password = request.getPassword();
|
| 22 |
|
23 |
|
| 23 |
boolean status = false;
|
24 |
boolean status = false;
|
| 24 |
long warehouseId = -1;
|
25 |
long warehouseId = -1;
|
| 25 |
boolean isAdmin = false;
|
26 |
boolean isAdmin = false;
|
| - |
|
27 |
boolean isCategoryManager = false;
|
| 26 |
NEXT nextScreen = null;
|
28 |
NEXT nextScreen = null;
|
| 27 |
String message = null;
|
29 |
String message = null;
|
| 28 |
|
30 |
|
| 29 |
try {
|
31 |
try {
|
| 30 |
HelperServiceClient hsc = new HelperServiceClient();
|
32 |
HelperServiceClient hsc = new HelperServiceClient();
|
| 31 |
Client client = hsc.getClient();
|
33 |
Client client = hsc.getClient();
|
| 32 |
DashboardUser dashboardUser = client.authenticateDashboardUser(userName, password);
|
34 |
DashboardUser dashboardUser = client.authenticateDashboardUser(userName, password);
|
| 33 |
status = true;
|
35 |
status = true;
|
| 34 |
nextScreen = NEXT.INBOX;
|
36 |
nextScreen = NEXT.INBOX;
|
| 35 |
warehouseId = dashboardUser.getWarehouseId();
|
37 |
warehouseId = dashboardUser.getWarehouseId();
|
| 36 |
isAdmin = dashboardUser.isAdmin();
|
38 |
if(dashboardUser.getRole() == Role.ADMIN)
|
| - |
|
39 |
isAdmin = true;
|
| - |
|
40 |
else if(dashboardUser.getRole() == Role.CATEGORY_MANAGER)
|
| - |
|
41 |
isCategoryManager = true;
|
| 37 |
message = "You are charming, loving and affectionate";
|
42 |
message = "You are charming, loving and affectionate";
|
| 38 |
} catch (HelperServiceException e) {
|
43 |
} catch (HelperServiceException e) {
|
| 39 |
e.printStackTrace();
|
44 |
e.printStackTrace();
|
| 40 |
} catch (TException e) {
|
45 |
} catch (TException e) {
|
| 41 |
e.printStackTrace();
|
46 |
e.printStackTrace();
|
| 42 |
} catch (Exception e) {
|
47 |
} catch (Exception e) {
|
| 43 |
e.printStackTrace();
|
48 |
e.printStackTrace();
|
| 44 |
}
|
49 |
}
|
| 45 |
return new AuthResponse(userName, status, message, nextScreen, warehouseId, isAdmin);
|
50 |
return new AuthResponse(userName, status, message, nextScreen, warehouseId, isAdmin, isCategoryManager);
|
| 46 |
}
|
51 |
}
|
| 47 |
|
52 |
|
| 48 |
@Override
|
53 |
@Override
|
| 49 |
public Class<AuthRequest> getActionType() {
|
54 |
public Class<AuthRequest> getActionType() {
|
| 50 |
return AuthRequest.class;
|
55 |
return AuthRequest.class;
|