com.atlassian.greenhopper.customfield
Class CustomFieldServiceImpl

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

@Service(value="gh-customFieldService")
public class CustomFieldServiceImpl
extends java.lang.Object
implements CustomFieldService


Field Summary
 
Fields inherited from interface com.atlassian.greenhopper.customfield.CustomFieldService
SERVICE
 
Constructor Summary
CustomFieldServiceImpl()
           
 
Method Summary
 void addOptionsToCustomField(com.atlassian.jira.issue.fields.CustomField customField, com.atlassian.jira.issue.fields.config.FieldConfig fieldConfig, java.util.List<java.lang.String> optionNames, java.lang.String defaultOptionName)
           
 void associateWithDefaultScreen(com.atlassian.jira.issue.fields.CustomField customField)
          Associate the custom field with the default screen.
 com.atlassian.jira.issue.fields.CustomField createCustomField(CustomFieldMetadata fieldMetadata)
          Create a new custom field in JIRA with the given configuration
 com.atlassian.jira.issue.fields.CustomField getCustomField(java.lang.Long id)
           
 com.atlassian.jira.issue.fields.CustomField getCustomField(java.lang.String id)
           
<T extends com.atlassian.jira.issue.customfields.CustomFieldType>
java.util.List<com.atlassian.jira.issue.fields.CustomField>
getCustomFields(java.lang.Class<T> type)
          Return all custom field instances which are of type T (but not sub-classes).
<T extends com.atlassian.jira.issue.customfields.CustomFieldType>
java.util.List<com.atlassian.jira.issue.fields.CustomField>
getCustomFields(java.lang.Class<T> type, boolean strict)
          Return all custom field instances which are of type T, or a subclass of T.
 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.
 boolean isFieldApplicable(com.atlassian.jira.issue.fields.CustomField customField, java.lang.Long projectId, java.lang.String issueTypeId)
          Determine whether the given custom field is applicable for (i.e.
 boolean isSystemFieldName(java.lang.String fieldName)
          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? Used whenever creating JQL to decide whether to use the name or the id of the field
 void removeCustomField(com.atlassian.jira.issue.fields.CustomField customField)
          Removes the custom field and all associated data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomFieldServiceImpl

public CustomFieldServiceImpl()
Method Detail

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

addOptionsToCustomField

public void addOptionsToCustomField(com.atlassian.jira.issue.fields.CustomField customField,
                                    com.atlassian.jira.issue.fields.config.FieldConfig fieldConfig,
                                    java.util.List<java.lang.String> optionNames,
                                    java.lang.String defaultOptionName)

getCustomField

public com.atlassian.jira.issue.fields.CustomField getCustomField(java.lang.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(java.lang.String id)
Specified by:
getCustomField in interface CustomFieldService
Returns:
the CustomField instance for the given String ID, or null if it doesn't exist

associateWithDefaultScreen

public void associateWithDefaultScreen(com.atlassian.jira.issue.fields.CustomField customField)
Associate the custom field with the default screen.

Specified by:
associateWithDefaultScreen in interface CustomFieldService

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> java.util.List<com.atlassian.jira.issue.fields.CustomField> getCustomFields(java.lang.Class<T> type)
Description copied from interface: CustomFieldService
Return all custom field instances which are of type T (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> java.util.List<com.atlassian.jira.issue.fields.CustomField> getCustomFields(java.lang.Class<T> type,
                                                                                                                                                     boolean strict)
Description copied from interface: CustomFieldService
Return all custom field instances which are of type T, or a subclass of T.

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(java.lang.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,
                                 java.lang.Long projectId,
                                 java.lang.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


Copyright © 2007-2012 Atlassian. All Rights Reserved.