com.atlassian.jira.issue.fields.rest
Class AbstractFieldOperationsHandler<T>

java.lang.Object
  extended by com.atlassian.jira.issue.fields.rest.AbstractFieldOperationsHandler<T>
All Implemented Interfaces:
RestFieldOperationsHandler
Direct Known Subclasses:
AbstractVersionsRestFieldOperationsHandler, AssigneeRestFieldOperationsHandler, ComponentsRestFieldOperationsHandler, DescriptionRestFieldOperationsHandler, DueDateRestFieldOperationsHandler, EnvironmentRestFieldOperationsHandler, LabelsRestFieldOperationsHandler, PriorityRestFieldOperationsHandler, ReporterRestFieldOperationsHandler, ResolutionRestFieldOperationsHandler, SecurityLevelRestFieldOperationsHandler, SingleVersionCustomFieldOperationsHandler, SummaryRestFieldOperationsHandler

public abstract class AbstractFieldOperationsHandler<T>
extends Object
implements RestFieldOperationsHandler

Since:
v5.0

Field Summary
protected  I18nHelper i18nHelper
           
 
Constructor Summary
AbstractFieldOperationsHandler(I18nHelper i18nHelper)
           
 
Method Summary
protected  T applyOperation(IssueContext issueCtx, Issue issue, String fieldId, StandardOperation operation, T currentFieldValue, JsonData operationValue, ErrorCollection errors)
          gets called (perhaps multiple times) to apply the given operation to the given currentValuye, retyrning the new value
protected abstract  void finaliseOperation(T finalValue, IssueInputParameters parameters, ErrorCollection errors)
          takes the valuye returnd by a call to applyOperation() and puts it into the inputparams
protected abstract  T getInitialCreateValue()
          compute the "currentValue" to be passed to applyOperation()
protected abstract  T getInitialValue(Issue issue, ErrorCollection errors)
          compute the "currentValue" to be passed to applyOperation()
protected  T handleAddOperation(IssueContext issueCtx, Issue issue, String fieldId, T currentFieldValue, JsonData operationValue, ErrorCollection errors)
           
protected  T handleRemoveOperation(IssueContext issueCtx, Issue issue, String fieldId, T currentFieldValue, JsonData operationValue, ErrorCollection errors)
           
protected  T handleSetOperation(IssueContext issueCtx, Issue issue, String fieldId, T currentFieldValue, JsonData operationValue, ErrorCollection errors)
           
protected  Long[] toLongIds(Collection<String> ids, String fieldName, ErrorCollection errors)
           
 ErrorCollection updateIssueInputParameters(IssueContext issueCtx, Issue issue, String fieldId, IssueInputParameters inputParameters, List<FieldOperationHolder> operations)
          This method has to set the field value(s) in the IssueInputParameters based on the operations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.jira.issue.fields.rest.RestFieldOperationsHandler
getSupportedOperations
 

Field Detail

i18nHelper

protected final I18nHelper i18nHelper
Constructor Detail

AbstractFieldOperationsHandler

public AbstractFieldOperationsHandler(I18nHelper i18nHelper)
Method Detail

getInitialValue

protected abstract T getInitialValue(Issue issue,
                                     ErrorCollection errors)
compute the "currentValue" to be passed to applyOperation()


getInitialCreateValue

protected abstract T getInitialCreateValue()
compute the "currentValue" to be passed to applyOperation()


finaliseOperation

protected abstract void finaliseOperation(T finalValue,
                                          IssueInputParameters parameters,
                                          ErrorCollection errors)
takes the valuye returnd by a call to applyOperation() and puts it into the inputparams


updateIssueInputParameters

public ErrorCollection updateIssueInputParameters(IssueContext issueCtx,
                                                  Issue issue,
                                                  String fieldId,
                                                  IssueInputParameters inputParameters,
                                                  List<FieldOperationHolder> operations)
Description copied from interface: RestFieldOperationsHandler
This method has to set the field value(s) in the IssueInputParameters based on the operations. The issue service will validate the new field values in the IssueInputParameters, thus all permission checks are done by the issue service.

Specified by:
updateIssueInputParameters in interface RestFieldOperationsHandler
Parameters:
issueCtx - the Issue Context , i.e. Project IssueType
issue - the issue (may be null when creating an issue)
fieldId - The Id of the field being processed.
inputParameters - the inputparameters containing all updatd field values.
operations - the operations to perform for this field. Has to be one of the supported operations.
Returns:
contains errors, if there was a problem when setting the field values on the IssueInputParameters. No errors if it was able to update the IssueInputParameters.

applyOperation

protected T applyOperation(IssueContext issueCtx,
                           Issue issue,
                           String fieldId,
                           StandardOperation operation,
                           T currentFieldValue,
                           JsonData operationValue,
                           ErrorCollection errors)
gets called (perhaps multiple times) to apply the given operation to the given currentValuye, retyrning the new value


handleRemoveOperation

protected T handleRemoveOperation(IssueContext issueCtx,
                                  Issue issue,
                                  String fieldId,
                                  T currentFieldValue,
                                  JsonData operationValue,
                                  ErrorCollection errors)

handleSetOperation

protected T handleSetOperation(IssueContext issueCtx,
                               Issue issue,
                               String fieldId,
                               T currentFieldValue,
                               JsonData operationValue,
                               ErrorCollection errors)

handleAddOperation

protected T handleAddOperation(IssueContext issueCtx,
                               Issue issue,
                               String fieldId,
                               T currentFieldValue,
                               JsonData operationValue,
                               ErrorCollection errors)

toLongIds

protected Long[] toLongIds(Collection<String> ids,
                           String fieldName,
                           ErrorCollection errors)


Copyright © 2002-2013 Atlassian. All Rights Reserved.