MyNode.java
1.79 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.day.text.Text
* org.apache.sling.api.resource.Resource
* org.apache.sling.api.resource.ValueMap
*/
package com.day.cq.mcm.core.servlets;
import com.day.text.Text;
import java.util.TreeSet;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;
class MyNode {
public String title = null;
public String name = null;
public Resource resource = null;
public String touchpointType = null;
public String resourceType = null;
public TreeSet<String> children = new TreeSet();
public MyNode parent;
MyNode() {
}
public MyNode initFrom(Resource resource) {
ValueMap vmap;
this.resource = resource;
this.name = Text.getName((String)resource.getPath());
Resource contentRes = resource.getChild("jcr:content");
if (contentRes == null && (contentRes = resource.getChild("profile")) == null) {
contentRes = resource;
}
if ((vmap = (ValueMap)contentRes.adaptTo(ValueMap.class)) != null) {
this.title = (String)vmap.get("jcr:title", (Object)this.name);
this.touchpointType = (String)vmap.get("touchpointType", String.class);
this.resourceType = (String)vmap.get("sling:resourceType", String.class);
}
if ("/".equals(resource.getPath())) {
this.title = "root";
}
if (this.touchpointType == null) {
if ("cq/personalization/components/teaser".equals(this.resourceType)) {
this.touchpointType = "teaser";
} else if ("cq/security/components/profile".equals(this.resourceType)) {
this.touchpointType = "authorizable_group";
}
}
return this;
}
}