Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2751 varun.gupt 1
package in.shop2020.datalogger.event;
2
 
3
import in.shop2020.datalogger.EventType;
4
 
5
import org.json.JSONException;
6
import org.json.JSONObject;
7
 
8
public class CouponRemoved extends Event {
9
 
10
	private String couponCode;
11
 
12
	public CouponRemoved(String[] eventFileds) {
13
		super(eventFileds);
14
		couponCode = eventFileds[4].trim();
15
	}
16
 
17
	public CouponRemoved(EventType eType, String sessionId, long userId, String email, String[] logData) {
18
		super(eType, sessionId, userId, email);
19
		couponCode = logData[4].trim();
20
	}
21
 
22
	public String toString() {
23
        StringBuilder sb = new StringBuilder();
24
        sb.append(eventType.name() + ", ");
25
        sb.append("userEmail : " + userEmail);
26
        sb.append(" couponCode : " + this.couponCode);
27
        sb.append(" time : " + time);
28
        sb.append(" session : " + sessionId);
29
 
30
        return sb.toString();
31
    }
32
 
33
    @Override
34
    public JSONObject getLogDataInJson() {
35
        JSONObject logDataInJson = new JSONObject();
36
        try {
37
            logDataInJson.put("coupon_code", this.couponCode);
38
        } catch (JSONException e) {
39
            e.printStackTrace();
40
        }
41
        return logDataInJson;
42
    }
43
 
44
    public String getCouponCode()	{
45
    	return this.couponCode;
46
    }
47
 
48
    public void setCouponCode(String couponCode)	{
49
    	this.couponCode = couponCode;
50
    }
51
}