Subversion Repositories SmartDukaan

Rev

Rev 6225 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package in.shop2020.serving.controllers;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.apache.thrift.TException;
import org.apache.thrift.transport.TTransportException;

import in.shop2020.thrift.clients.HelperClient;
import in.shop2020.utils.HelperServiceException;
import in.shop2020.utils.QuickLink;

public class QuicklinksController extends BaseController {
        
        private static Logger log = Logger.getLogger(Class.class);
        
        private Map<String, String> quicklinksMap = new HashMap<String, String>();
        
        public String index()   {
                try {
                        HelperClient helperServiceClient = new HelperClient();
                        in.shop2020.utils.HelperService.Client helperClient = helperServiceClient.getClient();
                        
                        List<QuickLink> quickLinks = helperClient.getQuickLinks();
                        
                        for (QuickLink quicklink: quickLinks)   {
                                
                                quicklinksMap.put(quicklink.getUrl(), quicklink.getText());
                        }
                } catch (TTransportException e) {
                        log.error("" + e);
                } catch (HelperServiceException e) {
                        log.error("" + e);
                } catch (TException e) {
                        log.error("" + e);
                }
                return "index";
        }
        
        public Map<String, String> getQuickLinks()      {
                return this.quicklinksMap;
        }
}