Class CustomFieldServiceImpl

java.lang.Object
com.atlassian.greenhopper.customfield.CustomFieldServiceImpl
All Implemented Interfaces:
CustomFieldService

@Service("gh-customFieldService") public class CustomFieldServiceImpl extends Object implements CustomFieldService
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final LoggerWrapper
     

    Fields inherited from interface com.atlassian.greenhopper.customfield.CustomFieldService

    SERVICE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.atlassian.jira.issue.fields.config.FieldConfigScheme
    associateCustomFieldContext(com.atlassian.jira.issue.fields.CustomField customField, CustomFieldMetadata customFieldMetadata)
    Re-associates the custom field to the specified contexts.
    com.atlassian.jira.issue.fields.config.FieldConfigScheme
    associateCustomFieldContext(com.atlassian.jira.issue.fields.CustomField customField, Collection<IssueTypePrototype> prototypes)
    Re-associates the custom field to the specified issue type specific contexts.
    com.atlassian.jira.issue.fields.CustomField
    Create a new custom field in JIRA with the given configuration
    com.atlassian.jira.issue.fields.CustomField
     
    com.atlassian.jira.issue.fields.CustomField
     
    <T extends com.atlassian.jira.issue.customfields.CustomFieldType>
    List<com.atlassian.jira.issue.fields.CustomField>
    Return all custom field instances which are of type CustomFieldService (but not sub-classes).
    <T extends com.atlassian.jira.issue.customfields.CustomFieldType>
    List<com.atlassian.jira.issue.fields.CustomField>
    getCustomFields(Class<T> type, boolean strict)
    Return all custom field instances which are of type CustomFieldService, or a subclass of CustomFieldService.
    boolean
    isFieldApplicable(com.atlassian.jira.issue.fields.CustomField customField, com.atlassian.jira.issue.Issue issue)
    Determine whether the given custom field is applicable for (i.e. configured for the context of) the specified issue.
    boolean
    isFieldApplicable(com.atlassian.jira.issue.fields.CustomField customField, Long projectId, String issueTypeId)
    Determine whether the given custom field is applicable for (i.e. configured for the context of) the specified project and issue type.
    boolean
    isFieldVisible(com.atlassian.jira.issue.fields.CustomField customField, com.atlassian.jira.issue.Issue issue)
     
    boolean
    Check whether the passed field name matches a system field name (as used by JQL)
    boolean
    isUniqueFieldName(com.atlassian.jira.issue.fields.CustomField customField)
    Has the custom field a unique name?
    void
    makeFieldRequired(com.atlassian.jira.issue.fields.CustomField field)
    Make the specified field required for all configurations
    void
    removeCustomField(com.atlassian.jira.issue.fields.CustomField customField)
    Removes the custom field and all associated data.
    void
    setOptionsOrderFromMetadata(com.atlassian.jira.issue.fields.CustomField customField, CustomFieldMetadata fieldMetadata)
    Set the order of Options in a CustomField based on the order of the Options in the CustomFieldMetadata.
    boolean
    Checks if a custom field with the given id exists in the database
    boolean
    Checks if a custom field with the given id exists in the database.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • CustomFieldServiceImpl

      public CustomFieldServiceImpl()
  • Method Details

    • createCustomField

      public com.atlassian.jira.issue.fields.CustomField createCustomField(CustomFieldMetadata fieldMetadata)
      Description copied from interface: CustomFieldService
      Create a new custom field in JIRA with the given configuration
      Specified by:
      createCustomField in interface CustomFieldService
    • associateCustomFieldContext

      public com.atlassian.jira.issue.fields.config.FieldConfigScheme associateCustomFieldContext(com.atlassian.jira.issue.fields.CustomField customField, CustomFieldMetadata customFieldMetadata)
      Description copied from interface: CustomFieldService
      Re-associates the custom field to the specified contexts. Warning - this has not been extensively tested in the case where the custom field already has some contexts. This is intended to be used when the custom field's contexts have been removed due to the removal of an issue type, for example.
      Specified by:
      associateCustomFieldContext in interface CustomFieldService
      Parameters:
      customField - the field instance
      customFieldMetadata - the metadata which contains context and issue type information
    • associateCustomFieldContext

      public com.atlassian.jira.issue.fields.config.FieldConfigScheme associateCustomFieldContext(com.atlassian.jira.issue.fields.CustomField customField, Collection<IssueTypePrototype> prototypes)
      Description copied from interface: CustomFieldService
      Re-associates the custom field to the specified issue type specific contexts. Warning - this has not been extensively tested in the case where the custom field already has some contexts. This is intended to be used when the custom field's contexts have been removed due to the removal of an issue type, for example.
      Specified by:
      associateCustomFieldContext in interface CustomFieldService
      Parameters:
      customField - the field instance
      prototypes - issue type information
    • setOptionsOrderFromMetadata

      public void setOptionsOrderFromMetadata(com.atlassian.jira.issue.fields.CustomField customField, CustomFieldMetadata fieldMetadata)
      Description copied from interface: CustomFieldService
      Set the order of Options in a CustomField based on the order of the Options in the CustomFieldMetadata. This is part of the work that is done in createCustomField, but split into a public method so we can fix up the order of Options after the fact in upgrade tasks, etc.
      Specified by:
      setOptionsOrderFromMetadata in interface CustomFieldService
    • getCustomField

      public com.atlassian.jira.issue.fields.CustomField getCustomField(Long id)
      Specified by:
      getCustomField in interface CustomFieldService
      Returns:
      the CustomField instance for the given ID, or null if it doesn't exist
    • getCustomField

      public com.atlassian.jira.issue.fields.CustomField getCustomField(String id)
      Specified by:
      getCustomField in interface CustomFieldService
      Returns:
      the CustomField instance for the given String ID, or null if it doesn't exist
    • removeCustomField

      public void removeCustomField(com.atlassian.jira.issue.fields.CustomField customField)
      Description copied from interface: CustomFieldService
      Removes the custom field and all associated data. Note that this requires the custom field to be fully recognisable in JIRA's current state (i.e. the CustomFieldType for this object must still be available).
      Specified by:
      removeCustomField in interface CustomFieldService
      Parameters:
      customField - the custom field object
      See Also:
      • CustomFieldManager.removeCustomField(com.atlassian.jira.issue.fields.CustomField)
    • getCustomFields

      public <T extends com.atlassian.jira.issue.customfields.CustomFieldType> List<com.atlassian.jira.issue.fields.CustomField> getCustomFields(Class<T> type)
      Description copied from interface: CustomFieldService
      Return all custom field instances which are of type CustomFieldService (but not sub-classes).
      Specified by:
      getCustomFields in interface CustomFieldService
      Type Parameters:
      T - the CustomFieldType to check for. Equality checking is done on the custom field's type.
      Parameters:
      type - the type to retrieve
      Returns:
      the list of custom fields; never null
    • getCustomFields

      public <T extends com.atlassian.jira.issue.customfields.CustomFieldType> List<com.atlassian.jira.issue.fields.CustomField> getCustomFields(Class<T> type, boolean strict)
      Description copied from interface: CustomFieldService
      Return all custom field instances which are of type CustomFieldService, or a subclass of CustomFieldService.
      Specified by:
      getCustomFields in interface CustomFieldService
      Type Parameters:
      T - the CustomFieldType to check for. Equality checking is done on the custom field's type.
      Parameters:
      type - the type to retrieve
      strict - set to true to do a strict equality check on the specified type.
      Returns:
      the list of custom fields; never null
    • isUniqueFieldName

      public boolean isUniqueFieldName(com.atlassian.jira.issue.fields.CustomField customField)
      Description copied from interface: CustomFieldService
      Has the custom field a unique name? Used whenever creating JQL to decide whether to use the name or the id of the field
      Specified by:
      isUniqueFieldName in interface CustomFieldService
    • isSystemFieldName

      public boolean isSystemFieldName(String fieldName)
      Check whether the passed field name matches a system field name (as used by JQL)
      Specified by:
      isSystemFieldName in interface CustomFieldService
    • isFieldApplicable

      public boolean isFieldApplicable(com.atlassian.jira.issue.fields.CustomField customField, com.atlassian.jira.issue.Issue issue)
      Description copied from interface: CustomFieldService
      Determine whether the given custom field is applicable for (i.e. configured for the context of) the specified issue.
      Specified by:
      isFieldApplicable in interface CustomFieldService
      Parameters:
      customField - the field
      issue - the issue
      Returns:
      whether or not the field is applicable
    • isFieldApplicable

      public boolean isFieldApplicable(com.atlassian.jira.issue.fields.CustomField customField, Long projectId, String issueTypeId)
      Description copied from interface: CustomFieldService
      Determine whether the given custom field is applicable for (i.e. configured for the context of) the specified project and issue type.
      Specified by:
      isFieldApplicable in interface CustomFieldService
      Parameters:
      customField - the field
      projectId - the project the issue is in
      issueTypeId - the issue type of the issue
      Returns:
      whether or not the field is applicable
    • isFieldVisible

      public boolean isFieldVisible(com.atlassian.jira.issue.fields.CustomField customField, com.atlassian.jira.issue.Issue issue)
      Specified by:
      isFieldVisible in interface CustomFieldService
    • makeFieldRequired

      public void makeFieldRequired(com.atlassian.jira.issue.fields.CustomField field)
      Description copied from interface: CustomFieldService
      Make the specified field required for all configurations
      Specified by:
      makeFieldRequired in interface CustomFieldService
      Parameters:
      field - the custom field.
    • verifyCustomFieldExistsInDB

      public boolean verifyCustomFieldExistsInDB(Long customFieldId)
      Description copied from interface: CustomFieldService
      Checks if a custom field with the given id exists in the database
      Specified by:
      verifyCustomFieldExistsInDB in interface CustomFieldService
      Returns:
    • verifyCustomFieldExistsInDB

      public boolean verifyCustomFieldExistsInDB(String customFieldId)
      Description copied from interface: CustomFieldService
      Checks if a custom field with the given id exists in the database. The id passed is expected to be in the form of "customfield_xxxx". If the given id does not match the expected form, false is returned.
      Specified by:
      verifyCustomFieldExistsInDB in interface CustomFieldService
      Returns: