GuideElement.java
3.77 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.aemds.guide.addon.dor.DoRThreadLocal
* com.adobe.aemds.guide.addon.dor.GuideType
* com.adobe.xfa.Element
* org.apache.sling.commons.json.JSONObject
*/
package com.adobe.aemds.guide.addon.dor.elements;
import com.adobe.aemds.guide.addon.dor.DoRThreadLocal;
import com.adobe.aemds.guide.addon.dor.GuideType;
import com.adobe.aemds.guide.addon.dor.elements.DoRElement;
import com.adobe.aemds.guide.addon.dor.elements.GuideElementProperties;
import com.adobe.aemds.guide.addon.dor.elements.GuideElementUtils;
import com.adobe.xfa.Element;
import java.util.Properties;
import org.apache.sling.commons.json.JSONObject;
public abstract class GuideElement {
protected Properties properties = new Properties();
protected String bindRef;
public GuideElement(JSONObject jsonObject) {
String property;
for (String key2 : GuideElementProperties.COMMON_PROPERTIES) {
if (!jsonObject.has(key2)) continue;
this.properties.setProperty(key2, jsonObject.optString(key2));
}
for (String key2 : GuideElementProperties.PATTERN_PROPERTIES) {
String value = jsonObject.optString(key2);
if (value == null || value.isEmpty()) continue;
this.properties.setProperty(key2, value);
}
if (this.properties.containsKey("displayIsSameAsValidate")) {
this.properties.put("validatePictureClause", jsonObject.optString("displayPictureClause"));
}
if (this.properties.containsKey("isEditSameAsDisplayPattern")) {
this.properties.put("editPictureClause", jsonObject.optString("displayPictureClause"));
}
if (this.properties.containsKey(property = "assistPriority") && this.properties.getProperty(property).equals("label")) {
this.properties.setProperty(property, "caption");
}
if (this.properties.containsKey(property = "hideTitle") && this.properties.getProperty(property).equals("true")) {
this.properties.remove("jcr:title");
}
if (this.properties.containsKey(property = "bindRef")) {
String binding = this.properties.getProperty(property);
this.bindRef = GuideElementUtils.adjustIndexes(binding);
if (this.bindRef.startsWith("/")) {
int index = DoRThreadLocal.getGuideType().equals((Object)GuideType.JSON_BASED) ? this.bindRef.indexOf(47, 0) : this.bindRef.indexOf(47, 1);
if (index == -1) {
this.properties.setProperty("bindMatch", "none");
this.properties.remove("bindRef");
this.bindRef = null;
} else {
String bind = "$record";
bind = DoRThreadLocal.getGuideType().equals((Object)GuideType.NON_XSD_NON_XDP_BASED) ? bind + this.bindRef : bind + this.bindRef.substring(index);
bind = bind.replace("/text()", "");
bind = bind.replaceAll("/", ".");
bind = bind.replaceAll("@", "");
this.properties.put(property, bind);
this.properties.setProperty("bindMatch", "dataRef");
}
}
}
if (this.properties.containsKey(property = "shortDescription")) {
String shortDescription = this.properties.getProperty(property);
String replacedString = shortDescription.replaceAll("<[^>]+>", "").replaceAll(" ", " ");
this.properties.put(property, replacedString);
}
}
public abstract DoRElement createDoRElement(Element var1) throws Exception;
public Properties getProperties() {
return this.properties;
}
public String getBindRef() {
return this.bindRef;
}
}