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
_contentHelper
The content helperprotected Context
_context
The contextprotected CurrentUserProvider
_currentUserProvider
The current user providerprotected Repository
_repository
The JCR repositoryprotected AmetysObjectResolver
_resolver
The ametys object resolverprotected RightManager
_rightManager
The right managerprotected UserManager
_userManager
The 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 commentvoid
contextualize(Context context)
Map
getCommentsAndReportsFromContentTypeId(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)Map
getCommentsAndReportsFromSelectedContents(List<String> contentIds)
Retrieves the comments and reports of the given selected contentsvoid
service(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:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in 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
-true
to include the comment that have no report,false
otherwise- 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
-true
to include the comment that have no report,false
otherwise- Returns:
- The comment as JSON object
-
-