Subversion Repositories SmartDukaan

Rev

Rev 7931 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7931 Rev 9338
Line 1... Line 1...
1
package in.shop2020.serving.controllers;
1
package in.shop2020.serving.controllers;
2
 
2
 
-
 
3
import in.shop2020.model.v1.inventory.Warehouse;
-
 
4
import in.shop2020.model.v1.order.Order;
-
 
5
import in.shop2020.model.v1.order.TransactionServiceException;
3
import in.shop2020.serving.model.ShipmentUpdate;
6
import in.shop2020.serving.model.ShipmentUpdate;
4
import in.shop2020.serving.services.FedExTrackingService;
7
import in.shop2020.serving.services.FedExTrackingService;
-
 
8
import in.shop2020.thrift.clients.InventoryClient;
-
 
9
import in.shop2020.thrift.clients.TransactionClient;
5
 
10
 
6
import java.util.List;
11
import java.util.List;
7
 
12
 
8
import org.apache.log4j.Logger;
13
import org.apache.log4j.Logger;
-
 
14
import org.apache.thrift.TException;
-
 
15
import org.apache.thrift.transport.TTransportException;
9
 
16
 
10
public class FedExUpdatesController extends BaseController {
17
public class FedExUpdatesController extends BaseController {
11
	/**
18
	/**
12
	 * 
19
	 * 
13
	 */
20
	 */
Line 20... Line 27...
20
		super();
27
		super();
21
	}
28
	}
22
	
29
	
23
	public String show() {
30
	public String show() {
24
		log.info("FedEx Updates Controller " + id);
31
		log.info("FedEx Updates Controller " + id);
-
 
32
		TransactionClient transactionServiceClient = null;
-
 
33
		try {
-
 
34
			transactionServiceClient = new TransactionClient();
-
 
35
		} catch (TTransportException e) {
-
 
36
			log.error("Exception : Getting Transaction Client",e);
-
 
37
		}
-
 
38
		Order order = null;
-
 
39
		if(transactionServiceClient!=null){
-
 
40
			try {
-
 
41
				order = transactionServiceClient.getClient().getOrderForAirwayBillNo(id);
-
 
42
			} catch (TransactionServiceException e) {
-
 
43
				log.error("Exception : Getting Transaction Service Exception",e);
-
 
44
			} catch (TException e) {
-
 
45
				log.error("Exception : Getting Transaction Service TException",e);
-
 
46
			}
-
 
47
		}
-
 
48
		
-
 
49
		Warehouse warehouse = null;
-
 
50
		if(order!=null){
-
 
51
			try{
-
 
52
	    		InventoryClient isc = new InventoryClient();
-
 
53
	    		warehouse = isc.getClient().getWarehouse(order.getWarehouse_id());
-
 
54
			} catch(Exception e) {
-
 
55
				log.error("Unable to get warehouse for id : " + order.getWarehouse_id(),e);
-
 
56
			}
-
 
57
		}
-
 
58
		if(warehouse!=null){
25
		FedExTrackingService trackingService = new FedExTrackingService();
59
			FedExTrackingService trackingService = new FedExTrackingService(warehouse.getLogisticsLocation());
26
    	updates = trackingService.getUpdates(id);
60
	    	updates = trackingService.getUpdates(id);
-
 
61
		}
27
		return "show";
62
		return "show";
28
	}
63
	}
29
	public String getId(){
64
	public String getId(){
30
		return id;
65
		return id;
31
	}
66
	}