Package com.atlassian.jira.config
Interface FeatureManager
- All Known Subinterfaces:
CachingFeatureManager
- All Known Implementing Classes:
BootstrapFeatureManager,DefaultFeatureManager,MockFeatureManager
@PublicApi
public interface FeatureManager
Component responsible for providing information whether certain features in JIRA are enabled or disabled.
- Since:
- v4.4
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe prefix used for enabling dark features from the command line. -
Method Summary
Modifier and TypeMethodDescriptionvoiddisableSiteDarkFeature(String feature) Disables a site-wide feature.voiddisableUserDarkFeature(ApplicationUser user, String feature) Disables a feature for a particular user.voidenableSiteDarkFeature(String feature) Enables a site-wide feature.voidenableUserDarkFeature(ApplicationUser user, String feature) Enables a feature for a particular User.CreatesDarkFeaturesinstances from the PropertySet associated with the current user.Returns a set containing the feature keys of all features that are currently enabled.io.atlassian.fugue.Option<FeatureFlag>getFeatureFlag(String featureKey) Return a feature flag by keybooleanReturns true if the currently logged in user has permission to edit site dark features.booleanisEnabled(CoreFeatures feature) Checks whetherfeatureis enabled either in the running JIRA instance or for the current user.booleanChecks whether or not the specified feature is enabled.booleanisEnabled(FeatureFlag featureFlag) Checking the state of feature flagbooleanChecks whether featurefeatureKeyis enabled either in the running JIRA instance or for the current user.booleanisEnabledForUser(ApplicationUser user, String featureKey) Checks whether a feature with given featureKey is enabled in the running JIRA instance for the given user.
-
Field Details
-
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=trueas a JVM argument in order to enable fast tabs.- See Also:
-
-
Method Details
-
isEnabled
Checks whether featurefeatureKeyis 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,falseotherwise
-
isEnabled
Checks whetherfeatureis enabled either in the running JIRA instance or for the current user. This method should be prefered overisEnabled(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:
trueiffeatureis enabled;falseotherwise
-
isEnabled
Checks whether or not the specified feature is enabled. This method should be prefered overisEnabled(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:
trueiffeatureis enabled;falseotherwise- Since:
- v6.0
-
isEnabled
Checking the state of feature flag- Parameters:
featureFlag- defined feature flag- Returns:
- state of the feature flag
- Since:
- 7.1
-
getFeatureFlag
Return a feature flag by key- Parameters:
featureKey- the feature key string- Returns:
- optional value of feature flag
- Since:
- 7.1
-
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
- Since:
- v5.0
-
getDarkFeatures
DarkFeatures getDarkFeatures()CreatesDarkFeaturesinstances from the PropertySet associated with the current user.- Returns:
- Returns the Dark Features state for the current user.
-
getRegisteredFlags
Set<FeatureFlag> getRegisteredFlags()- Returns:
- a list of feature flags in the system
- Since:
- 7.1
-
enableUserDarkFeature
Enables a feature for a particular User. Raises aFeatureEnabledEvent.Since JIRA 5.1, this method raises a
FeatureEnabledEventif it is successful.- Parameters:
user- the user to enable the feature forfeature- the feature to enable
-
disableUserDarkFeature
Disables a feature for a particular user.Since JIRA 5.1, this method raises a
FeatureDisabledEventif it is successful.- Parameters:
user- the user to disable the feature forfeature- the feature to disable
-
enableSiteDarkFeature
Enables a site-wide feature.Since JIRA 5.1, this method raises a
FeatureEnabledEventif it is successful.- Parameters:
feature- the feature to enable
-
disableSiteDarkFeature
Disables a site-wide feature.Since JIRA 5.1, this method raises a
FeatureDisabledEventif it is successful.- Parameters:
feature- the feature to disable
-
hasSiteEditPermission
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.
- Since:
- 5.2
-
getDarkFeaturesForUser
- Parameters:
user- the user being queried;nullrepresents the anonymous user- Returns:
- Returns the dark features state for the current user.
-
isEnabledForUser
Checks whether a feature with given featureKey is enabled in the running JIRA instance for the given user.- Parameters:
user- the user being queriedfeatureKey- feature key- Returns:
true, if feature identified by featureKey is enabled,falseotherwise
-