Subversion Repositories SmartDukaan

Rev

Rev 6524 | Rev 7735 | Go to most recent revision | Details | Compare with Previous | 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;
6612 amar.kumar 10
import org.slf4j.Logger;
11
import org.slf4j.LoggerFactory;
12
 
6322 amar.kumar 13
import com.opensymphony.xwork2.ActionSupport;
14
 
15
public class PincodeController extends ActionSupport implements ServletRequestAware {
16
 
17
	private Long provider;
18
	private String pincode;
19
	private String destCode;
20
	private String exp;
21
	private String cod;
6524 rajveer 22
	private String otg;
6322 amar.kumar 23
	private String stationType;
24
 
25
	private boolean codService = false;
26
	private boolean expService = false;
6524 rajveer 27
	private boolean otgService = false;
6322 amar.kumar 28
	private int stationType_int = 1;
29
 
6612 amar.kumar 30
	private static Logger logger = LoggerFactory.getLogger(PincodeController.class);
31
 
6322 amar.kumar 32
	@Override
33
	public void setServletRequest(HttpServletRequest arg0) {
34
		// TODO Auto-generated method stub
35
 
36
	}
37
 
38
	public String addPincode() throws TException{
39
		setBooleanServiceability();
40
		Client logisticsClient = new LogisticsClient().getClient();
6524 rajveer 41
		logisticsClient.addPincode(provider, pincode, destCode, expService, codService, stationType_int, otgService);
6322 amar.kumar 42
		return null;
43
	}
44
 
45
	public String updatePincode() throws TException{
46
		setBooleanServiceability();
6612 amar.kumar 47
		logger.info("provider = " + provider + " pincode " + pincode + " exp = " + expService + " cod = " + codService + " otg = " + otgService);
6322 amar.kumar 48
		Client logisticsClient = new LogisticsClient().getClient();
6524 rajveer 49
		logisticsClient.updatePincode(provider, pincode, expService, codService, otgService);
6322 amar.kumar 50
		return null;
51
	}
52
 
53
	public void setBooleanServiceability(){
54
 
55
		if(cod!=null && cod.equals("on")) {
56
			codService = true;
57
		}
58
		if(exp!= null && exp.equals("on")) {
59
			expService = true;
60
		}
6524 rajveer 61
		if(otg!= null && otg.equals("on")) {
62
			otgService = true;
63
		}
6322 amar.kumar 64
		if(stationType==null || !stationType.equals("on")) {
65
			stationType_int = 0;
66
		}
67
	}
68
 
69
	public Long getProvider() {
70
		return provider;
71
	}
72
 
73
	public void setProvider(Long provider) {
74
		this.provider = provider;
75
	}
76
 
77
	public String getPincode() {
78
		return pincode;
79
	}
80
 
81
	public void setPincode(String pincode) {
82
		this.pincode = pincode;
83
	}
84
 
85
	public String getDestCode() {
86
		return destCode;
87
	}
88
 
89
	public void setDestCode(String destCode) {
90
		this.destCode = destCode;
91
	}
92
 
93
	public String isExp() {
94
		return exp;
95
	}
96
 
97
	public void setExp(String exp) {
98
		this.exp = exp;
99
	}
100
 
101
	public String isCod() {
102
		return cod;
103
	}
104
 
105
	public void setCod(String cod) {
106
		this.cod = cod;
107
	}
108
 
109
	public String isStationType() {
110
		return stationType;
111
	}
112
 
113
	public void setStationType(String stationType) {
114
		this.stationType = stationType;
115
	}
6524 rajveer 116
 
117
	public void setOtg(String otg) {
118
		this.otg = otg;
119
	}
120
 
121
	public String getOtg() {
122
		return otg;
123
	}
6322 amar.kumar 124
 
125
 
126
}