@Override public WorklogResult validateUpdate(JiraServiceContext jiraServiceContext, final WorklogInputParameters params) { notNull("params", params); Worklog originalWorklog = worklogManager.getById(params.getWorklogId()); ApplicationUser user = jiraServiceContext.getLoggedInApplicationUser(); // Does the user have permission to edit a worklog if (hasPermissionToUpdate(jiraServiceContext, originalWorklog)) { Worklog updatedWorklog = validateParamsAndCreateWorklog(jiraServiceContext, originalWorklog.getIssue(), originalWorklog.getAuthorObject(), params.getVisibility(), params.getTimeSpent(), params.getStartDate(), params.getWorklogId(), params.getComment(), originalWorklog.getCreated(), new Date(), user, params.getErrorFieldPrefix()); if (updatedWorklog != null) { return WorklogResultFactory.create(updatedWorklog); } } return null; }
@Override public WorklogResult validateCreate(JiraServiceContext jiraServiceContext, WorklogInputParameters params) { ApplicationUser user = jiraServiceContext.getLoggedInApplicationUser(); // Does the user have permission to create a worklog if (hasPermissionToCreate(jiraServiceContext, params.getIssue(), params.isEditableCheckRequired())) { Worklog worklog = validateParamsAndCreateWorklog(jiraServiceContext, params.getIssue(), user, params.getVisibility(), params.getTimeSpent(), params.getStartDate(), null, params.getComment(), null, null, null, params.getErrorFieldPrefix()); if (worklog != null) { return WorklogResultFactory.create(worklog, params.isEditableCheckRequired()); } } return null; }