TestandtargetCampaign.java
6.66 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.tsdk.components.goalsandsettings.goals.Analytics
* com.adobe.tsdk.components.goalsandsettings.goals.metrics.dto.Metric
* org.apache.commons.lang.StringUtils
*/
package com.day.cq.analytics.testandtarget.impl;
import com.adobe.tsdk.components.goalsandsettings.goals.Analytics;
import com.adobe.tsdk.components.goalsandsettings.goals.metrics.dto.Metric;
import com.day.cq.analytics.testandtarget.impl.TestandTargetCampaignType;
import com.day.cq.analytics.testandtarget.impl.TntCampaignState;
import com.day.cq.analytics.testandtarget.impl.model.TestandtargetExperience;
import com.day.cq.analytics.testandtarget.impl.model.TestandtargetOffer;
import com.day.cq.analytics.testandtarget.impl.model.TntMacMetadata;
import com.day.cq.analytics.testandtarget.impl.model.TntMbox;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
public class TestandtargetCampaign {
private transient long id = 0;
private String thirdPartyId;
private TntCampaignState state;
private final String name;
private final String startsAt;
private final String endsAt;
private final String conversionGoal;
private int priority;
private final TntCampaignMboxList locations;
private final List<TestandtargetExperience> experiences;
private TntMacMetadata marketingCloudMetadata;
public static final String OFFER_NAME_DEFAULT_CONTENT = "Default AEM offer";
private final TestandTargetCampaignType campaignType;
private transient boolean forceLandingPageCampaign;
private String campaignId;
private List<Metric> metrics;
private Analytics analytics;
public TestandtargetCampaign(String name, Date start, Date end, String conversionGoal, TestandTargetCampaignType campaignType) {
this.locations = new TntCampaignMboxList(new ArrayList());
this.experiences = new ArrayList<TestandtargetExperience>();
this.metrics = new ArrayList<Metric>();
this.analytics = null;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
this.name = name;
this.startsAt = start != null ? dateFormat.format(start) : null;
this.endsAt = end != null ? dateFormat.format(end) : null;
this.conversionGoal = conversionGoal;
this.campaignType = campaignType;
}
public TestandtargetCampaign(String name, Date start, Date end, String conversionGoal, TestandTargetCampaignType campaignType, String editUrl, String remoteModifiedBy) {
this(name, start, end, conversionGoal, campaignType);
this.marketingCloudMetadata = new TntMacMetadata(editUrl, remoteModifiedBy);
}
public void addExperience(TestandtargetExperience tandtExperience) {
this.experiences.add(tandtExperience);
}
public void addMbox(TntMbox mbox) {
this.locations.addMbox(mbox);
}
public void addMboxes(List<TntMbox> mboxes) {
this.locations.addMboxes(mboxes);
}
public List<TestandtargetExperience> getExperiences() {
return this.experiences;
}
public List<TestandtargetOffer> getOffers() {
ArrayList<TestandtargetOffer> offers = new ArrayList<TestandtargetOffer>();
for (TestandtargetExperience experience : this.experiences) {
offers.addAll(experience.getOffers());
}
return offers;
}
public TestandtargetOffer getOfferByName(String offerName) {
ArrayList offers = new ArrayList();
for (TestandtargetExperience experience : this.experiences) {
for (TestandtargetOffer o : experience.getOffers()) {
if (!offerName.equals(o.getName())) continue;
return o;
}
}
return null;
}
public Set<String> getAllMboxLocations() {
LinkedHashSet<String> mboxLocations = new LinkedHashSet<String>();
for (TestandtargetOffer offer : this.getOffers()) {
mboxLocations.add(offer.getLocationName());
}
return mboxLocations;
}
public void setMetrics(List<Metric> metricList) {
this.metrics = metricList;
}
public void setAnalytics(Analytics a4t) {
this.analytics = a4t;
}
public String getCampaignId() {
return StringUtils.isEmpty((String)this.campaignId) ? String.valueOf(this.getId()) : this.campaignId;
}
public void setCampaignId(String campaignId) {
this.campaignId = campaignId;
this.setId(Long.valueOf(campaignId));
}
public void setForceLandingPageCampaign(boolean forceLandingPageCampaign) {
this.forceLandingPageCampaign = forceLandingPageCampaign;
}
public boolean isForceLandingPageCampaign() {
return this.forceLandingPageCampaign;
}
public TestandTargetCampaignType getCampaignType() {
return this.campaignType;
}
public String getRemoteModifiedBy() {
return this.marketingCloudMetadata.getRemoteModifiedBy();
}
public String getEditUrl() {
return this.marketingCloudMetadata.getEditURL();
}
public String getSourceProductName() {
return this.marketingCloudMetadata.getSourceProductName();
}
public String getConversionGoal() {
return this.conversionGoal;
}
public String getEnd() {
return this.endsAt == null ? "When Deactivated" : this.endsAt;
}
public String getStart() {
return this.startsAt == null ? "When Approved" : this.startsAt;
}
public String getName() {
return this.name;
}
public String getThirdPartyId() {
return this.thirdPartyId;
}
public void setThirdPartyId(String id) {
this.thirdPartyId = id;
}
public void setId(long id) {
this.id = id;
}
public long getId() {
return this.id;
}
public void setPriority(int prio) {
this.priority = prio;
}
public int getPriority() {
return this.priority;
}
public List<TntMbox> getTntMboxes() {
return this.locations.getMboxes();
}
private class TntCampaignMboxList {
private List<TntMbox> mboxes;
private TntCampaignMboxList(List<TntMbox> mboxes) {
this.mboxes = new ArrayList<TntMbox>();
this.mboxes = mboxes;
}
private void addMbox(TntMbox mbox) {
this.mboxes.add(mbox);
}
private void addMboxes(List<TntMbox> m) {
this.mboxes.addAll(m);
}
private List<TntMbox> getMboxes() {
return this.mboxes;
}
}
}