AdaptiveForm.java
2.94 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.day.cq.wcm.api.Page
* org.apache.sling.api.resource.Resource
* org.apache.sling.api.resource.ResourceResolver
* org.apache.sling.api.resource.ValueMap
*/
package com.adobe.aemds.guide.common;
import com.adobe.aemds.guide.common.AEMForm;
import com.adobe.aemds.guide.utils.GuideUtils;
import com.day.cq.wcm.api.Page;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ValueMap;
public class AdaptiveForm
extends AEMForm {
public String getFormPagePath() {
String formPath = super.getFormPath();
return GuideUtils.guideRefToGuidePath(formPath);
}
public String getFormEditPagePath() {
String formPagePath = this.getFormPagePath();
return formPagePath.substring(0, formPagePath.indexOf("/jcr:content"));
}
public String getFormTitle() {
String pageTitle = this.getFormPageTitle();
return pageTitle != null ? pageTitle : this.getFormPageName();
}
private String getFormPageTitle() {
return this.getFormPage().getTitle();
}
private String getFormPageName() {
return this.getFormPage().getName();
}
private Page getFormPage() {
return (Page)this.getFormPageResource().adaptTo(Page.class);
}
private Resource getFormPageResource() {
return this.getGuideContainerResource().getParent().getParent();
}
private Resource getGuideContainerResource() {
return this.getResourceResolver().getResource(this.getFormPagePath());
}
public String getFormThemeName() {
Resource resource = this.getResourceResolver().getResource(this.getFormPagePath());
String clientLibName = this.getThemeName();
ValueMap valueMap = resource.getValueMap();
if ("".equals(clientLibName) && resource != null) {
String formThemeRef = (String)valueMap.get("themeRef", (Object)"");
String formClientLib = this.getClientLibCategory(formThemeRef);
if ("".equals(formClientLib)) {
clientLibName = this.getCssClientlib();
} else {
return "";
}
}
if ("".equals(clientLibName)) {
String containerType = (String)valueMap.get("sling:resourceType", (Object)"");
clientLibName = "fd/adaddon/components/guideDocumentContainer".equals(containerType) ? "guide.theme.ad" : "guide.theme2.default";
}
return clientLibName;
}
public String getAcceptLangParamString() {
String lang;
String usePageLocale = (String)this.mResourceProps.get((Object)"usePageLocale");
if (usePageLocale != null && usePageLocale.equals("true") && (lang = (String)this.getPageProperties().get((Object)"jcr:language")) != null && !lang.isEmpty()) {
return "&afAcceptLang=" + lang;
}
return "";
}
}