com.atlassian.jira.issue.worklog
Class DefaultWorklogManager

java.lang.Object
  extended by com.atlassian.jira.issue.worklog.DefaultWorklogManager
All Implemented Interfaces:
WorklogManager

public class DefaultWorklogManager
extends Object
implements WorklogManager


Constructor Summary
DefaultWorklogManager(TextAnalyzer textAnalyzer, ProjectRoleManager projectRoleManager, WorklogStore worklogStore, TimeTrackingIssueUpdater timeTrackingIssueUpdater)
           
 
Method Summary
 Worklog create(User user, Worklog worklog, Long newEstimate, boolean dispatchEvent)
          Creates a worklog based on the passed in Worklog object and associates it with the given issue.
 boolean delete(User user, Worklog worklog, Long newEstimate, boolean dispatchEvent)
          Deletes the specified worklog and updates the issue's remaining estimate and time spent fields.
 Worklog getById(Long id)
          Used to get a worklog by its id.
 List getByIssue(Issue issue)
          Returns all child worklogs of a specified issue
 long getCountForWorklogsRestrictedByGroup(String groupName)
          Returns the count of all Worklog's that have a visibility restriction of the provided group.
 ProjectRole getProjectRole(Long projectRoleId)
          This is a convenience method to allow us to easily get a ProjectRole.
 int swapWorklogGroupRestriction(String groupName, String swapGroup)
          Updates Worklog's such that worklogs that have a visibility restriction of the provided groupName will be changed to have a visibility restriction of the provided swapGroup.
 Worklog update(User user, Worklog worklog, Long newEstimate, boolean dispatchEvent)
          Updates the provided Worklog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultWorklogManager

public DefaultWorklogManager(TextAnalyzer textAnalyzer,
                             ProjectRoleManager projectRoleManager,
                             WorklogStore worklogStore,
                             TimeTrackingIssueUpdater timeTrackingIssueUpdater)
Method Detail

delete

public boolean delete(User user,
                      Worklog worklog,
                      Long newEstimate,
                      boolean dispatchEvent)
Description copied from interface: WorklogManager
Deletes the specified worklog and updates the issue's remaining estimate and time spent fields.

Specified by:
delete in interface WorklogManager
Parameters:
user - the user who is performing the action
worklog - the value to remove in the database
newEstimate - the value to set the Issue's remainig estimate. If null the value will be left alone.
dispatchEvent - if true then an event of type EventType.ISSUE_WORKLOG_DELETED_ID will be dispatched and any notifications listening for that event will be triggered. If false no event will be dispatched.
Returns:
true if the worklog was deleted, false otherwise.

create

public Worklog create(User user,
                      Worklog worklog,
                      Long newEstimate,
                      boolean dispatchEvent)
Description copied from interface: WorklogManager
Creates a worklog based on the passed in Worklog object and associates it with the given issue.

If you have provided a groupLevel then the worklog 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 worklog 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: this method does not do any permission checks to see if the user can perform the requested operation.

Specified by:
create in interface WorklogManager
Parameters:
user - is the user who is trying to create the worklog, this can be different than the user identified by Worklog.getAuthor().
worklog - the object used to provide the parameters that will be used to create the worklog.
newEstimate - will be used to set the time estimate for this worklog.
dispatchEvent - if true then an event of type EventType.ISSUE_WORKLOGGED_ID will be dispatched and any notifications listening for that event will be triggered. If false no event will be dispatched.
Returns:
a Worklog object that represents the newly created worklog.

update

public Worklog update(User user,
                      Worklog worklog,
                      Long newEstimate,
                      boolean dispatchEvent)
Description copied from interface: WorklogManager
Updates the provided Worklog. This method will adjust the issue's remaining estimate to be the new value which has been passed to this method, the old remaining estimate value will be lost.

If you have provided a groupLevel then the worklog 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 worklog 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: this method does not do any permission checks to see if the user can perform the requested operation.

Specified by:
update in interface WorklogManager
Parameters:
user - the user who is performing the action
worklog - the value to update in the database
newEstimate - the value to set the Issue's remainig estimate. If null the value will be left alone.
dispatchEvent - if true then an event of type EventType.ISSUE_WORKLOG_UPDATED_ID will be dispatched and any notifications listening for that event will be triggered. If false no event will be dispatched.
Returns:
the updated worklog

getById

public Worklog getById(Long id)
Description copied from interface: WorklogManager
Used to get a worklog by its id.

Specified by:
getById in interface WorklogManager
Parameters:
id - uniquely identifies the worklog
Returns:
returns the worklog for the passed in id, null if not found.

getByIssue

public List getByIssue(Issue issue)
Description copied from interface: WorklogManager
Returns all child worklogs of a specified issue

Specified by:
getByIssue in interface WorklogManager
Parameters:
issue - the specified parent issue (not null)
Returns:
a List of Worklogs, ordered by creation date. An empty List will be returned if none are found

swapWorklogGroupRestriction

public int swapWorklogGroupRestriction(String groupName,
                                       String swapGroup)
Description copied from interface: WorklogManager
Updates Worklog's such that worklogs 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:
swapWorklogGroupRestriction in interface WorklogManager
Parameters:
groupName - identifies the group the worklogs are restricted by, this must not be null.
swapGroup - identifies the group the worklogs will be changed to be restricted by, this must not be null.
Returns:
tbe number of worklogs affected by the update.

getCountForWorklogsRestrictedByGroup

public long getCountForWorklogsRestrictedByGroup(String groupName)
Description copied from interface: WorklogManager
Returns the count of all Worklog's that have a visibility restriction of the provided group.

Specified by:
getCountForWorklogsRestrictedByGroup in interface WorklogManager
Parameters:
groupName - identifies the group the worklogs are restricted by, this must not be null.
Returns:
the count of restriced groups

getProjectRole

public ProjectRole getProjectRole(Long projectRoleId)
Description copied from interface: WorklogManager
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 WorklogManager
Parameters:
projectRoleId - the id to the ProjectRole object you would like returned.
Returns:
will return a ProjectRole based on the passed in projectRoleId.


Copyright © 2002-2010 Atlassian. All Rights Reserved.