public interface SocialUtils
Modifier and Type | Interface and Description |
---|---|
static class |
SocialUtils.AVATAR_SIZE
enum for avartar's size.
|
Modifier and Type | Field and Description |
---|---|
static String |
BUCKET_TYPE
Property name for bucket resource type.
|
static String |
CC_ASIPATH |
static String |
CC_CONSUMER_KEY |
static String |
CC_HOST_URL |
static String |
CC_REPORT_SUITE |
static String |
CC_SECRET_KEY |
static String |
CLOUD_SERVICE_REQUEST_LIST |
static String |
COMMENT_CS_RESOURCE_TYPE
The resource type for the comments component.
|
static String |
COMMENT_NODE_TYPE
The comment node type.
|
static String |
COMMENTID_SEPARATOR |
static String |
DEFAULT_AVATAR
Default avatar URL.
|
static String |
GROUP_MEMBERGROUP
Property name for group's member group.
|
static String |
NN_COMMENT_ATTACHMENTS
The property name for the Comment Attachments folder.
|
static String |
PATH_UGC
The path to the user-generated content.
|
static String |
PN_ATTACHMENT_LIST |
static String |
PN_BASETYPE |
static String |
PN_COMMENT_RESOURCETYPE |
static String |
PN_CS_ROOT |
static String |
PN_DATE |
static String |
PN_DS_KEY |
static String |
PN_ENTITY |
static String |
PN_IS_REPLY |
static String |
PN_PARENTID |
static String |
PN_POST_RESOURCETYPE |
static String |
PN_REMOTE_UGC_LOCATION
Property name for pointing a Social component to remote piece of UGC.
|
static String |
PN_SLING_RESOURCETYPE |
static String |
PN_TOPIC_RESOURCETYPE |
static String |
PROP_COMPONENT
The property name for the path to the comments component.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canAddNode(Session session,
String path)
Checks whether the given
session has the permission to add a node below the given
path . |
Boolean |
checkPermission(ResourceResolver resolver,
String path,
String action)
Checks a path and an action based on the passed in resolver.
|
Node |
createNode(ResourceResolver resolver,
String path,
String nodeType)
Create node.
|
String |
createUniqueNameHint(String message) |
String |
createUniqueNameHint(String message,
int numRandomChars) |
String |
generateRandomString(int length)
Generates a (secure) random string with the given length.
|
String |
getAvatar(UserProperties userProperties)
Returns the userProperties avatar URL or
CollabUtil#DEFAULT_AVATAR if profile has no avatar defined. |
String |
getAvatar(UserProperties userProperties,
int size)
Returns the userProperties avatar URL or
CollabUtil#DEFAULT_AVATAR if profile has no avatar defined. |
String |
getAvatar(UserProperties userProperties,
String absoluteDefaultAvatar)
Returns the userProperties avatar URL or
CollabUtil#DEFAULT_AVATAR if profile has no avatar defined. |
String |
getAvatar(UserProperties userProperties,
String absoluteDefaultAvatar,
SocialUtils.AVATAR_SIZE size)
Returns the userProperties avatar URL or absoluteDefaultAvatar if profile has no avatar defined.
|
SocialResourceProvider |
getConfiguredProvider(Resource resource)
A simple way of getting the configured SocialResourceProvider for a resource.
|
Page |
getContainingPage(Resource resource)
Finds the page which contains the given resource
|
Page |
getPage(String path,
ResourceResolver resolver) |
String |
getPagePath(Resource resource)
Returns the given
resource 's path without its potential /jcr:content/... suffix, thus
representing a page path. |
String |
getResourceTypeForIncludedResource(Resource component,
String defaultResourceType,
String designPropertyName)
Returns the resource type of a Component when it is included dynamically via cq:include.
|
String |
getResourceTypeFromDesign(Resource resource,
String styleProperty,
String defaultValue) |
String |
getSocialProfileURL(String username,
ResourceResolver resolver,
Page page)
Gets the social profile url for a user based on the page being passed in.
|
Configuration |
getStorageCloudServiceConfig(Resource resource)
From a resource get the cloud configuration for the social data service.
|
Resource |
getUGCResource(Resource userResource,
ResourceResolverFactory rrf)
Gets the base UGC Resource from a SocialResource.
|
Resource |
getUGCResource(Resource userResource,
ResourceResolverFactory rrf,
String resourceTypeHint)
Gets the base UGC Resource from a SocialResource.
|
UserProperties |
getUserProperties(ResourceResolver resolver,
String userId)
Returns the user properties denoted by the given
userId . |
boolean |
hasModeratePermissions(Resource resource)
Check if the login user can moderate a given resource.
|
boolean |
mayAccessUGC(ResourceResolver resolver)
May access ugc.
|
boolean |
mayPost(ResourceResolver resolver,
Resource resource)
Indicates whether the user within the given resource resolver has enough permissions to post to the given
resource component.
|
String |
prepareUserGeneratedContent(ResourceResolver resolver,
String path)
Prepare user generated content for the specified path.
|
String |
resourceToUGCPath(Resource resource)
This method maps the given
resource to its equivalent path in /usergenerated, e.g. |
String |
UGCToResourcePath(Resource resource)
This method maps the given
resource in /content/usergenerated to its equivalent path in the normal
content tree, e.g. |
String |
UGCToResourcePath(String ugcPath,
ResourceResolver resolver)
This method maps the given
resource in /content/usergenerated to its equivalent path in the normal
content tree, e.g. |
static final String PN_PARENTID
static final String PN_DATE
static final String PN_COMMENT_RESOURCETYPE
static final String PN_TOPIC_RESOURCETYPE
static final String PN_POST_RESOURCETYPE
static final String PN_SLING_RESOURCETYPE
static final String PN_DS_KEY
static final String PN_CS_ROOT
static final String PN_BASETYPE
static final String PN_ATTACHMENT_LIST
static final String PN_IS_REPLY
static final String PN_ENTITY
static final String CC_ASIPATH
static final String CC_HOST_URL
static final String CC_REPORT_SUITE
static final String CC_CONSUMER_KEY
static final String CC_SECRET_KEY
static final String COMMENTID_SEPARATOR
static final String CLOUD_SERVICE_REQUEST_LIST
static final String PROP_COMPONENT
static final String COMMENT_CS_RESOURCE_TYPE
static final String PATH_UGC
static final String PN_REMOTE_UGC_LOCATION
static final String BUCKET_TYPE
static final String GROUP_MEMBERGROUP
static final String COMMENT_NODE_TYPE
static final String DEFAULT_AVATAR
static final String NN_COMMENT_ATTACHMENTS
String getResourceTypeFromDesign(Resource resource, String styleProperty, String defaultValue)
Boolean checkPermission(ResourceResolver resolver, String path, String action)
resolver
- the resource resolver to use to evaluate the permissionspath
- the path to the resource to checkaction
- the action to checkResource getUGCResource(Resource userResource, ResourceResolverFactory rrf)
userResource
- a path to a resource that needs to have its UGC Resource located.rrf
- a resource resolver factory to use to create the nodes in the UGC areaResource getUGCResource(Resource userResource, ResourceResolverFactory rrf, String resourceTypeHint)
userResource
- a path to a resource that needs to have its UGC Resource located.rrf
- a resource resolver factory to use to create the nodes in the UGC arearesourceTypeHint
- the resource type to set on the root node in the UGC tree, this is used when components
are cq:included onto a pageString generateRandomString(int length)
length
- length of random string.Configuration getStorageCloudServiceConfig(Resource resource)
resource
- the base resource to check the cloud configuration forUserProperties getUserProperties(ResourceResolver resolver, String userId)
userId
. The user props are looked for using the
provided resource resolver, so as to ensure that the user properties are only accessible to users having the
necessary access rights on the requested user properties.resolver
- The ResourceResolver
.userId
- The user id for which to retrieve the user properties.UserProperties
or null
if not found.String getAvatar(UserProperties userProperties)
CollabUtil#DEFAULT_AVATAR
if profile has no avatar defined.userProperties
- The userProperties (may be null)String getAvatar(UserProperties userProperties, String absoluteDefaultAvatar)
CollabUtil#DEFAULT_AVATAR
if profile has no avatar defined.userProperties
- The userProperties (may be null)absoluteDefaultAvatar
- The absolute default avatarString getAvatar(UserProperties userProperties, String absoluteDefaultAvatar, SocialUtils.AVATAR_SIZE size)
userProperties
- The userProperties (may be null)absoluteDefaultAvatar
- The absolute default avatarsize
- The avatar size (for example, 32)String getAvatar(UserProperties userProperties, int size)
CollabUtil#DEFAULT_AVATAR
if profile has no avatar defined.userProperties
- The userProperties (may be null)size
- The avatar size (for example, 32)String getPagePath(Resource resource)
resource
's path without its potential /jcr:content/... suffix, thus
representing a page path.resource
- The resource to check.String
representing the page path.Node createNode(ResourceResolver resolver, String path, String nodeType) throws SocialException
resolver
- The ResourceResolver
to use for persisting values.path
- The path of the node to be creatednodeType
- The node typeCollabException
- if error occurs in Social CollaborationSocialException
String resourceToUGCPath(Resource resource)
resource
to its equivalent path in /usergenerated, e.g. as the
relationship a page /content/test to its comment at /content/usergenerated/content/test.resource
- The resource to transpose to the comment's UCG path.String
representing the equivalent UCG path.boolean canAddNode(Session session, String path)
session
has the permission to add a node below the given
path
.session
- The Session
to check the permissions for.path
- The repository path under which the "add node" permission is to be checked.false
if the session is null
or the session does not have add node
permissions on the given path.boolean mayPost(ResourceResolver resolver, Resource resource)
PATH_UGC
path are checked instead.resolver
- The ResourceResolver
resource
- The Resource
component.true
if the user may post.String prepareUserGeneratedContent(ResourceResolver resolver, String path) throws SocialException
resolver
- The ResourceResolver
to use for persisting values.path
- The page pathCollabException
- if error occurs in Social CollaborationSocialException
String UGCToResourcePath(Resource resource)
resource
in /content/usergenerated to its equivalent path in the normal
content tree, e.g. as the relationship of a comment in //content/usergenerated/content/test to its
parent resource at /content/test.resource
- The resource to transpose.String
representing the equivalent normal content path.String UGCToResourcePath(String ugcPath, ResourceResolver resolver)
resource
in /content/usergenerated to its equivalent path in the normal
content tree, e.g. as the relationship of a comment in //content/usergenerated/content/test to its
parent resource at /content/test.ugcPath
- The path to transpose.resolver
- The resource resolver to use.String
representing the equivalent normal content path.Page getContainingPage(Resource resource)
resource
- the resource for which the page is to be foundPage getPage(String path, ResourceResolver resolver)
path
- path to the pageresolver
- resolver to usPage
object for the given path if a page exists, null otherwise.SocialResourceProvider getConfiguredProvider(Resource resource)
resource
- The resource to use as the base of the resolutionString getSocialProfileURL(String username, ResourceResolver resolver, Page page)
username
- user to find the profile for.resolver
- the resolver to use, which must have read access to the profile otherpage
- the page to use as the basis for the search for "cq:socialProfilePage" property.boolean hasModeratePermissions(Resource resource)
resource
- The resource to checkString getResourceTypeForIncludedResource(Resource component, String defaultResourceType, String designPropertyName)
component
- the component to determine the type fordefaultResourceType
- the fall back if no suitable matchers are founddesignPropertyName
- the name of the design property to try and useboolean mayAccessUGC(ResourceResolver resolver)
resolver
- the resolver"Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"