Class DefaultWorklogManager
- All Implemented Interfaces:
GroupConfigurable
,WorklogManager
-
Field Summary
Fields inherited from interface com.atlassian.jira.issue.worklog.WorklogManager
WORKLOG_UPDATE_DATA_PAGE_SIZE
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultWorklogManager
(ProjectRoleManager projectRoleManager, WorklogStore worklogStore, TimeTrackingIssueUpdater timeTrackingIssueUpdater, com.atlassian.event.api.EventPublisher eventPublisher) -
Method Summary
Modifier and TypeMethodDescriptioncreate
(ApplicationUser user, Worklog worklog, Long newEstimate, boolean dispatchEvent) Creates a worklog based on the passed inWorklog
object and associates it with the given issue.boolean
delete
(ApplicationUser user, Worklog worklog, Long newEstimate, boolean dispatchEvent) Deletes the specified worklog and updates the issue's remaining estimate and time spent fields.void
deleteWorklogsForIssue
(Issue issue) Removes all worklogs which are associated with a given issue.Used to get a worklog by its id.getByIssue
(Issue issue) Returns all child worklogs of a specified issuegetByIssue
(Issue issue, int pageSize) Returns all child worklogs of a specified issue, in a PagedListlong
getCountForWorklogsRestrictedByGroup
(String groupName) Returns the count of allWorklog
's that have a visibility restriction of the provided group.long
Returns the count of allWorklog
's that have a visibility restriction of the provided role.getProjectRole
(Long projectRoleId) This is a convenience method to allow us to easily get a ProjectRole.getWorklogsDeletedSince
(Long sinceInMilliseconds) ReturnsWorklogManager.WORKLOG_UPDATE_DATA_PAGE_SIZE
of worklog ids and removal dates, which were removed after (inclusive) provided time in milliseconds.getWorklogsForIds
(Set<Long> idsOfWorklogs) Returns a set of worklogs for provided ids.getWorklogsUpdatedSince
(Long sinceInMilliseconds) ReturnsWorklogManager.WORKLOG_UPDATE_DATA_PAGE_SIZE
of worklogs, which were updated or created after (inclusive) provided time in milliseconds.boolean
isGroupUsed
(com.atlassian.crowd.embedded.api.Group group) Determine whether configuration exists for the specifiedGroup
.int
swapWorklogGroupRestriction
(String groupName, String swapGroup) UpdatesWorklog
'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.int
swapWorklogRoleRestriction
(Long roleId, Long swapRoleId) UpdatesWorklog
's such that worklogs that have a visibility restriction of the provided role will be changed to have a visibility restriction of a role with the provided swapRoleId.update
(ApplicationUser user, Worklog worklog, Long newEstimate, boolean dispatchEvent) Updates the providedWorklog
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.atlassian.jira.config.group.GroupConfigurable
isGroupUsed
-
Constructor Details
-
DefaultWorklogManager
public DefaultWorklogManager(ProjectRoleManager projectRoleManager, WorklogStore worklogStore, TimeTrackingIssueUpdater timeTrackingIssueUpdater, com.atlassian.event.api.EventPublisher eventPublisher)
-
-
Method Details
-
delete
public boolean delete(ApplicationUser 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 interfaceWorklogManager
- Parameters:
user
- the user who is performing the actionworklog
- the value to remove in the databasenewEstimate
- the value to set theIssue
's remainig estimate. If null the value will be left alone.dispatchEvent
- if true then an event of typeEventType.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(ApplicationUser user, Worklog worklog, Long newEstimate, boolean dispatchEvent) Description copied from interface:WorklogManager
Creates a worklog based on the passed inWorklog
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 interfaceWorklogManager
- Parameters:
user
- is the user who is trying to create the worklog, this can be different than the user identified byWorklog.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 typeEventType.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(ApplicationUser user, Worklog worklog, Long newEstimate, boolean dispatchEvent) Description copied from interface:WorklogManager
Updates the providedWorklog
. 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 interfaceWorklogManager
- Parameters:
user
- the user who is performing the actionworklog
- the value to update in the databasenewEstimate
- the value to set theIssue
's remainig estimate. If null the value will be left alone.dispatchEvent
- if true then an event of typeEventType.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
Description copied from interface:WorklogManager
Used to get a worklog by its id.- Specified by:
getById
in interfaceWorklogManager
- Parameters:
id
- uniquely identifies the worklog- Returns:
- returns the worklog for the passed in id, null if not found.
-
getByIssue
Description copied from interface:WorklogManager
Returns all child worklogs of a specified issue- Specified by:
getByIssue
in interfaceWorklogManager
- 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
-
getByIssue
Description copied from interface:WorklogManager
Returns all child worklogs of a specified issue, in a PagedList- Specified by:
getByIssue
in interfaceWorklogManager
- 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
Description copied from interface:WorklogManager
UpdatesWorklog
'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 interfaceWorklogManager
- 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
Description copied from interface:WorklogManager
Returns the count of allWorklog
's that have a visibility restriction of the provided group.- Specified by:
getCountForWorklogsRestrictedByGroup
in interfaceWorklogManager
- Parameters:
groupName
- identifies the group the worklogs are restricted by, this must not be null.- Returns:
- the count of restriced groups
-
getCountForWorklogsRestrictedByRole
Description copied from interface:WorklogManager
Returns the count of allWorklog
's that have a visibility restriction of the provided role.- Specified by:
getCountForWorklogsRestrictedByRole
in interfaceWorklogManager
- Parameters:
roleId
- identifies the role the worklogs are restricted by, this must not be null.- Returns:
- the count of restricted worklogs
-
swapWorklogRoleRestriction
Description copied from interface:WorklogManager
UpdatesWorklog
's such that worklogs that have a visibility restriction of the provided role will be changed to have a visibility restriction of a role with the provided swapRoleId.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:
swapWorklogRoleRestriction
in interfaceWorklogManager
- Parameters:
roleId
- identifies the role the worklogs are restricted by, this must not be null.swapRoleId
- identifies the role the worklogs will be changed to be restricted by, this must not be null.- Returns:
- tbe number of worklogs affected by the update.
-
getProjectRole
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 aProjectRole
.NOTE: If you are trying to retrieve a
ProjectRole
then you should be using theProjectRoleManager
.- Specified by:
getProjectRole
in interfaceWorklogManager
- Parameters:
projectRoleId
- the id to theProjectRole
object you would like returned.- Returns:
- will return a ProjectRole based on the passed in projectRoleId.
-
getWorklogsUpdatedSince
Description copied from interface:WorklogManager
ReturnsWorklogManager.WORKLOG_UPDATE_DATA_PAGE_SIZE
of worklogs, which were updated or created after (inclusive) provided time in milliseconds. Returned worklogs are ordered by the update time.- Specified by:
getWorklogsUpdatedSince
in interfaceWorklogManager
- Parameters:
sinceInMilliseconds
- the time in unix timestamp format. since which the modified worklogs will be returned.- Returns:
- worklogs updated since provided time.
-
getWorklogsDeletedSince
Description copied from interface:WorklogManager
ReturnsWorklogManager.WORKLOG_UPDATE_DATA_PAGE_SIZE
of worklog ids and removal dates, which were removed after (inclusive) provided time in milliseconds.- Specified by:
getWorklogsDeletedSince
in interfaceWorklogManager
- Parameters:
sinceInMilliseconds
- the time in unix timestamp format.- Returns:
- ids and removal dates of worklogs which were deleted since provided time.
-
getWorklogsForIds
Description copied from interface:WorklogManager
Returns a set of worklogs for provided ids. This method expects the size of to be less thanWorklogManager.WORKLOG_UPDATE_DATA_PAGE_SIZE
.- Specified by:
getWorklogsForIds
in interfaceWorklogManager
- Parameters:
idsOfWorklogs
- set of worklog ids.- Returns:
- a list of worklogs for provided ids.
-
deleteWorklogsForIssue
Description copied from interface:WorklogManager
Removes all worklogs which are associated with a given issue. This method will publish aWorklogDeletedEvent
for each worklog deleted.- Specified by:
deleteWorklogsForIssue
in interfaceWorklogManager
- Parameters:
issue
- issue for which worklogs will be removed.
-
isGroupUsed
public boolean isGroupUsed(@Nonnull com.atlassian.crowd.embedded.api.Group group) Description copied from interface:GroupConfigurable
Determine whether configuration exists for the specifiedGroup
.- Specified by:
isGroupUsed
in interfaceGroupConfigurable
- Parameters:
group
- that may or may not exist.- Returns:
- true if the group is used in the components configuration.
-