TranslationScopeImpl.java
2.05 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.granite.translation.api.TranslationScope
*/
package com.adobe.cq.wcm.translation.impl;
import com.adobe.cq.wcm.translation.impl.TranslationBaseObject;
import com.adobe.granite.translation.api.TranslationScope;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
public class TranslationScopeImpl
implements TranslationScope {
TranslationBaseObject baseObject;
String strPrefix;
public TranslationScopeImpl(TranslationBaseObject baseObject, String strPrefix) {
this.baseObject = baseObject;
this.strPrefix = strPrefix;
}
public int getWordCount() {
return 0;
}
public int getImageCount() {
return 0;
}
public int getVideoCount() {
return 0;
}
public Map<String, String> getFinalScope() {
LinkedHashMap<String, String> scopeMap = new LinkedHashMap<String, String>();
int iCount = this.baseObject.getIntAttribute(this.strPrefix + "scopeMapCount");
for (int index = 0; index < iCount; ++index) {
String strKey = this.baseObject.getStringAttribute(this.strPrefix + String.format("scopeMapKey_%d", index));
String strKeyValue = this.baseObject.getStringAttribute(this.strPrefix + String.format("scopeMapValue_%d", index));
scopeMap.put(strKey, strKeyValue);
}
return scopeMap;
}
public void updateScope(TranslationScope scope) {
Map scopeMap = scope.getFinalScope();
if (scopeMap != null) {
this.baseObject.setAttribute(this.strPrefix + "scopeMapCount", scopeMap.size());
Set keySet = scopeMap.keySet();
int index = 0;
for (String key : keySet) {
this.baseObject.setAttribute(this.strPrefix + String.format("scopeMapKey_%d", index), key);
this.baseObject.setAttribute(this.strPrefix + String.format("scopeMapValue_%d", index), (String)scopeMap.get(key));
++index;
}
}
}
}