com.atlassian.jira.config
Class DefaultFeatureManager

java.lang.Object
  extended by com.atlassian.jira.config.DefaultFeatureManager
All Implemented Interfaces:
FeatureManager, Startable, InitializingComponent

public class DefaultFeatureManager
extends Object
implements FeatureManager, Startable, InitializingComponent

Default implementation of FeatureManager.

Since:
v4.4

Nested Class Summary
static class DefaultFeatureManager.FeaturesMapHolder
           
 
Field Summary
static String FEATURE_RESOURCE_TYPE
           
static com.atlassian.plugin.Resources.TypeFilter FEATURE_TYPE_FILTER
           
 
Fields inherited from interface com.atlassian.jira.config.FeatureManager
SYSTEM_PROPERTY_PREFIX
 
Constructor Summary
DefaultFeatureManager(JiraAuthenticationContext authenticationContext, FeatureStore featureStore, JiraProperties jiraSystemProperties, com.atlassian.cache.CacheManager cacheManager, com.atlassian.tenancy.api.TenantAccessor tenantAccessor)
           
 
Method Summary
 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 wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FEATURE_RESOURCE_TYPE

public static final String FEATURE_RESOURCE_TYPE
See Also:
Constant Field Values

FEATURE_TYPE_FILTER

public static final com.atlassian.plugin.Resources.TypeFilter FEATURE_TYPE_FILTER
Constructor Detail

DefaultFeatureManager

public DefaultFeatureManager(JiraAuthenticationContext authenticationContext,
                             FeatureStore featureStore,
                             JiraProperties jiraSystemProperties,
                             com.atlassian.cache.CacheManager cacheManager,
                             com.atlassian.tenancy.api.TenantAccessor tenantAccessor)
Method Detail

afterInstantiation

public void afterInstantiation()
                        throws Exception
Specified by:
afterInstantiation in interface InitializingComponent
Throws:
Exception

isEnabled

public boolean isEnabled(String featureKey)
Description copied from interface: FeatureManager
Checks whether feature featureKey is enabled either in the running JIRA instance or for the current user.

Specified by:
isEnabled in interface FeatureManager
Parameters:
featureKey - feature key
Returns:
true, if feature identified by featureKey is enabled, false otherwise

isEnabled

public boolean isEnabled(Feature feature)
Description copied from interface: FeatureManager
Checks whether or not the specified feature is enabled. 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.

Specified by:
isEnabled in interface FeatureManager
Parameters:
feature - the feature to check
Returns:
true if feature is enabled; false otherwise

isEnabledForUser

public boolean isEnabledForUser(@Nullable
                                ApplicationUser user,
                                String featureKey)
Description copied from interface: FeatureManager
Checks whether a feature with given featureKey is enabled in the running JIRA instance for the given user.

Specified by:
isEnabledForUser in interface FeatureManager
Parameters:
user - the user being queried
featureKey - feature key
Returns:
true, if feature identified by featureKey is enabled, false otherwise

isEnabled

public boolean isEnabled(CoreFeatures feature)
Description copied from interface: FeatureManager
Checks whether 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.

Specified by:
isEnabled in interface FeatureManager
Parameters:
feature - the core feature to check
Returns:
true if feature is enabled; false otherwise

isOnDemand

public boolean isOnDemand()
Description copied from interface: FeatureManager
Convenience method equivalent to calling isEnabled(CoreFeatures.ON_DEMAND).

Specified by:
isOnDemand in interface FeatureManager
Returns:
true if this is JIRA OnDemand; false otherwise

getEnabledFeatureKeys

public Set<String> getEnabledFeatureKeys()
Description copied from interface: FeatureManager
Returns a set containing the feature keys of all features that are currently enabled.

Specified by:
getEnabledFeatureKeys in interface FeatureManager
Returns:
a set containing the feature keys of all features that are currently enabled

getDarkFeatures

public DarkFeatures getDarkFeatures()
Description copied from interface: FeatureManager
Creates DarkFeatures instances from the PropertySet associated with the current user.

Specified by:
getDarkFeatures in interface FeatureManager
Returns:
Returns the Dark Features state for the current user.

getDarkFeaturesForUser

public DarkFeatures getDarkFeaturesForUser(@Nullable
                                           ApplicationUser user)
Specified by:
getDarkFeaturesForUser in interface FeatureManager
Parameters:
user - the user being queried; null represents the anonymous user
Returns:
Returns the dark features state for the current user.

enableUserDarkFeature

@Deprecated
public void enableUserDarkFeature(com.atlassian.crowd.embedded.api.User user,
                                             String feature)
Deprecated. 

Description copied from interface: FeatureManager
Enables a feature for a particular User. Raises a FeatureEnabledEvent.

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

Specified by:
enableUserDarkFeature in interface FeatureManager
Parameters:
user - the user to enable the feature for
feature - the feature to enable

disableUserDarkFeature

@Deprecated
public void disableUserDarkFeature(com.atlassian.crowd.embedded.api.User user,
                                              String feature)
Deprecated. 

Description copied from interface: FeatureManager
Disables a feature for a particular user.

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

Specified by:
disableUserDarkFeature in interface FeatureManager
Parameters:
user - the user to disable the feature for
feature - the feature to disable

enableUserDarkFeature

public void enableUserDarkFeature(ApplicationUser user,
                                  String feature)
Description copied from interface: FeatureManager
Enables a feature for a particular User. Raises a FeatureEnabledEvent.

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

Specified by:
enableUserDarkFeature in interface FeatureManager
Parameters:
user - the user to enable the feature for
feature - the feature to enable

disableUserDarkFeature

public void disableUserDarkFeature(ApplicationUser user,
                                   String feature)
Description copied from interface: FeatureManager
Disables a feature for a particular user.

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

Specified by:
disableUserDarkFeature in interface FeatureManager
Parameters:
user - the user to disable the feature for
feature - the feature to disable

enableSiteDarkFeature

public void enableSiteDarkFeature(String feature)
Description copied from interface: FeatureManager
Enables a site-wide feature.

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

Specified by:
enableSiteDarkFeature in interface FeatureManager
Parameters:
feature - the feature to enable

disableSiteDarkFeature

public void disableSiteDarkFeature(String feature)
Description copied from interface: FeatureManager
Disables a site-wide feature. Since JIRA 5.1, this method raises a FeatureDisabledEvent if it is successful.

Specified by:
disableSiteDarkFeature in interface FeatureManager
Parameters:
feature - the feature to disable

hasSiteEditPermission

public boolean hasSiteEditPermission()
Description copied from interface: FeatureManager
Returns true if the currently logged in user has permission to edit site dark features.

Specified by:
hasSiteEditPermission in interface FeatureManager
Returns:
true if the currently logged in user has permission to edit site dark features.

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent event)

onTenantArrived

@EventListener
public void onTenantArrived(com.atlassian.tenancy.api.event.TenantArrivedEvent event)

start

public void start()
           throws Exception
Description copied from interface: Startable
This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.

Specified by:
start in interface Startable
Throws:
Exception - Allows implementations to throw an Exception.


Copyright © 2002-2014 Atlassian. All Rights Reserved.