com.atlassian.jira.issue.comments
Interface CommentManager

All Known Implementing Classes:
DefaultCommentManager

public interface CommentManager

The CommentManager is used to retrieve and create comments in JIRA. Comments are always associated with an issue.


Method Summary
 Comment convertToComment(org.ofbiz.core.entity.GenericValue commentGV)
          This is a convienice method that can be used to convert a GenericValue representation of a comment to a comment object.
 Comment create(Issue issue, String author, String body, boolean dispatchEvent)
          Creates a comment and associates it with the given issue.
 Comment create(Issue issue, String author, String body, String groupLevel, Long roleLevelId, boolean dispatchEvent)
          Creates a comment and associates it with the given issue.
 Comment 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.
 Comment getCommentById(Long commentId, User user)
          Will return a comment for the passed in commentId.
 List getComments(Issue issue)
          This will return all comments for a given issue.
 List getCommentsForUser(Issue issue, User user)
          Retrieves all Comments on the given Issue that the given User has permission to see.
 ProjectRole getProjectRole(Long projectRoleId)
          This is a convenience method to allow us to easily get a ProjectRole.
 

Method Detail

getCommentsForUser

public List getCommentsForUser(Issue issue,
                               User user)
Retrieves all Comments on the given Issue that the given User 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.

Parameters:
issue - the issue are associated with.
user - the user whose permission level will be used to limit the comments returned.
Returns:
Possibly empty List of Comments

getComments

public List getComments(Issue issue)
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(Issue issue, User user)

Parameters:
issue - the comments are associated with.
Returns:
a List of comments, will return an empty list if none found.

create

public Comment create(Issue issue,
                      String author,
                      String body,
                      boolean dispatchEvent)
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.

Parameters:
issue - the issue to associate the comment with.
author - the user who has created this comment.
body - the text of the comment.
dispatchEvent - if true then an event of type EventType.ISSUE_COMMENTED_ID will 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,
                      boolean dispatchEvent)
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 insure 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 insure 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.

Parameters:
issue - the issue to associate the comment with.
author - 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 visiblity to, this must reference a valid project role.
dispatchEvent - if true then an event of type EventType.ISSUE_COMMENTED_ID will 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)
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 insure 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 insure 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.

Parameters:
issue - the issue to associate the comment with.
author - 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 visiblity 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 EventType.ISSUE_COMMENTED_ID will 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.

getProjectRole

public ProjectRole getProjectRole(Long projectRoleId)
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.

Parameters:
projectRoleId - the id to the ProjectRole object you would like returned.
Returns:
will return a ProjectRole based on the passed in projectRoleId.

convertToComment

public Comment convertToComment(org.ofbiz.core.entity.GenericValue commentGV)
This is a convienice method that can be used to convert a GenericValue representation of a comment to a comment object.

Parameters:
commentGV - is the GenericValue representation of a comment.

getCommentById

public Comment getCommentById(Long commentId,
                              User user)
Will return a comment for the passed in commentId. This will return null if the user does not have permission to view the comment

Parameters:
commentId - the id representing the Comment you would like to retrieve.
Returns:
a Comment or null (if the user cannot browse the comment).


Copyright © 2002-2007 Atlassian. All Rights Reserved.