com.atlassian.jira.issue.fields.config.persistence
Class CachedFieldConfigSchemePersister

java.lang.Object
  extended by com.atlassian.jira.issue.fields.config.persistence.FieldConfigSchemePersisterImpl
      extended by com.atlassian.jira.issue.fields.config.persistence.CachedFieldConfigSchemePersister
All Implemented Interfaces:
FieldConfigSchemePersister, JiraCachedManager

public class CachedFieldConfigSchemePersister
extends FieldConfigSchemePersisterImpl
implements JiraCachedManager

A simple caching wrapper

NOTE : you may be wondering about the cache invalidation strategy on this cache. Will the top level classes that use this cache such as com.atlassian.jira.issue.CustomFieldManager@refreshCache call init() and this clears the cache.

TODO: This probably should be rewritten so that the upper lays of code are not responsible for clearing the lower level caches and also the "cache inheritance" pattern should be removed.


Field Summary
 
Fields inherited from class com.atlassian.jira.issue.fields.config.persistence.FieldConfigSchemePersisterImpl
ENTITY_CONFIG_ID, ENTITY_DESCRIPTION, ENTITY_FIELD, ENTITY_ID, ENTITY_ISSUE_TYPE, ENTITY_NAME, ENTITY_RELATED_TABLE_NAME, ENTITY_SCHEME_ID, ENTITY_TABLE_NAME, FK_RELATED_CONFIGS
 
Constructor Summary
CachedFieldConfigSchemePersister(OfBizDelegator delegator, ConstantsManager constantsManager, FieldConfigPersister fieldConfigPersister, FieldConfigContextPersister fieldContextPersister)
           
 
Method Summary
 long getCacheSize()
           
 FieldConfigScheme getConfigSchemeForFieldConfig(FieldConfig fieldConfig)
          Finds the FieldConfigScheme that contains the FieldConfig
 List<FieldConfigScheme> getConfigSchemesForCustomField(ConfigurableField field)
           
 FieldConfigScheme getFieldConfigScheme(Long configSchemeId)
           
 void init()
           
 void onClearCache(ClearCacheEvent event)
           
 void refreshCache()
           
 void remove(Long fieldConfigSchemeId)
           
 
Methods inherited from class com.atlassian.jira.issue.fields.config.persistence.FieldConfigSchemePersisterImpl
create, createWithDefaultValues, getConfigSchemeIdsForCustomFieldId, getInvalidFieldConfigSchemeAfterIssueTypeRemoval, removeByIssueType, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedFieldConfigSchemePersister

public CachedFieldConfigSchemePersister(OfBizDelegator delegator,
                                        ConstantsManager constantsManager,
                                        FieldConfigPersister fieldConfigPersister,
                                        FieldConfigContextPersister fieldContextPersister)
Method Detail

init

public void init()
Specified by:
init in interface FieldConfigSchemePersister
Overrides:
init in class FieldConfigSchemePersisterImpl

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent event)

getFieldConfigScheme

public FieldConfigScheme getFieldConfigScheme(Long configSchemeId)
Specified by:
getFieldConfigScheme in interface FieldConfigSchemePersister
Overrides:
getFieldConfigScheme in class FieldConfigSchemePersisterImpl

getConfigSchemesForCustomField

public List<FieldConfigScheme> getConfigSchemesForCustomField(ConfigurableField field)
Specified by:
getConfigSchemesForCustomField in interface FieldConfigSchemePersister
Overrides:
getConfigSchemesForCustomField in class FieldConfigSchemePersisterImpl

getConfigSchemeForFieldConfig

public FieldConfigScheme getConfigSchemeForFieldConfig(FieldConfig fieldConfig)
Description copied from interface: FieldConfigSchemePersister
Finds the FieldConfigScheme that contains the FieldConfig

Specified by:
getConfigSchemeForFieldConfig in interface FieldConfigSchemePersister
Overrides:
getConfigSchemeForFieldConfig in class FieldConfigSchemePersisterImpl
Parameters:
fieldConfig - the config to find the containing FieldConfigScheme of; cannot be null.
Returns:
the first scheme that contains the FieldConfig. Not Null.

getCacheSize

public long getCacheSize()
Specified by:
getCacheSize in interface JiraCachedManager

remove

public void remove(Long fieldConfigSchemeId)
Specified by:
remove in interface FieldConfigSchemePersister
Overrides:
remove in class FieldConfigSchemePersisterImpl

refreshCache

public void refreshCache()
Specified by:
refreshCache in interface JiraCachedManager


Copyright © 2002-2013 Atlassian. All Rights Reserved.