@Override public Worklog validateAndPerformAndLeaveEstimate(JiraServiceContext serviceContext, Issue issue, WorklogInputParameters worklogInputParameters) { WorklogResult worklogResult = getWorklogService().validateCreate(serviceContext, worklogInputParameters); return getWorklogService().createAndRetainRemainingEstimate(serviceContext, worklogResult, true); }
worklog = worklogService.createAndRetainRemainingEstimate(getJiraServiceContext(), worklogResult, true);
public void createValue(Issue issue, WorklogValue value) { final WorklogResult worklogResult = value.worklogResult(); // note that we don't expect this to be actually used but we need to pass it anyway final JiraServiceContext jiraServiceContext = new JiraServiceContextImpl(authenticationContext.getUser()); // Based on how the user wants to update the remaining estimate we will call the correct do method on the service switch (value.adjustEstimate()) { case LEAVE: getWorklogService().createAndRetainRemainingEstimate(jiraServiceContext, worklogResult, true); break; case NEW: getWorklogService().createWithNewRemainingEstimate(jiraServiceContext, (WorklogNewEstimateResult) worklogResult, true); break; case MANUAL: getWorklogService().createWithManuallyAdjustedEstimate(jiraServiceContext, (WorklogAdjustmentAmountResult) worklogResult, true); break; default : getWorklogService().createAndAutoAdjustRemainingEstimate(jiraServiceContext, worklogResult, true); } }
public RemoteWorklog addWorklogAndRetainRemainingEstimate(final User user, final String issueKey, final RemoteWorklog remoteWorklog) throws RemoteException, RemotePermissionException, RemoteValidationException { JiraServiceContext serviceContext = new JiraServiceContextImpl(user, new SimpleErrorCollection()); Issue issue = getIssueFromKey(issueKey); String timeSpent = remoteWorklog.getTimeSpent(); Date startDate = remoteWorklog.getStartDate(); String comment = remoteWorklog.getComment(); String groupLevel = remoteWorklog.getGroupLevel(); String roleLevelId = remoteWorklog.getRoleLevelId(); WorklogInputParameters params = WorklogInputParametersImpl .issue(issue) .timeSpent(timeSpent) .startDate(startDate) .comment(comment) .groupLevel(groupLevel) .roleLevelId(roleLevelId) .build(); WorklogResult worklogResult = worklogService.validateCreate(serviceContext, params); checkAndThrowValidationException(serviceContext.getErrorCollection()); if (worklogResult == null) { throw new RemoteValidationException(getI18nHelper().getText("error.unexpected.condition", "WorklogService.validateCreate")); } Worklog createdWorklog = worklogService.createAndRetainRemainingEstimate(serviceContext, worklogResult, true); checkAndThrowRemoteException(serviceContext.getErrorCollection()); return RemoteWorklogImpl.copyToRemoteWorkLog(createdWorklog, getJiraDurationUtils()); }