Class DefaultCommentManager
- All Implemented Interfaces:
GroupConfigurable,CommentManager
-
Field Summary
FieldsFields inherited from interface com.atlassian.jira.issue.comments.CommentManager
EVENT_ORIGINAL_COMMENT_PARAMETER -
Constructor Summary
ConstructorsConstructorDescriptionDefaultCommentManager(ProjectRoleManager projectRoleManager, CommentPermissionManager commentPermissionManager, OfBizDelegator delegator, JiraAuthenticationContext jiraAuthenticationContext, TextFieldCharacterLengthValidator textFieldCharacterLengthValidator, CommentsPerIssueLimitValidator commentsPerIssueLimitValidator, UserManager userManager, JsonEntityPropertyManager jsonEntityPropertyManager, CommentPropertyHelper commentPropertyHelper, CommentSearchManager commentSearchManager, CommentEventPublisher commentEventPublisher, IssueUpdater issueUpdater, QueryDSLCommentFactory queryDSLCommentFactory, QueryDslAccessor queryDslAccessor, CommentHandler commentHandler, FeatureManager featureManager, CommentPinManager commentPinManager, ActionDTOToCommentConverter converter, com.atlassian.event.api.EventPublisher eventPublisher, PinnedCommentHandler pinnedCommentHandler) -
Method Summary
Modifier and TypeMethodDescriptionconvertToComment(org.ofbiz.core.entity.GenericValue gv) This is a convenience method that can be used to convert a GenericValue representation of a comment to a comment object.create(Issue issue, ApplicationUser author, ApplicationUser updateAuthor, String body, String groupLevel, Long roleLevelId, Date created, Date updated, boolean dispatchEvent) Creates a comment and associates it with the given issue.create(Issue issue, ApplicationUser author, ApplicationUser updateAuthor, String body, String groupLevel, Long roleLevelId, Date created, Date updated, boolean dispatchEvent, boolean modifyIssueUpdateDate) Creates a comment and associates it with the given issue.create(Issue issue, ApplicationUser author, ApplicationUser updateAuthor, String body, String groupLevel, Long roleLevelId, Date created, Date updated, Map<String, JSONObject> commentProperties, boolean dispatchEvent, boolean modifyIssueUpdateDate) Creates a comment and associates it with the given issue.create(Issue issue, ApplicationUser author, String body, boolean dispatchEvent) Creates a comment and associates it with the given issue.create(Issue issue, ApplicationUser author, String body, String groupLevel, Long roleLevelId, boolean dispatchEvent) Creates a comment and associates it with the given issue.create(Issue issue, ApplicationUser author, String body, String groupLevel, Long roleLevelId, Date created, boolean dispatchEvent) Creates a comment and associates it with the given issue.create(Issue issue, ApplicationUser author, String body, String groupLevel, Long roleLevelId, Date created, Map<String, JSONObject> commentProperties, boolean dispatchEvent) Creates a comment and associates it with the given issue.Creates a comment and associates it with the given issue.create(Issue issue, String author, String body, String groupLevel, Long roleLevelId, boolean dispatchEvent) Creates a comment and associates it with the given issue.create(Issue issue, String author, String body, String groupLevel, Long roleLevelId, Date created, boolean dispatchEvent) Creates a comment and associates it with the given issue.create(Issue issue, String author, String updateAuthor, String body, String groupLevel, Long roleLevelId, Date created, Date updated, boolean dispatchEvent) Creates a comment and associates it with the given issue.create(Issue issue, String author, String updateAuthor, String body, String groupLevel, Long roleLevelId, Date created, Date updated, boolean dispatchEvent, boolean modifyIssueUpdateDate) Creates a comment and associates it with the given issue.Deletes the specified comment.voiddelete(Comment comment, boolean dispatchEvent, ApplicationUser user) Deletes the specified comment.voiddeleteCommentsForIssue(Issue issue) RemovesComments belonging to the passed issue.getCommentById(Long commentId) Will return a comment for the passed in commentId.getComments(Issue issue) This will return all comments for a given issue.getCommentsForUser(Issue issue, ApplicationUser user) Retrieves allComments on the given Issue that the givenApplicationUserhas permission to see.getCommentsForUserSince(Issue issue, ApplicationUser user, Date since) RetrievesComments that were created or updated after the provided date, on the given Issue that the givenApplicationUserhas permission to see.getCommentSummary(ApplicationUser user, Issue issue, Optional<Long> focusedCommentId) Method that will return a summary of comments required to render the initial view issue page.longgetCountForCommentsRestrictedByGroup(String groupName) Returns the count of allComment's that have their visibility restricted by the named group.longReturns the count of allComment's that have their visibility restricted by the role with the given id.getLastComment(Issue issue) getMutableComment(Long commentId) Retrieves comment by given id and returns it as mutable object.getPinnedComments(Issue issue, ApplicationUser user) Returns list of pinned comments for given issue which are visible for userbooleanisGroupUsed(com.atlassian.crowd.embedded.api.Group group) Determine whether configuration exists for the specifiedGroup.booleanisUserCommentAuthor(ApplicationUser user, Comment comment) Returns true if the given user is the author of the given comment.searchCommentsVisibleForUser(CommentSearchParameters parameters) Returns list of comments filtered and sorted by given parametersCommentSearchParameters.voidsetPin(Comment comment, ApplicationUser user, boolean pinComment) Pins the specified comment.streamComments(ApplicationUser user, Issue issue) Streams every comment of the given issue that is visible to the user.intswapCommentGroupRestriction(String groupName, String swapGroup) UpdatesComment'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.intswapCommentRoleRestriction(Long roleId, Long swapRoleId) UpdatesComment'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.voidPersists the updated comment.voidupdate(Comment comment, Map<String, JSONObject> commentProperties, boolean dispatchEvent) Persists the updated comment.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.jira.config.group.GroupConfigurable
isGroupUsed
-
Field Details
-
COMMENT_ENTITY
- See Also:
-
EVENTSOURCE_PARAMETER
- See Also:
-
-
Constructor Details
-
DefaultCommentManager
public DefaultCommentManager(ProjectRoleManager projectRoleManager, CommentPermissionManager commentPermissionManager, OfBizDelegator delegator, JiraAuthenticationContext jiraAuthenticationContext, TextFieldCharacterLengthValidator textFieldCharacterLengthValidator, CommentsPerIssueLimitValidator commentsPerIssueLimitValidator, UserManager userManager, JsonEntityPropertyManager jsonEntityPropertyManager, CommentPropertyHelper commentPropertyHelper, CommentSearchManager commentSearchManager, CommentEventPublisher commentEventPublisher, IssueUpdater issueUpdater, QueryDSLCommentFactory queryDSLCommentFactory, QueryDslAccessor queryDslAccessor, CommentHandler commentHandler, FeatureManager featureManager, CommentPinManager commentPinManager, ActionDTOToCommentConverter converter, com.atlassian.event.api.EventPublisher eventPublisher, PinnedCommentHandler pinnedCommentHandler)
-
-
Method Details
-
convertToComment
Description copied from interface:CommentManagerThis is a convenience method that can be used to convert a GenericValue representation of a comment to a comment object.- Specified by:
convertToCommentin interfaceCommentManager- Parameters:
gv- is the GenericValue representation of a comment.- Returns:
- Comment object.
-
getCommentById
Description copied from interface:CommentManagerWill return a comment for the passed in commentId.- Specified by:
getCommentByIdin interfaceCommentManager- Parameters:
commentId- the id representing theCommentyou would like to retrieve.- Returns:
- a
Commentor null (if the user cannot browse the comment).
-
getMutableComment
Description copied from interface:CommentManagerRetrieves comment by given id and returns it as mutable object.- Specified by:
getMutableCommentin interfaceCommentManager- Parameters:
commentId- comment id- Returns:
- mutable comment or null if comment with given id not found
-
getCommentsForUser
Description copied from interface:CommentManagerRetrieves allComments on the given Issue that the givenApplicationUserhas 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.- Specified by:
getCommentsForUserin interfaceCommentManager- Parameters:
issue- the comments are associated with.user- the user whose permission level will be used to limit the comments returned.- Returns:
- Possibly empty List of
Comments
-
searchCommentsVisibleForUser
Description copied from interface:CommentManagerReturns list of comments filtered and sorted by given parametersCommentSearchParameters.- Specified by:
searchCommentsVisibleForUserin interfaceCommentManager- Parameters:
parameters- search parameters- Returns:
Windowof comments
-
streamComments
Description copied from interface:CommentManagerStreams every comment of the given issue that is visible to the user. Comments are returned in the order that they were created in.- Specified by:
streamCommentsin interfaceCommentManager- Parameters:
user- the user to check permissions against, or null if anonymousissue- issue for which to get comments- Returns:
- a stream of comments
-
getCommentSummary
public CommentSummary getCommentSummary(@Nullable ApplicationUser user, @Nonnull Issue issue, @Nonnull Optional<Long> focusedCommentId) Description copied from interface:CommentManagerMethod that will return a summary of comments required to render the initial view issue page. That is if comment limiting is enabled this method will return a comment summary containing the total count of comments available to the provided user based on permissions as well as a subset of comments to be shown. If limiting is disabled, or if less than a minimum number of comments would be hidden (configured byAPKeys.COMMENT_COLLAPSING_MINIMUM_HIDDEN) then all comments will be returned (similar to the results of callingCommentManager.getCommentsForUser(Issue, ApplicationUser).- Specified by:
getCommentSummaryin interfaceCommentManager- Parameters:
user- the user whose permission level will be used to limit the comments returned.issue- the comments are associated with.focusedCommentId- optional id of a comment to focus. If the summary doesn't contain the focusedComment, then all comments are retrieved- Returns:
- CommentSummary with total comment count and subset of comments to be shown.
-
getLastComment
Description copied from interface:CommentManagerReturns the the lastCommenton the givenIssue. 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.- Specified by:
getLastCommentin interfaceCommentManager- Parameters:
issue- the comments are associated with.- Returns:
- The author of the last comment, or null if there is no comment.
-
getCommentsForUserSince
@Nonnull public List<Comment> getCommentsForUserSince(@Nonnull Issue issue, @Nullable ApplicationUser user, @Nonnull Date since) Description copied from interface:CommentManagerRetrievesComments that were created or updated after the provided date, on the given Issue that the givenApplicationUserhas 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.- Specified by:
getCommentsForUserSincein interfaceCommentManager- Parameters:
issue- the comments are associated with. Must not be nulluser- 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.- Returns:
- Possibly empty List of
Comments
-
getComments
Description copied from interface:CommentManagerThis 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 givenUserplease useCommentManager.getCommentsForUser(com.atlassian.jira.issue.Issue, com.atlassian.jira.user.ApplicationUser))}- Specified by:
getCommentsin interfaceCommentManager- Parameters:
issue- the comments are associated with.- Returns:
- a List of comments, will return an empty list if none found.
-
create
Description copied from interface:CommentManagerCreates 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.- Specified by:
createin interfaceCommentManager- Parameters:
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 typeEventType.ISSUE_COMMENTED_IDwill be dispatched and any notifications listening for that event will be triggered. If false no event will be dispatched.- Returns:
- the object representation of the newly created comment.
-
create
Description copied from interface:CommentManagerCreates 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.- Specified by:
createin interfaceCommentManager- Parameters:
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 typeEventType.ISSUE_COMMENTED_IDwill be dispatched and any notifications listening for that event will be triggered. If false no event will be dispatched.- Returns:
- the object representation of the newly created comment.
-
create
public Comment create(Issue issue, ApplicationUser author, String body, String groupLevel, Long roleLevelId, boolean dispatchEvent) throws DataAccessException Description copied from interface:CommentManagerCreates 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.- Specified by:
createin interfaceCommentManager- Parameters:
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 theProjectRoleto limit comment visibility to, this must reference a valid project role.dispatchEvent- if true then an event of typeEventType.ISSUE_COMMENTED_IDwill be dispatched and any notifications listening for that event will be triggered. If false no event will be dispatched.- Returns:
- the object representation of the newly created comment.
- Throws:
DataAccessException
-
create
public Comment create(Issue issue, String author, String body, String groupLevel, Long roleLevelId, boolean dispatchEvent) Description copied from interface:CommentManagerCreates 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.
- Specified by:
createin interfaceCommentManager- Parameters:
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 theProjectRoleto limit comment visibility to, this must reference a valid project role.dispatchEvent- if true then an event of typeEventType.ISSUE_COMMENTED_IDwill be dispatched and any notifications listening for that event will be triggered. If false no event will be dispatched.- Returns:
- the object representation of the newly created comment.
-
create
public Comment create(Issue issue, ApplicationUser author, String body, String groupLevel, Long roleLevelId, Date created, boolean dispatchEvent) throws DataAccessException Description copied from interface:CommentManagerCreates 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.- Specified by:
createin interfaceCommentManager- Parameters:
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 theProjectRoleto 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 typeEventType.ISSUE_COMMENTED_IDwill be dispatched and any notifications listening for that event will be triggered. If false no event will be dispatched.- Returns:
- the object representation of the newly created comment.
- Throws:
DataAccessException
-
create
public Comment create(Issue issue, ApplicationUser author, String body, String groupLevel, Long roleLevelId, Date created, Map<String, JSONObject> commentProperties, boolean dispatchEvent) Description copied from interface:CommentManagerCreates 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.- Specified by:
createin interfaceCommentManager- Parameters:
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 theProjectRoleto 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 typeEventType.ISSUE_COMMENTED_IDwill be dispatched and any notifications listening for that event will be triggered. If false no event will be dispatched.- Returns:
- the object representation of the newly created comment.
-
create
public Comment create(Issue issue, String author, String body, String groupLevel, Long roleLevelId, Date created, boolean dispatchEvent) Description copied from interface:CommentManagerCreates 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.
- Specified by:
createin interfaceCommentManager- Parameters:
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 theProjectRoleto 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 typeEventType.ISSUE_COMMENTED_IDwill be dispatched and any notifications listening for that event will be triggered. If false no event will be dispatched.- Returns:
- the object representation of the newly created comment.
-
create
public Comment create(Issue issue, ApplicationUser author, ApplicationUser updateAuthor, String body, String groupLevel, Long roleLevelId, Date created, Date updated, boolean dispatchEvent) throws DataAccessException Description copied from interface:CommentManagerCreates 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.- Specified by:
createin interfaceCommentManager- Parameters:
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 lastbody- 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 theProjectRoleto 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 typeEventType.ISSUE_COMMENTED_IDwill be dispatched and any notifications listening for that event will be triggered. If false no event will be dispatched.- Returns:
- the object representation of the newly created comment.
- Throws:
DataAccessException
-
create
public Comment create(Issue issue, String author, String updateAuthor, String body, String groupLevel, Long roleLevelId, Date created, Date updated, boolean dispatchEvent) Description copied from interface:CommentManagerCreates 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.
- Specified by:
createin interfaceCommentManager- Parameters:
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 lastbody- 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 theProjectRoleto 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 typeEventType.ISSUE_COMMENTED_IDwill be dispatched and any notifications listening for that event will be triggered. If false no event will be dispatched.- Returns:
- the object representation of the newly created comment.
-
create
public Comment create(Issue issue, ApplicationUser author, ApplicationUser updateAuthor, String body, String groupLevel, Long roleLevelId, Date created, Date updated, boolean dispatchEvent, boolean modifyIssueUpdateDate) Description copied from interface:CommentManagerCreates 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.- Specified by:
createin interfaceCommentManager- Parameters:
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 lastbody- 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 theProjectRoleto 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 typeEventType.ISSUE_COMMENTED_IDwill 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).- Returns:
- the object representation of the newly created comment.
-
create
public Comment create(Issue issue, ApplicationUser author, ApplicationUser updateAuthor, String body, String groupLevel, Long roleLevelId, Date created, Date updated, Map<String, JSONObject> commentProperties, boolean dispatchEvent, boolean modifyIssueUpdateDate) Description copied from interface:CommentManagerCreates 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.- Specified by:
createin interfaceCommentManager- Parameters:
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 lastbody- 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 theProjectRoleto 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 typeEventType.ISSUE_COMMENTED_IDwill 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).- Returns:
- the object representation of the newly created comment.
-
create
public Comment create(Issue issue, String author, String updateAuthor, String body, String groupLevel, Long roleLevelId, Date created, Date updated, boolean dispatchEvent, boolean modifyIssueUpdateDate) Description copied from interface:CommentManagerCreates 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.- Specified by:
createin interfaceCommentManager- Parameters:
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 lastbody- 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 theProjectRoleto 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 typeEventType.ISSUE_COMMENTED_IDwill 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).- Returns:
- the object representation of the newly created comment.
-
update
Description copied from interface:CommentManagerPersists the updated comment.- Specified by:
updatein interfaceCommentManager- Parameters:
comment- to updatedispatchEvent- if true then an event of typeEventType.ISSUE_COMMENT_EDITED_IDwill be dispatched and any notifications listening for that event will be triggered. If false no event will be dispatched.
-
update
public void update(Comment comment, Map<String, JSONObject> commentProperties, boolean dispatchEvent) Description copied from interface:CommentManagerPersists the updated comment.- Specified by:
updatein interfaceCommentManager- Parameters:
comment- to updatecommentProperties- Comment properties that should be attached to the created comment before the comment can be considered 'created'dispatchEvent- if true then an event of typeEventType.ISSUE_COMMENT_EDITED_IDwill be dispatched and any notifications listening for that event will be triggered. If false no event will be dispatched.
-
delete
Description copied from interface:CommentManagerDeletes the specified comment.- Specified by:
deletein interfaceCommentManager- Parameters:
comment- to delete- Returns:
- a change item that represents the change of deleting the comment
-
delete
Description copied from interface:CommentManagerDeletes the specified comment.- Specified by:
deletein interfaceCommentManager- Parameters:
comment- to deletedispatchEvent- if true then an event of typeEventType.ISSUE_COMMENT_DELETED_IDwill be dispatched and any notifications listening for that event will be triggered. If false no event will be dispatched. Together withIssueEventCommentDeletedEventuser- who executes this action. will be dispatched.
-
setPin
Description copied from interface:CommentManagerPins the specified comment.- Specified by:
setPinin interfaceCommentManager- Parameters:
comment- to pinuser- who executes this actionpinComment- true if comments should be pinned, false if comments should be unpinned
-
getPinnedComments
Description copied from interface:CommentManagerReturns list of pinned comments for given issue which are visible for user- Specified by:
getPinnedCommentsin interfaceCommentManageruser- who executes this action.- Returns:
- list of Pinned comments for given issue
-
deleteCommentsForIssue
Description copied from interface:CommentManagerRemovesComments belonging to the passed issue.- Specified by:
deleteCommentsForIssuein interfaceCommentManager- Parameters:
issue- entity with the comments to delete.
-
isUserCommentAuthor
Description copied from interface:CommentManagerReturns 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.
- Specified by:
isUserCommentAuthorin interfaceCommentManager- Parameters:
user- The User. Can be null to represent current user is not logged in (anonymous).comment- The Comment. Cannot be null.- Returns:
- true if the given user is the author of the given comment.
-
swapCommentGroupRestriction
Description copied from interface:CommentManagerUpdatesComment'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.- Specified by:
swapCommentGroupRestrictionin interfaceCommentManager- Parameters:
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.- Returns:
- tbe number of comments affected by the update.
-
swapCommentRoleRestriction
Description copied from interface:CommentManagerUpdatesComment'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.- Specified by:
swapCommentRoleRestrictionin interfaceCommentManager- Parameters:
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.- Returns:
- the number of comments affected by the update.
-
getCountForCommentsRestrictedByGroup
Description copied from interface:CommentManagerReturns the count of allComment's that have their visibility restricted by the named group.- Specified by:
getCountForCommentsRestrictedByGroupin interfaceCommentManager- Parameters:
groupName- identifies the group the comments are restricted by, this must not be null.- Returns:
- a count of
Comment's who's visibility are restricted by the passed in group name.
-
getCountForCommentsRestrictedByRole
Description copied from interface:CommentManagerReturns the count of allComment's that have their visibility restricted by the role with the given id.- Specified by:
getCountForCommentsRestrictedByRolein interfaceCommentManager- Parameters:
roleId- identifies the role the comments are restricted by, this must not be null.- Returns:
- a count of
Comment's who's visibility are restricted by the role with the passed in role id.
-
isGroupUsed
public boolean isGroupUsed(@Nonnull com.atlassian.crowd.embedded.api.Group group) Description copied from interface:GroupConfigurableDetermine whether configuration exists for the specifiedGroup.- Specified by:
isGroupUsedin interfaceGroupConfigurable- Parameters:
group- that may or may not exist.- Returns:
- true if the group is used in the components configuration.
-