ChildEditor.java 1.88 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.day.cq.commons.JSONItem
 *  javax.jcr.Node
 *  javax.jcr.RepositoryException
 *  org.apache.sling.commons.json.JSONException
 *  org.apache.sling.commons.json.io.JSONWriter
 *  org.apache.sling.jcr.resource.JcrPropertyMap
 */
package com.day.cq.wcm.api.components;

import com.day.cq.commons.JSONItem;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.io.JSONWriter;
import org.apache.sling.jcr.resource.JcrPropertyMap;

public class ChildEditor
implements JSONItem {
    private final String PN_CE_TITLE = "title";
    private final String PN_CE_TYPE = "type";
    private final String PN_CE_ICON = "icon";
    private final String name;
    private final String id;
    private final String title;
    private final String icon;
    private final String type;

    public ChildEditor(Node node) throws RepositoryException {
        JcrPropertyMap map = new JcrPropertyMap(node);
        this.id = this.name = node.getName();
        this.type = (String)map.get("type", (Object)"");
        this.title = (String)map.get("title", (Object)"");
        this.icon = (String)map.get("icon", (Object)"");
    }

    public String getName() {
        return this.name;
    }

    public String getId() {
        return this.id;
    }

    public String getTitle() {
        return this.title;
    }

    public String getType() {
        return this.type;
    }

    public String getIcon() {
        return this.icon;
    }

    public void write(JSONWriter out) throws JSONException {
        out.object();
        out.key("id").value((Object)this.name);
        out.key("type").value((Object)this.type);
        out.key("title").value((Object)this.title);
        out.key("icon").value((Object)this.icon);
        out.endObject();
    }
}