public class

CachingLabelStore

extends Object
implements Startable LabelStore
java.lang.Object
   ↳ com.atlassian.jira.issue.label.CachingLabelStore

Class Overview

Caching implementation of the Label store, that caches labels in a weakhashmap based on the issue/field combination.

Summary

Public Constructors
CachingLabelStore(OfBizLabelStore delegateStore, CacheManager cacheManager)
Public Methods
Label addLabel(Long issueId, Long customFieldId, String label)
Adds a new label to the issue for the custom field specified.
Set<Label> getLabels(Long issueId, Long customFieldId)
Returns all the labels for the given issue and custom field.
@EventListener void onClearCache(ClearCacheEvent event)
void removeLabel(Long labelId, Long issueId, Long customFieldId)
Removes the label identified by id
Set<Long> removeLabelsForCustomField(Long customFieldId)
Deletes all labels for a given custom field.
Set<Label> setLabels(Long issueId, Long customFieldId, Set<String> labels)
Sets the labels for a particular issue and field combo to the set specified as a parameter.
void start()
This method will be called after the plugin system is fully initialised and all components added to the dependency injection framework.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.extension.Startable
From interface com.atlassian.jira.issue.label.LabelStore

Public Constructors

public CachingLabelStore (OfBizLabelStore delegateStore, CacheManager cacheManager)

Public Methods

public Label addLabel (Long issueId, Long customFieldId, String label)

Adds a new label to the issue for the custom field specified. If the customFieldId is null, the label will be added for the system field. Adding an existing label again, will simply return the existing label.

Parameters
issueId The issue id that the label is linked against
customFieldId Custom field id for the labels CF or null if it's the system field.
label The new label to add
Returns
  • The Label object that was added

public Set<Label> getLabels (Long issueId, Long customFieldId)

Returns all the labels for the given issue and custom field. The custom field may also be null, in which case the labels for the system field will be returned.

Parameters
issueId The issue id that the label is linked against
customFieldId Custom field id for the labels CF or null if it's the system field.
Returns
  • A set of alphabetically ordered labels for the issue and custom field.

@EventListener public void onClearCache (ClearCacheEvent event)

public void removeLabel (Long labelId, Long issueId, Long customFieldId)

Removes the label identified by id

Parameters
labelId The id of the label to delete
issueId The issue id that the label is linked against
customFieldId Custom field id for the labels CF or null if it's the system field.

public Set<Long> removeLabelsForCustomField (Long customFieldId)

Deletes all labels for a given custom field. This is useful when deleting a custom field.

Parameters
customFieldId The custom field id for which to delete labels
Returns
  • A set of issueids affected by this operation

public Set<Label> setLabels (Long issueId, Long customFieldId, Set<String> labels)

Sets the labels for a particular issue and field combo to the set specified as a parameter. The set may be an empty set in order to clear all labels for an issue.

Parameters
issueId The issue id that the label is linked against
customFieldId Custom field id for the labels CF or null if it's the system field.
labels the new labels for this issue and custom field combo
Returns
  • a set of stored label objects in alphabetical order

public void start ()

This method will be called after the plugin system is fully initialised and all components added to the dependency injection framework.

Throws
Exception