/** * Used for copying the {@link WorklogResult} received from the base <code>validate</code> method and adding on the * <code>newEstimate</code>. * * @param worklogResult the worklog result to copy; must not be null. * @param newEstimate the new estimate in seconds * @return Creates a {@link WorklogResult} that contains the {@link Worklog} and the new estimate. The editable check will be required. */ public static WorklogNewEstimateResult createNewEstimate(final WorklogResult worklogResult, final Long newEstimate) { notNull("worklogResult", worklogResult); return createNewEstimate(worklogResult.getWorklog(), newEstimate, worklogResult.isEditableCheckRequired()); }
/** * Used for copying the {@link WorklogResult} received from the base <code>validate</code> method and adding on the * <code>adjustmentAmount</code>. * * @param worklogResult the worklog result to copy; must not be null. * @param adjustmentAmount the adjustment amount in seconds * @return Creates a {@link WorklogResult} that contains the {@link Worklog} and the adjustment amount. The editable check will be required. */ public static WorklogAdjustmentAmountResult createAdjustmentAmount(final WorklogResult worklogResult, final Long adjustmentAmount) { notNull("worklogResult", worklogResult); return createAdjustmentAmount(worklogResult.getWorklog(), adjustmentAmount, worklogResult.isEditableCheckRequired()); }
protected Worklog create(JiraServiceContext jiraServiceContext, WorklogResult worklogResult, Long newEstimate, boolean dispatchEvent) { Worklog newWorklog = null; ApplicationUser user = jiraServiceContext.getLoggedInApplicationUser(); 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; } // Re-do the permission check if (hasPermissionToCreate(jiraServiceContext, worklogResult.getWorklog().getIssue(), worklogResult.isEditableCheckRequired())) { newWorklog = worklogManager.create(user, worklogResult.getWorklog(), newEstimate, dispatchEvent); } return newWorklog; }