1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
package com.adjust.sdk;
import org.json.JSONObject;
import java.io.Serializable;
/**
* Created by pfms on 07/11/14.
*/
public class AdjustAttribution implements Serializable {
private static final long serialVersionUID = 1L;
public String trackerToken;
public String trackerName;
public String network;
public String campaign;
public String adgroup;
public String creative;
public static AdjustAttribution fromJson(JSONObject jsonObject) {
if (jsonObject == null) return null;
AdjustAttribution attribution = new AdjustAttribution();
attribution.trackerToken = jsonObject.optString("tracker_token", null);
attribution.trackerName = jsonObject.optString("tracker_name", null);
attribution.network = jsonObject.optString("network", null);
attribution.campaign = jsonObject.optString("campaign", null);
attribution.adgroup = jsonObject.optString("adgroup", null);
attribution.creative = jsonObject.optString("creative", null);
return attribution;
}
public boolean equals(Object other) {
if (other == this) return true;
if (other == null) return false;
if (getClass() != other.getClass()) return false;
AdjustAttribution otherAttribution = (AdjustAttribution) other;
if (!equalString(trackerToken, otherAttribution.trackerToken)) return false;
if (!equalString(trackerName, otherAttribution.trackerName)) return false;
if (!equalString(network, otherAttribution.network)) return false;
if (!equalString(campaign, otherAttribution.campaign)) return false;
if (!equalString(adgroup, otherAttribution.adgroup)) return false;
if (!equalString(creative, otherAttribution.creative)) return false;
return true;
}
private boolean equalString(String first, String second) {
if (first == null || second == null) {
return first == null && second == null;
}
return first.equals(second);
}
@Override
public String toString() {
return String.format("tt:%s tn:%s net:%s cam:%s adg:%s cre:%s",
trackerToken, trackerName, network, campaign, adgroup, creative);
}
}
|