com.atlassian.crucible.spi.data
Class CommentDataImpl

java.lang.Object
  extended by com.atlassian.crucible.spi.data.CommentDataImpl
All Implemented Interfaces:
CommentData, java.io.Serializable
Direct Known Subclasses:
GeneralCommentData, VersionedCommentData

public class CommentDataImpl
extends java.lang.Object
implements CommentData

An abstract class (should be abstract - see note below) containing fields common to all comment data objects

NoteThis class is not declared abstract because otherwise the current JSON deserialier does not know how to handle the list of comments in some of the REST api objects. Longer term, a heterogeneous list of comments is not ideal in the REST interface.

See Also:
Serialized Form

Nested Class Summary
protected static class CommentDataImpl.CommentDataBuilder<M extends CommentDataImpl.CommentDataBuilder,T extends CommentDataImpl>
           
 
Nested classes/interfaces inherited from interface com.atlassian.crucible.spi.data.CommentData
CommentData.Status
 
Constructor Summary
CommentDataImpl()
          Deprecated. for serialization use only.
CommentDataImpl(java.lang.String message, boolean draft, boolean deleted, boolean defectRaised, boolean defectApproved, CommentData.Status readStatus, UserData user, java.util.Date createDate, java.lang.String permaId, java.util.List<GeneralCommentData> replies, java.util.Map<java.lang.String,CustomFieldData> metrics, java.lang.String parentCommentPermId)
          Deprecated. Use a CommentDataImpl.CommentDataBuilder instead of this.
CommentDataImpl(java.lang.String message, java.lang.String messageAsHtml, boolean draft, boolean deleted, boolean defectRaised, boolean defectApproved, CommentData.Status readStatus, UserData user, java.util.Date createDate, java.lang.String permaId, java.util.List<GeneralCommentData> replies, java.util.Map<java.lang.String,CustomFieldData> metrics, java.lang.String parentCommentPermId)
          Deprecated. Use a CommentDataImpl.CommentDataBuilder instead of this.
 
Method Summary
 java.util.Date getCreateDate()
          Get the comment's creation date.
 java.lang.String getMessage()
           
 java.lang.String getMessageAsHtml()
           
 java.util.Map<java.lang.String,CustomFieldData> getMetrics()
           
 PermId<CommentData> getParentCommentId()
          Get the perma-id of the comment that this comment is a reply to.
 java.lang.String getPermaIdAsString()
          Get the comment's perma-id.
 CommentData.Status getReadStatus()
          Get the read status of the comment with respect to the user who requested the comment.
 java.util.List<GeneralCommentData> getReplies()
          Get the direct replies to the comment.
 UserData getUser()
          Get the comment's author.
 boolean isDefectApproved()
           
 boolean isDefectRaised()
           
 boolean isDeleted()
           
 boolean isDraft()
           
 void setCreateDate(java.util.Date createDate)
          Set the comment's creation date.
 void setDefectApproved(boolean defectApproved)
           
 void setDefectRaised(boolean defectRaised)
           
 void setDeleted(boolean deleted)
           
 void setDraft(boolean draft)
           
 void setMessage(java.lang.String message)
           
 void setMessageAsHtml(java.lang.String messageAsHtml)
           
 void setMetrics(java.util.Map<java.lang.String,CustomFieldData> metrics)
           
 void setParentCommentId(PermId<CommentData> parentPermId)
          Set the parent comment of this comment.
 void setPermaIdAsString(java.lang.String permaId)
          Set the comment's perma-id.
 void setReadStatus(CommentData.Status readStatus)
          Set the comment's read status with respect to the user making the request.
 void setReplies(java.util.List<GeneralCommentData> replies)
          Set the replies for the comment.
 void setUser(UserData user)
          Set the comment's author.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommentDataImpl

@Deprecated
public CommentDataImpl()
Deprecated. for serialization use only.


CommentDataImpl

@Deprecated
public CommentDataImpl(java.lang.String message,
                                  boolean draft,
                                  boolean deleted,
                                  boolean defectRaised,
                                  boolean defectApproved,
                                  CommentData.Status readStatus,
                                  UserData user,
                                  java.util.Date createDate,
                                  java.lang.String permaId,
                                  java.util.List<GeneralCommentData> replies,
                                  java.util.Map<java.lang.String,CustomFieldData> metrics,
                                  java.lang.String parentCommentPermId)
Deprecated. Use a CommentDataImpl.CommentDataBuilder instead of this.


CommentDataImpl

@Deprecated
public CommentDataImpl(java.lang.String message,
                                  java.lang.String messageAsHtml,
                                  boolean draft,
                                  boolean deleted,
                                  boolean defectRaised,
                                  boolean defectApproved,
                                  CommentData.Status readStatus,
                                  UserData user,
                                  java.util.Date createDate,
                                  java.lang.String permaId,
                                  java.util.List<GeneralCommentData> replies,
                                  java.util.Map<java.lang.String,CustomFieldData> metrics,
                                  java.lang.String parentCommentPermId)
