com.atlassian.jira.user.preferences
Class JiraUserPreferences

java.lang.Object
  extended by com.atlassian.jira.user.preferences.JiraUserPreferences
All Implemented Interfaces:
com.atlassian.core.user.preferences.Preferences, ExtendedPreferences

@Internal
public class JiraUserPreferences
extends Object
implements ExtendedPreferences

The JIRA implementation atlassian-core's Preferences. Preferences that have not been set will default to the corresponding value saved in the ApplicationProperties.

WARNING: This class should not be in the API and will be moved to its rightful home in jira-core, possibly as early as JIRA 7.0. As such, all of its public constructors are deprecated. Use the UserPreferencesManager to get a user's preferences instead of referencing this class directly.


Constructor Summary
JiraUserPreferences()
          Deprecated. You should not construct user preferences directly. Request them through the UserPreferencesManager, instead. Since v6.2.
JiraUserPreferences(ApplicationUser user)
          Deprecated. You should not construct user preferences directly. Request them through the UserPreferencesManager, instead. Since v6.2.
JiraUserPreferences(com.opensymphony.module.propertyset.PropertySet userPs)
          Deprecated. You should not construct user preferences directly. Further, preferences created with this particular constructor do not have a reference to the user and therefore may not behave correctly in all circumstances. In particular, getUserKey(), equals(Object) and hashCode() will all behave as they would for an anonymous user, while the actual preferences returned will instead match those provided by the property set. Request user preferences through the UserPreferencesManager, instead. Since v6.2.
JiraUserPreferences(com.atlassian.crowd.embedded.api.User pUser)
          Deprecated. You should not construct user preferences directly. Request them through the UserPreferencesManager, instead. Since v6.2.
 
Method Summary
 boolean containsValue(String key)
          Returns true if the specified property is set.
 boolean equals(Object o)
          Preferences objects are equal iff they are preferences for the same user.
 boolean getBoolean(String key)
           
 long getLong(String key)
           
 String getString(String key)
           
 String getText(String key)
           
 String getUserKey()
          Returns the user's key, or null if the preferences are for an anonymous user.
 int hashCode()
          Returns a hash code based on the user's key, or 0 if the preferences are for an anonymous user.
 void remove(String key)
           
 void setBoolean(String key, boolean value)
           
 void setLong(String key, long value)
           
 void setString(String key, String value)
           
 void setText(String key, String value)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JiraUserPreferences

@Deprecated
public JiraUserPreferences()
Deprecated. You should not construct user preferences directly. Request them through the UserPreferencesManager, instead. Since v6.2.

Returns a user preferences placeholder that is suitable for an anonymous user and defaults to the global preferences defined by ApplicationProperties for everything. Attempts to modify the preferences throw AtlassianCoreException.


JiraUserPreferences

@Deprecated
public JiraUserPreferences(ApplicationUser user)
Deprecated. You should not construct user preferences directly. Request them through the UserPreferencesManager, instead. Since v6.2.


JiraUserPreferences

@Deprecated
public JiraUserPreferences(com.atlassian.crowd.embedded.api.User pUser)
Deprecated. You should not construct user preferences directly. Request them through the UserPreferencesManager, instead. Since v6.2.


JiraUserPreferences

@Deprecated
public JiraUserPreferences(com.opensymphony.module.propertyset.PropertySet userPs)
Deprecated. You should not construct user preferences directly. Further, preferences created with this particular constructor do not have a reference to the user and therefore may not behave correctly in all circumstances. In particular, getUserKey(), equals(Object) and hashCode() will all behave as they would for an anonymous user, while the actual preferences returned will instead match those provided by the property set. Request user preferences through the UserPreferencesManager, instead. Since v6.2.

Method Detail

getLong

public long getLong(String key)
Specified by:
getLong in interface com.atlassian.core.user.preferences.Preferences

getString

public String getString(String key)
Specified by:
getString in interface com.atlassian.core.user.preferences.Preferences

getText

public String getText(String key)
Specified by:
getText in interface ExtendedPreferences

getBoolean

public boolean getBoolean(String key)
Specified by:
getBoolean in interface com.atlassian.core.user.preferences.Preferences

setLong

public void setLong(String key,
                    long value)
             throws com.atlassian.core.AtlassianCoreException
Specified by:
setLong in interface com.atlassian.core.user.preferences.Preferences
Throws:
com.atlassian.core.AtlassianCoreException

setString

public void setString(String key,
                      String value)
               throws com.atlassian.core.AtlassianCoreException
Specified by:
setString in interface com.atlassian.core.user.preferences.Preferences
Throws:
com.atlassian.core.AtlassianCoreException

setText

public void setText(String key,
                    String value)
             throws com.atlassian.core.AtlassianCoreException
Specified by:
setText in interface ExtendedPreferences
Throws:
com.atlassian.core.AtlassianCoreException

setBoolean

public void setBoolean(String key,
                       boolean value)
                throws com.atlassian.core.AtlassianCoreException
Specified by:
setBoolean in interface com.atlassian.core.user.preferences.Preferences
Throws:
com.atlassian.core.AtlassianCoreException

remove

public void remove(String key)
            throws com.atlassian.core.AtlassianCoreException
Specified by:
remove in interface com.atlassian.core.user.preferences.Preferences
Throws:
com.atlassian.core.AtlassianCoreException

getUserKey

public String getUserKey()
Description copied from interface: ExtendedPreferences
Returns the user's key, or null if the preferences are for an anonymous user.

Specified by:
getUserKey in interface ExtendedPreferences
Returns:
the user's key, or null if the preferences are for an anonymous user.

equals

public boolean equals(Object o)
Description copied from interface: ExtendedPreferences
Preferences objects are equal iff they are preferences for the same user.

Specified by:
equals in interface ExtendedPreferences
Overrides:
equals in class Object
Parameters:
o - the object to check for equality
Returns:
true if the the preferences are for the same user; false otherwise

hashCode

public int hashCode()
Description copied from interface: ExtendedPreferences
Returns a hash code based on the user's key, or 0 if the preferences are for an anonymous user.

Specified by:
hashCode in interface ExtendedPreferences
Overrides:
hashCode in class Object
Returns:
a hash code based on the user's key, or 0 if the preferences are for an anonymous user.

containsValue

public boolean containsValue(String key)
Returns true if the specified property is set.

Specified by:
containsValue in interface ExtendedPreferences
Parameters:
key - - property to be tested.
Returns:
if value for key exists
Since:
5.2.2


Copyright © 2002-2014 Atlassian. All Rights Reserved.