ActionConfigAdaptor.java
2.33 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.day.cq.wcm.api.msm.ActionConfig
* com.day.cq.wcm.msm.api.ActionConfig
* com.day.cq.wcm.msm.api.RolloutConfig
* org.apache.sling.commons.json.JSONException
* org.apache.sling.commons.json.io.JSONWriter
*/
package com.day.cq.wcm.msm.impl.compat;
import com.day.cq.wcm.msm.api.ActionConfig;
import com.day.cq.wcm.msm.api.RolloutConfig;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.io.JSONWriter;
class ActionConfigAdaptor
implements com.day.cq.wcm.api.msm.ActionConfig {
private final ActionConfig adaptee;
private final boolean inherited;
ActionConfigAdaptor(ActionConfig delegatee, boolean inherited) {
this.adaptee = delegatee;
this.inherited = inherited;
}
public String getName() {
return this.adaptee.getName();
}
public String getParameterName() {
return this.adaptee.getParameterName();
}
public Map<String, String> getProperties() {
return this.adaptee.getProperties();
}
public String getProperty(String propertyName) {
return this.adaptee.getProperty(propertyName);
}
public boolean hasProperty(String propertyName) {
return this.adaptee.hasProperty(propertyName);
}
public int getRank() {
return this.adaptee.getRank();
}
public int compareTo(com.day.cq.wcm.api.msm.ActionConfig config) {
if (config != null) {
int cmp = this.getName().compareTo(config.getName());
return cmp != 0 ? this.getRank() - config.getRank() : 0;
}
return -9999;
}
public boolean isInherited() {
return this.inherited;
}
public void write(JSONWriter out) throws JSONException {
this.adaptee.write(out);
}
static Set<com.day.cq.wcm.api.msm.ActionConfig> rolloutToAction(List<RolloutConfig> rolloutCfg) {
HashSet<com.day.cq.wcm.api.msm.ActionConfig> ret = new HashSet<com.day.cq.wcm.api.msm.ActionConfig>();
for (RolloutConfig cfg : rolloutCfg) {
for (ActionConfig aCfg : cfg.getActionsConfig()) {
ret.add(new ActionConfigAdaptor(aCfg, false));
}
}
return ret;
}
}