JSONCreationOptions.java
3.78 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.day.cq.i18n.I18n
* org.apache.sling.api.resource.Resource
* org.apache.sling.api.resource.ResourceUtil
* org.apache.sling.api.resource.ValueMap
* org.slf4j.Logger
* org.slf4j.LoggerFactory
*/
package com.adobe.aemds.guide.utils;
import com.adobe.aemds.guide.common.ResourcePropertyTransformer;
import com.day.cq.i18n.I18n;
import java.util.Locale;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceUtil;
import org.apache.sling.api.resource.ValueMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class JSONCreationOptions {
private Logger logger = LoggerFactory.getLogger(JSONCreationOptions.class);
private boolean includeJcrPath;
private I18n i18n;
private boolean includeFragmentJson;
private String dataRef;
private String pagePath;
private String formContainerPath;
private boolean contextNeeded;
private Resource formResource;
private ResourcePropertyTransformer transformer;
private String data;
private Locale locale;
public Locale getLocale() {
return this.locale;
}
public void setLocale(Locale locale) {
this.locale = locale;
}
public boolean getContextNeeded() {
return this.contextNeeded;
}
public JSONCreationOptions() {
this.contextNeeded = false;
}
public JSONCreationOptions(I18n i18n, boolean includeJcrPath, boolean includeFragmentJson, Locale locale, Resource formResource) {
this.includeJcrPath = includeJcrPath;
this.i18n = i18n;
this.includeFragmentJson = includeFragmentJson;
this.locale = locale;
this.formResource = formResource;
this.contextNeeded = true;
}
public void setTransformer(ResourcePropertyTransformer transformer) {
this.transformer = transformer;
}
public JSONCreationOptions setI18n(I18n i18n) {
this.i18n = i18n;
return this;
}
public I18n getI18n() {
return this.i18n;
}
public boolean isIncludeJcrPath() {
return this.includeJcrPath;
}
public boolean isIncludeFragmentJson() {
return this.includeFragmentJson;
}
public void setIncludeFragmentJson(boolean includeFragmentJson) {
this.includeFragmentJson = includeFragmentJson;
}
public Resource getFormResource() {
return this.formResource;
}
public void setFormResource(Resource formResource) {
this.formResource = formResource;
}
public String getFormResourceProperty(String propertyName) {
String propertyValue = "";
if (this.formResource != null) {
ValueMap resourceProps = ResourceUtil.getValueMap((Resource)this.formResource);
propertyValue = (String)resourceProps.get(propertyName, (Object)"");
}
return propertyValue;
}
public ResourcePropertyTransformer getTransformer() {
return this.transformer;
}
public String getDataRef() {
return this.dataRef;
}
public JSONCreationOptions setDataRef(String dataRef) {
this.dataRef = dataRef;
return this;
}
public String getPagePath() {
return this.pagePath;
}
public JSONCreationOptions setPagePath(String pagePath) {
this.pagePath = pagePath;
return this;
}
public String getFormContainerPath() {
return this.formContainerPath;
}
public JSONCreationOptions setFormContainerPath(String formContainerPath) {
this.formContainerPath = formContainerPath;
return this;
}
public String getData() {
return this.data;
}
public JSONCreationOptions setData(String data) {
this.data = data;
return this;
}
}