@Override public Worklog validateAndPerformAndSetNewEstimate(JiraServiceContext serviceContext, Issue issue, WorklogInputParameters worklogInputParameters) { WorklogNewEstimateResult worklogResult = getWorklogService().validateUpdateWithNewEstimate(serviceContext, (WorklogNewEstimateInputParameters) worklogInputParameters); return getWorklogService().updateWithNewRemainingEstimate(serviceContext, worklogResult, true); }
@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.updateAndAutoAdjustRemainingEstimate(getJiraServiceContext(), worklogResult, true); } else if (ADJUST_ESTIMATE_NEW.equalsIgnoreCase(adjustEstimate)) { worklogService.updateWithNewRemainingEstimate(getJiraServiceContext(), (WorklogNewEstimateResult) worklogResult, true); } else { worklogService.updateAndRetainRemainingEstimate(getJiraServiceContext(), worklogResult, true); } if (getHasErrorMessages()) { return ERROR; } if (isInlineDialogMode()) { return returnComplete(); } return getRedirect("/browse/" + getIssue().getString("key")); }
public void updateWorklogWithNewRemainingEstimate(User user, RemoteWorklog remoteWorklog, String newRemainingEstimate) throws RemoteException, RemotePermissionException, RemoteValidationException { JiraServiceContext serviceContext = new JiraServiceContextImpl(user, new SimpleErrorCollection()); Long id = SoapUtils.toLongRequired(remoteWorklog.getId()); String timeSpent = remoteWorklog.getTimeSpent(); Date startDate = remoteWorklog.getStartDate(); String comment = remoteWorklog.getComment(); String groupLevel = remoteWorklog.getGroupLevel(); String roleLevelId = remoteWorklog.getRoleLevelId(); final WorklogNewEstimateInputParameters params = WorklogInputParametersImpl .timeSpent(timeSpent) .worklogId(id) .startDate(startDate) .comment(comment) .groupLevel(groupLevel) .roleLevelId(roleLevelId) .newEstimate(newRemainingEstimate) .buildNewEstimate(); WorklogNewEstimateResult worklogResult = worklogService.validateUpdateWithNewEstimate(serviceContext, params); checkAndThrowValidationException(serviceContext.getErrorCollection()); if (worklogResult == null) { throw new RemoteValidationException(getI18nHelper().getText("error.unexpected.condition", "WorklogService.validateUpdateWithNewEstimate")); } worklogService.updateWithNewRemainingEstimate(serviceContext, worklogResult, true); checkAndThrowRemoteException(serviceContext.getErrorCollection()); }