com.atlassian.jira.issue.context.persistence
Class CachingFieldConfigContextPersister

java.lang.Object
  extended by com.atlassian.jira.issue.context.persistence.CachingFieldConfigContextPersister
All Implemented Interfaces:
com.atlassian.bandana.BandanaPersister, Startable, FieldConfigContextPersister

@Internal
public class CachingFieldConfigContextPersister
extends Object
implements FieldConfigContextPersister, Startable

Caching decorator for FieldConfigContextPersister. This corresponds to the configurationcontext table, which is essentially an association table between CustomField and either a ProjectCategory or a Project, but not both (in practice it is always a Project). Each association also has FieldConfigScheme as a property of the association, and this is where things like default values for custom fields are ultimately stored. When both the project and projectCategory are null, then that database row is in fact a special row holding the FieldConfigScheme for the "Global Context".

See CustomField Configuration - DB Entity Model for a more in-depth explanation of how this all works.

Since:
v5.1

Constructor Summary
CachingFieldConfigContextPersister(OfBizDelegator delegator, ProjectManager projectManager, JiraContextTreeManager treeManager, com.atlassian.cache.CacheManager cacheManager)
          Creates a new CachingFieldConfigContextPersister that wraps a new FieldConfigContextPersisterImpl instance.
 
Method Summary
 void flushCaches()
           
 List<JiraContextNode> getAllContextsForConfigScheme(FieldConfigScheme fieldConfigScheme)
           
 List<JiraContextNode> getAllContextsForCustomField(String key)
           
 void onClearCache(ClearCacheEvent clearCacheEvent)
          Clears this CachingFieldConfigContextPersister's cache upon receiving a ClearCacheEvent.
 void remove(com.atlassian.bandana.BandanaContext context)
           
 void remove(com.atlassian.bandana.BandanaContext context, String customField)
           
 void removeContextsForConfigScheme(FieldConfigScheme fieldConfigScheme)
           
 void removeContextsForConfigScheme(Long fieldConfigSchemeId)
          Remove contexts for a scheme
 void removeContextsForProject(org.ofbiz.core.entity.GenericValue project)
           
 void removeContextsForProject(Project project)
           
 void removeContextsForProjectCategory(ProjectCategory projectCategory)
           
 Object retrieve(com.atlassian.bandana.BandanaContext context, String key)
           
 void start()
          Registers this CachingFieldConfigContextPersister's cache in the JIRA instrumentation.
 void store(com.atlassian.bandana.BandanaContext context, String customField, Object fieldConfigScheme)
           
 void store(Collection<? extends com.atlassian.bandana.BandanaContext> contexts, String customField, Object fieldConfigScheme)
          Bulk store context/key/value triplets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingFieldConfigContextPersister

public CachingFieldConfigContextPersister(OfBizDelegator delegator,
                                          ProjectManager projectManager,
                                          JiraContextTreeManager treeManager,
                                          com.atlassian.cache.CacheManager cacheManager)
Creates a new CachingFieldConfigContextPersister that wraps a new FieldConfigContextPersisterImpl instance.

Parameters:
delegator - the OfBizDelegator
projectManager - the ProjectManager
treeManager - the JiraContextTreeManager
Method Detail

start

public void start()
           throws Exception
Registers this CachingFieldConfigContextPersister's cache in the JIRA instrumentation.

Specified by:
start in interface Startable
Throws:
Exception

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent clearCacheEvent)
Clears this CachingFieldConfigContextPersister's cache upon receiving a ClearCacheEvent.

Parameters:
clearCacheEvent - a ClearCacheEvent

getAllContextsForCustomField

public List<JiraContextNode> getAllContextsForCustomField(String key)
Specified by:
getAllContextsForCustomField in interface FieldConfigContextPersister

getAllContextsForConfigScheme

public List<JiraContextNode> getAllContextsForConfigScheme(FieldConfigScheme fieldConfigScheme)
Specified by:
getAllContextsForConfigScheme in interface FieldConfigContextPersister

removeContextsForConfigScheme

public void removeContextsForConfigScheme(FieldConfigScheme fieldConfigScheme)
Specified by:
removeContextsForConfigScheme in interface FieldConfigContextPersister

removeContextsForConfigScheme

public void removeContextsForConfigScheme(Long fieldConfigSchemeId)
Description copied from interface: FieldConfigContextPersister
Remove contexts for a scheme

Specified by:
removeContextsForConfigScheme in interface FieldConfigContextPersister
Parameters:
fieldConfigSchemeId - ID of scheme to remove.

removeContextsForProject

public void removeContextsForProject(org.ofbiz.core.entity.GenericValue project)
Specified by:
removeContextsForProject in interface FieldConfigContextPersister
Parameters:
project - the project

removeContextsForProject

public void removeContextsForProject(Project project)
Specified by:
removeContextsForProject in interface FieldConfigContextPersister

removeContextsForProjectCategory

public void removeContextsForProjectCategory(ProjectCategory projectCategory)
Specified by:
removeContextsForProjectCategory in interface FieldConfigContextPersister

retrieve

public Object retrieve(com.atlassian.bandana.BandanaContext context,
                       String key)
Specified by:
retrieve in interface com.atlassian.bandana.BandanaPersister

store

public void store(com.atlassian.bandana.BandanaContext context,
                  String customField,
                  Object fieldConfigScheme)
Specified by:
store in interface com.atlassian.bandana.BandanaPersister

store

public void store(Collection<? extends com.atlassian.bandana.BandanaContext> contexts,
                  String customField,
                  Object fieldConfigScheme)
Description copied from interface: FieldConfigContextPersister
Bulk store context/key/value triplets.

Specified by:
store in interface FieldConfigContextPersister

flushCaches

public void flushCaches()
Specified by:
flushCaches in interface com.atlassian.bandana.BandanaPersister

remove

public void remove(com.atlassian.bandana.BandanaContext context)
Specified by:
remove in interface com.atlassian.bandana.BandanaPersister

remove

public void remove(com.atlassian.bandana.BandanaContext context,
                   String customField)
Specified by:
remove in interface com.atlassian.bandana.BandanaPersister


Copyright © 2002-2014 Atlassian. All Rights Reserved.