public class DefaultFeatureManager extends Object implements FeatureManager, Startable, InitializingComponent
FeatureManager
.Modifier and Type | Class and Description |
---|---|
static class |
DefaultFeatureManager.FeaturesMapHolder |
Modifier and Type | Field and Description |
---|---|
static String |
FEATURE_RESOURCE_TYPE |
static com.atlassian.plugin.Resources.TypeFilter |
FEATURE_TYPE_FILTER |
SYSTEM_PROPERTY_PREFIX
Constructor and Description |
---|
DefaultFeatureManager(JiraAuthenticationContext authenticationContext,
FeatureStore featureStore,
JiraProperties jiraSystemProperties,
com.atlassian.cache.CacheManager cacheManager,
com.atlassian.tenancy.api.TenantAccessor tenantAccessor) |
Modifier and Type | Method and Description |
---|---|
void |
afterInstantiation() |
void |
disableSiteDarkFeature(String feature)
Disables a site-wide feature.
|
void |
disableUserDarkFeature(ApplicationUser user,
String feature)
Disables a feature for a particular user.
|
void |
disableUserDarkFeature(com.atlassian.crowd.embedded.api.User user,
String feature)
Deprecated.
|
void |
enableSiteDarkFeature(String feature)
Enables a site-wide feature.
|
void |
enableUserDarkFeature(ApplicationUser user,
String feature)
Enables a feature for a particular User.
|
void |
enableUserDarkFeature(com.atlassian.crowd.embedded.api.User user,
String feature)
Deprecated.
|
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.
|
boolean |
hasSiteEditPermission()
Returns true if the currently logged in user has permission to edit site dark features.
|
boolean |
isEnabled(CoreFeatures feature)
Checks whether
feature is enabled either in the running JIRA instance
or for the current user. |
boolean |
isEnabled(Feature feature)
Checks whether or not the specified feature is enabled.
|
boolean |
isEnabled(String featureKey)
Checks whether feature
featureKey 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) . |
void |
onClearCache(ClearCacheEvent event) |
void |
onTenantArrived(com.atlassian.tenancy.api.event.TenantArrivedEvent event) |
void |
start()
This method will be called after the plugin system is fully initialised and all components added to the
dependency injection framework.
|
public static final String FEATURE_RESOURCE_TYPE
public static final com.atlassian.plugin.Resources.TypeFilter FEATURE_TYPE_FILTER
public DefaultFeatureManager(JiraAuthenticationContext authenticationContext, FeatureStore featureStore, JiraProperties jiraSystemProperties, com.atlassian.cache.CacheManager cacheManager, com.atlassian.tenancy.api.TenantAccessor tenantAccessor)
public void afterInstantiation() throws Exception
afterInstantiation
in interface InitializingComponent
Exception
public boolean isEnabled(String featureKey)
FeatureManager
featureKey
is enabled either in the running JIRA instance
or for the current user.isEnabled
in interface FeatureManager
featureKey
- feature keytrue
, if feature identified by featureKey is enabled, false
otherwisepublic boolean isEnabled(Feature feature)
FeatureManager
FeatureManager.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.isEnabled
in interface FeatureManager
feature
- the feature to checktrue
if feature
is enabled; false
otherwisepublic boolean isEnabledForUser(@Nullable ApplicationUser user, String featureKey)
FeatureManager
isEnabledForUser
in interface FeatureManager
user
- the user being queriedfeatureKey
- feature keytrue
, if feature identified by featureKey is enabled, false
otherwisepublic boolean isEnabled(CoreFeatures feature)
FeatureManager
feature
is enabled either in the running JIRA instance
or for the current user. This method should be prefered over
FeatureManager.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.isEnabled
in interface FeatureManager
feature
- the core feature to checktrue
if feature
is enabled; false
otherwisepublic boolean isOnDemand()
FeatureManager
isEnabled(CoreFeatures.ON_DEMAND)
.isOnDemand
in interface FeatureManager
true
if this is JIRA OnDemand; false
otherwisepublic Set<String> getEnabledFeatureKeys()
FeatureManager
getEnabledFeatureKeys
in interface FeatureManager
public DarkFeatures getDarkFeatures()
FeatureManager
DarkFeatures
instances from the PropertySet associated
with the current user.getDarkFeatures
in interface FeatureManager
public DarkFeatures getDarkFeaturesForUser(@Nullable ApplicationUser user)
getDarkFeaturesForUser
in interface FeatureManager
user
- the user being queried; null
represents the anonymous user@Deprecated public void enableUserDarkFeature(com.atlassian.crowd.embedded.api.User user, String feature)
FeatureManager
FeatureEnabledEvent
.
Since JIRA 5.1, this method raises a FeatureEnabledEvent
if it is successful.enableUserDarkFeature
in interface FeatureManager
user
- the user to enable the feature forfeature
- the feature to enable@Deprecated public void disableUserDarkFeature(com.atlassian.crowd.embedded.api.User user, String feature)
FeatureManager
FeatureDisabledEvent
if it is successful.disableUserDarkFeature
in interface FeatureManager
user
- the user to disable the feature forfeature
- the feature to disablepublic void enableUserDarkFeature(ApplicationUser user, String feature)
FeatureManager
FeatureEnabledEvent
.
Since JIRA 5.1, this method raises a FeatureEnabledEvent
if it is successful.enableUserDarkFeature
in interface FeatureManager
user
- the user to enable the feature forfeature
- the feature to enablepublic void disableUserDarkFeature(ApplicationUser user, String feature)
FeatureManager
FeatureDisabledEvent
if it is successful.disableUserDarkFeature
in interface FeatureManager
user
- the user to disable the feature forfeature
- the feature to disablepublic void enableSiteDarkFeature(String feature)
FeatureManager
FeatureEnabledEvent
if it is successful.enableSiteDarkFeature
in interface FeatureManager
feature
- the feature to enablepublic void disableSiteDarkFeature(String feature)
FeatureManager
FeatureDisabledEvent
if it is successful.disableSiteDarkFeature
in interface FeatureManager
feature
- the feature to disablepublic boolean hasSiteEditPermission()
FeatureManager
hasSiteEditPermission
in interface FeatureManager
@EventListener public void onClearCache(ClearCacheEvent event)
@EventListener public void onTenantArrived(com.atlassian.tenancy.api.event.TenantArrivedEvent event)
Copyright © 2002-2015 Atlassian. All Rights Reserved.