public class DefaultWorklogService extends Object implements WorklogService
Constructor and Description |
---|
DefaultWorklogService(WorklogManager worklogManager,
PermissionManager permissionManager,
VisibilityValidator visibilityValidator,
ProjectRoleManager projectRoleManager,
IssueManager issueManager,
TimeTrackingConfiguration timeTrackingConfiguration,
JiraDurationUtils jiraDurationUtils,
GroupManager groupManager) |
Modifier and Type | Method and Description |
---|---|
protected Worklog |
create(JiraServiceContext jiraServiceContext,
WorklogResult worklogResult,
Long newEstimate,
boolean dispatchEvent) |
Worklog |
createAndAutoAdjustRemainingEstimate(JiraServiceContext jiraServiceContext,
WorklogResult worklogResult,
boolean dispatchEvent)
|
Worklog |
createAndRetainRemainingEstimate(JiraServiceContext jiraServiceContext,
WorklogResult worklogResult,
boolean dispatchEvent)
|
Worklog |
createWithManuallyAdjustedEstimate(JiraServiceContext jiraServiceContext,
WorklogAdjustmentAmountResult worklogResult,
boolean dispatchEvent)
|
Worklog |
createWithNewRemainingEstimate(JiraServiceContext jiraServiceContext,
WorklogNewEstimateResult worklogResult,
boolean dispatchEvent)
|
protected boolean |
delete(JiraServiceContext jiraServiceContext,
WorklogResult worklogResult,
Long newEstimate,
boolean dispatchEvent) |
boolean |
deleteAndAutoAdjustRemainingEstimate(JiraServiceContext jiraServiceContext,
WorklogResult worklogResult,
boolean dispatchEvent)
Deletes the specified
Worklog . |
boolean |
deleteAndRetainRemainingEstimate(JiraServiceContext jiraServiceContext,
WorklogResult worklogResult,
boolean dispatchEvent)
Deletes the specified
Worklog . |
boolean |
deleteWithManuallyAdjustedEstimate(JiraServiceContext jiraServiceContext,
WorklogAdjustmentAmountResult worklogResult,
boolean dispatchEvent)
Deletes the specified
Worklog . |
boolean |
deleteWithNewRemainingEstimate(JiraServiceContext jiraServiceContext,
WorklogNewEstimateResult worklogNewEstimate,
boolean dispatchEvent)
Deletes the specified
Worklog . |
protected Long |
getAutoAdjustNewEstimateOnUpdate(Issue issue,
Long newTimeSpent,
Long originalTimeSpent) |
Worklog |
getById(JiraServiceContext jiraServiceContext,
Long id)
Used to get a worklog by its id.
|
List |
getByIssue(JiraServiceContext jiraServiceContext,
Issue issue)
Returns all child worklogs of a specified issue.
|
List<Worklog> |
getByIssueVisibleToUser(JiraServiceContext jiraServiceContext,
Issue issue)
Returns all child worklogs of a specified issue that the provided user has permission to see.
|
PagedList<Worklog> |
getByIssueVisibleToUser(JiraServiceContext jiraServiceContext,
Issue issue,
int pageSize)
Returns a PagedList over all all child worklogs of a specified issue that the provided user has permission to see.
|
protected long |
getDurationForFormattedString(String timeSpent,
JiraServiceContext jiraServiceContext) |
WorklogChangedSincePage<DeletedWorklog> |
getWorklogsDeletedSince(ApplicationUser user,
Long sinceInMilliseconds)
Returns a list of ids of worklogs which were removed, since the time provided in .
|
ServiceOutcome<Set<Worklog>> |
getWorklogsForIds(JiraServiceContext jiraServiceContext,
Set<Long> idsOfWorklogs)
Returns a set of worklogs for provided ids.
|
WorklogChangedSincePage<Worklog> |
getWorklogsUpdatedSince(ApplicationUser user,
Long sinceInMilliseconds)
Returns a list of worklogs visible by the calling user, which were modified since time provided in .
|
protected boolean |
hasDeleteAllPermission(ApplicationUser user,
Issue issue) |
protected boolean |
hasDeleteOwnPermission(ApplicationUser user,
Worklog worklog) |
protected boolean |
hasEditAllPermission(ApplicationUser user,
Issue issue) |
protected boolean |
hasEditOwnPermission(ApplicationUser user,
Worklog worklog) |
boolean |
hasPermissionToCreate(JiraServiceContext jiraServiceContext,
Issue issue,
boolean isEditableCheckRequired)
Determines if the user has the
Permissions.WORK_ISSUE permission,
that timetracking is enabled in JIRA and that the associated issue is in an editable workflow state. |
boolean |
hasPermissionToDelete(JiraServiceContext jiraServiceContext,
Worklog worklog)
Determine whether the current user has the permission to delete the supplied
worklog, timetracking is enabled in JIRA and that the associated issue is in an editable workflow state.
|
boolean |
hasPermissionToUpdate(JiraServiceContext jiraServiceContext,
Worklog worklog)
Determine whether the current user has the permission to update the supplied
worklog, timetracking is enabled in JIRA and that the associated issue is in an editable workflow state.
|
protected boolean |
hasViewPermission(ApplicationUser user,
Issue issue) |
protected Long |
increaseEstimate(Issue issue,
Long amount) |
boolean |
isIssueInEditableWorkflowState(Issue issue)
Will return true if the issue is in an editable workflow state.
|
protected boolean |
isSameAuthor(ApplicationUser user,
Worklog worklog) |
boolean |
isTimeTrackingEnabled()
Will return true if
APKeys.JIRA_OPTION_TIMETRACKING is true, false
otherwise. |
protected boolean |
isUserInGroup(ApplicationUser user,
String groupLevel) |
protected boolean |
isUserInRole(Long roleLevel,
ApplicationUser user,
Issue issue) |
protected boolean |
isValidAdjustmentAmount(JiraServiceContext jiraServiceContext,
String adjustmentAmount)
Checks if the given String is a valid amount of time to change an estimate by.
|
protected boolean |
isValidAdjustmentAmount(JiraServiceContext jiraServiceContext,
String adjustmentAmount,
String errorFieldPrefix)
Checks if the given String is a valid amount of time to change an estimate by.
|
protected boolean |
isValidNewEstimate(JiraServiceContext jiraServiceContext,
String newEstimate) |
protected boolean |
isValidNewEstimate(JiraServiceContext jiraServiceContext,
String newEstimate,
String errorFieldPrefix) |
protected boolean |
isValidWorklogInputFields(JiraServiceContext jiraServiceContext,
Issue issue,
String timeSpent,
Date startDate,
String errorFieldPrefix) |
protected Long |
reduceEstimate(Issue issue,
Long amount) |
protected Worklog |
update(JiraServiceContext jiraServiceContext,
WorklogResult worklogResult,
Long newEstimate,
boolean dispatchEvent) |
Worklog |
updateAndAutoAdjustRemainingEstimate(JiraServiceContext jiraServiceContext,
WorklogResult worklogResult,
boolean dispatchEvent)
Updates the provided
Worklog . |
Worklog |
updateAndRetainRemainingEstimate(JiraServiceContext jiraServiceContext,
WorklogResult worklogResult,
boolean dispatchEvent)
Updates the provided
Worklog . |
Worklog |
updateWithNewRemainingEstimate(JiraServiceContext jiraServiceContext,
WorklogNewEstimateResult worklogResult,
boolean dispatchEvent)
Updates the provided
Worklog . |
WorklogResult |
validateCreate(JiraServiceContext jiraServiceContext,
WorklogInputParameters params)
Determines whether worklogs are enabled in JIRA and if the user has the required permissions
as determined by calling
WorklogService.hasPermissionToCreate(com.atlassian.jira.bc.JiraServiceContext, com.atlassian.jira.issue.Issue, boolean)
to create a worklog for this issue. |
WorklogAdjustmentAmountResult |
validateCreateWithManuallyAdjustedEstimate(JiraServiceContext jiraServiceContext,
WorklogAdjustmentAmountInputParameters params)
Determines whether worklogs are enabled in JIRA and if the user has the required permission
as determined by calling
WorklogService.hasPermissionToCreate(com.atlassian.jira.bc.JiraServiceContext, com.atlassian.jira.issue.Issue, boolean)
to create a worklog for this issue. |
WorklogNewEstimateResult |
validateCreateWithNewEstimate(JiraServiceContext jiraServiceContext,
WorklogNewEstimateInputParameters params)
Determines whether worklogs are enabled in JIRA and if the user has the required permission
as determined by calling
WorklogService.hasPermissionToCreate(com.atlassian.jira.bc.JiraServiceContext, com.atlassian.jira.issue.Issue, boolean)
to create a worklog for this issue. |
WorklogResult |
validateDelete(JiraServiceContext jiraServiceContext,
Long worklogId)
Determines whether worklogs are enabled in JIRA and if the user has the required permissions
as determined by calling
WorklogService.hasPermissionToDelete(com.atlassian.jira.bc.JiraServiceContext, com.atlassian.jira.issue.worklog.Worklog)
to delete a worklog for this issue. |
WorklogAdjustmentAmountResult |
validateDeleteWithManuallyAdjustedEstimate(JiraServiceContext jiraServiceContext,
Long worklogId,
String adjustmentAmount)
Determines whether worklogs are enabled in JIRA and if the user has the required permissions
as determined by calling
WorklogService.hasPermissionToDelete(com.atlassian.jira.bc.JiraServiceContext, com.atlassian.jira.issue.worklog.Worklog)
to delete a worklog for this issue. |
WorklogNewEstimateResult |
validateDeleteWithNewEstimate(JiraServiceContext jiraServiceContext,
Long worklogId,
String newEstimate)
Determines whether worklogs are enabled in JIRA and if the user has the required permissions
as determined by calling
WorklogService.hasPermissionToDelete(com.atlassian.jira.bc.JiraServiceContext, com.atlassian.jira.issue.worklog.Worklog)
to delete a worklog for this issue. |
protected Worklog |
validateParamsAndCreateWorklog(JiraServiceContext jiraServiceContext,
Issue issue,
ApplicationUser author,
Visibility visibility,
String timeSpent,
Date startDate,
Long worklogId,
String comment,
Date created,
Date updated,
ApplicationUser updateAuthor,
String errorFieldPrefix) |
WorklogResult |
validateUpdate(JiraServiceContext jiraServiceContext,
WorklogInputParameters params)
Determines whether worklogs are enabled in JIRA and if the user has the required permissions
as determined by calling
WorklogService.hasPermissionToUpdate(com.atlassian.jira.bc.JiraServiceContext, com.atlassian.jira.issue.worklog.Worklog)
to update a worklog for this issue. |
WorklogNewEstimateResult |
validateUpdateWithNewEstimate(JiraServiceContext jiraServiceContext,
WorklogNewEstimateInputParameters params)
Determines whether worklogs are enabled in JIRA and if the user has the required permissions
as determined by calling
WorklogService.hasPermissionToUpdate(com.atlassian.jira.bc.JiraServiceContext, com.atlassian.jira.issue.worklog.Worklog)
to update a worklog for this issue. |
public DefaultWorklogService(WorklogManager worklogManager, PermissionManager permissionManager, VisibilityValidator visibilityValidator, ProjectRoleManager projectRoleManager, IssueManager issueManager, TimeTrackingConfiguration timeTrackingConfiguration, JiraDurationUtils jiraDurationUtils, GroupManager groupManager)
public WorklogResult validateDelete(JiraServiceContext jiraServiceContext, Long worklogId)
WorklogService
WorklogService.hasPermissionToDelete(com.atlassian.jira.bc.JiraServiceContext, com.atlassian.jira.issue.worklog.Worklog)
to delete a worklog for this issue.validateDelete
in interface WorklogService
jiraServiceContext
- containing the user who wishes to create a worklog and the errorCollection
that will contain any errors in calling the methodworklogId
- identifies the worklog that the update validation will occur againstpublic WorklogNewEstimateResult validateDeleteWithNewEstimate(JiraServiceContext jiraServiceContext, Long worklogId, String newEstimate)
WorklogService
WorklogService.hasPermissionToDelete(com.atlassian.jira.bc.JiraServiceContext, com.atlassian.jira.issue.worklog.Worklog)
to delete a worklog for this issue.validateDeleteWithNewEstimate
in interface WorklogService
jiraServiceContext
- containing the user who wishes to create a worklog and the errorCollection
that will contain any errors in calling the methodworklogId
- identifies the worklog that the delete validation will occur againstnewEstimate
- The value to change the issues remaining estimate to.public WorklogAdjustmentAmountResult validateDeleteWithManuallyAdjustedEstimate(JiraServiceContext jiraServiceContext, Long worklogId, String adjustmentAmount)
WorklogService
WorklogService.hasPermissionToDelete(com.atlassian.jira.bc.JiraServiceContext, com.atlassian.jira.issue.worklog.Worklog)
to delete a worklog for this issue.validateDeleteWithManuallyAdjustedEstimate
in interface WorklogService
jiraServiceContext
- containing the user who wishes to create a worklog and the errorCollection
that will contain any errors in calling the methodworklogId
- identifies the worklog that the delete validation will occur againstadjustmentAmount
- The value to increase the issues remaining estimate by.public boolean deleteWithNewRemainingEstimate(JiraServiceContext jiraServiceContext, WorklogNewEstimateResult worklogNewEstimate, boolean dispatchEvent)
WorklogService
Worklog
. This method will
adjust the issues remaining estimate to be the new value which has been passed to this method, the old
remaining estimate value will be lost.deleteWithNewRemainingEstimate
in interface WorklogService
jiraServiceContext
- containing the User
who wishes to update the supplied worklog and
the ErrorCollection
that will contain any errors encountered
in calling the methodworklogNewEstimate
- the Worklog and new estimate for the issue.dispatchEvent
- whether or not you want to have an event dispatched on Worklog delete @return the deleted Worklog object, or null if no object has been deleted.Worklog
was successfully deleted, false otherwisepublic boolean deleteWithManuallyAdjustedEstimate(JiraServiceContext jiraServiceContext, WorklogAdjustmentAmountResult worklogResult, boolean dispatchEvent)
WorklogService
Worklog
. This method will
adjust the issues remaining estimate to be the new value which has been passed to this method, the old
remaining estimate value will be lost.deleteWithManuallyAdjustedEstimate
in interface WorklogService
jiraServiceContext
- containing the User
who wishes to update the supplied worklog and
the ErrorCollection
that will contain any errors encountered
in calling the methodworklogResult
- the Worklog and adjustmentAmount for the issue.dispatchEvent
- whether or not you want to have an event dispatched on Worklog delete @return the deleted Worklog object, or null if no object has been deleted.Worklog
was successfully deleted, false otherwisepublic boolean deleteAndRetainRemainingEstimate(JiraServiceContext jiraServiceContext, WorklogResult worklogResult, boolean dispatchEvent)
WorklogService
Worklog
. This method will
make no adjustment to the issues remaining estimate.deleteAndRetainRemainingEstimate
in interface WorklogService
jiraServiceContext
- containing the User
who wishes to update the supplied worklog and
the ErrorCollection
that will contain any errors encountered
in calling the methodworklogResult
- result of the call to WorklogService.validateDelete(com.atlassian.jira.bc.JiraServiceContext, Long)
which contains the Worklog
to deletedispatchEvent
- whether or not you want to have an event dispatched on Worklog deleteWorklog
was successfully deleted, false otherwisepublic boolean deleteAndAutoAdjustRemainingEstimate(JiraServiceContext jiraServiceContext, WorklogResult worklogResult, boolean dispatchEvent)
WorklogService
Worklog
. This method will auto-adjust the issues
remaining estimate by adding the time spent on the deleted worklog.deleteAndAutoAdjustRemainingEstimate
in interface WorklogService
jiraServiceContext
- containing the User
who wishes to update the supplied worklog and
the ErrorCollection
that will contain any errors encountered
in calling the methodworklogResult
- result of the call to WorklogService.validateDelete(com.atlassian.jira.bc.JiraServiceContext, Long)
which contains the Worklog
to deletedispatchEvent
- whether or not you want to have an event dispatched on Worklog deleteWorklog
was successfully deleted, false otherwisepublic WorklogResult validateUpdate(JiraServiceContext jiraServiceContext, WorklogInputParameters params)
WorklogService
WorklogService.hasPermissionToUpdate(com.atlassian.jira.bc.JiraServiceContext, com.atlassian.jira.issue.worklog.Worklog)
to update a worklog for this issue.validateUpdate
in interface WorklogService
jiraServiceContext
- containing the user who wishes to create a worklog and the errorCollection
that will contain any errors in calling the methodparams
- parameter object that contains all the values required to validatepublic WorklogNewEstimateResult validateUpdateWithNewEstimate(JiraServiceContext jiraServiceContext, WorklogNewEstimateInputParameters params)
WorklogService
WorklogService.hasPermissionToUpdate(com.atlassian.jira.bc.JiraServiceContext, com.atlassian.jira.issue.worklog.Worklog)
to update a worklog for this issue.validateUpdateWithNewEstimate
in interface WorklogService
jiraServiceContext
- containing the user who wishes to create a worklog and the errorCollection
that will contain any errors in calling the methodparams
- parameter object that contains all the values required to validatepublic Worklog updateWithNewRemainingEstimate(JiraServiceContext jiraServiceContext, WorklogNewEstimateResult worklogResult, boolean dispatchEvent)
WorklogService
Worklog
. This method will
adjust the issues remaining estimate to be the new value which has been passed to this method, the old
remaining estimate value will be lost.updateWithNewRemainingEstimate
in interface WorklogService
jiraServiceContext
- containing the User
who wishes to create a worklog and
the ErrorCollection
that will contain any errors in calling the methodworklogResult
- the Worklog and new estimate for the issue.dispatchEvent
- whether or not you want to have an event dispatched on Worklog update @return the updated Worklog object, or null if no object has been updated.public Worklog updateAndRetainRemainingEstimate(JiraServiceContext jiraServiceContext, WorklogResult worklogResult, boolean dispatchEvent)
WorklogService
Worklog
. This method will
make no adjustment to the issues remaining estimate.updateAndRetainRemainingEstimate
in interface WorklogService
jiraServiceContext
- containing the User
who wishes to update the supplied worklog and
the ErrorCollection
that will contain any errors encountered
in calling the methodworklogResult
- result of the call to WorklogService.validateUpdate(com.atlassian.jira.bc.JiraServiceContext, WorklogInputParameters)
which contains the Worklog
to updatedispatchEvent
- whether or not you want to have an event dispatched on Worklog updatepublic Worklog updateAndAutoAdjustRemainingEstimate(JiraServiceContext jiraServiceContext, WorklogResult worklogResult, boolean dispatchEvent)
WorklogService
Worklog
. This method will auto-adjust the issues
remaining estimate based on the updated value of the time spent on the work.updateAndAutoAdjustRemainingEstimate
in interface WorklogService
jiraServiceContext
- containing the User
who wishes to update the worklog and
the ErrorCollection
that will contain any errors
in calling the methodworklogResult
- result of the call to WorklogService.validateUpdate(com.atlassian.jira.bc.JiraServiceContext, WorklogInputParameters)
which contains the Worklog
to updatedispatchEvent
- whether or not you want to have an event dispatched on Worklog updateprotected boolean delete(JiraServiceContext jiraServiceContext, WorklogResult worklogResult, Long newEstimate, boolean dispatchEvent)
protected Worklog update(JiraServiceContext jiraServiceContext, WorklogResult worklogResult, Long newEstimate, boolean dispatchEvent)
public WorklogResult validateCreate(JiraServiceContext jiraServiceContext, WorklogInputParameters params)
WorklogService
WorklogService.hasPermissionToCreate(com.atlassian.jira.bc.JiraServiceContext, com.atlassian.jira.issue.Issue, boolean)
to create a worklog for this issue.validateCreate
in interface WorklogService
jiraServiceContext
- containing the user who wishes to create a worklog and the errorCollection
that will contain any errors in calling the methodparams
- parameter object that contains all the values required to validatepublic WorklogNewEstimateResult validateCreateWithNewEstimate(JiraServiceContext jiraServiceContext, WorklogNewEstimateInputParameters params)
WorklogService
WorklogService.hasPermissionToCreate(com.atlassian.jira.bc.JiraServiceContext, com.atlassian.jira.issue.Issue, boolean)
to create a worklog for this issue.validateCreateWithNewEstimate
in interface WorklogService
jiraServiceContext
- containing the user who wishes to create a worklog and the errorCollection
that will contain any errors in calling the methodparams
- parameter object that contains all the values required to validatepublic WorklogAdjustmentAmountResult validateCreateWithManuallyAdjustedEstimate(JiraServiceContext jiraServiceContext, WorklogAdjustmentAmountInputParameters params)
WorklogService
WorklogService.hasPermissionToCreate(com.atlassian.jira.bc.JiraServiceContext, com.atlassian.jira.issue.Issue, boolean)
to create a worklog for this issue.validateCreateWithManuallyAdjustedEstimate
in interface WorklogService
jiraServiceContext
- containing the user who wishes to create a worklog and the errorCollection
that will contain any errors in calling the methodparams
- parameter object that contains all the values required to validatepublic Worklog createWithNewRemainingEstimate(JiraServiceContext jiraServiceContext, WorklogNewEstimateResult worklogResult, boolean dispatchEvent)
WorklogService
Worklog
on the given Issue
. This method will
adjust the issues remaining estimate to be the new value which has been passed to this method, the old
remaining estimate value will be lost.createWithNewRemainingEstimate
in interface WorklogService
jiraServiceContext
- containing the User
who wishes to create a worklog and
the ErrorCollection
that will contain any errors in calling the methodworklogResult
- the Worklog and new estimate for the issue.dispatchEvent
- whether or not you want to have an event dispatched on Worklog creationWorklogService.validateCreateWithNewEstimate(com.atlassian.jira.bc.JiraServiceContext, WorklogNewEstimateInputParameters)
public Worklog createWithManuallyAdjustedEstimate(JiraServiceContext jiraServiceContext, WorklogAdjustmentAmountResult worklogResult, boolean dispatchEvent)
WorklogService
Worklog
on the given Issue
. This method will
adjust the issues remaining estimate by reducing by the adjustmentAmount which has been passed to this method.
Before calling this method, you must call validateCreateWithManuallyAdjustedEstimate() to ensure that the
creation is OK.createWithManuallyAdjustedEstimate
in interface WorklogService
jiraServiceContext
- containing the User
who wishes to create a worklog and
the ErrorCollection
that will contain any errors in calling the methodworklogResult
- the Worklog and adjustmentAmount for the issue.dispatchEvent
- whether or not you want to have an event dispatched on Worklog creationWorklogService.validateCreateWithManuallyAdjustedEstimate(com.atlassian.jira.bc.JiraServiceContext, com.atlassian.jira.bc.issue.worklog.WorklogAdjustmentAmountInputParameters)
public Worklog createAndRetainRemainingEstimate(JiraServiceContext jiraServiceContext, WorklogResult worklogResult, boolean dispatchEvent)
WorklogService
Worklog
on the given Issue
. This method will
make no adjustment to the issues remaining estimate.createAndRetainRemainingEstimate
in interface WorklogService
jiraServiceContext
- containing the User
who wishes to create a worklog and
the ErrorCollection
that will contain any errors in calling the methodworklogResult
- the WorklogResult generated by the validate calldispatchEvent
- whether or not you want to have an event dispatched on Worklog creation @return the created Worklog object, or null if no object created.public Worklog createAndAutoAdjustRemainingEstimate(JiraServiceContext jiraServiceContext, WorklogResult worklogResult, boolean dispatchEvent)
WorklogService
Worklog
on the given Issue
. This method will
auto-adjust the issues remaining estimate based on the value of the time spent on the work.createAndAutoAdjustRemainingEstimate
in interface WorklogService
jiraServiceContext
- containing the User
who wishes to create a worklog and
the ErrorCollection
that will contain any errors in calling the methodworklogResult
- the WorklogResult generated by the validate calldispatchEvent
- whether or not you want to have an event dispatched on Worklog creation @return the created Worklog object, or null if no object created.public boolean hasPermissionToCreate(JiraServiceContext jiraServiceContext, Issue issue, boolean isEditableCheckRequired)
WorklogService
Permissions.WORK_ISSUE
permission,
that timetracking is enabled in JIRA and that the associated issue is in an editable workflow state.hasPermissionToCreate
in interface WorklogService
jiraServiceContext
- containing the User
who wishes to create a worklog and
the ErrorCollection
that will contain any errors in calling the methodissue
- the issue to add the worklog toisEditableCheckRequired
- set to true if we require the issue to be in an editable state. This should always
be the case except when logging work on transitionpublic boolean hasPermissionToUpdate(JiraServiceContext jiraServiceContext, Worklog worklog)
WorklogService
In case of errors, add error messages to the error collection within the servicecontext.
Passing in null worklog or a worklog with null ID will return false and an error message will be added to the error collection.
Passing in null error collection will throw NPE.
This method will return true if the user is a member of the worklog's group/role level (if specified) AND
Permissions.WORKLOG_EDIT_ALL
permission; ORWorklog
author and has the Permissions.WORKLOG_EDIT_OWN
permissionhasPermissionToUpdate
in interface WorklogService
jiraServiceContext
- containing the User
who wishes to update the worklog and
the ErrorCollection
that will contain any errors
in calling the methodworklog
- the Worklog
the user wishes to updatepublic boolean hasPermissionToDelete(JiraServiceContext jiraServiceContext, Worklog worklog)
WorklogService
In case of errors, add error messages to the error collection within the servicecontext.
Passing in null worklog or a worklog with null ID will return false and an error message will be added to the error collection.
Passing in null error collection will throw NPE.
This method will return true if the user is a member of the worklog's group/role level (if specified) AND
Permissions.WORKLOG_DELETE_ALL
permission; ORWorklog
author and has the Permissions.WORKLOG_DELETE_OWN
permissionhasPermissionToDelete
in interface WorklogService
jiraServiceContext
- containing the User
who wishes to delete the worklog and
the ErrorCollection
that will contain any errors
in calling the methodworklog
- the Worklog
the user wishes to deletepublic Worklog getById(JiraServiceContext jiraServiceContext, Long id)
WorklogService
getById
in interface WorklogService
jiraServiceContext
- containing the User
who wishes to create a worklog and
the ErrorCollection
that will contain any errors in calling the methodid
- uniquely identifies the worklogpublic List getByIssue(JiraServiceContext jiraServiceContext, Issue issue)
WorklogService
getByIssue
in interface WorklogService
jiraServiceContext
- containing the User
who wishes to create a worklog and
the ErrorCollection
that will contain any errors in calling the methodissue
- the specified parent issue (not null)public List<Worklog> getByIssueVisibleToUser(JiraServiceContext jiraServiceContext, Issue issue)
WorklogService
getByIssueVisibleToUser
in interface WorklogService
jiraServiceContext
- containing the User
who wishes to create a worklog and
the ErrorCollection
that will contain any errors in calling the methodissue
- the specified parent issue (not null)public PagedList<Worklog> getByIssueVisibleToUser(JiraServiceContext jiraServiceContext, Issue issue, int pageSize)
WorklogService
getByIssueVisibleToUser
in interface WorklogService
jiraServiceContext
- containing the User
who wishes to create a worklog and
the ErrorCollection
that will contain any errors in calling the methodissue
- the specified parent issue (not null)pageSize
- the number of worklogs per pagepublic boolean isTimeTrackingEnabled()
WorklogService
APKeys.JIRA_OPTION_TIMETRACKING
is true, false
otherwise.isTimeTrackingEnabled
in interface WorklogService
public boolean isIssueInEditableWorkflowState(Issue issue)
WorklogService
isIssueInEditableWorkflowState
in interface WorklogService
issue
- the issue to see if it is in an editable storepublic WorklogChangedSincePage<Worklog> getWorklogsUpdatedSince(ApplicationUser user, Long sinceInMilliseconds)
WorklogService
WorklogManager.WORKLOG_UPDATE_DATA_PAGE_SIZE
elements, in order
to get more elements, execute this method again with which is equal to the updated time of the last element
in the result.
This won't return worklogs updated within last minute.getWorklogsUpdatedSince
in interface WorklogService
user
- user retrieving the list of modified worklogs since a qiven time expressed in miliseconds.sinceInMilliseconds
- the time (measured as a difference between the timestamp and midnight, January 1, 1970 UTC)
since which the modified worklogs will be returned.public WorklogChangedSincePage<DeletedWorklog> getWorklogsDeletedSince(ApplicationUser user, Long sinceInMilliseconds)
WorklogService
WorklogManager.WORKLOG_UPDATE_DATA_PAGE_SIZE
elements, in order
to get more elements, execute this method again with which is equal to removal time of the last element
in the result.
This won't return worklogs updated within last minute.getWorklogsDeletedSince
in interface WorklogService
user
- user retrieving the list of deleted worklogs since a qiven time expressed in milliseconds.sinceInMilliseconds
- the time (measured as a difference between the timestamp and midnight, January 1, 1970 UTC)
since which the deleted worklogs will be returned.public ServiceOutcome<Set<Worklog>> getWorklogsForIds(JiraServiceContext jiraServiceContext, Set<Long> idsOfWorklogs)
WorklogService
WorklogManager.WORKLOG_UPDATE_DATA_PAGE_SIZE
elements,
in order to get more elements, execute this method again providing ids of other Worklog
to retrieve.getWorklogsForIds
in interface WorklogService
jiraServiceContext
- containing the User
who wishes to create a worklog and
the ErrorCollection
that will contain any errors in calling the methodidsOfWorklogs
- set of ids for which worklogs will be returned.protected Worklog validateParamsAndCreateWorklog(JiraServiceContext jiraServiceContext, Issue issue, ApplicationUser author, Visibility visibility, String timeSpent, Date startDate, Long worklogId, String comment, Date created, Date updated, ApplicationUser updateAuthor, String errorFieldPrefix)
protected Worklog create(JiraServiceContext jiraServiceContext, WorklogResult worklogResult, Long newEstimate, boolean dispatchEvent)
protected boolean hasEditOwnPermission(ApplicationUser user, Worklog worklog)
protected boolean hasViewPermission(ApplicationUser user, Issue issue)
protected boolean hasEditAllPermission(ApplicationUser user, Issue issue)
protected boolean hasDeleteOwnPermission(ApplicationUser user, Worklog worklog)
protected boolean hasDeleteAllPermission(ApplicationUser user, Issue issue)
protected boolean isSameAuthor(ApplicationUser user, Worklog worklog)
protected Long getAutoAdjustNewEstimateOnUpdate(Issue issue, Long newTimeSpent, Long originalTimeSpent)
protected boolean isValidNewEstimate(JiraServiceContext jiraServiceContext, String newEstimate)
protected boolean isValidNewEstimate(JiraServiceContext jiraServiceContext, String newEstimate, String errorFieldPrefix)
protected boolean isValidAdjustmentAmount(JiraServiceContext jiraServiceContext, String adjustmentAmount)
jiraServiceContext
- JiraServiceContextadjustmentAmount
- String with amount of time eg "3d 4h"protected boolean isValidAdjustmentAmount(JiraServiceContext jiraServiceContext, String adjustmentAmount, String errorFieldPrefix)
jiraServiceContext
- JiraServiceContextadjustmentAmount
- String with amount of time eg "3d 4h"errorFieldPrefix
- the prefix for the error fieldprotected boolean isValidWorklogInputFields(JiraServiceContext jiraServiceContext, Issue issue, String timeSpent, Date startDate, String errorFieldPrefix)
protected long getDurationForFormattedString(String timeSpent, JiraServiceContext jiraServiceContext)
protected boolean isUserInGroup(ApplicationUser user, String groupLevel)
protected boolean isUserInRole(Long roleLevel, ApplicationUser user, Issue issue)
Copyright © 2002-2021 Atlassian. All Rights Reserved.