public class DefaultFieldManager extends Object implements FieldManager
CUSTOM_FIELD_PREFIX| Constructor and Description |
|---|
DefaultFieldManager(RequestCacheFactory requestCacheFactory) |
| Modifier and Type | Method and Description |
|---|---|
Set<NavigableField> |
getAllAvailableNavigableFields()
Returns a set of
Fields that are NOT hidden in AT LEAST ONE project in the system. |
Set<SearchableField> |
getAllSearchableFields()
Return all the searchable fields in the system.
|
Set<CustomField> |
getAvailableCustomFields(ApplicationUser remoteUser,
Issue issue)
Retrieves custom fields in scope for the given issue
|
Set<NavigableField> |
getAvailableNavigableFields(ApplicationUser remoteUser)
Returns a set of
Fields that are NOT hidden in AT LEAST ONE project that the remote user can see (has
Permissions.BROWSE permission for). |
Set<NavigableField> |
getAvailableNavigableFieldsWithScope(ApplicationUser user)
Gets all the available fields that the user can see, this is providing no context scope.
|
Set<NavigableField> |
getAvailableNavigableFieldsWithScope(ApplicationUser remoteUser,
QueryContext queryContext)
Gets all the available fields within the defined scope of the QueryContext.
|
ConfigurableField |
getConfigurableField(String id) |
CustomField |
getCustomField(String key)
Get a CustomField by its text key (eg 'customfield_10000').
|
Field |
getField(String id)
Get a field by its id.
|
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(ApplicationUser user)
Returns all the visible FieldLayouts for the given user.
|
boolean |
isCustomField(Field field) |
boolean |
isCustomField(String key)
Returns true if the given ID is a Custom Field that actually exists in JIRA.
|
boolean |
isCustomFieldId(String id)
Returns true if the given field ID is in the custom field format.
|
boolean |
isExistingCustomField(String id)
Returns true if the given ID is a Custom Field that actually exists in JIRA.
|
boolean |
isFieldHidden(ApplicationUser remoteUser,
Field field) |
boolean |
isFieldHidden(ApplicationUser 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 |
isFieldHidden(Set<FieldLayout> fieldLayouts,
Field field)
Checks whether the given field is hidden in all of the given Field Layouts.
|
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.
|
public DefaultFieldManager(RequestCacheFactory requestCacheFactory)
public Field getField(String id)
FieldManagergetField in interface FieldManagerid - An IssueFieldConstants constant, or custom field key (eg. "customfield_10010")public Set<NavigableField> getAllAvailableNavigableFields() throws FieldException
Fields that are NOT hidden in AT LEAST ONE project in the system.
NOTE: This method is used in the Admin interface, as admins should be able to configure the default ColumnLayouts irrespective of their permissions. They should be able to see all fields that are not hidden in at least one FieldLayout in the system
getAllAvailableNavigableFields in interface FieldManagerFieldException - if cannot retrieve the projects the user can see, or if cannot retrieve the field layouts
for the viewable projectspublic Set<NavigableField> getAvailableNavigableFields(ApplicationUser remoteUser) throws FieldException
Fields that are NOT hidden in AT LEAST ONE project that the remote user can see (has
Permissions.BROWSE permission for).
The returned set of fields contains all custom fields that are not hidden in AT LEAST one FieldLayout that the user can see.
NOTE: This method is primarily used for configuring user's ColumnLayout, as the user should be able to add any field (including custom field) to it that they can see in the system. THe scope of custom fields is ignored here as the user configures the ColumnLayout outside of scope.
getAvailableNavigableFields in interface FieldManagerremoteUser - the remote userFieldException - if cannot retrieve the projects the user can see, or if cannot retrieve the field layouts
for the viewable projectspublic Set<SearchableField> getAllSearchableFields()
FieldManagergetAllSearchableFields in interface FieldManagerpublic Set<SearchableField> getSystemSearchableFields()
FieldManagergetSystemSearchableFields in interface FieldManagerpublic IssueTypeField getIssueTypeField()
FieldManagergetIssueTypeField in interface FieldManagerpublic ProjectField getProjectField()
FieldManagergetProjectField in interface FieldManagerpublic Set<NavigableField> getAvailableNavigableFieldsWithScope(ApplicationUser user) throws FieldException
FieldManagergetAvailableNavigableFieldsWithScope in interface FieldManageruser - the remote user.FieldException - thrown if there is a problem looking up the fieldspublic Set<NavigableField> getAvailableNavigableFieldsWithScope(ApplicationUser remoteUser, QueryContext queryContext) throws FieldException
FieldManagergetAvailableNavigableFieldsWithScope in interface FieldManagerremoteUser - the user making the requestqueryContext - the context of the search request.FieldException - thrown if there is a problem looking up the fieldspublic Set<CustomField> getAvailableCustomFields(ApplicationUser remoteUser, Issue issue) throws FieldException
FieldManagergetAvailableCustomFields in interface FieldManagerremoteUser - Remote com.atlassian.jira.user.ApplicationUserissue - IssueFieldException - if cannot retrieve the projects the user can see, or if cannot retrieve
the field layouts for the viewable projectspublic boolean isFieldHidden(ApplicationUser remoteUser, String fieldId)
FieldManagerFieldLayout that the user can see
(assigned to projects for which the user has the ProjectPermissions.BROWSE_PROJECTS permission).isFieldHidden in interface FieldManagerremoteUser - the remote user.fieldId - The Field IDpublic boolean isFieldHidden(ApplicationUser remoteUser, Field field)
isFieldHidden in interface FieldManagerpublic Set<FieldLayout> getVisibleFieldLayouts(ApplicationUser user)
FieldManager
This is used in conjunction with FieldManager.isFieldHidden(Set, Field) as a performance optimisation in usages that want to call FieldManager.isFieldHidden(com.atlassian.jira.user.ApplicationUser, 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))
{
...
}
}
getVisibleFieldLayouts in interface FieldManageruser - the user whose project browsing permissions are used to limit visible FieldLayouts.public boolean isFieldHidden(Set<FieldLayout> fieldLayouts, Field field)
FieldManager
This method can be used in conjunction with FieldManager.getVisibleFieldLayouts(com.atlassian.jira.user.ApplicationUser)
to provide a more performant way of looking up FieldManager.isFieldHidden(com.atlassian.jira.user.ApplicationUser, 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))
{
...
}
}
isFieldHidden in interface FieldManagerfieldLayouts - The FieldLayouts to checkfield - The field to checkFieldManager.getVisibleFieldLayouts(com.atlassian.jira.user.ApplicationUser),
FieldManager.isFieldHidden(com.atlassian.jira.user.ApplicationUser, Field)public boolean isCustomField(String key)
FieldManagerisCustomField in interface FieldManagerkey - the field IDpublic boolean isCustomFieldId(String id)
FieldManagerThis method just checks that the ID looks like a Custom Field (it starts with "customfield_") but not that the custom field actually exists (it could have been deleted).
isCustomFieldId in interface FieldManagerid - the field IDFieldManager.isExistingCustomField(java.lang.String)public boolean isExistingCustomField(String id)
FieldManager Checking for existance comes with a performance price, so use where possible.
isExistingCustomField in interface FieldManagerid - the field IDFieldManager.isCustomFieldId(java.lang.String)public boolean isCustomField(Field field)
isCustomField in interface FieldManager@Nullable public CustomField getCustomField(String key)
FieldManagergetCustomField in interface FieldManagerkey - Eg. 'customfield_10000'CustomField or null if not found.public boolean isHideableField(String id)
isHideableField in interface FieldManagerpublic boolean isHideableField(Field field)
isHideableField in interface FieldManagerpublic HideableField getHideableField(String id)
getHideableField in interface FieldManagerpublic boolean isOrderableField(String id)
isOrderableField in interface FieldManagerpublic boolean isOrderableField(Field field)
isOrderableField in interface FieldManager@Nullable public OrderableField getOrderableField(String id)
getOrderableField in interface FieldManager@Nullable public ConfigurableField getConfigurableField(String id)
getConfigurableField in interface FieldManagerpublic Set<OrderableField> getOrderableFields()
getOrderableFields in interface FieldManagerpublic Set<NavigableField> getNavigableFields()
getNavigableFields in interface FieldManagerpublic boolean isNavigableField(String id)
isNavigableField in interface FieldManagerpublic boolean isNavigableField(Field field)
isNavigableField in interface FieldManagerpublic NavigableField getNavigableField(String id)
getNavigableField in interface FieldManagerpublic boolean isRequirableField(String id)
isRequirableField in interface FieldManagerpublic boolean isRequirableField(Field field)
isRequirableField in interface FieldManagerpublic boolean isMandatoryField(String id)
isMandatoryField in interface FieldManagerpublic boolean isMandatoryField(Field field)
isMandatoryField in interface FieldManagerpublic boolean isRenderableField(String id)
isRenderableField in interface FieldManagerpublic boolean isRenderableField(Field field)
isRenderableField in interface FieldManagerpublic boolean isUnscreenableField(String id)
isUnscreenableField in interface FieldManagerpublic boolean isUnscreenableField(Field field)
isUnscreenableField in interface FieldManagerpublic RequirableField getRequiredField(String id)
getRequiredField in interface FieldManagerpublic void refresh()
FieldManager
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.
refresh in interface FieldManagerpublic boolean isTimeTrackingOn()
isTimeTrackingOn in interface FieldManagerpublic Set<Field> getUnavailableFields()
getUnavailableFields in interface FieldManagerCopyright © 2002-2019 Atlassian. All Rights Reserved.