com.atlassian.jira.bc.issue.comment.CommentService |
Known Indirect Subclasses |
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).
This is the business layer component that must be used to access all Comment
functionality.
This will perform validation before it hands off to the CommentManager
.
Operations will not be performed if validation fails.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CommentService.CommentCreateValidationResult | |||||||||||
CommentService.CommentParameters | |||||||||||
CommentService.CommentUpdateValidationResult | |||||||||||
CommentService.CommentVisibility |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This method is deprecated.
use
validateCommentCreate(ApplicationUser, CommentParameters) and
create(ApplicationUser, CommentCreateValidationResult, boolean) .
| |||||||||||
This method is deprecated.
use
validateCommentCreate(ApplicationUser, CommentParameters) and
create(ApplicationUser, CommentCreateValidationResult, boolean) .
| |||||||||||
This method is deprecated.
use
validateCommentCreate(ApplicationUser, CommentParameters) and
create(ApplicationUser, CommentCreateValidationResult, boolean) .
| |||||||||||
Deletes a comment and updates the issue's change history and updated date.
| |||||||||||
Will return a comment for the passed in commentId.
| |||||||||||
This method is deprecated.
Use
getCommentsForUser(ApplicationUser, Issue) instead. Since v6.3.
| |||||||||||
Will return a list of
Comment s that were created or updated since the provided date, for the given user. | |||||||||||
This method is deprecated.
Use
getCommentById(ApplicationUser, Long, ErrorCollection) instead. Since v6.0.
| |||||||||||
Check if the given user has permission to create a comment during a workflow transition for a given action description.
| |||||||||||
Check if the given user has permission to create a comment in the current state of the issue or if the issue was in the given status.
| |||||||||||
Check if the given user has permission to create a comment in the current state of the issue.
| |||||||||||
Determines whether the user can delete a comment.
| |||||||||||
This method is deprecated.
Use
hasPermissionToCreate(ApplicationUser, Issue, ErrorCollection) instead. Since v6.0.
| |||||||||||
Determines whether the user can edit a comment.
| |||||||||||
Returns the flag that indicates whether group visiblity is enabled
| |||||||||||
This method is deprecated.
Deprecated because of typo in signature. Use
isGroupVisibilityEnabled() . Since 6.4
| |||||||||||
Returns the flag that indicates whether project role visibility is enabled
| |||||||||||
This method is deprecated.
Deprecated because of typo in signature. Use
isProjectRoleVisibilityEnabled() . Since 6.4
| |||||||||||
Will call all other validate methods setting the appropriate errors
in the
errorCollection if any errors occur. | |||||||||||
This method is deprecated.
Use
isValidAllCommentData(ApplicationUser, Issue, String, com.atlassian.jira.bc.issue.visibility.Visibility, ErrorCollection) instead. Since v6.4.
| |||||||||||
Validates that the body is a valid string, if not the appropriate error
is added to the
errorCollection . | |||||||||||
Validates that the body is a valid string, if not the appropriate error
is added to the
errorCollection . | |||||||||||
This method is deprecated.
Use
isValidCommentVisibility(ApplicationUser, Issue, com.atlassian.jira.bc.issue.visibility.Visibility, ErrorCollection) instead. Since v6.4.
| |||||||||||
This method validates if the comment has the correct role and group
levels set.
| |||||||||||
This method is deprecated.
use
update(ApplicationUser, CommentUpdateValidationResult, boolean) instead.
| |||||||||||
Updates a
Comment and sets the comments updated date to be now and the updatedAuthor to be the
passed in user. | |||||||||||
Confirms the parameters to create a comment are valid and that the user has the permission to do so if the issue was in the given status.
| |||||||||||
Confirms the parameters to create a comment are valid and that the user has the permission to do so.
| |||||||||||
Confirms the parameters to update a comment are valid and that the updating user has the permission to do so.
| |||||||||||
This method is deprecated.
use
validateCommentUpdate(ApplicationUser, Long, com.atlassian.jira.bc.issue.comment.CommentService.CommentParameters) .
|
This method is deprecated.
use validateCommentCreate(ApplicationUser, CommentParameters)
and
create(ApplicationUser, CommentCreateValidationResult, boolean)
.
Creates and persists a Comment
on the given Issue
set with current date and time, visible to all
- no group level or role level restriction.
user | The User who will be performing the operation. |
---|---|
issue | The Issue you wish to associate the Comment with. This can not be null |
body | The body of the comment |
dispatchEvent | whether or not you want to have an event dispatched on Comment creation |
errorCollection | holder for any errors that were thrown attempting to create a comment |
user | The ApplicationUser who will be performing the operation. |
---|---|
commentValidationResult | the results of validateCommentCreate(ApplicationUser, com.atlassian.jira.bc.issue.comment.CommentService.CommentParameters) . |
dispatchEvent | whether or not you want to have an event dispatched on Comment creation |
This method is deprecated.
use validateCommentCreate(ApplicationUser, CommentParameters)
and
create(ApplicationUser, CommentCreateValidationResult, boolean)
.
user | The User who will be performing the operation. |
---|---|
issue | The Issue you wish to associate the Comment with. This can not be null |
body | The body of the comment |
groupLevel | The group level visibility of the comment (null if roleLevelId specified) |
roleLevelId | The role level visibility id of the comment (null if groupLevel specified) |
created | The date of comment creation |
dispatchEvent | whether or not you want to have an event dispatched on Comment creation |
errorCollection | holder for any errors that were thrown attempting to create a comment |
This method is deprecated.
use validateCommentCreate(ApplicationUser, CommentParameters)
and
create(ApplicationUser, CommentCreateValidationResult, boolean)
.
user | The User who will be performing the operation. |
---|---|
issue | The Issue you wish to associate the Comment with. This can not be null |
body | The body of the comment |
groupLevel | The group level visibility of the comment (null if roleLevelId specified) |
roleLevelId | The role level visibility id of the comment (null if groupLevel specified) |
dispatchEvent | whether or not you want to have an event dispatched on Comment creation |
errorCollection | holder for any errors that were thrown attempting to create a comment |
Deletes a comment and updates the issue's change history and updated date. Expects that
hasPermissionToDelete(com.atlassian.jira.bc.JiraServiceContext, Long)
is successfully called first.
jiraServiceContext | containing the user who wishes to delete a comment and the errorCollection that will contain any errors encountered when calling the method |
---|---|
comment | the comment to delete (cannot be null) |
dispatchEvent | a flag indicating whether to dispatch an issue updated event. If this flag is false then the issue will not be reindexed. |
Will return a comment for the passed in commentId. This will return null if the user does not have permission to view the comment
user | who is looking up the comment |
---|---|
commentId | the id representing the Comment you would like to retrieve. |
errorCollection | holder for any errors that can occur in process of validation |
Comment
or null (if the user cannot browse the comment).
Will return a list of Comment
s for the given user
Will return a list of Comment
s for the given user.
user | the user to check permissions against ApplicationUser , or anonymous if null. |
---|---|
issue | the issue with associated comments. Must not be null. |
This method is deprecated.
Use getCommentsForUser(ApplicationUser, Issue)
instead. Since v6.3.
Will return a list of Comment
s for the given user.
currentUser | current User |
---|---|
issue | the issue with associated comments |
errorCollection | holder for any errors that were thrown attempting to retrieve comments |
Will return a list of Comment
s that were created or updated since the provided date, for the given user.
user | the user to check permissions against ApplicationUser , or anonymous if null. |
---|---|
issue | the issue with associated comments. Must not be null. |
since | only comments created or updated after this date will be returned. Must not be null. |
This method is deprecated.
Use getCommentById(ApplicationUser, Long, ErrorCollection)
instead. Since v6.0.
Will return a MutableComment
for the passed in commentId. This will return null if the user does not have
permission to view the comment. The difference between this method and getCommentById(ApplicationUser, Long, ErrorCollection)
is that this
method returns a version of the Comment
that we can set values on.
user | the current user. |
---|---|
commentId | the id that we use to find the comment object. |
errorCollection | holder for any errors that can occur in process of validation |
Check if the given user has permission to create a comment during a workflow transition for a given action description. This checks if the user is able to create a comment in either the origin status or the target status of the workflow transition.
user | The ApplicationUser who will be performing the operation. |
---|---|
issue | The issue with associated comments. |
errorCollection | Holder for any errors that were thrown attempting permission checks. |
actionDescriptor | The status that should be used for the permission check. If Optional.none, will check using current status of the given issue. |
Check if the given user has permission to create a comment in the current state of the issue or if the issue was in the given status.
If the state is Optional.none, we use the status in the issue param - the same as calling
hasPermissionToCreate(ApplicationUser, Issue, ErrorCollection)
.
user | The ApplicationUser who will be performing the operation. |
---|---|
issue | The issue with associated comments. |
errorCollection | Holder for any errors that were thrown attempting permission checks. |
status | The status that should be used for the permission check. If Optional.none, will check using current status of the given issue. |
Check if the given user has permission to create a comment in the current state of the issue.
user | The ApplicationUser who will be performing the operation. |
---|---|
issue | The issue with associated comments. |
errorCollection | Holder for any errors that were thrown attempting permission checks. |
Determines whether the user can delete a comment. Will return true when the following are satisfied:
jiraServiceContext | jiraServiceContext containing the user who wishes to delete a comment and the errorCollection that will contain any errors encountered when calling the method |
---|---|
commentId | the id of the target comment (cannot be null) |
This method is deprecated.
Use hasPermissionToCreate(ApplicationUser, Issue, ErrorCollection)
instead. Since v6.0.
Determine whether the current user has the permission to edit the comment. In case of errors, add error messages to the error collection.
Passing in null comment or a comment with null ID will return false and an error message will be added to the error collection.
Passing in null error collection will throw NPE.
user | The User who will be performing the operation. |
---|---|
comment | The Comment you wish to edit. |
errorCollection | holder for any errors that were thrown attempting permission checks |
Determines whether the user can edit a comment. Will return true when the following are satisfied:
jiraServiceContext | JIRA service context containing the user who wishes to edit a comment and the errorCollection that will contain any errors encountered when calling the method |
---|---|
commentId | the id of the target comment (cannot be null) |
Returns the flag that indicates whether group visiblity is enabled
This method is deprecated.
Deprecated because of typo in signature. Use isGroupVisibilityEnabled()
. Since 6.4
Returns the flag that indicates whether group visiblity is enabled
Returns the flag that indicates whether project role visibility is enabled
This method is deprecated.
Deprecated because of typo in signature. Use isProjectRoleVisibilityEnabled()
. Since 6.4
Returns the flag that indicates whether project role visibility is enabled
Will call all other validate methods setting the appropriate errors
in the errorCollection
if any errors occur.
user | The User who will be performing the operation. |
---|---|
issue | issue to associate the comment with |
body | comment body |
visibility | visibility level |
errorCollection | holder for any errors that can occur in process of validarion |
This method is deprecated.
Use isValidAllCommentData(ApplicationUser, Issue, String, com.atlassian.jira.bc.issue.visibility.Visibility, ErrorCollection)
instead. Since v6.4.
Will call all other validate methods setting the appropriate errors
in the errorCollection
if any errors occur.
user | The User who will be performing the operation. |
---|---|
issue | issue to associate the comment with |
body | comment body |
groupLevel | comment group visibility level |
roleLevelId | comment project role visibility level id |
errorCollection | holder for any errors that can occur in process of validarion |
Validates that the body is a valid string, if not the appropriate error
is added to the errorCollection
. This method was added so
the CommentSystemField can validate the body and set the appropriate error message.
body | comment body to validate |
---|---|
errorCollection | holder for any errors that can occur in process of validation |
Validates that the body is a valid string, if not the appropriate error
is added to the errorCollection
. This method was added so
the CommentSystemField can validate the body and set the appropriate error message.
body | comment body to validate |
---|---|
errorCollection | holder for any errors that can occur in process of validation |
allowEmpty | indicates whether empty body is allowed |
This method is deprecated.
Use isValidCommentVisibility(ApplicationUser, Issue, com.atlassian.jira.bc.issue.visibility.Visibility, ErrorCollection)
instead. Since v6.4.
This method validates if the comment has the correct role and group
levels set. If there is an error during validation the passed in
errorCollection
will contain the errors.
user | The User who will be performing the operation. |
---|---|
issue | issue to associate the comment with |
groupLevel | comment group visibility level |
roleLevelId | comment project role visibility level id |
errorCollection | holder for any errors that can occur in process of validation |
This method validates if the comment has the correct role and group
levels set. If there is an error during validation the passed in
errorCollection
will contain the errors.
user | The User who will be performing the operation. |
---|---|
issue | issue to associate the comment with |
visibility | comment visibility level |
errorCollection | holder for any errors that can occur in process of validation |
This method is deprecated.
use update(ApplicationUser, CommentUpdateValidationResult, boolean)
instead.
Updates a Comment
and sets the comments updated date to be now and the updatedAuthor to be the
passed in user.
user | the User who must have permission to update this comment and who will be used as the updateAuthor |
---|---|
comment | the object that contains the changes to the comment to persist. |
dispatchEvent | whether or not you want to have an event dispatched on Comment update. If false then the issue will not be reindexed. |
errorCollection | holder for any errors that were thrown attempting to update a comment |
IllegalArgumentException | if comment or its id is null |
---|
Updates a Comment
and sets the comments updated date to be now and the updatedAuthor to be the
passed in user.
user | the ApplicationUser who must have permission to update this comment and who will be used as the updateAuthor |
---|---|
updateCommentValidationResult | the comment parameters. |
dispatchEvent | whether or not you want to have an event dispatched on Comment update. If false then the issue will not be reindexed. |
Confirms the parameters to create a comment are valid and that the user has the permission to do so if the issue was in the given status.
This method will validate the raw input parameters. This method only validates the parameters and will not
actually persist the changes, you must call create(ApplicationUser, CommentCreateValidationResult, boolean)
to persist the changes.
If an error is encountered then the CommentService.CommentCreateValidationResult
will contain the specific error message.
user | The ApplicationUser who will be performing the operation. |
---|---|
commentParameters | the comment parameters. |
status | The given status to be validated against. |
Confirms the parameters to create a comment are valid and that the user has the permission to do so.
This method will validate the raw input parameters. This method only validates the parameters and will not
actually persist the changes, you must call create(ApplicationUser, CommentCreateValidationResult, boolean)
to persist the changes.
If an error is encountered then the CommentService.CommentCreateValidationResult
will contain the specific error message.
user | The ApplicationUser who will be performing the operation. |
---|---|
commentParameters | the comment parameters. |
Confirms the parameters to update a comment are valid and that the updating user has the permission to do so.
This method will validate the raw input parameters. This method only validates the parameters and will not
actually persist the changes, you must call update(ApplicationUser, CommentService.CommentUpdateValidationResult, boolean)
to persist the changes. If an error is encountered
then the ErrorCollection
will contain the specific error message.
user | The ApplicationUser who will be performing the operation and who will be the updatedAuthor. |
---|---|
commentId | The id of the comment to be updated. Permissions will be checked to ensure that the user has the right to update this comment. If the comment does not exist an error will be reported. |
commentParameters | the comment parameters. |
This method is deprecated.
use validateCommentUpdate(ApplicationUser, Long, com.atlassian.jira.bc.issue.comment.CommentService.CommentParameters)
.
Confirms the parameters to update a comment are valid and that the updating user has the permission to do so.
This method will validate the raw input parameters. This method only validates the parameters and will not
actually persist the changes, you must call update(ApplicationUser, CommentService.CommentUpdateValidationResult, boolean)
to persist the changes. If an error is encountered
then the ErrorCollection
will contain the specific error message.
user | The ApplicationUser who will be performing the operation and who will be the updatedAuthor. |
---|---|
commentId | The id of the comment to be updated. Permissions will be checked to ensure that the user has the right to update this comment. If the comment does not exist an error will be reported. |
body | The body of the comment to be updated. |
groupLevel | The group level visibility of the comment (null if roleLevelId specified) |
roleLevelId | The role level visibility id of the comment (null if groupLevel specified) |
errorCollection | holder for any errors that were thrown attempting to update a comment |