DamLabeledResource.java 1.22 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.day.cq.commons.JcrLabeledResource
 *  com.day.cq.dam.api.Asset
 *  javax.jcr.Node
 *  javax.jcr.RepositoryException
 *  org.apache.sling.api.resource.Resource
 */
package com.day.cq.dam.core.impl;

import com.day.cq.commons.JcrLabeledResource;
import com.day.cq.dam.api.Asset;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import org.apache.sling.api.resource.Resource;

public class DamLabeledResource
extends JcrLabeledResource {
    private final Asset asset;

    public DamLabeledResource(Resource resource) throws RepositoryException {
        super((Node)resource.adaptTo(Node.class));
        this.asset = (Asset)resource.adaptTo(Asset.class);
    }

    public String getTitle() {
        String title = super.getTitle();
        if (this.asset != null && title == null) {
            title = this.asset.getMetadataValue("dc:title");
        }
        return title;
    }

    public String getDescription() {
        String description = super.getDescription();
        if (this.asset != null && description == null) {
            description = this.asset.getMetadataValue("dc:description");
        }
        return description;
    }
}