Rev 9338 | Blame | Compare with Previous | Last modification | View Log | RSS feed
package in.shop2020.serving.controllers;import in.shop2020.model.v1.inventory.Warehouse;import in.shop2020.model.v1.order.Order;import in.shop2020.model.v1.order.TransactionServiceException;import in.shop2020.serving.model.ShipmentUpdate;import in.shop2020.serving.services.FedExTrackingService;import in.shop2020.thrift.clients.InventoryClient;import in.shop2020.thrift.clients.TransactionClient;import java.util.List;import org.apache.log4j.Logger;import org.apache.thrift.TException;import org.apache.thrift.transport.TTransportException;public class FedExUpdatesController extends BaseController {/****/private static final long serialVersionUID = 2544586714453252214L;private static Logger log = Logger.getLogger(Class.class);private String id;private List<ShipmentUpdate> updates;public FedExUpdatesController(){super();}public String show() {log.info("FedEx Updates Controller " + id);TransactionClient transactionServiceClient = null;try {transactionServiceClient = new TransactionClient();} catch (TTransportException e) {log.error("Exception : Getting Transaction Client",e);}Order order = null;if(transactionServiceClient!=null){try {order = transactionServiceClient.getClient().getOrderForAirwayBillNo(id).get(0);} catch (TransactionServiceException e) {log.error("Exception : Getting Transaction Service Exception",e);} catch (TException e) {log.error("Exception : Getting Transaction Service TException",e);}}Warehouse warehouse = null;if(order!=null){try{InventoryClient isc = new InventoryClient();warehouse = isc.getClient().getWarehouse(order.getWarehouse_id());} catch(Exception e) {log.error("Unable to get warehouse for id : " + order.getWarehouse_id(),e);}}if(warehouse!=null){FedExTrackingService trackingService = new FedExTrackingService(warehouse.getLogisticsLocation());updates = trackingService.getUpdates(id);}return "show";}public String getId(){return id;}public void setId(String id){this.id = id;}public List<ShipmentUpdate> getUpdates(){return updates;}}