@Deprecated public class CollabUtil extends Object
SocialUtils
Modifier and Type | Class and Description |
---|---|
static class |
CollabUtil.AVATAR_SIZE
Deprecated.
enum for avartar's size.
|
Modifier and Type | Field and Description |
---|---|
static String |
BUCKET_TYPE
Deprecated.
Property name for bucket resource type.
|
static String |
DEFAULT_AVATAR
Deprecated.
Default avatar URL.
|
static String |
GROUP_MEMBERGROUP
Deprecated.
Property name for group's member group.
|
static String |
PN_REMOTE_UGC_LOCATION
Deprecated.
Property name for pointing a Social component to remote piece of UGC.
|
static String |
REQ_ATTR_SOCIAL_PROFILE_PAGE
Deprecated.
since 5.6.1. Fetch the property directly from the page hierarchy with
WCMUtils.getInheritedProperty(currentPage, resourceResolver, "cq:socialProfilePage");
|
Constructor and Description |
---|
CollabUtil()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
canAddNode(Session session,
String path)
Deprecated.
Checks whether the given
session has the permission to add a node below the given
path . |
static boolean |
causeByInvalidItemStateException(Exception e)
Deprecated.
Check to see if the specified exception caused by a jcr InvalidItemStateException.
|
static Node |
createNode(ResourceResolver resolver,
String path,
String nodeType)
Deprecated.
Create node.
|
static Node |
createNode(Session session,
String path,
String nodeType)
Deprecated.
|
static Page |
createPage(ResourceResolver resolver,
String path,
String template,
String resourceTypeProp,
String resourceType,
String title)
Deprecated.
Create page.
|
static Page |
createPage(ResourceResolver resolver,
String parentPath,
String name,
String template,
String resourceTypeProp,
String resourceType,
String title)
Deprecated.
Create page.
|
static String |
formatFileSize(long size)
Deprecated.
Format file size.
|
static String |
generateRandomString(int length)
Deprecated.
Generates a (secure) random string with the given length.
|
static FileDataSource |
getAttachmentFromDataSource(FileDataSource attachmentDataSource,
FileUploadSizeLimit fileUploadSizeLimit,
Set<String> whitelist,
String[] blacklistIn)
Deprecated.
Utility to check file against the specified white list and black list.
|
static Iterable<javax.activation.DataSource> |
getAttachmentsFromDataSources(Iterable<FileDataSource> attachmentList,
FileUploadSizeLimit fileUploadSizeLimit,
Set<String> whitelist,
String[] blacklist)
Deprecated.
Utility to get filtered list of attachments after checking size, whitelist and blacklist.
|
static List<javax.activation.DataSource> |
getAttachmentsFromRequest(RequestParameter[] fileRequestParameters,
FileUploadSizeLimit fileUploadSizeLimit,
List<String> whitelist,
String[] blacklist)
Deprecated.
Utility to check attached files against the specified white list and black list.
|
static List<javax.activation.DataSource> |
getAttachmentsFromRequest(RequestParameter[] fileRequestParameters,
long attachmentSizeLimit,
List<String> whitelist,
String[] blacklist)
Deprecated.
Utility to check attached files against the specified white list and black list.
|
static String |
getAvatar(Profile profile)
Deprecated.
|
static String |
getAvatar(Profile profile,
String email,
String absoluteDefaultAvatar)
Deprecated.
|
static String |
getAvatar(Profile profile,
String email,
String absoluteDefaultAvatar,
CollabUtil.AVATAR_SIZE size)
Deprecated.
|
static String |
getAvatar(UserProperties userProperties)
Deprecated.
Returns the userProperties avatar URL or
DEFAULT_AVATAR if profile has no avatar defined. |
static String |
getAvatar(UserProperties userProperties,
String email,
String absoluteDefaultAvatar)
Deprecated.
Returns the userProperties avatar URL or
DEFAULT_AVATAR if profile has no avatar defined. |
static String |
getAvatar(UserProperties userProperties,
String email,
String absoluteDefaultAvatar,
CollabUtil.AVATAR_SIZE size)
Deprecated.
Returns the userProperties avatar URL or
DEFAULT_AVATAR if profile has no avatar defined. |
static String |
getCommunityGroupUGCPath(Resource resource)
Deprecated.
Given a resource, this will climb the tree to find the path of the community the resource is contained in.
|
static String |
getGravatar(String email,
String absoluteDefaultAvatar)
Deprecated.
Returns the gravatar URL.
|
static String |
getIdFromResource(Resource resource)
Deprecated.
Returns the given
resource 's name without selectors and / or file extension. |
static String |
getPagePath(Resource resource)
Deprecated.
Returns the given
resource 's path without its potential /jcr:content/... suffix, thus
representing a page path. |
static Profile |
getProfile(ResourceResolver resolver,
ProfileManager pm,
String userId)
Deprecated.
Use
#getUserProperties(org.apache.sling.api.resource.ResourceResolver, String) instead. |
static UserProperties |
getUserProperties(ResourceResolver resolver,
String userId)
Deprecated.
Returns the user properties denoted by the given
userId . |
static String |
getValueString(Object value)
Deprecated.
Get the string value for the specified object.
|
static boolean |
hasModeratePermissions(Resource resource)
Deprecated.
Check if the login user can moderate a given resource.
|
static boolean |
isCommunityGroupResource(Resource resource)
Deprecated.
Check if a given resource is associated with a community group.
|
static boolean |
isResourceOwner(Resource resource)
Deprecated.
Check if the login user is the resource owner.
|
static boolean |
mayEdit(ResourceResolver resolver,
String authorizableID,
Comment comment)
Deprecated.
Use
#CollabUtil.hasModeratePermissions(Resource) instead. |
static String |
prepareUserGeneratedContent(ResourceResolver resolver,
String path)
Deprecated.
Prepare user generated content for the specified path.
|
static String |
resourceToUGCPath(Resource resource)
Deprecated.
This method maps the given
resource to its equivalent path in /usergenerated, e.g. |
static void |
save(ResourceResolver resolver)
Deprecated.
Save the content of changes.
|
static void |
setNodeProperty(Node node,
String name,
Object value)
Deprecated.
|
static String |
UGCToResourcePath(Resource resource)
Deprecated.
This method maps the given
resource in /content/usergenerated to its equivalent path in the normal
content tree, e.g. |
static String |
UGCToResourcePath(String ugcPath,
ResourceResolver resolver)
Deprecated.
|
public static String PN_REMOTE_UGC_LOCATION
public static final String BUCKET_TYPE
@Deprecated public static final String REQ_ATTR_SOCIAL_PROFILE_PAGE
public static final String GROUP_MEMBERGROUP
public static String DEFAULT_AVATAR
public static boolean isCommunityGroupResource(Resource resource)
resource
- The resource to checkpublic static String getCommunityGroupUGCPath(Resource resource)
resource
- The resource to checkpublic static boolean hasModeratePermissions(Resource resource)
resource
- The resource to checkpublic static boolean isResourceOwner(Resource resource)
resource
- The resource to checkpublic static 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.public static 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.public static String UGCToResourcePath(String ugcPath, ResourceResolver resolver)
public static 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.public static String getIdFromResource(Resource resource)
resource
's name without selectors and / or file extension.resource
- The resource from which to retrieve its name.String
representing the id.public static 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.@Deprecated public static String getAvatar(Profile profile)
getAvatar(com.adobe.granite.security.user.UserProperties)
instead.DEFAULT_AVATAR
if profile has no avatar defined.profile
- The profile (may be null)public static String getAvatar(UserProperties userProperties)
DEFAULT_AVATAR
if profile has no avatar defined.userProperties
- The userProperties (may be null)public static String getAvatar(UserProperties userProperties, String email, String absoluteDefaultAvatar)
DEFAULT_AVATAR
if profile has no avatar defined.userProperties
- The userProperties (may be null)email
- The email addressabsoluteDefaultAvatar
- The absolute default avatarpublic static String getAvatar(UserProperties userProperties, String email, String absoluteDefaultAvatar, CollabUtil.AVATAR_SIZE size)
DEFAULT_AVATAR
if profile has no avatar defined.userProperties
- The userProperties (may be null)email
- The email addressabsoluteDefaultAvatar
- The absolute default avatarsize
- The avatar size (for example, 32x48)@Deprecated public static String getAvatar(Profile profile, String email, String absoluteDefaultAvatar)
getAvatar(com.adobe.granite.security.user.UserProperties, String, String)
instead.@Deprecated public static String getAvatar(Profile profile, String email, String absoluteDefaultAvatar, CollabUtil.AVATAR_SIZE size)
getAvatar(com.adobe.granite.security.user.UserProperties, String, String)
instead.public static String getGravatar(String email, String absoluteDefaultAvatar)
email
- The email addressabsoluteDefaultAvatar
- The absolute default avatarpublic static String generateRandomString(int length)
length
- length of random string.public static String prepareUserGeneratedContent(ResourceResolver resolver, String path) throws CollabException
resolver
- The ResourceResolver
to use for persisting values.path
- The page pathCollabException
- if error occurs in Social Collaborationpublic static void save(ResourceResolver resolver) throws CollabException, IllegalArgumentException
resolver
- The ResourceResolver
to use for persisting values.CollabException
- if error occurs in Social CollaborationIllegalArgumentException
- if error occurs with illegal argumentspublic static Page createPage(ResourceResolver resolver, String path, String template, String resourceTypeProp, String resourceType, String title) throws CollabException
resolver
- The ResourceResolver
to use for persisting values.path
- The page pathtemplate
- The templateresourceTypeProp
- The resource type propertiesresourceType
- The resource type of the JCR nodetitle
- The title of the JCR nodeCollabException
- if error occurs in Social Collaborationpublic static Page createPage(ResourceResolver resolver, String parentPath, String name, String template, String resourceTypeProp, String resourceType, String title) throws CollabException
resolver
- The ResourceResolver
to use for persisting values.parentPath
- The page parent pathname
- The page nametemplate
- The templateresourceTypeProp
- The resource type propertiesresourceType
- The resource type of the nodetitle
- The title of the nodeCollabException
- if error occurs in Social Collaborationpublic static Node createNode(ResourceResolver resolver, String path, String nodeType) throws CollabException
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 Collaborationpublic static void setNodeProperty(Node node, String name, Object value) throws RepositoryException
RepositoryException
@Deprecated public static Profile getProfile(ResourceResolver resolver, ProfileManager pm, String userId)
#getUserProperties(org.apache.sling.api.resource.ResourceResolver, String)
instead.userId
. The profile is looked for using the provided
profile manager and resource resolver, so as to ensure that the profile is only accessible to users having the
necessary access rights on the requested profile.resolver
- The ResourceResolver
.pm
- The ProfileManager
userId
- The user id for which to retrieve the profile.Profile
or null
of not found.public static UserProperties 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.public static boolean causeByInvalidItemStateException(Exception e)
e
- The exception@Deprecated public static boolean mayEdit(ResourceResolver resolver, String authorizableID, Comment comment)
#CollabUtil.hasModeratePermissions(Resource)
instead.resolver
- resolver to use to test if the user can editauthorizableID
- the authorizable ID for the usercomment
- which comment to testpublic static String formatFileSize(long size)
size
- The file sizepublic static List<javax.activation.DataSource> getAttachmentsFromRequest(RequestParameter[] fileRequestParameters, long attachmentSizeLimit, List<String> whitelist, String[] blacklist)
fileRequestParameters
- Request parameters of the type fileattachmentSizeLimit
- size limit of the filewhitelist
- comma separated extensions of allowed file typesblacklist
- Black list of harmful filespublic static List<javax.activation.DataSource> getAttachmentsFromRequest(RequestParameter[] fileRequestParameters, FileUploadSizeLimit fileUploadSizeLimit, List<String> whitelist, String[] blacklist)
fileRequestParameters
- Request parameters of the type filefileUploadSizeLimit
- size limits of the filewhitelist
- comma separated extensions of allowed file typesblacklist
- Black list of harmful filespublic static Iterable<javax.activation.DataSource> getAttachmentsFromDataSources(Iterable<FileDataSource> attachmentList, FileUploadSizeLimit fileUploadSizeLimit, Set<String> whitelist, String[] blacklist)
attachmentList
- unfiltered list of attachmentsfileUploadSizeLimit
- size limits of the filewhitelist
- comma separated extensions of allowed file typesblacklist
- Black list of harmful filespublic static FileDataSource getAttachmentFromDataSource(FileDataSource attachmentDataSource, FileUploadSizeLimit fileUploadSizeLimit, Set<String> whitelist, String[] blacklistIn)
attachmentDataSource
- Data Source of the attachmentfileUploadSizeLimit
- size limits of the filewhitelist
- comma separated extensions of allowed file typesblacklist
- Black list of harmful filespublic static String getValueString(Object value) throws RepositoryException
Value
, then return the
string of the Value
, else return the string of the Object.toString().value
- RepositoryException
- if the specified value is an array"Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"