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

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

/*************************************************************************
 *
 * ADOBE CONFIDENTIAL
 * __________________
 *
 *  Copyright 2012 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 org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ResourceUtil;
import org.apache.sling.api.resource.ValueMap;

import com.adobe.cq.social.commons.CommentSystem;
import com.adobe.cq.social.commons.comments.api.AbstractCommentCollection;
import com.adobe.cq.social.commons.comments.listing.CommentSocialComponentListProviderManager;
import com.adobe.cq.social.scf.ClientUtilities;
import com.adobe.cq.social.scf.QueryRequestInfo;
import com.day.cq.wcm.api.Page;
import com.day.cq.wcm.api.PageManager;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;

public abstract class AbstractFileLibrary

extends AbstractCommentCollection implements FileLibrary { private final String title; private final boolean isClosed; private FileLibraryConfiguration configuration; /** * Construct a {@link FileLibrary} with the specified root resource. * @param resource The root resource * @param clientUtils The client utilities * @param listProviderManager {@link CommentSocialComponentListProviderManager} */ public AbstractFileLibrary(final Resource resource, final ClientUtilities clientUtils, final CommentSocialComponentListProviderManager listProviderManager) { this(resource, clientUtils, QueryRequestInfo.DEFAULT_QUERY_INFO_FACTORY.create(), listProviderManager); } /** * Construct a {@link FileLibrary} with the specified root resource. * @param resource the root resource * @param clientUtils * @param queryInfo {@link QueryRequestInfo} * @param listProviderManager {@link CommentSocialComponentListProviderManager} */ public AbstractFileLibrary(final Resource resource, final ClientUtilities clientUtils, final QueryRequestInfo queryInfo, final CommentSocialComponentListProviderManager listProviderManager) { super(resource, clientUtils, queryInfo, listProviderManager); final ResourceResolver resolver = resource.getResourceResolver(); final PageManager pageManager = resolver.adaptTo(PageManager.class); final ValueMap properties = ResourceUtil.getValueMap(resource); if (null != pageManager) { final Page page = pageManager.getContainingPage(resource); title = page.getTitle(); } else { title = null; } isClosed = properties.get(FileLibrary.PN_CLOSED, false); } /** * {@inheritDoc} */ @Override @JsonProperty("isClosed") public boolean isClosed() { return isClosed; } @Override @JsonInclude(value = Include.NON_NULL) public String getTitle() { return title; } @Override public C createConfiguration(final Resource resource) { return (C) new AbstractFileLibraryConfiguration(resource); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy