@Override public boolean deleteWithManuallyAdjustedEstimate(JiraServiceContext jiraServiceContext, WorklogAdjustmentAmountResult worklogResult, boolean dispatchEvent) { ErrorCollection errorCollection = jiraServiceContext.getErrorCollection(); if (worklogResult == null || worklogResult.getWorklog() == null) { errorCollection.addErrorMessage(getText(jiraServiceContext, "worklog.service.error.worklog.null")); return false; } if (worklogResult.getWorklog().getIssue() == null) { errorCollection.addErrorMessage(getText(jiraServiceContext, "worklog.service.error.issue.null")); return false; } // Calculate the new remaining estimate Long newEstimate = increaseEstimate(worklogResult.getWorklog().getIssue(), worklogResult.getAdjustmentAmount()); return delete(jiraServiceContext, worklogResult, newEstimate, dispatchEvent); }
@Override public Worklog createWithManuallyAdjustedEstimate(final JiraServiceContext jiraServiceContext, final WorklogAdjustmentAmountResult worklogResult, final boolean dispatchEvent) { ErrorCollection errorCollection = jiraServiceContext.getErrorCollection(); if (worklogResult == null || worklogResult.getWorklog() == null) { errorCollection.addErrorMessage(getText(jiraServiceContext, "worklog.service.error.worklog.null")); return null; } if (worklogResult.getWorklog().getIssue() == null) { errorCollection.addErrorMessage(getText(jiraServiceContext, "worklog.service.error.issue.null")); return null; } // Calculate the new remaining estimate final Worklog worklog = worklogResult.getWorklog(); Long newEstimate = reduceEstimate(worklog.getIssue(), worklogResult.getAdjustmentAmount()); return create(jiraServiceContext, worklogResult, newEstimate, dispatchEvent); }