com.atlassian.jira.issue.fields
Interface FieldManager

All Known Implementing Classes:
DefaultFieldManager, MockFieldManager

@PublicApi
public interface FieldManager


Field Summary
static String CUSTOM_FIELD_PREFIX
           
 
Method Summary
 Set<NavigableField> getAllAvailableNavigableFields()
           
 Set<SearchableField> getAllSearchableFields()
          Return all the searchable fields in the system.
 Set<CustomField> getAvailableCustomFields(com.atlassian.crowd.embedded.api.User remoteUser, Issue issue)
          Retrieves custom fields in scope for the given issue
 Set<NavigableField> getAvailableNavigableFields(com.atlassian.crowd.embedded.api.User remoteUser)
           
 Set<NavigableField> getAvailableNavigableFieldsWithScope(com.atlassian.crowd.embedded.api.User user)
          Gets all the available fields that the user can see, this is providing no context scope.
 Set<NavigableField> getAvailableNavigableFieldsWithScope(com.atlassian.crowd.embedded.api.User user, QueryContext queryContext)
          Gets all the available fields within the defined scope of the QueryContext.
 ColumnLayoutManager getColumnLayoutManager()
          Deprecated. Declare your dependency and let PicoContainer resolve it instead
 ConfigurableField getConfigurableField(String id)
           
 CustomField getCustomField(String id)
          Get a CustomField by its text key (eg 'customfield_10000').
 Field getField(String id)
          Get a field by its id.
 FieldLayoutManager getFieldLayoutManager()
          Deprecated. Declare your dependency and let PicoContainer resolve it instead
 HideableField getHideableField(String id)
           
 IssueTypeField getIssueTypeField()
          Retrieve the IssueType system Field.
 NavigableField getNavigableField(String id)
           
 Set<NavigableField> getNavigableFields()
           
 OrderableField getOrderableField(String id)
           
 Set<OrderableField> getOrderableFields()
           
 ProjectField getProjectField()
          Retrieve the Project system Field.
 RequirableField getRequiredField(String id)
           
 Set<SearchableField> getSystemSearchableFields()
          Return all the searchable systems fields.
 Set<Field> getUnavailableFields()
           
 Set<FieldLayout> getVisibleFieldLayouts(com.atlassian.crowd.embedded.api.User user)
          Returns all the visible FieldLayouts for the given user.
 boolean isCustomField(Field field)
           
 boolean isCustomField(String id)
           
 boolean isFieldHidden(Set<FieldLayout> fieldLayouts, Field field)
          Checks whether the given field is hidden in all of the given Field Layouts.
 boolean isFieldHidden(com.atlassian.crowd.embedded.api.User remoteUser, Field field)
           
 boolean isFieldHidden(com.atlassian.crowd.embedded.api.User remoteUser, String fieldId)
          Determines whether the field with id of fieldId is NOT hidden in AT LEAST one FieldLayout that the user can see (assigned to projects for which the user has the ProjectPermissions.BROWSE_PROJECTS permission).
 boolean isHideableField(Field field)
           
 boolean isHideableField(String id)
           
 boolean isMandatoryField(Field field)
           
 boolean isMandatoryField(String id)
           
 boolean isNavigableField(Field field)
           
 boolean isNavigableField(String id)
           
 boolean isOrderableField(Field field)
           
 boolean isOrderableField(String id)
           
 boolean isRenderableField(Field field)
           
 boolean isRenderableField(String id)
           
 boolean isRequirableField(Field field)
           
 boolean isRequirableField(String id)
           
 boolean isTimeTrackingOn()
           
 boolean isUnscreenableField(Field field)
           
 boolean isUnscreenableField(String id)
           
 void refresh()
          Invalidates all field-related caches in JIRA.
 

Field Detail

CUSTOM_FIELD_PREFIX

static final String CUSTOM_FIELD_PREFIX
See Also:
Constant Field Values
Method Detail

getField

Field getField(String id)
Get a field by its id.

Parameters:
id - An IssueFieldConstants constant, or custom field key (eg. "customfield_10010")
Returns:
the Field

isCustomField

boolean isCustomField(String id)

isCustomField

boolean isCustomField(Field field)

getCustomField

@Nullable
CustomField getCustomField(String id)
Get a CustomField by its text key (eg 'customfield_10000').

Parameters:
id - Eg. 'customfield_10000'
Returns:
The CustomField or null if not found.

isHideableField

boolean isHideableField(String id)

isHideableField

boolean isHideableField(Field field)

getHideableField

HideableField getHideableField(String id)

isOrderableField

boolean isOrderableField(String id)

isOrderableField

boolean isOrderableField(Field field)

getOrderableField

OrderableField getOrderableField(String id)

getConfigurableField

ConfigurableField getConfigurableField(String id)

getOrderableFields

Set<OrderableField> getOrderableFields()

getNavigableFields

Set<NavigableField> getNavigableFields()

isNavigableField

boolean isNavigableField(String id)

isNavigableField

boolean isNavigableField(Field field)

getNavigableField

NavigableField getNavigableField(String id)

isRequirableField

boolean isRequirableField(String id)

isRequirableField

boolean isRequirableField(Field field)

isMandatoryField

boolean isMandatoryField(String id)

isMandatoryField

boolean isMandatoryField(Field field)

isRenderableField

boolean isRenderableField(String id)

isRenderableField

boolean isRenderableField(Field field)

isUnscreenableField

boolean isUnscreenableField(String id)

isUnscreenableField

boolean isUnscreenableField(Field field)

getRequiredField

RequirableField getRequiredField(String id)

getFieldLayoutManager

@Deprecated
FieldLayoutManager getFieldLayoutManager()
Deprecated. Declare your dependency and let PicoContainer resolve it instead

