DoRThreadLocal.java
3.42 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.xfa.ut.LcLocale
* com.day.cq.i18n.I18n
* org.apache.sling.api.resource.ResourceResolver
*/
package com.adobe.aemds.guide.addon.dor;
import com.adobe.aemds.guide.addon.dor.GuideType;
import com.adobe.xfa.ut.LcLocale;
import com.day.cq.i18n.I18n;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import org.apache.sling.api.resource.ResourceResolver;
public class DoRThreadLocal {
private static final ThreadLocal<GuideType> guideType = new ThreadLocal();
private static final ThreadLocal<ResourceResolver> resourceResolver = new ThreadLocal();
private static final ThreadLocal<HashMap<String, String>> formProperties = new ThreadLocal();
private static final ThreadLocal<Locale> formLocale = new ThreadLocal();
private static final ThreadLocal<I18n> langDic = new ThreadLocal();
private static final ThreadLocal<LcLocale> dorLocale = new ThreadLocal();
private static final ThreadLocal<String> schemaRootElement = new ThreadLocal();
public static GuideType getGuideType() {
return guideType.get();
}
public static void setGuideType(GuideType type) {
guideType.set(type);
}
public static void removeGuideType() {
guideType.remove();
}
public static Locale getFormLocale() {
return formLocale.get();
}
public static void setFormLocale(Locale locale) {
formLocale.set(locale);
}
public static void removeFormLocale() {
formLocale.remove();
}
public static void setDoRLocale(LcLocale lcLocale) {
dorLocale.set(lcLocale);
}
public static LcLocale getDoRLocale() {
return dorLocale.get();
}
public static void removeDoRLocale() {
dorLocale.remove();
}
public static Map<String, String> getFormProperties() {
return formProperties.get();
}
public static void setFormProperties(Map<String, String> formPropertiesMap) {
HashMap<String, String> map = new HashMap<String, String>();
map.putAll(formPropertiesMap);
formProperties.set(map);
}
public static void removeFormProperties() {
formProperties.remove();
}
public static ResourceResolver getResourceResolver() {
return resourceResolver.get();
}
public static void setResourceResolver(ResourceResolver resourceResolver) {
DoRThreadLocal.resourceResolver.set(resourceResolver);
}
public static void removeResourceResolver() {
resourceResolver.remove();
}
public static I18n getI18n() {
return langDic.get();
}
public static void setI18n(I18n i18n) {
langDic.set(i18n);
}
public static void removeI18n() {
langDic.remove();
}
public static void removeThreadLocals() {
DoRThreadLocal.removeGuideType();
DoRThreadLocal.removeFormLocale();
DoRThreadLocal.removeFormProperties();
DoRThreadLocal.removeResourceResolver();
DoRThreadLocal.removeI18n();
DoRThreadLocal.removeDoRLocale();
DoRThreadLocal.removeSchemaRootElement();
}
public static void setSchemaRootElement(String root) {
schemaRootElement.set(root);
}
public static String getSchemaRootElement() {
return schemaRootElement.get();
}
public static void removeSchemaRootElement() {
schemaRootElement.remove();
}
}