com.atlassian.jira.issue.comments.CommentManager |
![]() |
Clients of @PublicApi
can expect
that programs compiled against a given version will remain binary compatible with later versions of the
@PublicApi
as per each product's API policy as long as the client does not implement/extend
@PublicApi
interfaces or classes (refer to each product's API policy for the exact
guarantee---usually binary compatibility is guaranteed at least across minor versions).
@PublicApi
interfaces and classes are not designed to be implemented or extended by clients,
we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not
affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces
annotated with @PublicSpi
are safe to extend/implement).
The CommentManager is used to retrieve and create comments in JIRA. Comments are always associated with an issue.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | EVENT_ORIGINAL_COMMENT_PARAMETER | Retrieves all Comment s on the given Issue that the given ApplicationUser has permission to see. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This is a convenience method that can be used to convert a GenericValue representation of a comment to a comment
object.
| |||||||||||
This method is deprecated.
Use
create(Issue, ApplicationUser, ApplicationUser, String, String, Long, Date, Date, boolean) instead. Since v6.0.
| |||||||||||
Creates a comment and associates it with the given issue.
| |||||||||||
Creates a comment and associates it with the given issue.
| |||||||||||
Creates a comment and associates it with the given issue.
| |||||||||||
Creates a comment and associates it with the given issue.
| |||||||||||
This method is deprecated.
Use
create(com.atlassian.jira.issue.Issue, com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.user.ApplicationUser, String, String, Long, java.util.Date, java.util.Date, boolean, boolean)
instead. Since v6.0.
| |||||||||||
This method is deprecated.
Use
create(Issue, ApplicationUser, String, String, Long, boolean) instead. Since v6.0.
| |||||||||||
This method is deprecated.
Use
create(Issue, ApplicationUser, String, boolean) instead.
Since 6.0.
| |||||||||||
Creates a comment and associates it with the given issue.
| |||||||||||
Creates a comment and associates it with the given issue.
| |||||||||||
Creates a comment and associates it with the given issue.
| |||||||||||
This method is deprecated.
Use
create(Issue, ApplicationUser, String, String, Long, Date, boolean) instead. Since v6.0.
| |||||||||||
Deletes the specified comment.
| |||||||||||
Deletes the specified comment.
| |||||||||||
Will return a comment for the passed in commentId.
| |||||||||||
This will return all comments for a given issue.
| |||||||||||
Retrieves all
Comment s on the given Issue that the given ApplicationUser
has permission to see. | |||||||||||
Retrieves
Comment s that were created or updated after the provided date, on the given Issue that the
given ApplicationUser has permission to see. | |||||||||||
Returns the count of all
Comment 's that have their visibility restricted by the named group. | |||||||||||
Returns the count of all
Comment 's that have their visibility restricted by the role with the given id. | |||||||||||
Retrieves comment by given id and returns it as mutable object.
| |||||||||||
This method is deprecated.
Don't use this because
getProjectRole(Long)
exists and should be used instead. Deprecated since 6.2.3
| |||||||||||
Returns true if the given user is the author of the given comment.
| |||||||||||
Updates
Comment 's such that comments that have a visibility restriction of the provided groupName will be
changed to have a visibility restriction of the provided swapGroup. | |||||||||||
Updates
Comment 's such that comments that have a visibility restriction of the provided role will be
changed to have a visibility restriction of the role with the provided swapRoleId. | |||||||||||
Persists the updated comment.
| |||||||||||
Persists the updated comment.
|
Retrieves all Comment
s on the given Issue that the given ApplicationUser
has permission to see.
If the passed in user is null, only comments with no permission level set will be returned.
NOTE: keep in mind null user represents an anonymous i.e. non-logged in user.
This is a convenience method that can be used to convert a GenericValue representation of a comment to a comment object.
commentGV | is the GenericValue representation of a comment. |
---|
This method is deprecated.
Use create(Issue, ApplicationUser, ApplicationUser, String, String, Long, Date, Date, boolean)
instead. Since v6.0.
Creates a comment and associates it with the given issue. Using this method the comment will be created with a createdDate of the specified date. This method should be used if you are trying to preserve existing information and it is important to retain the original created date. If you have provided a groupLevel then the comment visibility will be restricted to the provided group, it is assumed that validation to ensure that the group actually exists has been performed outside of this method. If you have provided a roleLevelId then the comment visibility will be restricted to the provided role, it is assumed that validation to ensure that the role actually exists has been performed outside of this method.
NOTE: A comment should not have both a group level and role level visibility restriction. This method will not stop this, but it does not semantically make sense.
issue | the issue to associate the comment with. |
---|---|
author | the key of the user who has created this comment. |
updateAuthor | the key of the user who has updated this comment last |
body | the text of the comment. |
groupLevel | is the group name to limit comment visibility to, this must be a valid group name. |
roleLevelId | is the id of the the ProjectRole to limit comment visibility to, this must reference a
valid project role. |
created | is the date that will be used as the comments creation date. |
updated | is the date that will be used as the comments updated date. |
dispatchEvent | if true then an event of type ISSUE_COMMENTED_ID
will be dispatched and any notifications listening for that event will be triggered. If false no event will be
dispatched. |
Creates a comment and associates it with the given issue. Using this method the comment will be created with a
createdDate of the specified date. This method should be used if you are trying to preserve existing information
and it is important to retain the original created date. If you have provided a groupLevel then the comment
visibility will be restricted to the provided group, it is assumed that validation to ensure that the group
actually exists has been performed outside of this method. If you have provided a roleLevelId then the comment
visibility will be restricted to the provided role, it is assumed that validation to ensure that the role
actually exists has been performed outside of this method.
NOTE: A comment should not have both a group level and role level visibility restriction. This
method will not stop this, but it does not semantically make sense.
issue | the issue to associate the comment with. |
---|---|
author | the key of the user who has created this comment. |
updateAuthor | the key of the user who has updated this comment last |
body | the text of the comment. |
groupLevel | is the group name to limit comment visibility to, this must be a valid group name. |
roleLevelId | is the id of the the ProjectRole to limit comment visibility to, this must reference a
valid project role. |
created | is the date that will be used as the comments creation date. |
updated | is the date that will be used as the comments updated date. |
dispatchEvent | if true then an event of type ISSUE_COMMENTED_ID
will be dispatched and any notifications listening for that event will be triggered. If false no event will be
dispatched. |
CommentBodyCharacterLimitExceededException | when comment body exceeds the jira character limit |
---|
Creates a comment and associates it with the given issue. Using this method the comment will be created with a
createdDate of the current time. If you have provided a groupLevel then the comment visibility will be restricted
to the provided group, it is assumed that validation to ensure that the group actually exists has been performed
outside of this method. If you have provided a roleLevelId then the comment visibility will be restricted to the
provided role, it is assumed that validation to ensure that the role actually exists has been performed outside
of this method.
NOTE: A comment should not have both a group level and role level visibility restriction. This
method will not stop this, but it does not semantically make sense.
issue | the issue to associate the comment with. |
---|---|
author | the key of the user who has created this comment. |
body | the text of the comment. |
groupLevel | is the group name to limit comment visibility to, this must be a valid group name. |
roleLevelId | is the id of the the ProjectRole to limit comment visibility to, this must reference a
valid project role. |
dispatchEvent | if true then an event of type ISSUE_COMMENTED_ID
will be dispatched and any notifications listening for that event will be triggered. If false no event will be
dispatched. |
CommentBodyCharacterLimitExceededException | when comment body exceeds the jira character limit |
---|
Creates a comment and associates it with the given issue. Using this method the comment will be created with a
createdDate of the specified date. This method should be used if you are trying to preserve existing information
and it is important to retain the original created date. If you have provided a groupLevel then the comment
visibility will be restricted to the provided group, it is assumed that validation to ensure that the group
actually exists has been performed outside of this method. If you have provided a roleLevelId then the comment
visibility will be restricted to the provided role, it is assumed that validation to ensure that the role
actually exists has been performed outside of this method.
NOTE: A comment should not have both a group level and role level visibility restriction. This
method will not stop this, but it does not semantically make sense.
issue | the issue to associate the comment with. |
---|---|
author | the key of the user who has created this comment. |
updateAuthor | the key of the user who has updated this comment last |
body | the text of the comment. |
groupLevel | is the group name to limit comment visibility to, this must be a valid group name. |
roleLevelId | is the id of the the ProjectRole to limit comment visibility to, this must reference a
valid project role. |
created | is the date that will be used as the comments creation date. |
updated | is the date that will be used as the comments updated date. |
commentProperties | Comment properties that should be attached to the created comment before the comment can be considered 'created' |
dispatchEvent | if true then an event of type ISSUE_COMMENTED_ID
will be dispatched and any notifications listening for that event will be triggered. If false no event will be
dispatched. |
modifyIssueUpdateDate | if true the issue's "updated" date will set to the date of this comment (unless the given date is earlier than the current issue update date). |
CommentBodyCharacterLimitExceededException | when comment body exceeds the jira character limit |
---|
Creates a comment and associates it with the given issue. Using this method the comment will be created with a createdDate of the current date/time and with no visibility restrictions.
issue | the issue to associate the comment with. |
---|---|
author | the key of the user who has created this comment. |
body | the text of the comment. |
dispatchEvent | if true then an event of type ISSUE_COMMENTED_ID
will be dispatched and any notifications listening for that event will be triggered. If false no event will be
dispatched. |
CommentBodyCharacterLimitExceededException | when comment body exceeds the jira character limit |
---|
This method is deprecated.
Use create(com.atlassian.jira.issue.Issue, com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.user.ApplicationUser, String, String, Long, java.util.Date, java.util.Date, boolean, boolean)
instead. Since v6.0.
Creates a comment and associates it with the given issue. Using this method the comment will be created with a
createdDate of the specified date. This method should be used if you are trying to preserve existing information
and it is important to retain the original created date. If you have provided a groupLevel then the comment
visibility will be restricted to the provided group, it is assumed that validation to ensure that the group
actually exists has been performed outside of this method. If you have provided a roleLevelId then the comment
visibility will be restricted to the provided role, it is assumed that validation to ensure that the role
actually exists has been performed outside of this method.
NOTE: A comment should not have both a group level and role level visibility restriction. This
method will not stop this, but it does not semantically make sense.
issue | the issue to associate the comment with. |
---|---|
author | the key of the user who has created this comment. |
updateAuthor | the key of the user who has updated this comment last |
body | the text of the comment. |
groupLevel | is the group name to limit comment visibility to, this must be a valid group name. |
roleLevelId | is the id of the the ProjectRole to limit comment visibility to, this must reference a
valid project role. |
created | is the date that will be used as the comments creation date. |
updated | is the date that will be used as the comments updated date. |
dispatchEvent | if true then an event of type ISSUE_COMMENTED_ID
will be dispatched and any notifications listening for that event will be triggered. If false no event will be
dispatched. |
modifyIssueUpdateDate | if true the issue's "updated" date will set to the date of this comment (unless the given date is earlier than the current issue update date). |
This method is deprecated.
Use create(Issue, ApplicationUser, String, String, Long, boolean)
instead. Since v6.0.
Creates a comment and associates it with the given issue. Using this method the comment will be created with a createdDate of the current time. If you have provided a groupLevel then the comment visibility will be restricted to the provided group, it is assumed that validation to ensure that the group actually exists has been performed outside of this method. If you have provided a roleLevelId then the comment visibility will be restricted to the provided role, it is assumed that validation to ensure that the role actually exists has been performed outside of this method.
NOTE: A comment should not have both a group level and role level visibility restriction. This method will not stop this, but it does not semantically make sense.
issue | the issue to associate the comment with. |
---|---|
author | the key of the user who has created this comment. |
body | the text of the comment. |
groupLevel | is the group name to limit comment visibility to, this must be a valid group name. |
roleLevelId | is the id of the the ProjectRole to limit comment visibility to, this must reference a
valid project role. |
dispatchEvent | if true then an event of type ISSUE_COMMENTED_ID
will be dispatched and any notifications listening for that event will be triggered. If false no event will be
dispatched. |
This method is deprecated.
Use create(Issue, ApplicationUser, String, boolean)
instead.
Since 6.0.
Creates a comment and associates it with the given issue. Using this method the comment will be created with a createdDate of the current date/time and with no visibility restrictions.
issue | the issue to associate the comment with. |
---|---|
author | the key of the user who has created this comment. |
body | the text of the comment. |
dispatchEvent | if true then an event of type ISSUE_COMMENTED_ID
will be dispatched and any notifications listening for that event will be triggered. If false no event will be
dispatched. |
Creates a comment and associates it with the given issue. Using this method the comment will be created with a
createdDate of the specified date. This method should be used if you are trying to preserve existing information
and it is important to retain the original created date. If you have provided a groupLevel then the comment
visibility will be restricted to the provided group, it is assumed that validation to ensure that the group
actually exists has been performed outside of this method. If you have provided a roleLevelId then the comment
visibility will be restricted to the provided role, it is assumed that validation to ensure that the role
actually exists has been performed outside of this method.
NOTE: A comment should not have both a group level and role level visibility restriction. This
method will not stop this, but it does not semantically make sense.
issue | the issue to associate the comment with. |
---|---|
author | the key of the user who has created this comment. |
body | the text of the comment. |
groupLevel | is the group name to limit comment visibility to, this must be a valid group name. |
roleLevelId | is the id of the the ProjectRole to limit comment visibility to, this must reference a
valid project role. |
created | is the date that will be used as the comments creation date. |
commentProperties | Comment properties that should be attached to the created comment before the comment can be considered 'created'. May be null. |
dispatchEvent | if true then an event of type ISSUE_COMMENTED_ID
will be dispatched and any notifications listening for that event will be triggered. If false no event will be
dispatched. |
CommentBodyCharacterLimitExceededException | when comment body exceeds the jira character limit |
---|
Creates a comment and associates it with the given issue. Using this method the comment will be created with a
createdDate of the specified date. This method should be used if you are trying to preserve existing information
and it is important to retain the original created date. If you have provided a groupLevel then the comment
visibility will be restricted to the provided group, it is assumed that validation to ensure that the group
actually exists has been performed outside of this method. If you have provided a roleLevelId then the comment
visibility will be restricted to the provided role, it is assumed that validation to ensure that the role
actually exists has been performed outside of this method.
NOTE: A comment should not have both a group level and role level visibility restriction. This
method will not stop this, but it does not semantically make sense.
issue | the issue to associate the comment with. |
---|---|
author | the key of the user who has created this comment. |
body | the text of the comment. |
groupLevel | is the group name to limit comment visibility to, this must be a valid group name. |
roleLevelId | is the id of the the ProjectRole to limit comment visibility to, this must reference a
valid project role. |
created | is the date that will be used as the comments creation date. |
dispatchEvent | if true then an event of type ISSUE_COMMENTED_ID
will be dispatched and any notifications listening for that event will be triggered. If false no event will be
dispatched. |
CommentBodyCharacterLimitExceededException | when comment body exceeds the jira character limit |
---|
Creates a comment and associates it with the given issue. Using this method the comment will be created with a
createdDate of the specified date. This method should be used if you are trying to preserve existing information
and it is important to retain the original created date. If you have provided a groupLevel then the comment
visibility will be restricted to the provided group, it is assumed that validation to ensure that the group
actually exists has been performed outside of this method. If you have provided a roleLevelId then the comment
visibility will be restricted to the provided role, it is assumed that validation to ensure that the role
actually exists has been performed outside of this method.
NOTE: A comment should not have both a group level and role level visibility restriction. This
method will not stop this, but it does not semantically make sense.
issue | the issue to associate the comment with. |
---|---|
author | the key of the user who has created this comment. |
updateAuthor | the key of the user who has updated this comment last |
body | the text of the comment. |
groupLevel | is the group name to limit comment visibility to, this must be a valid group name. |
roleLevelId | is the id of the the ProjectRole to limit comment visibility to, this must reference a
valid project role. |
created | is the date that will be used as the comments creation date. |
updated | is the date that will be used as the comments updated date. |
dispatchEvent | if true then an event of type ISSUE_COMMENTED_ID
will be dispatched and any notifications listening for that event will be triggered. If false no event will be
dispatched. |
modifyIssueUpdateDate | if true the issue's "updated" date will set to the date of this comment (unless the given date is earlier than the current issue update date). |
CommentBodyCharacterLimitExceededException | when comment body exceeds the jira character limit |
---|
This method is deprecated.
Use create(Issue, ApplicationUser, String, String, Long, Date, boolean)
instead. Since v6.0.
Creates a comment and associates it with the given issue. Using this method the comment will be created with a createdDate of the specified date. This method should be used if you are trying to preserve existing information and it is important to retain the original created date. If you have provided a groupLevel then the comment visibility will be restricted to the provided group, it is assumed that validation to ensure that the group actually exists has been performed outside of this method. If you have provided a roleLevelId then the comment visibility will be restricted to the provided role, it is assumed that validation to ensure that the role actually exists has been performed outside of this method.
NOTE: A comment should not have both a group level and role level visibility restriction. This method will not stop this, but it does not semantically make sense.
issue | the issue to associate the comment with. |
---|---|
author | the key of the user who has created this comment. |
body | the text of the comment. |
groupLevel | is the group name to limit comment visibility to, this must be a valid group name. |
roleLevelId | is the id of the the ProjectRole to limit comment visibility to, this must reference a
valid project role. |
created | is the date that will be used as the comments creation date. |
dispatchEvent | if true then an event of type ISSUE_COMMENTED_ID
will be dispatched and any notifications listening for that event will be triggered. If false no event will be
dispatched. |
Deletes the specified comment.
comment | to delete |
---|
IllegalArgumentException | if comment passed in is null or its id is null |
---|
Deletes the specified comment.
comment | to delete |
---|---|
dispatchEvent | if true then an event of type ISSUE_COMMENT_DELETED_ID
will be dispatched and any notifications listening for that event will be triggered. If false no event will be
dispatched. Together with IssueEvent CommentDeletedEvent |
user | who executes this action. will be dispatched. |
Will return a comment for the passed in commentId.
commentId | the id representing the Comment you would like to retrieve. |
---|
Comment
or null (if the user cannot browse the comment).IllegalArgumentException | if its id is null |
---|
This will return all comments for a given issue. Please note that this method does not perform any permission
checks on the returned comments. If you are returning comments to the UI or service for a given User
please use getCommentsForUser(com.atlassian.jira.issue.Issue, com.atlassian.jira.user.ApplicationUser)
)}
issue | the comments are associated with. |
---|
Retrieves all Comment
s on the given Issue that the given ApplicationUser
has permission to see. If the passed in user is null, only comments with no permission level set will be
returned.
NOTE: keep in mind null user represents an anonymous i.e. non-logged in user.
issue | the comments are associated with. |
---|---|
user | the user whose permission level will be used to limit the comments returned. |
Comment
s
Retrieves Comment
s that were created or updated after the provided date, on the given Issue that the
given ApplicationUser
has permission to see. If the passed in user is null, only
comments with no permission level set will be returned.
NOTE: keep in mind null user represents an anonymous i.e. non-logged in user.
issue | the comments are associated with. Must not be null |
---|---|
user | the user whose permission level will be used to limit the comments returned. |
since | only comments created or updated after this date will be returned. Must not be null. |
Comment
sReturns the the last Comment
on the given Issue
. For performance reasons this method does not
take into account access level of the user logged in. As a result, output of this method might not be the same as
what is presented in the application UI to users.
issue | the comments are associated with. |
---|
Retrieves comment by given id and returns it as mutable object.
commentId | comment id |
---|
IllegalArgumentException | if its id is null |
---|
This method is deprecated.
Don't use this because getProjectRole(Long)
exists and should be used instead. Deprecated since 6.2.3
This is a convenience method to allow us to easily get a ProjectRole. This is being used by the CommentImpl to
get a ProjectRole
.
NOTE: If you are trying to retrieve a ProjectRole
then you should be using the ProjectRoleManager
.
projectRoleId | the id to the ProjectRole object you would like returned. |
---|
Returns true if the given user is the author of the given comment.
If the given Comment has a null author, this represents that it was created anonymously, and no-one is the author (returns false). If the given User is null, then this represents that the current user is anonymous, and the method will always return false.
user | The User. Can be null to represent current user is not logged in (anonymous). |
---|---|
comment | The Comment. Cannot be null. |
Updates Comment
's such that comments that have a visibility restriction of the provided groupName will be
changed to have a visibility restriction of the provided swapGroup.
Note: There is no validation performed by this method to determine if the provided swapGroup is a valid group
with JIRA. This validation must be done by the caller.
groupName | identifies the group the comments are restricted by, this must not be null. |
---|---|
swapGroup | identifies the group the comments will be changed to be restricted by, this must not be null. |
Updates Comment
's such that comments that have a visibility restriction of the provided role will be
changed to have a visibility restriction of the role with the provided swapRoleId.
Note: There is no validation performed by this method to determine if the provided swapRoleId is a valid role id
with JIRA. This validation must be done by the caller.
roleId | identifies the role the comments are restricted by, this must not be null. |
---|---|
swapRoleId | identifies the role the comments will be changed to be restricted by, this must not be null. |
Persists the updated comment.
comment | to update |
---|---|
commentProperties | Comment properties that should be attached to the created comment before the comment can be considered 'created' |
dispatchEvent | if true then an event of type ISSUE_COMMENT_EDITED_ID
will be dispatched and any notifications listening for that event will be triggered. If false no event will be
dispatched. |
IllegalArgumentException | if comment passed in is null or its id is null |
---|---|
CommentBodyCharacterLimitExceededException | when comment body exceeds the jira character limit |
Persists the updated comment.
comment | to update |
---|---|
dispatchEvent | if true then an event of type ISSUE_COMMENT_EDITED_ID
will be dispatched and any notifications listening for that event will be triggered. If false no event will be
dispatched. |
IllegalArgumentException | if comment passed in is null or its id is null |
---|---|
CommentBodyCharacterLimitExceededException | when comment body exceeds the jira character limit |