Rev 462 | Blame | Last modification | View Log | RSS feed
/****/package in.shop2020.serving.controllers;import java.util.StringTokenizer;import in.shop2020.logistics.LogisticsService.Client;import in.shop2020.thrift.clients.LogisticsServiceClient;import org.apache.juli.logging.Log;import org.apache.juli.logging.LogFactory;import org.apache.struts2.rest.DefaultHttpHeaders;import org.apache.struts2.rest.HttpHeaders;/*** @author rajveer**/public class EstimateController extends BaseController {/****/private static Log log = LogFactory.getLog(EstimateController.class);private String id;private long itemId;private String pincode;private long hours = 72;public EstimateController() {super();}// GET /logoutpublic HttpHeaders show() throws Exception {LogisticsServiceClient logisticsServiceClient;try {logisticsServiceClient = new LogisticsServiceClient();Client logisticsClient = logisticsServiceClient.getClient();hours = logisticsClient.getLogisticsEstimation(itemId, pincode, 1).getShippingTime();} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}return new DefaultHttpHeaders("index");}/**** @param id*/public void setId(String id) {this.id = id;StringTokenizer tokenizer = new StringTokenizer(id, "_");this.pincode = tokenizer.nextToken();this.itemId = Long.parseLong(tokenizer.nextToken());}public long getEstimatedTime() {return hours;}}