@PublicApi public interface

FieldManager

com.atlassian.jira.issue.fields.FieldManager
Known Indirect Subclasses

@PublicApi

This interface is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Summary

Constants
String CUSTOM_FIELD_PREFIX
Public Methods
Set<NavigableField> getAllAvailableNavigableFields()
Set<SearchableField> getAllSearchableFields()
Return all the searchable fields in the system.
Set<CustomField> getAvailableCustomFields(User remoteUser, Issue issue)
Retrieves custom fields in scope for the given issue
Set<NavigableField> getAvailableNavigableFields(User remoteUser)
Set<NavigableField> getAvailableNavigableFieldsWithScope(User user)
Gets all the available fields that the user can see, this is providing no context scope.
Set<NavigableField> getAvailableNavigableFieldsWithScope(User user, QueryContext queryContext)
Gets all the available fields within the defined scope of the QueryContext.
@Deprecated ColumnLayoutManager getColumnLayoutManager()
This method is 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.
@Deprecated FieldLayoutManager getFieldLayoutManager()
This method is 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(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(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 BROWSE permission).
boolean isFieldHidden(User remoteUser, Field field)
boolean isHideableField(Field field)
boolean isHideableField(String id)
boolean isMandatoryField(Field field)
boolean isMandatoryField(String id)
boolean isNavigableField(String id)
boolean isNavigableField(Field field)
boolean isOrderableField(String id)
boolean isOrderableField(Field field)
boolean isRenderableField(String id)
boolean isRenderableField(Field field)
boolean isRequirableField(String id)
boolean isRequirableField(Field field)
boolean isTimeTrackingOn()
boolean isUnscreenableField(String id)
boolean isUnscreenableField(Field field)
void refresh()
Invalidates all field-related caches in JIRA.

Constants

public static final String CUSTOM_FIELD_PREFIX

Constant Value: "customfield_"

Public Methods

public Set<NavigableField> getAllAvailableNavigableFields ()

public 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.

public Set<CustomField> getAvailableCustomFields (User remoteUser, Issue issue)

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

public Set<NavigableField> getAvailableNavigableFields (User remoteUser)

public Set<NavigableField> getAvailableNavigableFieldsWithScope (User user)

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

public Set<NavigableField> getAvailableNavigableFieldsWithScope (User user, QueryContext queryContext)

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

@Deprecated public ColumnLayoutManager getColumnLayoutManager ()

This method is deprecated.
Declare your dependency and let PicoContainer resolve it instead

Returns
  • ColumnLayoutManager

public ConfigurableField getConfigurableField (String id)

public CustomField getCustomField (String id)

Get a CustomField by its text key (eg 'customfield_10000').

Parameters
id Eg. 'customfield_10000'
Returns

public 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

@Deprecated public FieldLayoutManager getFieldLayoutManager ()

This method is deprecated.
Declare your dependency and let PicoContainer resolve it instead

Returns
  • FieldLayoutManager

public HideableField getHideableField (String id)

public IssueTypeField getIssueTypeField ()

Retrieve the IssueType system Field.

Returns
  • the IssueType system Field.

public NavigableField getNavigableField (String id)

public Set<NavigableField> getNavigableFields ()

public OrderableField getOrderableField (String id)

public Set<OrderableField> getOrderableFields ()

public ProjectField getProjectField ()

Retrieve the Project system Field.

Returns
  • the Project system Field.

public RequirableField getRequiredField (String id)

public 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.

public Set<Field> getUnavailableFields ()

public Set<FieldLayout> getVisibleFieldLayouts (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.

public boolean isCustomField (Field field)

public boolean isCustomField (String id)

public 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.

public boolean isFieldHidden (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 BROWSE permission).

Parameters
remoteUser the remote user.
fieldId The Field ID

public boolean isFieldHidden (User remoteUser, Field field)

public boolean isHideableField (Field field)

public boolean isHideableField (String id)

public boolean isMandatoryField (Field field)

public boolean isMandatoryField (String id)

public boolean isNavigableField (String id)

public boolean isNavigableField (Field field)

public boolean isOrderableField (String id)

public boolean isOrderableField (Field field)

public boolean isRenderableField (String id)

public boolean isRenderableField (Field field)

public boolean isRequirableField (String id)

public boolean isRequirableField (Field field)

public boolean isTimeTrackingOn ()

public boolean isUnscreenableField (String id)

public boolean isUnscreenableField (Field field)

public 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.