All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adobe.cq.social.filelibrary.client.api.FileLibraryBreadcrumb Maven / Gradle / Ivy

/*************************************************************************
 *
 * ADOBE CONFIDENTIAL
 * __________________
 *
 *  Copyright 2017 Adobe Systems Incorporated
 *  All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated and its
 * suppliers and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 **************************************************************************/

package com.adobe.cq.social.filelibrary.client.api;

import com.day.cq.commons.jcr.JcrConstants;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceUtil;
import org.apache.sling.api.resource.ValueMap;

public class FileLibraryBreadcrumb {

    private final String title;
    private final String path;
    private final boolean current;

    public FileLibraryBreadcrumb(final String title, final String path) {
        this(title, path, false);
    }

    public FileLibraryBreadcrumb(final String title, final String path, final boolean current) {
        this.title = title;
        this.path = path;
        this.current = current;
    }

    public FileLibraryBreadcrumb(final Resource resource) {
        this(resource, false);
    }

    public FileLibraryBreadcrumb(final Resource resource, final boolean current) {
        if (resource != null) {
            this.path = resource.getPath();
            final ValueMap valueMap = ResourceUtil.getValueMap(resource);
            this.title = valueMap != null ? valueMap.get(JcrConstants.JCR_TITLE, "Unknown") : "Unknown";
        } else {
            this.path = "Unknown";
            this.title = "Unknown";
        }
        this.current = current;
    }

    public String getTitle() {
        return title;
    }

    public String getPath() {
        return path;
    }

    public boolean isCurrent() {
        return current;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy