@Override public WorklogNewEstimateResult validateCreateWithNewEstimate(JiraServiceContext jiraServiceContext, WorklogNewEstimateInputParameters params) { WorklogResult worklogResult = validateCreate(jiraServiceContext, params); if (isValidNewEstimate(jiraServiceContext, params.getNewEstimate(), params.getErrorFieldPrefix()) && worklogResult != null) { final Long estimate = (params.getNewEstimate() == null) ? null : getDurationForFormattedString(params.getNewEstimate(), jiraServiceContext); return WorklogResultFactory.createNewEstimate(worklogResult, estimate); } return null; }
@Override public WorklogAdjustmentAmountResult validateCreateWithManuallyAdjustedEstimate(JiraServiceContext jiraServiceContext, WorklogAdjustmentAmountInputParameters params) { WorklogResult worklogResult = validateCreate(jiraServiceContext, params); if (isValidAdjustmentAmount(jiraServiceContext, params.getAdjustmentAmount(), params.getErrorFieldPrefix()) && worklogResult != null) { return WorklogResultFactory.createAdjustmentAmount(worklogResult, getDurationForFormattedString(params.getAdjustmentAmount(), jiraServiceContext)); } return null; }
@Override public Worklog validateAndPerformAndSetNewEstimate(JiraServiceContext serviceContext, Issue issue, WorklogInputParameters worklogInputParameters) { WorklogNewEstimateResult worklogResult = getWorklogService().validateDeleteWithNewEstimate(serviceContext, worklogInputParameters.getWorklogId(), ((WorklogNewEstimateInputParameters) worklogInputParameters).getNewEstimate()); boolean success = getWorklogService().deleteWithNewRemainingEstimate(serviceContext, worklogResult, true); return success ? worklogResult.getWorklog() : null; }
@Override public Worklog validateAndPerformAndAutoAdjustEstimate(JiraServiceContext serviceContext, Issue issue, WorklogInputParameters worklogInputParameters) { WorklogResult worklogResult = getWorklogService().validateDelete(serviceContext, worklogInputParameters.getWorklogId()); boolean success = getWorklogService().deleteAndAutoAdjustRemainingEstimate(serviceContext, worklogResult, true); return success ? worklogResult.getWorklog() : null; }
@Override public Worklog validateAndPerformAndLeaveEstimate(JiraServiceContext serviceContext, Issue issue, WorklogInputParameters worklogInputParameters) { WorklogResult worklogResult = getWorklogService().validateDelete(serviceContext, worklogInputParameters.getWorklogId()); boolean success = getWorklogService().deleteAndRetainRemainingEstimate(serviceContext, worklogResult, true); return success ? worklogResult.getWorklog() : null; }
@Override public Worklog validateAndPerformAndManualAdjustEstimate(JiraServiceContext serviceContext, Issue issue, WorklogInputParameters worklogInputParameters) { WorklogAdjustmentAmountResult worklogResult = getWorklogService().validateDeleteWithManuallyAdjustedEstimate(serviceContext, worklogInputParameters.getWorklogId(), ((WorklogAdjustmentAmountInputParameters) worklogInputParameters).getAdjustmentAmount()); boolean success = getWorklogService().deleteWithManuallyAdjustedEstimate(serviceContext, worklogResult, true); return success ? worklogResult.getWorklog() : null; }
@Override public WorklogNewEstimateResult validateUpdateWithNewEstimate(JiraServiceContext jiraServiceContext, final WorklogNewEstimateInputParameters params) { notNull("params", params); WorklogResult worklogResult = validateUpdate(jiraServiceContext, params); if (isValidNewEstimate(jiraServiceContext, params.getNewEstimate(), params.getErrorFieldPrefix()) && worklogResult != null) { final Long estimate = (params.getNewEstimate() == null) ? null : getDurationForFormattedString(params.getNewEstimate(), jiraServiceContext); return WorklogResultFactory.createNewEstimate(worklogResult, estimate); } return null; }
@Override public WorklogAdjustmentAmountResult validateDeleteWithManuallyAdjustedEstimate(JiraServiceContext jiraServiceContext, Long worklogId, String adjustmentAmount) { WorklogResult originalWorklogResult = validateDelete(jiraServiceContext, worklogId); if (originalWorklogResult != null && isValidAdjustmentAmount(jiraServiceContext, adjustmentAmount)) { return WorklogResultFactory.createAdjustmentAmount(originalWorklogResult, getDurationForFormattedString(adjustmentAmount, jiraServiceContext)); } return null; }
@Override public WorklogNewEstimateResult validateDeleteWithNewEstimate(JiraServiceContext jiraServiceContext, Long worklogId, String newEstimate) { WorklogResult originalWorklogResult = validateDelete(jiraServiceContext, worklogId); if (originalWorklogResult != null && isValidNewEstimate(jiraServiceContext, newEstimate)) { final Long estimate = (newEstimate == null) ? null : getDurationForFormattedString(newEstimate, jiraServiceContext); return WorklogResultFactory.createNewEstimate(originalWorklogResult, estimate); } return null; }
/** * Use this method to build the base {@link WorklogInputParameters} object. * * @return a {@link WorklogInputParameters} object with the built parameters. */ public WorklogInputParameters build() { return new WorklogInputParametersImpl(worklogId, issue, timeSpent, startDate, comment, groupLevel, roleLevelId, getVisibility(), null, null, editableCheckRequired, errorFieldPrefix); }
@Override public Worklog updateWithNewRemainingEstimate(JiraServiceContext jiraServiceContext, WorklogNewEstimateResult worklogResult, boolean dispatchEvent) { return update(jiraServiceContext, worklogResult, worklogResult.getNewEstimate(), dispatchEvent); }
@Override public Worklog createWithNewRemainingEstimate(JiraServiceContext jiraServiceContext, WorklogNewEstimateResult worklogResult, boolean dispatchEvent) { return create(jiraServiceContext, worklogResult, worklogResult.getNewEstimate(), dispatchEvent); }
@Override public boolean deleteWithNewRemainingEstimate(JiraServiceContext jiraServiceContext, WorklogNewEstimateResult worklogNewEstimate, boolean dispatchEvent) { return delete(jiraServiceContext, worklogNewEstimate, worklogNewEstimate.getNewEstimate(), dispatchEvent); }
/** * Used for creating {@link WorklogResult} objects that also capture a <code>newEstimate</code> to be set. * * @param worklog the worklog * @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 Worklog worklog, final Long newEstimate) { return createNewEstimate(worklog, newEstimate, true); }
/** * Used for creating {@link WorklogResult} objects that also capture a <code>adjustmentAmount</code> to be set. * * @param worklog the worklog * @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 Worklog worklog, final Long adjustmentAmount) { return createAdjustmentAmount(worklog, adjustmentAmount, true); }
/** * Used for creating {@link WorklogResult} objects that also capture a <code>newEstimate</code> to be set. * * @param worklog the worklog * @param newEstimate the new estimate in seconds * @param isEditableCheckRequired flag to set on the result * @return Creates a {@link WorklogResult} that contains the {@link Worklog}, the new estimate and the flag for the editable check. */ public static WorklogNewEstimateResult createNewEstimate(final Worklog worklog, final Long newEstimate, final boolean isEditableCheckRequired) { return new WorklogResultImpl(worklog, isEditableCheckRequired, newEstimate, null); }
/** * Use this method to build the {@link WorklogNewEstimateInputParameters} object required for the "new estimate" * service calls. * * @return a {@link WorklogNewEstimateInputParameters} object with the built parameters. */ public WorklogNewEstimateInputParameters buildNewEstimate() { return new WorklogInputParametersImpl(worklogId, issue, timeSpent, startDate, comment, groupLevel, roleLevelId, getVisibility(), newEstimate, null, editableCheckRequired, errorFieldPrefix); }
/** * Will build the {@link WorklogInputParameters} object and pass in every variable independent of which * adjustment option you have picked. * * @return a {@link WorklogInputParameters} object with the built parameters. */ public WorklogInputParameters buildAll() { return new WorklogInputParametersImpl(worklogId, issue, timeSpent, startDate, comment, groupLevel, roleLevelId, getVisibility(), newEstimate, adjustmentAmount, editableCheckRequired, errorFieldPrefix); }
/** * Use this method to build the {@link WorklogAdjustmentAmountInputParameters} object required for the * "manual adjustment" (or "adjustment amount") service calls. * * @return a {@link WorklogAdjustmentAmountInputParameters} object with the built parameters. */ public WorklogAdjustmentAmountInputParameters buildAdjustmentAmount() { return new WorklogInputParametersImpl(worklogId, issue, timeSpent, startDate, comment, groupLevel, roleLevelId, getVisibility(), null, adjustmentAmount, editableCheckRequired, errorFieldPrefix); }