Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6108 amar.kumar 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 RechargeStatusEvent extends Event{
9
 
10
	private long operatorId;
11
	private long amount;
12
	private long walletAmount;
13
	private String rechargeType;
14
 
15
    public RechargeStatusEvent(String[] eventFileds) {
16
        super(eventFileds);
17
        operatorId = Long.parseLong(eventFileds[5].trim());
18
        amount = Long.parseLong(eventFileds[6].trim());
19
        walletAmount = Long.parseLong(eventFileds[7].trim());
20
        rechargeType = eventFileds[8].trim();
21
    }
22
 
23
    public RechargeStatusEvent(EventType eType, String sessionId, long userId, String email, String[] logData) {
24
        super(eType, sessionId, userId, email);
25
        operatorId = Long.parseLong(logData[0].trim());
26
        amount = Long.parseLong(logData[1].trim());
27
        walletAmount = Long.parseLong(logData[2].trim());
28
        rechargeType = logData[3].trim();
29
    }
30
 
31
    public String toString() {
32
        StringBuilder sb = new StringBuilder();
33
        sb.append(eventType.name() + ", ");
34
        sb.append("userEmail : " + userEmail);
35
        sb.append(" operatorId : " + operatorId);
36
        sb.append(" amount : " + amount);
37
        sb.append(" walletAmount : " + walletAmount);
38
        sb.append(" rechargeType : " + rechargeType);
39
        sb.append(" time : " + time);
40
        sb.append(" session : " + sessionId);
41
 
42
        return sb.toString();
43
    }
44
 
45
    @Override
46
    public JSONObject getLogDataInJson() {
47
        JSONObject logDataInJson = new JSONObject();
48
        try {
49
            logDataInJson.put("operatorId", operatorId);
50
            logDataInJson.put("amount", amount);
51
            logDataInJson.put("walletAmount", walletAmount);
52
            logDataInJson.put("rechargeType", rechargeType);
53
        } catch (JSONException e) {
54
            e.printStackTrace();
55
        }
56
        return logDataInJson;
57
    }
58
 
59
	public long getOperatorId() {
60
		return operatorId;
61
	}
62
 
63
	public void setOperatorId(long operatorId) {
64
		this.operatorId = operatorId;
65
	}
66
 
67
	public long getAmount() {
68
		return amount;
69
	}
70
 
71
	public void setAmount(long amount) {
72
		this.amount = amount;
73
	}
74
 
75
	public long getWalletAmount() {
76
		return walletAmount;
77
	}
78
 
79
	public void setWalletAmount(long walletAmount) {
80
		this.walletAmount = walletAmount;
81
	}
82
 
83
	public String getRechargeType() {
84
		return rechargeType;
85
	}
86
 
87
	public void setRechargeType(String rechargeType) {
88
		this.rechargeType = rechargeType;
89
	}
90
 
91
}