| Line 1... |
Line 1... |
| 1 |
package in.shop2020.hotspot.dashbaord.server.handler;
|
1 |
package in.shop2020.hotspot.dashbaord.server.handler;
|
| 2 |
|
2 |
|
| 3 |
import java.util.Map;
|
3 |
import in.shop2020.hotspot.dashbaord.server.CatalogUtils;
|
| 4 |
|
- |
|
| 5 |
import org.apache.thrift.TException;
|
4 |
import in.shop2020.hotspot.dashbaord.server.LogisticsUtils;
|
| 6 |
|
- |
|
| 7 |
import in.shop2020.hotspot.dashbaord.shared.actions.AuthRequest;
|
5 |
import in.shop2020.hotspot.dashbaord.shared.actions.AuthRequest;
|
| 8 |
import in.shop2020.hotspot.dashbaord.shared.actions.AuthResponse;
|
6 |
import in.shop2020.hotspot.dashbaord.shared.actions.AuthResponse;
|
| 9 |
import in.shop2020.hotspot.dashbaord.shared.actions.AuthResponse.NEXT;
|
7 |
import in.shop2020.hotspot.dashbaord.shared.actions.AuthResponse.NEXT;
|
| 10 |
import in.shop2020.hotspot.dashbaord.shared.actions.BillingType;
|
8 |
import in.shop2020.hotspot.dashbaord.shared.actions.BillingType;
|
| 11 |
import in.shop2020.hotspot.dashbaord.shared.actions.UserType;
|
9 |
import in.shop2020.hotspot.dashbaord.shared.actions.UserType;
|
| 12 |
import in.shop2020.hotspot.dashbaord.server.CatalogUtils;
|
- |
|
| 13 |
import in.shop2020.hotspot.dashbaord.server.LogisticsUtils;
|
- |
|
| 14 |
import in.shop2020.model.v1.catalog.Warehouse;
|
10 |
import in.shop2020.model.v1.catalog.Warehouse;
|
| 15 |
import in.shop2020.thrift.clients.CatalogClient;
|
11 |
import in.shop2020.thrift.clients.CatalogClient;
|
| 16 |
import in.shop2020.thrift.clients.HelperClient;
|
12 |
import in.shop2020.thrift.clients.HelperClient;
|
| 17 |
import in.shop2020.utils.DashboardUser;
|
13 |
import in.shop2020.utils.DashboardUser;
|
| 18 |
import in.shop2020.utils.HelperService.Client;
|
14 |
import in.shop2020.utils.HelperService.Client;
|
| 19 |
import in.shop2020.utils.HelperServiceException;
|
15 |
import in.shop2020.utils.HelperServiceException;
|
| - |
|
16 |
|
| - |
|
17 |
import java.util.Map;
|
| - |
|
18 |
|
| 20 |
import net.customware.gwt.dispatch.server.ActionHandler;
|
19 |
import net.customware.gwt.dispatch.server.ActionHandler;
|
| 21 |
import net.customware.gwt.dispatch.server.ExecutionContext;
|
20 |
import net.customware.gwt.dispatch.server.ExecutionContext;
|
| 22 |
import net.customware.gwt.dispatch.shared.ActionException;
|
21 |
import net.customware.gwt.dispatch.shared.ActionException;
|
| 23 |
|
22 |
|
| - |
|
23 |
import org.apache.thrift.TException;
|
| - |
|
24 |
|
| 24 |
public class AuthHandler implements ActionHandler<AuthRequest, AuthResponse>{
|
25 |
public class AuthHandler implements ActionHandler<AuthRequest, AuthResponse>{
|
| 25 |
|
26 |
|
| 26 |
@Override
|
27 |
@Override
|
| 27 |
public AuthResponse execute(AuthRequest request, ExecutionContext response) throws ActionException {
|
28 |
public AuthResponse execute(AuthRequest request, ExecutionContext response) throws ActionException {
|
| 28 |
String userName = request.getUsername();
|
29 |
String userName = request.getUsername();
|
| Line 30... |
Line 31... |
| 30 |
|
31 |
|
| 31 |
boolean status = false;
|
32 |
boolean status = false;
|
| 32 |
long warehouseId = -1;
|
33 |
long warehouseId = -1;
|
| 33 |
UserType userType = UserType.WAREHOUSE_EXECUTIVE;
|
34 |
UserType userType = UserType.WAREHOUSE_EXECUTIVE;
|
| 34 |
BillingType billingType = BillingType.EXTERNAL;
|
35 |
BillingType billingType = BillingType.EXTERNAL;
|
| 35 |
Map<Long, String> vendors = null;
|
36 |
Map<Long, String> warehouses = null;
|
| 36 |
Map<Long, String> providers = null;
|
37 |
Map<Long, String> providers = null;
|
| 37 |
NEXT nextScreen = null;
|
38 |
NEXT nextScreen = null;
|
| 38 |
String message = null;
|
39 |
String message = null;
|
| 39 |
|
40 |
|
| 40 |
try {
|
41 |
try {
|
| Line 67... |
Line 68... |
| 67 |
break;
|
68 |
break;
|
| 68 |
default:
|
69 |
default:
|
| 69 |
billingType = BillingType.EXTERNAL;
|
70 |
billingType = BillingType.EXTERNAL;
|
| 70 |
}
|
71 |
}
|
| 71 |
|
72 |
|
| 72 |
vendors = CatalogUtils.getVendorsForWarehouse(warehouseId);
|
73 |
warehouses = CatalogUtils.getWarehousesForBillingWarehouse(warehouseId);
|
| 73 |
|
74 |
|
| 74 |
providers = LogisticsUtils.getAllProviders();
|
75 |
providers = LogisticsUtils.getAllProviders();
|
| 75 |
|
76 |
|
| 76 |
message = "You are charming, loving and affectionate";
|
77 |
message = "You are charming, loving and affectionate";
|
| 77 |
} catch (HelperServiceException e) {
|
78 |
} catch (HelperServiceException e) {
|
| Line 79... |
Line 80... |
| 79 |
} catch (TException e) {
|
80 |
} catch (TException e) {
|
| 80 |
e.printStackTrace();
|
81 |
e.printStackTrace();
|
| 81 |
} catch (Exception e) {
|
82 |
} catch (Exception e) {
|
| 82 |
e.printStackTrace();
|
83 |
e.printStackTrace();
|
| 83 |
}
|
84 |
}
|
| 84 |
return new AuthResponse(userName, status, message, nextScreen, warehouseId, userType, billingType, vendors, providers);
|
85 |
return new AuthResponse(userName, status, message, nextScreen, warehouseId, userType, billingType, warehouses, providers);
|
| 85 |
}
|
86 |
}
|
| 86 |
|
87 |
|
| 87 |
@Override
|
88 |
@Override
|
| 88 |
public Class<AuthRequest> getActionType() {
|
89 |
public Class<AuthRequest> getActionType() {
|
| 89 |
return AuthRequest.class;
|
90 |
return AuthRequest.class;
|