MyNode.java 1.79 KB
/*
 * 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;
    }
}