Class MockFieldManager
- All Implemented Interfaces:
FieldManager
-
Field Summary
Fields inherited from interface com.atlassian.jira.issue.fields.FieldManager
CUSTOM_FIELD_PREFIX
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddMockCustomField
(int id) addMockOrderableField
(int id) addUnavilableField
(Field field) clear()
Return all the searchable fields in the system.getAvailableCustomFields
(ApplicationUser remoteUser, Issue issue) Retrieves custom fields in scope for the given issuegetAvailableNavigableFields
(ApplicationUser remoteUser) Gets all the available fields that the user can see, this is providing no context scope.getAvailableNavigableFieldsWithScope
(ApplicationUser user, QueryContext queryContext) Gets all the available fields within the defined scope of the QueryContext.getCustomField
(String id) Get a CustomField by its text key (eg 'customfield_10000').Get a field by its id.Retrieve the IssueType system Field.Retrieve the Project system Field.Return all the searchable systems fields.Returns all the visible FieldLayouts for the given user.boolean
isCustomField
(Field field) boolean
isCustomField
(String id) Returns true if the given ID is a Custom Field that actually exists in JIRA.boolean
Returns true if the given field ID is in the custom field format.boolean
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 oneFieldLayout
that the user can see (assigned to projects for which the user has theProjectPermissions.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
boolean
isMandatoryField
(Field field) boolean
boolean
isNavigableField
(Field field) boolean
boolean
isOrderableField
(Field field) boolean
boolean
isRenderableField
(Field field) boolean
boolean
isRequirableField
(Field field) boolean
boolean
boolean
isUnscreenableField
(Field field) boolean
void
refresh()
Invalidates all field-related caches in JIRA.toString()
-
Constructor Details
-
MockFieldManager
public MockFieldManager()
-
-
Method Details
-
addMockOrderableField
-
addMockCustomField
-
addField
-
clear
-
getField
Description copied from interface:FieldManager
Get a field by its id.- Specified by:
getField
in interfaceFieldManager
- Parameters:
id
- AnIssueFieldConstants
constant, or custom field key (eg. "customfield_10010")- Returns:
- the Field
-
isCustomField
Description copied from interface:FieldManager
Returns true if the given ID is a Custom Field that actually exists in JIRA.- Specified by:
isCustomField
in interfaceFieldManager
- Parameters:
id
- the field ID- Returns:
- true if the given ID is a Custom Field that actually exists in JIRA.
-
isCustomFieldId
Description copied from interface:FieldManager
Returns true if the given field ID is in the custom field format.This 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).
- Specified by:
isCustomFieldId
in interfaceFieldManager
- Parameters:
id
- the field ID- Returns:
- true if the given ID is a Custom Field that actually exists in JIRA.
- See Also:
-
isExistingCustomField
Description copied from interface:FieldManager
Returns true if the given ID is a Custom Field that actually exists in JIRA.Checking for existance comes with a performance price, so use
where possible
.- Specified by:
isExistingCustomField
in interfaceFieldManager
- Parameters:
id
- the field ID- Returns:
- true if the given ID is a Custom Field that actually exists in JIRA.
- See Also:
-
isCustomField
- Specified by:
isCustomField
in interfaceFieldManager
-
getCustomField
Description copied from interface:FieldManager
Get a CustomField by its text key (eg 'customfield_10000').- Specified by:
getCustomField
in interfaceFieldManager
- Parameters:
id
- Eg. 'customfield_10000'- Returns:
- The
CustomField
or null if not found.
-
isHideableField
- Specified by:
isHideableField
in interfaceFieldManager
-
isHideableField
- Specified by:
isHideableField
in interfaceFieldManager
-
getHideableField
- Specified by:
getHideableField
in interfaceFieldManager
-
isOrderableField
- Specified by:
isOrderableField
in interfaceFieldManager
-
isOrderableField
- Specified by:
isOrderableField
in interfaceFieldManager
-
getOrderableField
- Specified by:
getOrderableField
in interfaceFieldManager
-
getConfigurableField
- Specified by:
getConfigurableField
in interfaceFieldManager
-
getOrderableFields
- Specified by:
getOrderableFields
in interfaceFieldManager
-
isRequirableField
- Specified by:
isRequirableField
in interfaceFieldManager
-
isRequirableField
- Specified by:
isRequirableField
in interfaceFieldManager
-
isMandatoryField
- Specified by:
isMandatoryField
in interfaceFieldManager
-
isMandatoryField
- Specified by:
isMandatoryField
in interfaceFieldManager
-
isRenderableField
- Specified by:
isRenderableField
in interfaceFieldManager
-
isRenderableField
- Specified by:
isRenderableField
in interfaceFieldManager
-
isUnscreenableField
- Specified by:
isUnscreenableField
in interfaceFieldManager
-
isUnscreenableField
- Specified by:
isUnscreenableField
in interfaceFieldManager
-
getRequiredField
- Specified by:
getRequiredField
in interfaceFieldManager
-
getFieldLayoutManager
-
getColumnLayoutManager
-
refresh
public void refresh()Description copied from interface:FieldManager
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 aFooUpdatedEvent
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.
- Specified by:
refresh
in interfaceFieldManager
-
isFieldHidden
- Specified by:
isFieldHidden
in interfaceFieldManager
-
isFieldHidden
Description copied from interface:FieldManager
Checks whether the given field is hidden in all of the given Field Layouts.This method can be used in conjunction with
FieldManager.getVisibleFieldLayouts(com.atlassian.jira.user.ApplicationUser)
to provide a more performant way of looking upFieldManager.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)) { ... } } - Specified by:
isFieldHidden
in interfaceFieldManager
- Parameters:
fieldLayouts
- The FieldLayouts to checkfield
- The field to check- Returns:
- true if the given field is hidden in all of the given Field Layouts.
- See Also:
-
getVisibleFieldLayouts
Description copied from interface:FieldManager
Returns all the visible FieldLayouts for the given user.This is used in conjunction with
FieldManager.isFieldHidden(Set, Field)
as a performance optimisation in usages that want to callFieldManager.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)) { ... } } - Specified by:
getVisibleFieldLayouts
in interfaceFieldManager
- Parameters:
user
- the user whose project browsing permissions are used to limit visible FieldLayouts.- Returns:
- all the visible FieldLayouts for the given user.
-
isFieldHidden
Description copied from interface:FieldManager
Determines whether the field with id of fieldId is NOT hidden in AT LEAST oneFieldLayout
that the user can see (assigned to projects for which the user has theProjectPermissions.BROWSE_PROJECTS
permission).- Specified by:
isFieldHidden
in interfaceFieldManager
- Parameters:
remoteUser
- the remote user.fieldId
- The Field ID
-
getAvailableCustomFields
public Set<CustomField> getAvailableCustomFields(ApplicationUser remoteUser, Issue issue) throws FieldException Description copied from interface:FieldManager
Retrieves custom fields in scope for the given issue- Specified by:
getAvailableCustomFields
in interfaceFieldManager
- Parameters:
remoteUser
- Remote com.atlassian.jira.user.ApplicationUserissue
- 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
-
getAllSearchableFields
Description copied from interface:FieldManager
Return all the searchable fields in the system. This set will included all defined custom fields.- Specified by:
getAllSearchableFields
in interfaceFieldManager
- Returns:
- the set of all searchable fields in the system.
-
getSystemSearchableFields
Description copied from interface:FieldManager
Return all the searchable systems fields. This set will *NOT* include defined custom fields.- Specified by:
getSystemSearchableFields
in interfaceFieldManager
- Returns:
- the set of all searchable systems fields defined.
-
getIssueTypeField
Description copied from interface:FieldManager
Retrieve the IssueType system Field.- Specified by:
getIssueTypeField
in interfaceFieldManager
- Returns:
- the IssueType system Field.
-
getProjectField
Description copied from interface:FieldManager
Retrieve the Project system Field.- Specified by:
getProjectField
in interfaceFieldManager
- Returns:
- the Project system Field.
-
isTimeTrackingOn
public boolean isTimeTrackingOn()- Specified by:
isTimeTrackingOn
in interfaceFieldManager
-
toString
-