com.atlassian.jira.bc.issue.comment
Interface CommentService

All Known Implementing Classes:
DefaultCommentService

public interface CommentService

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.


Method Summary
 Comment create(User user, Issue issue, String body, boolean dispatchEvent, ErrorCollection errorCollection)
          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.
 Comment create(User user, Issue issue, String body, String groupLevel, Long roleLevelId, boolean dispatchEvent, ErrorCollection errorCollection)
          Creates and persists a Comment on the given Issue set with current date and time.
 Comment create(User user, Issue issue, String body, String groupLevel, Long roleLevelId, Date created, boolean dispatchEvent, ErrorCollection errorCollection)
          Creates and persists a Comment on the given Issue.
 List getCommentsForUser(User currentUser, Issue issue, ErrorCollection errorCollection)
          Will return a list of Comments for the given user
 boolean hasPermissionToCreate(User currentUser, Issue issue, ErrorCollection errorCollection)
          Has the correct permission to create a comment for the given issue.
 boolean isGroupVisiblityEnabled()
          Returns the flag that indicates whether group visiblity is enabled
 boolean isProjectRoleVisiblityEnabled()
          Returns the flag that indicates whether project role visibility is enabled
 boolean isValidAllCommentData(User currentUser, Issue issue, String body, String groupLevel, String roleLevelId, ErrorCollection errorCollection)
          Will call all other validate methods setting the appropriate errors in the errorCollection if any errors occur.
 boolean isValidCommentBody(String body, ErrorCollection errorCollection)
          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.
 boolean isValidCommentData(User currentUser, Issue issue, String groupLevel, String roleLevelId, ErrorCollection errorCollection)
          This method validates if the comment has the correct role and group levels set.
 

Method Detail

create

public Comment create(User user,
                      Issue issue,
                      String body,
                      String groupLevel,
                      Long roleLevelId,
                      Date created,
                      boolean dispatchEvent,
                      ErrorCollection errorCollection)
Creates and persists a Comment on the given Issue.

Parameters:
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
Returns:
the created Comment object, or null if no object created.

create

public Comment create(User user,
                      Issue issue,
                      String body,
                      String groupLevel,
                      Long roleLevelId,
                      boolean dispatchEvent,
                      ErrorCollection errorCollection)
Creates and persists a Comment on the given Issue set with current date and time.

Parameters:
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
Returns:
the created Comment object, or null if no object created.

create

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

Parameters:
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
Returns:
the created Comment object, or null if no object created.

getCommentsForUser

public List getCommentsForUser(User currentUser,
                               Issue issue,
                               ErrorCollection errorCollection)
Will return a list of Comments for the given user

Parameters:
currentUser -
issue - the issue with associated comments
errorCollection -
Returns:
a List of comments

hasPermissionToCreate

public boolean hasPermissionToCreate(User currentUser,
                                     Issue issue,
                                     ErrorCollection errorCollection)
Has the correct permission to create a comment for the given issue.

Parameters:
currentUser -
issue -
Returns:
true if permission check passes.

isValidCommentBody

public boolean isValidCommentBody(String body,
                                  ErrorCollection errorCollection)
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.

Parameters:
body -
errorCollection -
Returns:
true is the body is valid.

isValidCommentData

public boolean isValidCommentData(User currentUser,
                                  Issue issue,
                                  String groupLevel,
                                  String roleLevelId,
                                  ErrorCollection errorCollection)
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.

Parameters:
currentUser -
issue -
groupLevel -
roleLevelId -
errorCollection -
Returns:
true if the role and group level information has been set correctly for a comment

isValidAllCommentData

public boolean isValidAllCommentData(User currentUser,
                                     Issue issue,
                                     String body,
                                     String groupLevel,
                                     String roleLevelId,
                                     ErrorCollection errorCollection)
Will call all other validate methods setting the appropriate errors in the errorCollection if any errors occur.

Parameters:
currentUser -
issue -
body -
groupLevel -
roleLevelId -
errorCollection -
Returns:
true if validation passes

isGroupVisiblityEnabled

public boolean isGroupVisiblityEnabled()
Returns the flag that indicates whether group visiblity is enabled

Returns:
true if enabled, false otherwise

isProjectRoleVisiblityEnabled

public boolean isProjectRoleVisiblityEnabled()
Returns the flag that indicates whether project role visibility is enabled

Returns:
true if enabled, false otherwise


Copyright © 2002-2007 Atlassian. All Rights Reserved.