GuideProgressiveSectionInfo.java
4.21 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.apache.sling.commons.json.JSONArray
* org.apache.sling.commons.json.JSONException
* org.apache.sling.commons.json.JSONObject
* org.apache.sling.commons.json.io.JSONWriter
*/
package com.adobe.aemds.guide.progressive;
import com.adobe.aemds.guide.progressive.GuideProgressiveField;
import com.adobe.aemds.guide.service.GuideException;
import java.io.StringWriter;
import java.io.Writer;
import java.util.List;
import org.apache.sling.commons.json.JSONArray;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.JSONObject;
import org.apache.sling.commons.json.io.JSONWriter;
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
public class GuideProgressiveSectionInfo {
private String id;
private String title;
private String name;
private List<GuideProgressiveField> fields;
private String repeatablePanelId;
private Boolean fetchedFromService = true;
private String repeatablePanelPath;
public GuideProgressiveSectionInfo() {
}
public String convertToJSON() {
StringWriter jsonStringWriter = new StringWriter();
JSONWriter jsonWriter = new JSONWriter((Writer)jsonStringWriter);
try {
jsonWriter.object();
jsonWriter.key("id").value((Object)this.getId());
jsonWriter.key("title").value((Object)this.getTitle());
jsonWriter.key("name").value((Object)this.getName());
List<GuideProgressiveField> fieldList = this.getFields();
JSONArray fieldJsonArray = new JSONArray();
for (int i = 0; i < fieldList.size(); ++i) {
GuideProgressiveField field = fieldList.get(i);
JSONObject obj = new JSONObject();
obj.put("id", (Object)field.getId());
obj.put("path", (Object)field.getPath());
obj.put("prefixId", (Object)field.getPrefixId());
fieldJsonArray.put((Object)obj);
}
jsonWriter.key("fields").value((Object)fieldJsonArray);
jsonWriter.key("repeatablePanelPath").value((Object)this.getRepeatablePanelPath());
jsonWriter.key("repeatablePanelId").value((Object)this.getRepeatablePanelId());
jsonWriter.key("fetchedFromService").value((Object)this.getFetchedFromService());
jsonWriter.key("guideNodeClass").value((Object)"guideProgressiveSection");
jsonWriter.endObject();
}
catch (JSONException ex) {
throw new GuideException(ex.getMessage(), (Exception)ex);
}
return jsonStringWriter.toString();
}
public GuideProgressiveSectionInfo(String id, String title, String name, List<GuideProgressiveField> fields, String repeatablePanelPath, String repeatablePanelId) {
this.id = id;
this.title = title;
this.fields = fields;
this.name = name;
this.repeatablePanelPath = repeatablePanelPath;
this.repeatablePanelId = repeatablePanelId;
}
public GuideProgressiveSectionInfo(String id, String title, String name, List<GuideProgressiveField> fields, String repeatablePanelPath, String repeatablePanelId, Boolean fetchedFromService) {
this(id, title, name, fields, repeatablePanelPath, repeatablePanelId);
this.fetchedFromService = fetchedFromService;
}
public String getFetchedFromService() {
return String.valueOf(this.fetchedFromService);
}
public String getRepeatablePanelId() {
return this.repeatablePanelId;
}
public String getRepeatablePanelPath() {
return this.repeatablePanelPath;
}
public List<GuideProgressiveField> getFields() {
return this.fields;
}
public void setFields(List<GuideProgressiveField> fields) {
this.fields = fields;
}
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return this.title;
}
public String getName() {
return this.name == null ? this.getId() : this.name;
}
public void setTitle(String title) {
this.title = title;
}
}