public class CachingCustomFieldManager extends Object implements CustomFieldManager
| Constructor and Description |
|---|
CachingCustomFieldManager(com.atlassian.plugin.PluginAccessor pluginAccessor,
QueryDslAccessor dbConnectionManager,
FieldConfigSchemeManager fieldConfigSchemeManager,
ConstantsManager constantsManager,
ProjectManager projectManager,
FieldConfigContextPersister contextPersister,
FieldScreenManager fieldScreenManager,
CustomFieldValuePersister customFieldValuePersister,
NotificationSchemeManager notificationSchemeManager,
FieldManager fieldManager,
com.atlassian.event.api.EventPublisher eventPublisher,
CustomFieldFactory customFieldFactory,
CustomFieldTypeModuleDescriptors customFieldTypeModuleDescriptors,
CustomFieldSearcherModuleDescriptors customFieldSearcherModuleDescriptors,
CustomFieldSearcherManager customFieldSearcherManager,
com.atlassian.cache.CacheManager cacheManager) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
areConfigSchemesEqual(List<FieldConfigScheme> schemes,
List<FieldConfigScheme> otherSchemes) |
void |
clear()
clear the cache
|
CustomField |
createCustomField(String fieldName,
String description,
CustomFieldType fieldType,
CustomFieldSearcher customFieldSearcher,
List<JiraContextNode> contexts,
List<IssueType> issueTypes)
Creates a custom field with the given name and description of the given CustomFieldType
using the given CustomFieldSearcher that is displayed in the given list of contexts available to the given list of issueTypes.
|
boolean |
exists(String key)
Returns true if this customfield actually exists.
|
CustomField |
getCustomFieldInstance(org.ofbiz.core.entity.GenericValue customFieldGv)
Converts a customfield
GenericValue to a CustomField instance. |
CustomField |
getCustomFieldObject(Long id)
Get a CustomField by ID.
|
CustomField |
getCustomFieldObject(String key)
Get a CustomField by its text key (eg 'customfield_10000').
|
CustomField |
getCustomFieldObjectByName(String customFieldName)
Retrieve the first custom field object with the specified name.
|
List<CustomField> |
getCustomFieldObjects()
Returns all custom fields.
|
List<CustomField> |
getCustomFieldObjects(org.ofbiz.core.entity.GenericValue issue)
Deprecated.
|
List<CustomField> |
getCustomFieldObjects(Issue issue)
Get all
CustomFields in scope for this issue's project/type. |
List<CustomField> |
getCustomFieldObjects(Long projectId,
List<String> issueTypeIds)
Returns the same as
CustomFieldManager.getCustomFieldObjects(Long, String) but allows to specify a list of issueTypes. |
List<CustomField> |
getCustomFieldObjects(Long projectId,
String issueTypeId)
Gets a list of custom fields for a particular project and issue type.
|
List<CustomField> |
getCustomFieldObjects(SearchContext searchContext)
Returns all customfields in a particular
SearchContext. |
Collection<CustomField> |
getCustomFieldObjectsByName(String customFieldName)
Retrieve custom field(s) of a certain name.
|
Collection<CustomField> |
getCustomFieldObjectsByNameIgnoreCase(String customFieldName)
Retrieve custom field(s) of a certain name ignoring case.
|
CustomFieldSearcher |
getCustomFieldSearcher(String key)
Retrieve a custom field searcher by its type key.
|
Class<? extends CustomFieldSearcher> |
getCustomFieldSearcherClass(String key)
Retrieve a custom field searcher by its type key.
|
List<CustomFieldSearcher> |
getCustomFieldSearchers(CustomFieldType customFieldType)
Retrieves all the searchers registered for a particular custom Field.
|
Set<CustomField> |
getCustomFieldsWithValue(Issue issue)
Returns a set of
CustomFields that have value stored in database for particular issue. |
CustomFieldType |
getCustomFieldType(String key)
Retrieve a custom field type by its type key.
|
List<CustomFieldType<?,?>> |
getCustomFieldTypes()
Retrieve all customfieldtypes registered in the system.
|
CustomFieldSearcher |
getDefaultSearcher(CustomFieldType<?,?> type)
Return the default
CustomFieldSearcher for the passed CustomFieldType. |
List<CustomField> |
getGlobalCustomFieldObjects()
Returns a list of custom fields where the
CustomField.isGlobal()
is true. |
boolean |
isCustomField(String id)
Returns true if this ID is in the Custom Field format.
|
void |
onClearCache(ClearCacheEvent event) |
void |
onTerminologyCacheClearedEvent(TerminologyCacheClearedEvent event) |
void |
refresh()
reloads all customfields into the cache from the DB, this is an expensive operation, so avoid it if you can.
|
void |
refreshConfiguration() |
void |
refreshConfigurationSchemes(Long customFieldId)
Causes a reload of the field configuration scheme for a specified custom field id
Call when the configuration scheme changes
|
void |
removeCustomField(CustomField customField)
Removes the customfield supplied including all associations and values.
|
void |
removeCustomFieldPossiblyLeavingOrphanedData(Long customFieldId)
Removes the customfield supplied.
|
void |
removeCustomFieldValues(org.ofbiz.core.entity.GenericValue issue)
Removes the values stored by customfields for a particular Issue.
|
void |
removeProjectAssociations(Project project)
Used if a project is deleted to remove the project field associations.
|
void |
updateCustomField(Long id,
String name,
String description,
CustomFieldSearcher searcher)
Updates the given custom field.
|
public CachingCustomFieldManager(com.atlassian.plugin.PluginAccessor pluginAccessor,
QueryDslAccessor dbConnectionManager,
FieldConfigSchemeManager fieldConfigSchemeManager,
ConstantsManager constantsManager,
ProjectManager projectManager,
FieldConfigContextPersister contextPersister,
FieldScreenManager fieldScreenManager,
CustomFieldValuePersister customFieldValuePersister,
NotificationSchemeManager notificationSchemeManager,
FieldManager fieldManager,
com.atlassian.event.api.EventPublisher eventPublisher,
CustomFieldFactory customFieldFactory,
CustomFieldTypeModuleDescriptors customFieldTypeModuleDescriptors,
CustomFieldSearcherModuleDescriptors customFieldSearcherModuleDescriptors,
CustomFieldSearcherManager customFieldSearcherManager,
com.atlassian.cache.CacheManager cacheManager)
public CustomField createCustomField(String fieldName, String description, CustomFieldType fieldType, CustomFieldSearcher customFieldSearcher, List<JiraContextNode> contexts, List<IssueType> issueTypes) throws org.ofbiz.core.entity.GenericEntityException
CustomFieldManagercreateCustomField in interface CustomFieldManagerorg.ofbiz.core.entity.GenericEntityException - if the CustomField could not be created.@Nonnull public List<CustomFieldType<?,?>> getCustomFieldTypes()
CustomFieldManagergetCustomFieldTypes in interface CustomFieldManagerCustomFieldTypespublic CustomFieldType getCustomFieldType(String key)
CustomFieldManagerThe key is the "full plugin module key". That is, the plugin key for the plugin it comes from, a colon separator, and then the module key. e.g. the system types are specified in system-customfieldtypes-plugin.xml:
<atlassian-plugin key="com.atlassian.jira.plugin.system.customfieldtypes" name="Custom Field Types & Searchers">
...
<customfield-type key="float" name="Number Field"
...
To access the 'Number Field' type, the key would then be 'com.atlassian.jira.plugin.system.customfieldtypes:float'.getCustomFieldType in interface CustomFieldManagerkey - Type identifier constructed from plugin XML.@Nonnull public List<CustomFieldSearcher> getCustomFieldSearchers(CustomFieldType customFieldType)
CustomFieldManager
<customfield-searcher key="daterange" name="Date Range picker"
i18n-name-key="admin.customfield.searcher.daterange.name"
class="com.atlassian.jira.issue.customfields.searchers.DateRangeSearcher">
getCustomFieldSearchers in interface CustomFieldManagercustomFieldType - the CustomFieldTypeCustomFieldSearcherspublic CustomFieldSearcher getCustomFieldSearcher(String key)
CustomFieldManagerThe key is the "full plugin module key". That is, the plugin key for the plugin it comes from, a colon separator, and then the module key. e.g. the system types are specified in system-customfieldtypes-plugin.xml:
<atlassian-plugin key="com.atlassian.jira.plugin.system.customfieldtypes" name="Custom Field Types & Searchers">
...
<customfield-type key="float" name="Number Field"
...
To access the 'Number Field' type, the key would then be 'com.atlassian.jira.plugin.system.customfieldtypes:float'.getCustomFieldSearcher in interface CustomFieldManagerkey - Type identifier constructed from plugin XML.@Nullable public CustomFieldSearcher getDefaultSearcher(@Nonnull CustomFieldType<?,?> type)
CustomFieldManagerCustomFieldSearcher for the passed CustomFieldType. The default searcher can
be null if there is no searcher associated with the type.getDefaultSearcher in interface CustomFieldManagertype - the CustomFieldType to query.CustomFieldType. Can be null if the type has no associated
searcher.public Class<? extends CustomFieldSearcher> getCustomFieldSearcherClass(String key)
CustomFieldManagerThe key is the "full plugin module key". That is, the plugin key for the plugin it comes from, a colon separator, and then the module key. e.g. the system types are specified in system-customfieldtypes-plugin.xml:
<atlassian-plugin key="com.atlassian.jira.plugin.system.customfieldtypes" name="Custom Field Types & Searchers">
...
<customfield-type key="float" name="Number Field"
...
To access the 'Number Field' type, the key would then be 'com.atlassian.jira.plugin.system.customfieldtypes:float'.getCustomFieldSearcherClass in interface CustomFieldManagerkey - Type identifier constructed from plugin XML.public List<CustomField> getCustomFieldObjects(Issue issue)
CustomFields in scope for this issue's project/type.getCustomFieldObjects in interface CustomFieldManagerissue - A Issue objectCustomFieldspublic List<CustomField> getCustomFieldObjects(org.ofbiz.core.entity.GenericValue issue)
getCustomFieldObjects(com.atlassian.jira.issue.Issue)CustomFieldManagerCustomFields that apply to a particular issue.getCustomFieldObjects in interface CustomFieldManagerissue - A GenericValue of the issueCustomFieldspublic List<CustomField> getCustomFieldObjects(Long projectId, String issueTypeId)
CustomFieldManagergetCustomFieldObjects in interface CustomFieldManagerprojectId - Id of the projectissueTypeId - An issue type. See ConstantsManager.ALL_ISSUE_TYPES,
ConstantsManager.ALL_STANDARD_ISSUE_TYPES and ConstantsManager.ALL_SUB_TASK_ISSUE_TYPESCustomFieldspublic List<CustomField> getCustomFieldObjects(Long projectId, List<String> issueTypeIds)
CustomFieldManagerCustomFieldManager.getCustomFieldObjects(Long, String) but allows to specify a list of issueTypes.getCustomFieldObjects in interface CustomFieldManagerprojectId - Id of the project. It can be null, in which case means that we are looking for "any project" (acts like a wildcard).issueTypeIds - A list of issue types. It can be null or empty, in which case means that we are looking for "any issue type" (acts like a wildcard).
See ConstantsManager.ALL_ISSUE_TYPES, ConstantsManager.ALL_STANDARD_ISSUE_TYPES
and ConstantsManager.ALL_SUB_TASK_ISSUE_TYPESCustomFieldsCustomField#isInScopeForSearch(com.atlassian.jira.project.Project, java.util.List)} for a full description on how wildcards are treated.public List<CustomField> getCustomFieldObjects(SearchContext searchContext)
CustomFieldManagerSearchContext. Also
see CustomField.isInScope(com.atlassian.jira.issue.search.SearchContext).getCustomFieldObjects in interface CustomFieldManagersearchContext - the SearchContextCustomFields@Nullable public CustomField getCustomFieldObject(Long id)
CustomFieldManagergetCustomFieldObject in interface CustomFieldManagerid - ID of field, eg. 10000CustomField or null.@Nullable public CustomField getCustomFieldObject(String key)
CustomFieldManagergetCustomFieldObject in interface CustomFieldManagerkey - Eg. 'customfield_10000'CustomField or null if not found.public boolean isCustomField(String id)
CustomFieldManagerNote that this does not check if the Custom Field actually exists. It just checks whether the given ID looks like Custom Field ID (eg starts with "customfield_").
isCustomField in interface CustomFieldManagerid - The Field IDCustomFieldManager.exists(String)public boolean exists(String key)
CustomFieldManagerexists in interface CustomFieldManagerkey - Eg. 'customfield_10000'CustomFieldManager.isCustomField(String)@Nullable public CustomField getCustomFieldObjectByName(String customFieldName)
CustomFieldManagerCustomFieldManager.getCustomFieldObjectsByName(String) to retrieve all custom fields.getCustomFieldObjectByName in interface CustomFieldManagercustomFieldName - the NameCustomField, or null if not found.public Collection<CustomField> getCustomFieldObjectsByName(String customFieldName)
CustomFieldManagergetCustomFieldObjectsByName in interface CustomFieldManagercustomFieldName - custom field nameCustomFields.public Collection<CustomField> getCustomFieldObjectsByNameIgnoreCase(String customFieldName)
CustomFieldManagergetCustomFieldObjectsByNameIgnoreCase in interface CustomFieldManagercustomFieldName - custom field nameCustomFields.public List<CustomField> getCustomFieldObjects()
CustomFieldManagergetCustomFieldObjects in interface CustomFieldManagerCustomFields.public List<CustomField> getGlobalCustomFieldObjects()
CustomFieldManagerCustomField.isGlobal()
is true.getGlobalCustomFieldObjects in interface CustomFieldManagerCustomFieldspublic void refresh()
CustomFieldManagerrefresh in interface CustomFieldManagerpublic void refreshConfigurationSchemes(Long customFieldId)
CustomFieldManagerrefreshConfigurationSchemes in interface CustomFieldManagercustomFieldId - the custom field IDpublic void refreshConfiguration()
public void clear()
CustomFieldManagerclear in interface CustomFieldManagerpublic void removeCustomFieldPossiblyLeavingOrphanedData(Long customFieldId) throws RemoveException
CustomFieldManagerCustomFieldManager.removeCustomField(com.atlassian.jira.issue.fields.CustomField) method, which will not leave any orphaned
data behind.
NOTE: Generally you should use the CustomFieldManager.removeCustomField(com.atlassian.jira.issue.fields.CustomField)
method to remove a custom field, as it is guaranteed to remove all data. This method should only be used if
a customfield needs to be removed when the customfieldtype for that field is no longer available!
If however the customfield object cannot be retrieved via the manager, which may be the case if the custom field
type is no longer available (a plugin may have been removed), then this method will try to lookup the custom
field directly in the database. If it doesn't exist in the database, an IllegalArgumentException will
be thrown. Otherwise, the customfield and all associated configurations will be removed. This method
will also call to the CustomFieldValuePersister.removeAllValues(String)
method to delete any values. Please note however, that if your custom field stores any other values (such
as options for example), they will have to be removed by the caller of this method, as the custom field type
is not accessible (which is usually responsible for removing such values).
removeCustomFieldPossiblyLeavingOrphanedData in interface CustomFieldManagercustomFieldId - The id of the customField to be removed.RemoveException - On any error removing the custom fieldpublic void removeCustomField(CustomField customField) throws RemoveException
CustomFieldManagerremoveCustomField in interface CustomFieldManagercustomField - The CustomField to be removed.RemoveException - On any error removing the custom fieldpublic void removeCustomFieldValues(org.ofbiz.core.entity.GenericValue issue)
throws org.ofbiz.core.entity.GenericEntityException
CustomFieldManagerremoveCustomFieldValues in interface CustomFieldManagerissue - The issue GenericValueorg.ofbiz.core.entity.GenericEntityException - DB error@Nonnull public Set<CustomField> getCustomFieldsWithValue(@Nonnull Issue issue)
CustomFieldManagerCustomFields that have value stored in database for particular issue.getCustomFieldsWithValue in interface CustomFieldManagerissue - An Issue objectCustomFieldspublic void updateCustomField(Long id, String name, String description, CustomFieldSearcher searcher)
CustomFieldManagerupdateCustomField in interface CustomFieldManagerid - the custom field IDname - the new namedescription - the new descriptionsearcher - the new Searcherprotected boolean areConfigSchemesEqual(List<FieldConfigScheme> schemes, List<FieldConfigScheme> otherSchemes)
public CustomField getCustomFieldInstance(org.ofbiz.core.entity.GenericValue customFieldGv)
CustomFieldManagerGenericValue to a CustomField instance.getCustomFieldInstance in interface CustomFieldManagerCustomField instancepublic void removeProjectAssociations(Project project)
CustomFieldManagerremoveProjectAssociations in interface CustomFieldManagerproject - The project being deleted.@EventListener public void onClearCache(ClearCacheEvent event)
@EventListener public void onTerminologyCacheClearedEvent(TerminologyCacheClearedEvent event)
Copyright © 2002-2021 Atlassian. All Rights Reserved.