Rev 7030 | Blame | Compare with Previous | Last modification | View Log | RSS feed
package in.shop2020.serving.services;import in.shop2020.config.ConfigException;import in.shop2020.serving.model.ShipmentUpdate;import in.shop2020.thrift.clients.TransactionClient;import in.shop2020.thrift.clients.config.ConfigClient;import java.util.ArrayList;import java.util.List;import javax.xml.xpath.XPath;import javax.xml.xpath.XPathConstants;import javax.xml.xpath.XPathExpressionException;import javax.xml.xpath.XPathFactory;import org.apache.log4j.Logger;import org.w3c.dom.Element;import org.w3c.dom.NodeList;import org.xml.sax.InputSource;public class RedExpressTrackingService {private static Logger log = Logger.getLogger(Class.class);public List<ShipmentUpdate> getUpdates(String awbNumber){List<ShipmentUpdate> updates = new ArrayList<ShipmentUpdate>();try{TransactionClient tc = new TransactionClient();List<String> tokens= tc.getClient().receiveUpdatesForRedExpress(awbNumber);for(String token: tokens){String[] parts = token.split("~!~");ShipmentUpdate update = new ShipmentUpdate();update.date = parts[0];update.time = " " + parts[1];update.description = parts[2];update.city = "--";updates.add(update);}} catch (Exception e) {log.info("Some problem while fetching");}return updates;}}