public class DefaultWorklogManager extends Object implements WorklogManager, GroupConfigurable
WORKLOG_UPDATE_DATA_PAGE_SIZE
Constructor and Description |
---|
DefaultWorklogManager(ProjectRoleManager projectRoleManager,
WorklogStore worklogStore,
TimeTrackingIssueUpdater timeTrackingIssueUpdater,
com.atlassian.event.api.EventPublisher eventPublisher) |
Modifier and Type | Method and Description |
---|---|
Worklog |
create(ApplicationUser 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(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.
|
Worklog |
getById(Long id)
Used to get a worklog by its id.
|
List<Worklog> |
getByIssue(Issue issue)
Returns all child worklogs of a specified issue
|
PagedList<Worklog> |
getByIssue(Issue issue,
int pageSize)
Returns all child worklogs of a specified issue, in a PagedList
|
long |
getCountForWorklogsRestrictedByGroup(String groupName)
Returns the count of all
Worklog 's that have a visibility restriction
of the provided group. |
long |
getCountForWorklogsRestrictedByRole(Long roleId)
Returns the count of all
Worklog 's that have a visibility restriction
of the provided role. |
ProjectRole |
getProjectRole(Long projectRoleId)
This is a convenience method to allow us to easily get a ProjectRole.
|
List<DeletedWorklog> |
getWorklogsDeletedSince(Long sinceInMilliseconds)
Returns
WorklogManager.WORKLOG_UPDATE_DATA_PAGE_SIZE of worklog ids and removal dates,
which were removed after (inclusive) provided time in milliseconds. |
Set<Worklog> |
getWorklogsForIds(Set<Long> idsOfWorklogs)
Returns a set of worklogs for provided ids.
|
List<Worklog> |
getWorklogsUpdatedSince(Long sinceInMilliseconds)
Returns
WorklogManager.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 specified
Group . |
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. |
int |
swapWorklogRoleRestriction(Long roleId,
Long swapRoleId)
Updates
Worklog '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. |
Worklog |
update(ApplicationUser user,
Worklog worklog,
Long newEstimate,
boolean dispatchEvent)
Updates the provided
Worklog . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isGroupUsed
public DefaultWorklogManager(ProjectRoleManager projectRoleManager, WorklogStore worklogStore, TimeTrackingIssueUpdater timeTrackingIssueUpdater, com.atlassian.event.api.EventPublisher eventPublisher)
public boolean delete(ApplicationUser user, Worklog worklog, Long newEstimate, boolean dispatchEvent)
WorklogManager
delete
in interface WorklogManager
user
- the user who is performing the actionworklog
- the value to remove in the databasenewEstimate
- 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.public Worklog create(ApplicationUser user, Worklog worklog, Long newEstimate, boolean dispatchEvent)
WorklogManager
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.
create
in interface WorklogManager
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.Worklog
object that represents the newly created worklog.public Worklog update(ApplicationUser user, Worklog worklog, Long newEstimate, boolean dispatchEvent)
WorklogManager
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.
update
in interface WorklogManager
user
- the user who is performing the actionworklog
- the value to update in the databasenewEstimate
- 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.public Worklog getById(Long id)
WorklogManager
getById
in interface WorklogManager
id
- uniquely identifies the worklogpublic List<Worklog> getByIssue(Issue issue)
WorklogManager
getByIssue
in interface WorklogManager
issue
- the specified parent issue (not null)public PagedList<Worklog> getByIssue(Issue issue, int pageSize)
WorklogManager
getByIssue
in interface WorklogManager
issue
- the specified parent issue (not null)public int swapWorklogGroupRestriction(String groupName, String swapGroup)
WorklogManager
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.
swapWorklogGroupRestriction
in interface WorklogManager
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.public long getCountForWorklogsRestrictedByGroup(String groupName)
WorklogManager
Worklog
's that have a visibility restriction
of the provided group.getCountForWorklogsRestrictedByGroup
in interface WorklogManager
groupName
- identifies the group the worklogs are restricted by, this must not be null.public long getCountForWorklogsRestrictedByRole(Long roleId)
WorklogManager
Worklog
's that have a visibility restriction
of the provided role.getCountForWorklogsRestrictedByRole
in interface WorklogManager
roleId
- identifies the role the worklogs are restricted by, this must not be null.public int swapWorklogRoleRestriction(Long roleId, Long swapRoleId)
WorklogManager
Worklog
'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.
swapWorklogRoleRestriction
in interface WorklogManager
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.public ProjectRole getProjectRole(Long projectRoleId)
WorklogManager
ProjectRole
.
NOTE: If you are trying to retrieve a ProjectRole
then you should be using the
ProjectRoleManager
.
getProjectRole
in interface WorklogManager
projectRoleId
- the id to the ProjectRole
object you would like returned.public List<Worklog> getWorklogsUpdatedSince(Long sinceInMilliseconds)
WorklogManager
WorklogManager.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.getWorklogsUpdatedSince
in interface WorklogManager
sinceInMilliseconds
- the time in unix timestamp format.
since which the modified worklogs will be returned.public List<DeletedWorklog> getWorklogsDeletedSince(Long sinceInMilliseconds)
WorklogManager
WorklogManager.WORKLOG_UPDATE_DATA_PAGE_SIZE
of worklog ids and removal dates,
which were removed after (inclusive) provided time in milliseconds.getWorklogsDeletedSince
in interface WorklogManager
sinceInMilliseconds
- the time in unix timestamp format.public Set<Worklog> getWorklogsForIds(Set<Long> idsOfWorklogs)
WorklogManager
WorklogManager.WORKLOG_UPDATE_DATA_PAGE_SIZE
.getWorklogsForIds
in interface WorklogManager
idsOfWorklogs
- set of worklog ids.public void deleteWorklogsForIssue(Issue issue)
WorklogManager
WorklogDeletedEvent
for each worklog deleted.deleteWorklogsForIssue
in interface WorklogManager
issue
- issue for which worklogs will be removed.public boolean isGroupUsed(@Nonnull com.atlassian.crowd.embedded.api.Group group)
GroupConfigurable
Group
.isGroupUsed
in interface GroupConfigurable
group
- that may or may not exist.Copyright © 2002-2018 Atlassian. All Rights Reserved.