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:
Startable, FieldConfigSchemePersister, JiraCachedManager

public class CachedFieldConfigSchemePersister
extends FieldConfigSchemePersisterImpl
implements JiraCachedManager, Startable

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, com.atlassian.event.api.EventPublisher eventPublisher, FieldConfigContextPersister fieldContextPersister)
           
 
Method Summary
 long getCacheSize()
           
 FieldConfigScheme getConfigSchemeForFieldConfig(FieldConfig fieldConfig)
          Finds the FieldConfigScheme that contains the FieldConfig
 java.util.List<FieldConfigScheme> getConfigSchemesForCustomField(ConfigurableField field)
           
 FieldConfigScheme getFieldConfigScheme(java.lang.Long configSchemeId)
           
 void init()
           
 void onClearCache(ClearCacheEvent event)
           
 void refreshCache()
           
 void remove(java.lang.Long fieldConfigSchemeId)
           
 void start()
          This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.
 
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,
                                        com.atlassian.event.api.EventPublisher eventPublisher,
                                        FieldConfigContextPersister fieldContextPersister)
Method Detail

init

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

start

public void start()
           throws java.lang.Exception
Description copied from interface: Startable
This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.

Specified by:
start in interface Startable
Throws:
java.lang.Exception - Allows implementations to throw an Exception.

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent event)

getFieldConfigScheme

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

getConfigSchemesForCustomField

public java.util.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(java.lang.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-2010 Atlassian. All Rights Reserved.