@Override public Worklog validateAndPerformAndAutoAdjustEstimate(JiraServiceContext serviceContext, Issue issue, WorklogInputParameters worklogInputParameters) { WorklogResult worklogResult = getWorklogService().validateDelete(serviceContext, worklogInputParameters.getWorklogId()); boolean success = getWorklogService().deleteAndAutoAdjustRemainingEstimate(serviceContext, worklogResult, true); return success ? worklogResult.getWorklog() : null; }
@RequiresXsrfCheck protected String doExecute() throws Exception { // Based on how the user wants to update the remaining estimate we will call the correct do method on the service if (ADJUST_ESTIMATE_AUTO.equalsIgnoreCase(adjustEstimate)) { worklogService.deleteAndAutoAdjustRemainingEstimate(getJiraServiceContext(), worklogResult, true); } else if (ADJUST_ESTIMATE_NEW.equalsIgnoreCase(adjustEstimate)) { worklogService.deleteWithNewRemainingEstimate(getJiraServiceContext(), (WorklogNewEstimateResult) worklogResult, true); } else if (ADJUST_ESTIMATE_MANUAL.equalsIgnoreCase(adjustEstimate)) { worklogService.deleteWithManuallyAdjustedEstimate(getJiraServiceContext(), (WorklogAdjustmentAmountResult) worklogResult, true); } else { worklogService.deleteAndRetainRemainingEstimate(getJiraServiceContext(), worklogResult, true); } if (getHasErrorMessages()) { return ERROR; } if (isInlineDialogMode()) { return returnComplete(); } return getRedirect("/browse/" + getIssue().getString("key")); }
public void deleteWorklogAndAutoAdjustRemainingEstimate(User user, String remoteWorklogId) throws RemoteException, RemotePermissionException, RemoteValidationException { JiraServiceContext serviceContext = new JiraServiceContextImpl(user, new SimpleErrorCollection()); Long id = SoapUtils.toLongRequired(remoteWorklogId); WorklogResult worklogResult = worklogService.validateDelete(serviceContext, id); checkAndThrowValidationException(serviceContext.getErrorCollection()); if (worklogResult == null) { throw new RemoteValidationException(getI18nHelper().getText("error.unexpected.condition", "WorklogService.validateDelete")); } worklogService.deleteAndAutoAdjustRemainingEstimate(serviceContext, worklogResult, true); checkAndThrowRemoteException(serviceContext.getErrorCollection()); }