Subversion Repositories SmartDukaan

Rev

Rev 167 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 167 Rev 306
Line 1... Line 1...
1
package in.shop2020.hotspot.dashbaord.server.handler;
1
package in.shop2020.hotspot.dashbaord.server.handler;
2
 
2
 
3
import in.shop2020.hotspot.dashbaord.shared.actions.AddressRequest;
3
import in.shop2020.hotspot.dashbaord.shared.actions.AddressRequest;
4
import in.shop2020.hotspot.dashbaord.shared.actions.AddressResponse;
4
import in.shop2020.hotspot.dashbaord.shared.actions.AddressResponse;
5
import in.shop2020.hotspot.dashbaord.shared.data.Address;
5
import in.shop2020.hotspot.dashbaord.shared.data.Address;
-
 
6
import in.shop2020.model.v1.order.ShipmentInfo;
-
 
7
import in.shop2020.model.v1.order.Transaction;
-
 
8
import in.shop2020.model.v1.order.TransactionService.Client;
-
 
9
import in.shop2020.thrift.clients.TransactionServiceClient;
6
import net.customware.gwt.dispatch.server.ActionHandler;
10
import net.customware.gwt.dispatch.server.ActionHandler;
7
import net.customware.gwt.dispatch.server.ExecutionContext;
11
import net.customware.gwt.dispatch.server.ExecutionContext;
8
import net.customware.gwt.dispatch.shared.ActionException;
12
import net.customware.gwt.dispatch.shared.ActionException;
9
 
13
 
10
public class AddressHandler implements ActionHandler<AddressRequest, AddressResponse>{
14
public class AddressHandler implements ActionHandler<AddressRequest, AddressResponse>{
11
 
15
 
12
	@Override
16
	@Override
13
	public AddressResponse execute(AddressRequest arg0, ExecutionContext arg1)
17
	public AddressResponse execute(AddressRequest request, ExecutionContext context)
14
			throws ActionException {
18
			throws ActionException {
-
 
19
		try{
-
 
20
			TransactionServiceClient client = new TransactionServiceClient();
15
		// TODO Auto-generated method stub
21
			Client c = client.getClient();
-
 
22
			ShipmentInfo sionfo = c.getShippingInfo(request.getOrder().getTransactionId());
-
 
23
			if (sionfo == null || sionfo.getShipments() == null || sionfo.getShipments().size() == 0){
-
 
24
				Address a = new Address("Ashish", "D-15/15, GF,", "Ardee City", "Sector-52", "Gold Souk", "Gurgaon", "Haryana", "India", "122003", "9811384697");
-
 
25
				return new AddressResponse(a);
-
 
26
			}else{
-
 
27
				String address = sionfo.getShipments().iterator().next().getAddress();
-
 
28
				Address a = new Address(address);
-
 
29
				return new AddressResponse(a);
-
 
30
				
-
 
31
			}
-
 
32
			
-
 
33
		}catch(Exception e){
16
		Address a = new Address("Ashish", "D-15/15, GF,", "Ardee City", "Sector-52", "Gold Souk", "Gurgaon", "Haryana", "India", "122003", "9811384697");
34
			Address a = new Address("Ashish", "D-15/15, GF,", "Ardee City", "Sector-52", "Gold Souk", "Gurgaon", "Haryana", "India", "122003", "9811384697");
17
		return new AddressResponse(a);
35
			return new AddressResponse(a);
-
 
36
		}
18
	}
37
	}
19
 
38
 
20
	@Override
39
	@Override
21
	public Class<AddressRequest> getActionType() {
40
	public Class<AddressRequest> getActionType() {
22
		// TODO Auto-generated method stub
41
		// TODO Auto-generated method stub