Class CommentsAndReportsTreeComponent
- java.lang.Object
-
- org.ametys.cms.repository.comment.ui.CommentsAndReportsTreeComponent
-
- All Implemented Interfaces:
Component,Contextualizable,Serviceable
public class CommentsAndReportsTreeComponent extends Object implements Component, Serviceable, Contextualizable
Action for getting the list of comments.
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentHelper_contentHelperThe content helperprotected Context_contextThe contextprotected CurrentUserProvider_currentUserProviderThe current user providerprotected Repository_repositoryThe JCR repositoryprotected AmetysObjectResolver_resolverThe ametys object resolverprotected RightManager_rightManagerThe right managerprotected UserManager_userManagerThe user manager
-
Constructor Summary
Constructors Constructor Description CommentsAndReportsTreeComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,Object>_comment2json(Comment comment, Content content, boolean includeNoReportedComments)Get the JSON representation of a commentprotected Map<String,Object>_content2json(Content content, UserIdentity user)Get the JSON representation of a contentprotected Map<String,Object>_content2json(Content content, UserIdentity user, boolean includeNoReportedComments)Get the JSON representation of a contentprotected Iterable<Content>_getReportedContentsFromContentType(String contentTypeId)Retrieves the contents from the current site with the given content type that have at least a report or a reported commentvoidcontextualize(Context context)MapgetCommentsAndReportsFromContentTypeId(String contentTypeId)Retrieves the comments and reports of the contents of the given type Manages only contents that have at least one report (on itself or on a comment)MapgetCommentsAndReportsFromSelectedContents(List<String> contentIds)Retrieves the comments and reports of the given selected contentsvoidservice(ServiceManager smanager)
-
-
-
Field Detail
-
_resolver
protected AmetysObjectResolver _resolver
The ametys object resolver
-
_rightManager
protected RightManager _rightManager
The right manager
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider
-
_contentHelper
protected ContentHelper _contentHelper
The content helper
-
_userManager
protected UserManager _userManager
The user manager
-
_repository
protected Repository _repository
The JCR repository
-
-
Constructor Detail
-
CommentsAndReportsTreeComponent
public CommentsAndReportsTreeComponent()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
getCommentsAndReportsFromSelectedContents
public Map getCommentsAndReportsFromSelectedContents(List<String> contentIds)
Retrieves the comments and reports of the given selected contents- Parameters:
contentIds- identifiers of the contents- Returns:
- the comments and reports of the contents
-
getCommentsAndReportsFromContentTypeId
public Map getCommentsAndReportsFromContentTypeId(String contentTypeId) throws RepositoryException
Retrieves the comments and reports of the contents of the given type Manages only contents that have at least one report (on itself or on a comment)- Parameters:
contentTypeId- the content type identifier- Returns:
- the comments and reports of the contents
- Throws:
RepositoryException- if an error occurs while retrieving contents from the repository
-
_getReportedContentsFromContentType
protected Iterable<Content> _getReportedContentsFromContentType(String contentTypeId) throws RepositoryException
Retrieves the contents from the current site with the given content type that have at least a report or a reported comment- Parameters:
contentTypeId- the content type identifier- Returns:
- the contents
- Throws:
RepositoryException- if an error occurs while retrieving the contents from the repository
-
_content2json
protected Map<String,Object> _content2json(Content content, UserIdentity user)
Get the JSON representation of a content- Parameters:
content- The contentuser- the current user- Returns:
- The content as JSON object
-
_content2json
protected Map<String,Object> _content2json(Content content, UserIdentity user, boolean includeNoReportedComments)
Get the JSON representation of a content- Parameters:
content- The contentuser- the current userincludeNoReportedComments-trueto include the comment that have no report,falseotherwise- Returns:
- The content as JSON object
-
_comment2json
protected Map<String,Object> _comment2json(Comment comment, Content content, boolean includeNoReportedComments)
Get the JSON representation of a comment- Parameters:
comment- the commentcontent- the contentincludeNoReportedComments-trueto include the comment that have no report,falseotherwise- Returns:
- The comment as JSON object
-
-