Deprecated. Use a CommentDataImpl.CommentDataBuilder instead of this.

Parameters:
message - the contents of the comment, in plain text
messageAsHtml - the contents of the comment, in html (e.g., wiki rendered comment). Can be null.
Method Detail

getMessageAsHtml

public java.lang.String getMessageAsHtml()
Specified by:
getMessageAsHtml in interface CommentData
Returns:
the wiki markup message rendered in html.

setMessageAsHtml

public void setMessageAsHtml(java.lang.String messageAsHtml)

getMetrics

public java.util.Map<java.lang.String,CustomFieldData> getMetrics()
Specified by:
getMetrics in interface CommentData

setMetrics

public void setMetrics(java.util.Map<java.lang.String,CustomFieldData> metrics)
Specified by:
setMetrics in interface CommentData

getMessage

public java.lang.String getMessage()
Specified by:
getMessage in interface CommentData

setMessage

public void setMessage(java.lang.String message)
Specified by:
setMessage in interface CommentData

isDraft

public boolean isDraft()
Specified by:
isDraft in interface CommentData

isDeleted

public boolean isDeleted()
Specified by:
isDeleted in interface CommentData

isDefectRaised

public boolean isDefectRaised()
Specified by:
isDefectRaised in interface CommentData

isDefectApproved

public boolean isDefectApproved()
Specified by:
isDefectApproved in interface CommentData

getReadStatus

public CommentData.Status getReadStatus()
Description copied from interface: CommentData
Get the read status of the comment with respect to the user who requested the comment.

Specified by:
getReadStatus in interface CommentData

setReadStatus

public void setReadStatus(CommentData.Status readStatus)
Description copied from interface: CommentData
Set the comment's read status with respect to the user making the request.

This field should not be set by client code. For the author of the comment, the read status is always READ, thus it is set to this value upon creation. To update the read status for other users, see markCommentAsRead, markCommentAsLeaveUnread, and markAllCommentsAsRead.

Specified by:
setReadStatus in interface CommentData

getUser

public UserData getUser()
Description copied from interface: CommentData
Get the comment's author.

Specified by:
getUser in interface CommentData

getCreateDate

public java.util.Date getCreateDate()
Description copied from interface: CommentData
Get the comment's creation date.

Specified by:
getCreateDate in interface CommentData

setPermaIdAsString

public void setPermaIdAsString(java.lang.String permaId)
Description copied from interface: CommentData
Set the comment's perma-id.

This field should not be set by client code. Perma-ids are allocated when a comment is created.

Specified by:
setPermaIdAsString in interface CommentData

setDraft

public void setDraft(boolean draft)
Specified by:
setDraft in interface CommentData

setDeleted

public void setDeleted(boolean deleted)
Specified by:
setDeleted in interface CommentData

setDefectRaised

public void setDefectRaised(boolean defectRaised)
Specified by:
setDefectRaised in interface CommentData

setDefectApproved

public void setDefectApproved(boolean defectApproved)
Specified by:
setDefectApproved in interface CommentData

setUser

public void setUser(UserData user)
Description copied from interface: CommentData
Set the comment's author.

This field should not be set by client code. When creating or updating a comment, it is ignored: the user who requested the comment creation is set as its author.

Specified by:
setUser in interface CommentData

setCreateDate

public void setCreateDate(java.util.Date createDate)
Description copied from interface: CommentData
Set the comment's creation date.

This field should not be set by client code. When creating or updating a comment, it is ignored: the date when the comment was created is set as its creation date.

Specified by:
setCreateDate in interface CommentData

getPermaIdAsString

public java.lang.String getPermaIdAsString()
Description copied from interface: CommentData
Get the comment's perma-id.

Specified by:
getPermaIdAsString in interface CommentData

getReplies

public java.util.List<GeneralCommentData> getReplies()
Description copied from interface: CommentData
Get the direct replies to the comment. To get nested replies, get the replies of the replies returned by this method.

Specified by:
getReplies in interface CommentData

setReplies

public void setReplies(java.util.List<GeneralCommentData> replies)
Description copied from interface: CommentData
Set the replies for the comment.

When creating or updating a comment, it is illegal to set the replies for that comment. You should create or update each comment individually.

Specified by:
setReplies in interface CommentData

getParentCommentId

public PermId<CommentData> getParentCommentId()
Description copied from interface: CommentData
Get the perma-id of the comment that this comment is a reply to.

Specified by:
getParentCommentId in interface CommentData
Returns:
the parent comment's perma-id or a PermId with a null value for id

setParentCommentId

public void setParentCommentId(PermId<CommentData> parentPermId)
Description copied from interface: CommentData
Set the parent comment of this comment.

This field should not be set by client code. When creating or updating a comment, it is ignored: it is set (automatically) for replies only.

Specified by:
setParentCommentId in interface CommentData
Parameters:
parentPermId - the perma-id of the parent of this comment
See Also:
ReviewService.addReply(com.atlassian.crucible.spi.PermId, GeneralCommentData)