Subversion Repositories SmartDukaan

Rev

Rev 6050 | Rev 6066 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6050 anupam.sin 1
package in.shop2020.serving.controllers;
2
 
3
import java.util.HashMap;
4
import java.util.List;
5
import java.util.Map;
6057 anupam.sin 6
import java.util.Set;
6050 anupam.sin 7
 
8
import org.apache.log4j.Logger;
9
import org.apache.thrift.TException;
10
import org.apache.thrift.transport.TTransportException;
11
 
6057 anupam.sin 12
import in.shop2020.logistics.LogisticsService;
13
import in.shop2020.logistics.PickupStore;
14
import in.shop2020.model.v1.order.RechargeType;
6050 anupam.sin 15
import in.shop2020.thrift.clients.HelperClient;
6057 anupam.sin 16
import in.shop2020.thrift.clients.LogisticsClient;
17
import in.shop2020.thrift.clients.TransactionClient;
6050 anupam.sin 18
import in.shop2020.utils.HelperServiceException;
19
import in.shop2020.utils.QuickLink;
20
 
21
public class RechargeController extends BaseController {
22
 
23
    /**
24
     * 
25
     */
6057 anupam.sin 26
    private String serviceType = "1";
6050 anupam.sin 27
    private String form = "";
6057 anupam.sin 28
    private Set<Long> providerKeys;
29
    private Map<Long, String> providers;
6050 anupam.sin 30
 
31
    private static final long serialVersionUID = 2079308723099307749L;
32
 
33
    private static Logger log = Logger.getLogger(Class.class);
34
 
6057 anupam.sin 35
 
36
/*    static{
37
        TransactionClient tc;
38
        try {
39
            tc = new TransactionClient();
40
            providers = tc.getClient().getServiceProviders(RechargeType.valueOf(serviceType));
41
        } catch (Exception e) {
42
            log.error("Cannot get providers");
43
        }
44
        setProviderKeys(providers.keySet());
45
    }*/
46
 
6050 anupam.sin 47
    public String index() {
6057 anupam.sin 48
        System.out.println("1");
6050 anupam.sin 49
        return "index";
50
    }
51
 
52
    public String create() {
53
        if(form.equals("serviceSelect")) {
54
            return index();
55
        }
56
        return "hello";
57
    }
6057 anupam.sin 58
 
59
    public Map<Long, String> getProviderMap() {
60
        System.out.println("2");
61
        TransactionClient tc;
62
        try {
63
            tc = new TransactionClient();
64
            System.out.println("3");
65
            providers = tc.getClient().getServiceProviders(RechargeType.findByValue(Integer.parseInt(serviceType)));
66
            System.out.println("4");
67
            setProviderKeys(providers.keySet());
68
            System.out.println("5");
69
        } catch (Exception e) {
70
            log.error("Cannot get providers", e);
71
        }
72
        return providers;
73
    }
6050 anupam.sin 74
 
6057 anupam.sin 75
    private void setProviderKeys(Set<Long> keySet) {
76
        this.providerKeys = keySet;
6050 anupam.sin 77
    }
6057 anupam.sin 78
 
79
    public Set<Long> getProviderKeys() {
80
        System.out.println("6");
81
        return providerKeys;
82
    }
6050 anupam.sin 83
 
6057 anupam.sin 84
    public void setServiceType(String incomingServiceType) {
85
        serviceType = incomingServiceType;
86
    }
87
 
6050 anupam.sin 88
    public String getServiceType() {
89
        return serviceType;
90
    }
91
 
92
    public String getForm() {
93
        return form;
94
    }
95
 
96
    public void setForm(String form) {
97
        this.form = form;
98
    }
99
}