@PublicApi public interface

FeatureManager

com.atlassian.jira.config.FeatureManager
Known Indirect Subclasses

@PublicApi

This interface is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Class Overview

Component responsible for providing information whether certain features in JIRA are enabled or disabled.

Summary

Constants
String SYSTEM_PROPERTY_PREFIX The prefix used for enabling dark features from the command line.
Public Methods
void disableSiteDarkFeature(String feature)
Disables a site-wide feature.
void disableUserDarkFeature(ApplicationUser user, String feature)
Disables a feature for a particular user.
void enableSiteDarkFeature(String feature)
Enables a site-wide feature.
void enableUserDarkFeature(ApplicationUser user, String feature)
Enables a feature for a particular User.
DarkFeatures getDarkFeatures()
Creates DarkFeatures instances from the PropertySet associated with the current user.
DarkFeatures getDarkFeaturesForUser(ApplicationUser user)
Set<String> getEnabledFeatureKeys()
Returns a set containing the feature keys of all features that are currently enabled.
Option<FeatureFlag> getFeatureFlag(String featureKey)
Return a feature flag by key
Set<FeatureFlag> getRegisteredFlags()
boolean hasSiteEditPermission()
Returns true if the currently logged in user has permission to edit site dark features.
boolean isEnabled(String featureKey)
Checks whether feature featureKey is enabled either in the running JIRA instance or for the current user.
boolean isEnabled(FeatureFlag featureFlag)
Checking the state of feature flag
@Internal boolean isEnabled(Feature feature)
Checks whether or not the specified feature is enabled.
@Internal boolean isEnabled(CoreFeatures feature)
Checks whether feature is enabled either in the running JIRA instance or for the current user.
boolean isEnabledForUser(ApplicationUser user, String featureKey)
Checks whether a feature with given featureKey is enabled in the running JIRA instance for the given user.
boolean isOnDemand()
Convenience method equivalent to calling isEnabled(CoreFeatures.ON_DEMAND).

Constants

public static final String SYSTEM_PROPERTY_PREFIX

The prefix used for enabling dark features from the command line. For example, one might use -Datlassian.darkfeature.com.atlassian.jira.config.FAST_TABS=true as a JVM argument in order to enable fast tabs.

Constant Value: "atlassian.darkfeature."

Public Methods

public void disableSiteDarkFeature (String feature)

Disables a site-wide feature.

Since JIRA 5.1, this method raises a FeatureDisabledEvent if it is successful.

Parameters
feature the feature to disable

public void disableUserDarkFeature (ApplicationUser user, String feature)

Disables a feature for a particular user.

Since JIRA 5.1, this method raises a FeatureDisabledEvent if it is successful.

Parameters
user the user to disable the feature for
feature the feature to disable

public void enableSiteDarkFeature (String feature)

Enables a site-wide feature.

Since JIRA 5.1, this method raises a FeatureEnabledEvent if it is successful.

Parameters
feature the feature to enable

public void enableUserDarkFeature (ApplicationUser user, String feature)

Enables a feature for a particular User. Raises a FeatureEnabledEvent.

Since JIRA 5.1, this method raises a FeatureEnabledEvent if it is successful.

Parameters
user the user to enable the feature for
feature the feature to enable

public DarkFeatures getDarkFeatures ()

Creates DarkFeatures instances from the PropertySet associated with the current user.

Returns
  • Returns the Dark Features state for the current user.

public DarkFeatures getDarkFeaturesForUser (ApplicationUser user)

Parameters
user the user being queried; null represents the anonymous user
Returns
  • Returns the dark features state for the current user.

public Set<String> getEnabledFeatureKeys ()

Returns a set containing the feature keys of all features that are currently enabled.

Returns
  • a set containing the feature keys of all features that are currently enabled

public Option<FeatureFlag> getFeatureFlag (String featureKey)

Return a feature flag by key

Parameters
featureKey the feature key string
Returns
  • optional value of feature flag

public Set<FeatureFlag> getRegisteredFlags ()

Returns
  • a list of feature flags in the system

public boolean hasSiteEditPermission ()

Returns true if the currently logged in user has permission to edit site dark features.

Returns
  • true if the currently logged in user has permission to edit site dark features.

public boolean isEnabled (String featureKey)

Checks whether feature featureKey is enabled either in the running JIRA instance or for the current user. If the featureKey relates to a feature flag that is defined, then it will also take the default values into consideration.

Parameters
featureKey feature key
Returns
  • true, if feature identified by featureKey is enabled, false otherwise

public boolean isEnabled (FeatureFlag featureFlag)

Checking the state of feature flag

Parameters
featureFlag defined feature flag
Returns
  • state of the feature flag

@Internal public boolean isEnabled (Feature feature)

@Internal

This method is an internal implementation detail and will change without notice.

Clients that depend on @Internal classes and interfaces can not expect to be compatible with any version other than the version they were compiled against (even minor version and milestone releases may break binary compatibility with respect to @Internal elements).

Checks whether or not the specified feature is enabled. This method should be prefered over isEnabled(String) for internal feature checks, particularly for core features that are not user-settable, as it will skip loading the current user's preferences when possible.

Parameters
feature the feature to check
Returns
  • true if feature is enabled; false otherwise

@Internal public boolean isEnabled (CoreFeatures feature)

@Internal

This method is an internal implementation detail and will change without notice.

Clients that depend on @Internal classes and interfaces can not expect to be compatible with any version other than the version they were compiled against (even minor version and milestone releases may break binary compatibility with respect to @Internal elements).

Checks whether feature is enabled either in the running JIRA instance or for the current user. This method should be prefered over isEnabled(String) for internal feature checks, particularly for core features that are not user-settable, as it will skip loading the current user's preferences when possible.

Parameters
feature the core feature to check
Returns
  • true if feature is enabled; false otherwise

public boolean isEnabledForUser (ApplicationUser user, String featureKey)

Checks whether a feature with given featureKey is enabled in the running JIRA instance for the given user.

Parameters
user the user being queried
featureKey feature key
Returns
  • true, if feature identified by featureKey is enabled, false otherwise

public boolean isOnDemand ()

Convenience method equivalent to calling isEnabled(CoreFeatures.ON_DEMAND).

Returns
  • true if this is JIRA OnDemand; false otherwise