public class Comment extends Object implements ReactionableObject
ReactionableObject.ReactionType
Modifier and Type | Field and Description |
---|---|
protected ModifiableCompositeMetadata |
_contentMetadataHolder
The content to comment
|
protected String |
_id
The id of the comment (unique in the content)
|
protected ModifiableCompositeMetadata |
_metadata
The metadata node of the comment
|
static String |
ID_SEPARATOR
Constants for the separator
|
static String |
METADATA_COMMENT_AUTHOREMAIL
Constants for author email Metadata
|
static String |
METADATA_COMMENT_AUTHOREMAIL_HIDDEN
Constants for author email hidden Metadata
|
static String |
METADATA_COMMENT_AUTHORNAME
Constants for author name Metadata
|
static String |
METADATA_COMMENT_AUTHORURL
Constants for author url Metadata
|
static String |
METADATA_COMMENT_CONTENT
Constants for the content Metadata
|
static String |
METADATA_COMMENT_CREATIONDATE
Constants for creation Metadata
|
static String |
METADATA_COMMENT_NB_REPORTERS
Constants for the number of reporters Metadata
|
static String |
METADATA_COMMENT_VALIDATED
Constants for the validated status Metadata
|
static String |
METADATA_COMMENTS
Constants for comments Metadat*
|
static String |
METADATA_COMMENTS_NOTVALIDATED
Constants for comments Metadata validated
|
static String |
METADATA_COMMENTS_VALIDATED
Constants for comments Metadata not validted
|
Constructor and Description |
---|
Comment(Comment comment)
Creates a new sub comment of the comment
|
Comment(ModifiableCompositeMetadata contentUnversionnedMetadataHolder)
Creates a new comment on the content
|
Comment(ModifiableCompositeMetadata contentUnversionnedMetadataHolder,
String commentId)
Retrieves a comment by its id
|
Modifier and Type | Method and Description |
---|---|
void |
addReaction(UserIdentity user,
ReactionableObject.ReactionType reactionType)
Add the user reaction
|
Comment |
createSubComment()
Create sub comment from this comment
|
String |
getAuthorEmail()
Get the email of the author.
|
String |
getAuthorName()
Get the readable name of the author.
|
String |
getAuthorURL()
Get the url given by the author as its personnal site url.
|
static Comment |
getComment(ModifiableCompositeMetadata contentUnversionnedMetadataHolder,
String commentId)
Get a comment
|
static List<Comment> |
getComments(Comment parentComment,
boolean includeNotValidatedComments,
boolean includeValidatedComments)
Get the comments of a content
|
static List<Comment> |
getComments(Comment parentComment,
boolean includeNotValidatedComments,
boolean includeValidatedComments,
boolean withSubComment)
Get the comments of a content
|
static List<Comment> |
getComments(ModifiableCompositeMetadata contentUnversionnedMetadataHolder,
boolean includeNotValidatedComments,
boolean includeValidatedComments)
Get the comments of a content
|
static List<Comment> |
getComments(ModifiableCompositeMetadata contentUnversionnedMetadataHolder,
boolean includeNotValidatedComments,
boolean includeValidatedComments,
boolean isRecursive)
Get the comments of a content
|
String |
getContent()
Get the content of the comment.
|
ModifiableCompositeMetadata |
getContentMetadata()
Get the composite metadata object holding the content
|
Date |
getCreationDate()
Get the date and time the comment was created
|
String |
getId()
The comment id (unique to the content)
|
ModifiableCompositeMetadata |
getMetadata()
Get the composite metadata object holding the comment
|
Long |
getNbReporters()
Get the number of reporters
|
List<UserIdentity> |
getReactionUsers(ReactionableObject.ReactionType reactionType)
Get the list of users who react
|
List<Comment> |
getSubComment(boolean includeNotValidatedComments,
boolean includeValidatedComments)
Get sub comments of the comment
|
Long |
increaseNbReporters()
Increase the number of reporters
|
boolean |
isEmailHidden()
Does the email of the authors have to be hidden ?
|
boolean |
isValidated()
Is the comment validated
|
void |
remove()
Remove the comment.
|
void |
removeReaction(UserIdentity user,
ReactionableObject.ReactionType reactionType)
Remove the user reaction
|
void |
resetNbReporters()
Reset to 0 the number of reporters
|
void |
setAuthorEmail(String email)
Set the email of the author.
|
void |
setAuthorName(String name)
Set the readable name of the author.
|
void |
setAuthorURL(String url)
Set the personnal site url of the author
|
void |
setContent(String content)
Set the content of the comment.
|
void |
setEmailHiddenStatus(boolean hideEmail)
Set the email hidden status.
|
void |
setValidated(boolean validated)
Set the validation status of the comment
|
protected void |
update()
Update the comment tag statistics
|
public static final String METADATA_COMMENTS
public static final String METADATA_COMMENTS_VALIDATED
public static final String METADATA_COMMENTS_NOTVALIDATED
public static final String METADATA_COMMENT_CREATIONDATE
public static final String METADATA_COMMENT_AUTHORNAME
public static final String METADATA_COMMENT_AUTHOREMAIL
public static final String METADATA_COMMENT_AUTHOREMAIL_HIDDEN
public static final String METADATA_COMMENT_AUTHORURL
public static final String METADATA_COMMENT_CONTENT
public static final String METADATA_COMMENT_VALIDATED
public static final String METADATA_COMMENT_NB_REPORTERS
public static final String ID_SEPARATOR
protected ModifiableCompositeMetadata _contentMetadataHolder
protected ModifiableCompositeMetadata _metadata
public Comment(ModifiableCompositeMetadata contentUnversionnedMetadataHolder, String commentId)
contentUnversionnedMetadataHolder
- The unversionned metadate holder of the content hosting the commentcommentId
- The id of the comment to retrieveAmetysRepositoryException
- if an error occuredpublic Comment(ModifiableCompositeMetadata contentUnversionnedMetadataHolder)
contentUnversionnedMetadataHolder
- The unversionned metadate holder of the content where to add the new commentpublic ModifiableCompositeMetadata getMetadata()
public ModifiableCompositeMetadata getContentMetadata()
public Date getCreationDate()
public String getAuthorName()
public void setAuthorName(String name)
name
- The full name. Can be null to remove the name.public String getAuthorEmail()
public void setAuthorEmail(String email)
email
- The email. Can be null to remove the email.public String getAuthorURL()
public void setAuthorURL(String url)
url
- The url. Can be null to remove url.public boolean isEmailHidden()
public void setEmailHiddenStatus(boolean hideEmail)
hideEmail
- true to set the email as hidden.public String getContent()
public void setContent(String content)
content
- The content to set. Can be null to remove the content. Have to be a simple String (with \n or \t).public boolean isValidated()
public void setValidated(boolean validated)
validated
- true the comment is validatedpublic void resetNbReporters()
public Long increaseNbReporters()
public Long getNbReporters()
public void remove()
public List<Comment> getSubComment(boolean includeNotValidatedComments, boolean includeValidatedComments)
includeNotValidatedComments
- True to include the comments that are not validatedincludeValidatedComments
- True to include the comments that are validatedpublic Comment createSubComment()
protected void update()
public static Comment getComment(ModifiableCompositeMetadata contentUnversionnedMetadataHolder, String commentId) throws AmetysRepositoryException
contentUnversionnedMetadataHolder
- the contentcommentId
- The commentAmetysRepositoryException
- if the comment does not existpublic static List<Comment> getComments(Comment parentComment, boolean includeNotValidatedComments, boolean includeValidatedComments) throws AmetysRepositoryException
parentComment
- The parent commentincludeNotValidatedComments
- True to include the comments that are not validatedincludeValidatedComments
- True to include the comments that are validatedAmetysRepositoryException
- If an error occurredpublic static List<Comment> getComments(Comment parentComment, boolean includeNotValidatedComments, boolean includeValidatedComments, boolean withSubComment) throws AmetysRepositoryException
parentComment
- The parent commentincludeNotValidatedComments
- True to include the comments that are not validatedincludeValidatedComments
- True to include the comments that are validatedwithSubComment
- true if we want to get all child commentsAmetysRepositoryException
- If an error occurredpublic static List<Comment> getComments(ModifiableCompositeMetadata contentUnversionnedMetadataHolder, boolean includeNotValidatedComments, boolean includeValidatedComments) throws AmetysRepositoryException
contentUnversionnedMetadataHolder
- The content unversionned metadata holderincludeNotValidatedComments
- True to include the comments that are not validatedincludeValidatedComments
- True to include the comments that are validatedAmetysRepositoryException
- If an error occurredpublic static List<Comment> getComments(ModifiableCompositeMetadata contentUnversionnedMetadataHolder, boolean includeNotValidatedComments, boolean includeValidatedComments, boolean isRecursive) throws AmetysRepositoryException
contentUnversionnedMetadataHolder
- The content unversionned metadata holderincludeNotValidatedComments
- True to include the comments that are not validatedincludeValidatedComments
- True to include the comments that are validatedisRecursive
- true if we want to have sub commentsAmetysRepositoryException
- If an error occurredpublic void addReaction(UserIdentity user, ReactionableObject.ReactionType reactionType)
ReactionableObject
addReaction
in interface ReactionableObject
user
- the userreactionType
- the reaction typepublic void removeReaction(UserIdentity user, ReactionableObject.ReactionType reactionType)
ReactionableObject
removeReaction
in interface ReactionableObject
user
- the userreactionType
- the reaction typepublic List<UserIdentity> getReactionUsers(ReactionableObject.ReactionType reactionType)
ReactionableObject
getReactionUsers
in interface ReactionableObject
reactionType
- the reaction type