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
Modifier and TypeFieldDescriptionprotected ContentHelper
The content helperprotected Context
The contextprotected CurrentUserProvider
The current user providerprotected javax.jcr.Repository
The JCR repositoryprotected AmetysObjectResolver
The ametys object resolverprotected RightManager
The right managerprotected UserManager
The user manager -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription_comment2json
(Comment comment, Content content, boolean includeNoReportedComments) Get the JSON representation of a comment_content2json
(Content content, UserIdentity user) Get the JSON representation of a content_content2json
(Content content, UserIdentity user, boolean includeNoReportedComments) Get the JSON representation of a 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) 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)getCommentsAndReportsFromSelectedContents
(List<String> contentIds) Retrieves the comments and reports of the given selected contentsvoid
service
(ServiceManager smanager)
-
Field Details
-
_resolver
The ametys object resolver -
_rightManager
The right manager -
_currentUserProvider
The current user provider -
_contentHelper
The content helper -
_userManager
The user manager -
_context
The context -
_repository
The JCR repository
-
-
Constructor Details
-
CommentsAndReportsTreeComponent
public CommentsAndReportsTreeComponent()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
getCommentsAndReportsFromSelectedContents
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 javax.jcr.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:
javax.jcr.RepositoryException
- if an error occurs while retrieving contents from the repository
-
_getReportedContentsFromContentType
protected Iterable<Content> _getReportedContentsFromContentType(String contentTypeId) throws javax.jcr.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:
javax.jcr.RepositoryException
- if an error occurs while retrieving the contents from the repository
-
_content2json
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
-