Subversion Repositories SmartDukaan

Rev

Rev 6524 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6322 amar.kumar 1
package in.shop2020.support.controllers;
2
 
3
import in.shop2020.logistics.LogisticsService.Client;
4
import in.shop2020.thrift.clients.LogisticsClient;
5
 
6
import javax.servlet.http.HttpServletRequest;
7
 
8
import org.apache.struts2.interceptor.ServletRequestAware;
9
import org.apache.thrift.TException;
10
import org.apache.thrift.transport.TTransportException;
11
 
12
import com.opensymphony.xwork2.ActionSupport;
13
 
14
public class PincodeController extends ActionSupport implements ServletRequestAware {
15
 
16
	private Long provider;
17
	private String pincode;
18
	private String destCode;
19
	private String exp;
20
	private String cod;
21
	private String stationType;
22
 
23
	private boolean codService = false;
24
	private boolean expService = false;
25
	private int stationType_int = 1;
26
 
27
	@Override
28
	public void setServletRequest(HttpServletRequest arg0) {
29
		// TODO Auto-generated method stub
30
 
31
	}
32
 
33
	public String addPincode() throws TException{
34
		setBooleanServiceability();
35
		Client logisticsClient = new LogisticsClient().getClient();
36
		logisticsClient.addPincode(provider, pincode, destCode, expService, codService, stationType_int);
37
		return null;
38
	}
39
 
40
	public String updatePincode() throws TException{
41
		setBooleanServiceability();
42
		Client logisticsClient = new LogisticsClient().getClient();
43
		logisticsClient.updatePincode(provider, pincode, expService, codService);
44
		return null;
45
	}
46
 
47
	public void setBooleanServiceability(){
48
 
49
		if(cod!=null && cod.equals("on")) {
50
			codService = true;
51
		}
52
		if(exp!= null && exp.equals("on")) {
53
			expService = true;
54
		}
55
		if(stationType==null || !stationType.equals("on")) {
56
			stationType_int = 0;
57
		}
58
	}
59
 
60
	public Long getProvider() {
61
		return provider;
62
	}
63
 
64
	public void setProvider(Long provider) {
65
		this.provider = provider;
66
	}
67
 
68
	public String getPincode() {
69
		return pincode;
70
	}
71
 
72
	public void setPincode(String pincode) {
73
		this.pincode = pincode;
74
	}
75
 
76
	public String getDestCode() {
77
		return destCode;
78
	}
79
 
80
	public void setDestCode(String destCode) {
81
		this.destCode = destCode;
82
	}
83
 
84
	public String isExp() {
85
		return exp;
86
	}
87
 
88
	public void setExp(String exp) {
89
		this.exp = exp;
90
	}
91
 
92
	public String isCod() {
93
		return cod;
94
	}
95
 
96
	public void setCod(String cod) {
97
		this.cod = cod;
98
	}
99
 
100
	public String isStationType() {
101
		return stationType;
102
	}
103
 
104
	public void setStationType(String stationType) {
105
		this.stationType = stationType;
106
	}
107
 
108
 
109
}