com.atlassian.jira.issue.comments
Class DefaultCommentManager

java.lang.Object
  extended bycom.atlassian.jira.issue.comments.DefaultCommentManager
All Implemented Interfaces:
CommentManager

public class DefaultCommentManager
extends Object
implements CommentManager


Constructor Summary
DefaultCommentManager(IssueManager issueManager, TextAnalyzer textAnalyzer, CacheManager cacheManager, ProjectRoleManager projectRoleManager, CommentPermissionManager commentPermissionManager, OfBizDelegator delegator)
           
 
Method Summary
 Comment convertToComment(org.ofbiz.core.entity.GenericValue gv)
          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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCommentManager

public DefaultCommentManager(IssueManager issueManager,
                             TextAnalyzer textAnalyzer,
                             CacheManager cacheManager,
                             ProjectRoleManager projectRoleManager,
                             CommentPermissionManager commentPermissionManager,
                             OfBizDelegator delegator)
Method Detail

getProjectRole

public ProjectRole getProjectRole(Long projectRoleId)
Description copied from interface: CommentManager
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.

Specified by:
getProjectRole in interface CommentManager
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 gv)
Description copied from interface: CommentManager
This is a convienice method that can be used to convert a GenericValue representation of a comment to a comment object.

Specified by:
convertToComment in interface CommentManager
Parameters:
gv - is the GenericValue representation of a comment.

getCommentById

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

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

getCommentsForUser

public List getCommentsForUser(Issue issue,
                               User user)
Description copied from interface: CommentManager
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.

Specified by:
getCommentsForUser in interface CommentManager
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)
Description copied from interface: CommentManager
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 CommentManager.getCommentsForUser(Issue issue, User user)

Specified by:
getComments in interface CommentManager
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)
Description copied from interface: CommentManager
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.

Specified by:
create in interface CommentManager
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)
               throws DataAccessException
Description copied from interface: CommentManager
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.

Specified by:
create in interface CommentManager
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.
Throws:
DataAccessException

create

public Comment create(Issue issue,
                      String author,
                      String body,
                      String groupLevel,
                      Long roleLevelId,
                      Date created,
                      boolean dispatchEvent)
               throws DataAccessException
Description copied from interface: CommentManager
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.

Specified by:
create in interface CommentManager
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.
Throws:
DataAccessException


Copyright © 2002-2007 Atlassian. All Rights Reserved.