PerformanceReportRequest.java
2.2 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
/*
* Decompiled with CFR 0_118.
*/
package com.day.cq.analytics.testandtarget;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class PerformanceReportRequest {
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH");
private long campaignId;
private Date start;
private Date end;
private String successMetric;
private String step;
public static PerformanceReportRequest forCampaignId(long campaignId) {
if (campaignId <= 0) {
throw new IllegalArgumentException("Expected campaignId > 0, but got " + campaignId);
}
PerformanceReportRequest request = new PerformanceReportRequest();
request.campaignId = campaignId;
return request;
}
public PerformanceReportRequest setStart(Date start) {
this.start = start;
return this;
}
public PerformanceReportRequest setEnd(Date end) {
this.end = end;
return this;
}
public PerformanceReportRequest setSuccessMetric(String successMetric) {
this.successMetric = successMetric;
return this;
}
public PerformanceReportRequest setStep(String step) {
this.step = step;
return this;
}
public String getSuccessMetric() {
return this.successMetric;
}
public String getStep() {
return this.step;
}
public long getCampaignId() {
return this.campaignId;
}
public Date getStart() {
return this.start;
}
public Date getEnd() {
return this.end;
}
public Map<String, String> getParameters() {
HashMap<String, String> paramMap = new HashMap<String, String>();
this.addParameter(paramMap, "successMetric", this.successMetric);
this.addParameter(paramMap, "step", this.step);
return paramMap;
}
private void addParameter(Map<String, String> destMap, String key, Object value) {
if (destMap != null && key != null && value != null) {
String valueStr = null;
valueStr = value instanceof Date ? this.sdf.format((Date)value) : value.toString();
destMap.put(key, valueStr);
}
}
}