SightlyWCMMode.java
1.89 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* aQute.bnd.annotation.ProviderType
* com.day.cq.wcm.api.WCMMode
* javax.servlet.ServletRequest
* org.apache.sling.api.SlingHttpServletRequest
*/
package com.adobe.cq.sightly;
import aQute.bnd.annotation.ProviderType;
import com.day.cq.wcm.api.WCMMode;
import org.apache.sling.api.SlingHttpServletRequest;
import javax.servlet.ServletRequest;
@ProviderType
public class SightlyWCMMode {
private final boolean isDisabled;
private final boolean isPreview;
private final boolean isAnalytics;
private final boolean isReadOnly;
private final boolean isEdit;
private final boolean isDesign;
private final SlingHttpServletRequest request;
public SightlyWCMMode(SlingHttpServletRequest request) {
this.request = request;
this.isEdit = WCMMode.fromRequest((ServletRequest)request) == WCMMode.EDIT;
this.isDesign = WCMMode.fromRequest((ServletRequest)request) == WCMMode.DESIGN;
this.isDisabled = WCMMode.fromRequest((ServletRequest)request) == WCMMode.DISABLED;
this.isPreview = WCMMode.fromRequest((ServletRequest)request) == WCMMode.PREVIEW;
this.isAnalytics = WCMMode.fromRequest((ServletRequest)request) == WCMMode.ANALYTICS;
this.isReadOnly = WCMMode.fromRequest((ServletRequest)request) == WCMMode.READ_ONLY;
}
public boolean isDisabled() {
return this.isDisabled;
}
public boolean isPreview() {
return this.isPreview;
}
public boolean isAnalytics() {
return this.isAnalytics;
}
public boolean isReadOnly() {
return this.isReadOnly;
}
public boolean isEdit() {
return this.isEdit;
}
public boolean isDesign() {
return this.isDesign;
}
public String toString() {
return WCMMode.fromRequest((ServletRequest)this.request).name();
}
}