TestandtargetOffer.java
3.44 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
* Decompiled with CFR 0_118.
*/
package com.day.cq.analytics.testandtarget.impl.model;
import com.day.cq.analytics.testandtarget.SaveOfferRequest;
import com.day.cq.analytics.testandtarget.impl.model.TntMbox;
public class TestandtargetOffer {
public static final String NAME_DEFAULT = "Default AEM offer";
public static final String DEFAULT_HTML_OFFER = "<script type=\"text/javascript\">(function() { CQ_Analytics.TestTarget.signalDefaultOffer('${mbox.name}');})();</script>";
private static final String BASE_CONTENT = "<script type='text/javascript'>(function() { CQ_Analytics.TestTarget.pull('%s','${mbox.name}','1.0.0');})();</script>";
private long id;
private String name;
private String locationName;
private TntMbox tntMbox;
private transient String contentPath;
private transient boolean needsCreating;
private transient boolean isDefault;
private transient String pagePath;
public SaveOfferRequest toSaveOfferRequest() {
return this.isDefault ? new SaveOfferRequest(this.name, "<script type=\"text/javascript\">(function() { CQ_Analytics.TestTarget.signalDefaultOffer('${mbox.name}');})();</script>") : new SaveOfferRequest(this.name, this.getContentDeliveryPath());
}
public TestandtargetOffer(String name, String locationName, String contentPath) {
this(name, locationName, contentPath, false);
}
public TestandtargetOffer(String name, String locationName, String contentPath, boolean isDefault) {
this.name = name;
this.locationName = locationName.replaceAll("[/:]", "-");
this.contentPath = contentPath;
this.isDefault = isDefault;
}
public TestandtargetOffer(long offerId, String name, String locationName, String contentPath, boolean isDefault) {
this(name, locationName, contentPath, isDefault);
this.id = offerId;
}
public TestandtargetOffer(long offerId, String name, String contentPath, TntMbox locationName) {
this.name = name;
this.id = offerId;
this.tntMbox = locationName;
this.contentPath = contentPath;
}
public void setPagePath(String path) {
this.pagePath = path;
}
public String getPagePath() {
return this.pagePath;
}
public void setOfferId(long id) {
this.id = id;
}
public String getName() {
return this.name;
}
public String getLocationName() {
return this.locationName;
}
public void setTntMbox(TntMbox mbox) {
this.tntMbox = mbox;
}
public String getContentPath() {
return this.contentPath;
}
public String getContentDeliveryPath() {
return this.contentPath + ".tandt.html";
}
public TestandtargetOffer setNeedsCreating(boolean needsCreating) {
this.needsCreating = needsCreating;
return this;
}
public boolean isNeedsCreating() {
return this.needsCreating;
}
public boolean isDefault() {
return this.isDefault;
}
public long getOfferId() {
return this.id;
}
public TntMbox getTntMbox() {
return this.tntMbox;
}
public static String buildOfferContent(String offerPath) {
return String.format("<script type='text/javascript'>(function() { CQ_Analytics.TestTarget.pull('%s','${mbox.name}','1.0.0');})();</script>", offerPath + ".tandt.html");
}
public String toString() {
return this.getClass().getName() + " : " + this.contentPath;
}
}