ActionConfigImpl.java
2.24 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.day.cq.wcm.msm.api.ActionConfig
* org.apache.sling.commons.json.JSONException
* org.apache.sling.commons.json.io.JSONWriter
*/
package com.day.cq.wcm.msm.impl.actions;
import com.day.cq.wcm.msm.api.ActionConfig;
import java.util.Map;
import java.util.Set;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.io.JSONWriter;
public class ActionConfigImpl
implements ActionConfig {
private String name;
private String parameterName;
private int rank;
private Map<String, String> properties;
public ActionConfigImpl(String name, String parameterName, Map<String, String> properties, int rank) {
this.name = name;
this.parameterName = parameterName;
this.properties = properties;
this.rank = rank;
}
public String getName() {
return this.name;
}
public int getRank() {
return this.rank;
}
public Map<String, String> getProperties() {
return this.properties;
}
public String getProperty(String propertyName) {
if (this.properties != null) {
return this.properties.get(propertyName);
}
return null;
}
public boolean hasProperty(String propertyName) {
return this.properties != null && this.properties.containsKey(propertyName);
}
public String getParameterName() {
return this.parameterName;
}
public int compareTo(ActionConfig config) {
if (config != null) {
int cmp = this.name.compareTo(config.getName());
return cmp != 0 ? this.getRank() - config.getRank() : 0;
}
return -9999;
}
public void write(JSONWriter jsonWriter) throws JSONException {
jsonWriter.object();
jsonWriter.key("name").value((Object)this.getName());
jsonWriter.key("parameterName").value((Object)this.getParameterName());
jsonWriter.key("rank").value((long)this.getRank());
if (this.properties != null) {
for (String key : this.properties.keySet()) {
jsonWriter.key(key).value((Object)this.properties.get(key));
}
}
jsonWriter.endObject();
}
}