GuideProgressiveField.java
2.43 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.apache.sling.api.resource.ResourceResolver
* org.apache.sling.commons.json.JSONException
* org.apache.sling.commons.json.io.JSONWriter
*/
package com.adobe.aemds.guide.progressive;
import com.adobe.aemds.guide.service.GuideException;
import com.adobe.aemds.guide.utils.GuideContainerThreadLocal;
import com.adobe.aemds.guide.utils.GuideFragmentHolder;
import java.io.StringWriter;
import java.io.Writer;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.io.JSONWriter;
public class GuideProgressiveField {
private String id;
private String path;
private String prefixId;
private ResourceResolver resourceResolver;
private String fragRefPreviousPrefixID = null;
public GuideProgressiveField(String id, String path, String prefixId, ResourceResolver resourceResolver) {
this.id = id;
this.path = path;
this.prefixId = prefixId;
this.resourceResolver = resourceResolver;
}
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("path").value((Object)this.getPath());
jsonWriter.key("prefixId").value((Object)this.getPrefixId());
jsonWriter.endObject();
}
catch (JSONException ex) {
throw new GuideException(ex.getMessage(), (Exception)ex);
}
return jsonStringWriter.toString();
}
public String getId() {
return this.id;
}
public String getPath() {
return this.path;
}
public String getPrefixId() {
return this.prefixId;
}
public void getMarkedFragmentPrefixId() {
GuideFragmentHolder guideFragmentHolder = GuideContainerThreadLocal.getGuideFragmentHolder();
if (guideFragmentHolder != null) {
this.fragRefPreviousPrefixID = guideFragmentHolder.getFragPrefixID();
}
GuideContainerThreadLocal.setGuideFragmentHolder(this.prefixId, null, null, null);
}
public void getUnmarkedFragmentPrefixId() {
GuideContainerThreadLocal.setGuideFragmentHolder(this.fragRefPreviousPrefixID, null, null, null);
}
}