com.adobe.cq.social.community.api.CommunityContext Maven / Gradle / Ivy
/*************************************************************************
*
* ADOBE CONFIDENTIAL
* __________________
*
* Copyright 2014 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.community.api;
import java.util.List;
import javax.jcr.RepositoryException;
import org.apache.jackrabbit.api.security.user.UserManager;
import org.apache.sling.tenant.Tenant;
import aQute.bnd.annotation.ProviderType;
import com.adobe.cq.social.srp.config.SocialResourceConfiguration;
@ProviderType
public interface CommunityContext {
/**
* Get {link Tenant}
* @return Tenant the tenant
*/
Tenant getTenant();
/**
* Get the tenant id
* @return the tenant id, or null if the context does not belong to a tenant.
*/
String getTenantId();
/**
* Return the site id of this context.
* @return the site id, or null if the context does not belong to a site.
*/
String getSiteId();
/**
* Return the community group name of this context.
* @return the group id, or null if the context does not belong to a group.
*/
String getCommunityGroupId();
/**
* Return the community group unique id of this context.
* @return the group id, or null if the context does not belong to a group.
*/
String getCommunityGroupUniqueId();
/**
* Get the content root path for the site in this context.
* @return the context root path
*/
String getContentRootPath();
/**
* Get the configuration path
* @return /content/social/tenants/tenantid/components configuration path.
*/
String getTenantConfigPath();
/**
* Get the location where the site payload is created and replicated
* @return site payload path
*/
String getSitePayloadPath();
/**
* This method returns the path of the root page path of the site. One of its children node is the configuration
* node
* @return the site page path
*/
String getSitePagePath();
/**
* Get the design root path
* @return the design root path
*/
String getDesignRootPath();
String getSiteThemePath();
String getPageThemePath();
/**
* Get the site path
* @return site path
*/
String getSitePath();
/**
* Get the community group path
* @return community group path
*/
String getCommunityGroupPath();
/**
* Get the site banner path for the specified siteId
* @return the site banner path
*/
String getSiteBannerPath();
/**
* Check if the multitenant deployment is supported.
* @return true/false if multitenancy is supported or not
*/
boolean isMultiTenantSupported();
/**
* Get the ugc root path.
* @return the ugc root path based on the tenant
*/
String getUgcPath();
/**
* Get the ugc site path.
* @return the ugc path or null if the context does not belong to a site
*/
String getUgcSitePath();
/**
* Get activity stream root path
* @return the activitystream root path, or null if this context does not belong to a site
*/
String getActivityStreamRootPath();
/**
* Get the tenant user group name for the specified group
* @param groupName is name of the group
* @return tenant user group name
*
*/
public String getTenantUserGroupName(final String groupName);
public String getSiteUserGroupName(final CommunityUserGroup userGroup);
/**
* Get the fully qualified group name based on this context
* @param groupName is name of the group
* @return fully qualified group name
*
*/
public String getFullyQualifiedGroupName(final String groupName);
/**
* Get the user group root path of this context.
* @return user group root path
*/
String getUserGroupRootPath();
/**
* Get the user root path of this context.
* @return user root path
*/
String getUserRootPath();
/**
* Get the user group path of a tenant. This is applicable to Admin and User group
* @param userGroupName is user group name
* @return user group root path
*/
public String getUserGroupPath(final String userGroupName);
/**
* Check if the specified user id belong to the community administrator group.
* @param um is user manager
* @param userId is user id
* @return true/false if user is community admin user or not
* @throws RepositoryException is unexpected repository exception
* @see checkIfUserIsGroupAdmin to verify if the specified user is a group administrator.
*/
public boolean checkIfUserIsAdmin(final UserManager um, final String userId) throws RepositoryException;
/**
* Check if the specified user id belong to the group admin or not.
* @param um is user manager
* @param userId is user id
* @return true/false if user is group admin or not
* @throws RepositoryException is unexpected repository exception
*/
public boolean checkIfUserIsGroupAdmin(final UserManager um, final String userId) throws RepositoryException;
/**
* Check if the specified user id is an administrator base on this context. If the context has a group, it checks
* if the user is a group administrator, otherwise, it checks if the user is a community administrator.
* @param um is user manager
* @param userId is user id
* @return true/false if user is admin user or not
* @throws RepositoryException is unexpected repository exception
*/
public boolean isUserAdmin(final UserManager um, final String userId) throws RepositoryException;
/**
* Get the storage configuration path.
* @return the storage configuration path.
*/
@Deprecated
String getStorageConfigurationPath();
/**
* Return the social configuration associated with the tenant.
* @return the configuration. If in a tenant, the tenant configuration, otherwise the site (default)
*/
SocialResourceConfiguration getStorageConfig();
/**
* Check if the specified user id belongs to the moderator group
* @param um is user manager
* @param userId is user id
* @return true/false if user is moderator or not
* @throws RepositoryException is unexpected repository exception
*/
boolean checkIfUserIsModerator(final UserManager um, final String userId) throws RepositoryException;
String getTenantGroupRootPath();
String getTenantUserRootPath();
String getCommunityGroupRootPath();
String getCommunityUserRootPath();
/**
* Get the site's resources path.
* @return site resoruces path
*/
String getSiteResourcesPath();
/**
* Get the community group resources path.
* @return community group resources path
*/
String getCommunityGroupResourcesPath();
/**
* Get the site's content paths.
* @return list of site's content paths
*/
List getSiteContentPaths();
/**
* Get the current site's root path.
* @return site root path
*/
String getSiteRootPath();
/**
* Get the site root path of the current tenant's site with the given siteId.
* @param siteId given siteId
* @return root path of the site with the given siteId
*/
String getSiteRootPath(final String siteId);
/**
* Get the current site name if not empty, else return siteId.
* @return site name
*/
String getSiteName();
/**
* Get the current site's dam root path.
* @return site dam root path or null if on a non-communities site
*/
String getSiteDamRootPath();
/**
* Get the current site's content fragment dam root path.
* @return site content fragment dam root path or null if on a non-communities site
*/
String getSiteContentFragmentDamRootPath();
/**
* Get the current site's content fragment associated media dam root path.
* @return site content fragment associated media dam root path or null if on a non-communities site
*/
String getSiteContentFragmentAssociatedMediaDamRootPath();
/**
* Get the current site's content fragment collection path.
* @return site content fragment collection path or null if on a non-communities site
*/
String getSiteDamCollectionPath();
}