Returns:
FieldLayoutManager

getColumnLayoutManager

@Deprecated
ColumnLayoutManager getColumnLayoutManager()
Deprecated. Declare your dependency and let PicoContainer resolve it instead

Returns:
ColumnLayoutManager

refresh

void refresh()
Invalidates all field-related caches in JIRA.

WARNING

This method invalidates a whole lot of JIRA caches, which means that JIRA performance significantly degrades after this method has been called. For this reason, you should avoid calling this method at all costs.

The correct approach to invalidate the cache entries is to do it in the "store" inside the FooStore.updateFoo() method, where you can invalidate a single cache entry. If the cache lives in another class then the store should raise a FooUpdatedEvent which that class can listen to in order to keep its caches up to date.

If you add any calls to this method in JIRA I will hunt you down and subject you to a Spanish inquisition.


getUnavailableFields

Set<Field> getUnavailableFields()

isFieldHidden

boolean isFieldHidden(com.atlassian.crowd.embedded.api.User remoteUser,
                      Field field)

isFieldHidden

boolean isFieldHidden(com.atlassian.crowd.embedded.api.User remoteUser,
                      String fieldId)
Determines whether the field with id of fieldId is NOT hidden in AT LEAST one FieldLayout that the user can see (assigned to projects for which the user has the ProjectPermissions.BROWSE_PROJECTS permission).

Parameters:
remoteUser - the remote user.
fieldId - The Field ID

isFieldHidden

boolean isFieldHidden(Set<FieldLayout> fieldLayouts,
                      Field field)
Checks whether the given field is hidden in all of the given Field Layouts.

This method can be used in conjunction with getVisibleFieldLayouts(com.atlassian.crowd.embedded.api.User) to provide a more performant way of looking up isFieldHidden(com.atlassian.crowd.embedded.api.User, Field) multiple times. Instead, it is more efficient to do something like:

     Set fieldLayouts = fieldManager.getVisibleFieldLayouts(loggedInUser);
     for (Field field: myFields)
     {
       if (fieldManager.isFieldHidden(fieldLayouts1, field))
       {
           ...
       }
     }
 

Parameters:
fieldLayouts - The FieldLayouts to check
field - The field to check
Returns:
true if the given field is hidden in all of the given Field Layouts.
See Also:
getVisibleFieldLayouts(com.atlassian.crowd.embedded.api.User), isFieldHidden(com.atlassian.crowd.embedded.api.User, Field)

getVisibleFieldLayouts

Set<FieldLayout> getVisibleFieldLayouts(com.atlassian.crowd.embedded.api.User user)
Returns all the visible FieldLayouts for the given user.

This is used in conjunction with isFieldHidden(Set, Field) as a performance optimisation in usages that want to call isFieldHidden(User, Field) multiple times. Instead, it is more efficient to do something like:

     Set fieldLayouts = fieldManager.getVisibleFieldLayouts(loggedInUser);
     for (Field field: myFields)
     {
       if (fieldManager.isFieldHidden(fieldLayouts1, field))
       {
           ...
       }
     }
 

Parameters:
user - the user whose project browsing permissions are used to limit visible FieldLayouts.
Returns:
all the visible FieldLayouts for the given user.

getAvailableNavigableFieldsWithScope

Set<NavigableField> getAvailableNavigableFieldsWithScope(com.atlassian.crowd.embedded.api.User user)
                                                         throws FieldException
Gets all the available fields that the user can see, this is providing no context scope.

Parameters:
user - the remote user.
Returns:
a set of NavigableFields that can be show because their visibility/configuration fall within what the user can see.
Throws:
FieldException - thrown if there is a problem looking up the fields

getAvailableNavigableFieldsWithScope

Set<NavigableField> getAvailableNavigableFieldsWithScope(com.atlassian.crowd.embedded.api.User user,
                                                         QueryContext queryContext)
                                                         throws FieldException
Gets all the available fields within the defined scope of the QueryContext.

Parameters:
user - the user making the request
queryContext - the context of the search request.
Returns:
a set of NavigableFields that can be show because their visibility/configuration fall within the specified context
Throws:
FieldException - thrown if there is a problem looking up the fields

getAvailableCustomFields

Set<CustomField> getAvailableCustomFields(com.atlassian.crowd.embedded.api.User remoteUser,
                                          Issue issue)
                                          throws FieldException
Retrieves custom fields in scope for the given issue

Parameters:
remoteUser - Remote User
issue - Issue
Returns:
custom fields in scope for the given issue
Throws:
FieldException - if cannot retrieve the projects the user can see, or if cannot retrieve the field layouts for the viewable projects

getAllAvailableNavigableFields

Set<NavigableField> getAllAvailableNavigableFields()
                                                   throws FieldException
Throws:
FieldException

getAvailableNavigableFields

Set<NavigableField> getAvailableNavigableFields(com.atlassian.crowd.embedded.api.User remoteUser)
                                                throws FieldException
Throws:
FieldException

getAllSearchableFields

Set<SearchableField> getAllSearchableFields()
Return all the searchable fields in the system. This set will included all defined custom fields.

Returns:
the set of all searchable fields in the system.

getSystemSearchableFields

Set<SearchableField> getSystemSearchableFields()
Return all the searchable systems fields. This set will *NOT* include defined custom fields.

Returns:
the set of all searchable systems fields defined.

getIssueTypeField

IssueTypeField getIssueTypeField()
Retrieve the IssueType system Field.

Returns:
the IssueType system Field.

getProjectField

ProjectField getProjectField()
Retrieve the Project system Field.

Returns:
the Project system Field.

isTimeTrackingOn

boolean isTimeTrackingOn()


Copyright © 2002-2015 Atlassian. All Rights Reserved.