com.atlassian.crowd.integration.osuser
Class CrowdPropertySet

java.lang.Object
  extended by com.opensymphony.module.propertyset.AbstractPropertySet
      extended by com.atlassian.crowd.integration.osuser.CrowdPropertySet
All Implemented Interfaces:
com.opensymphony.module.propertyset.PropertySet

public class CrowdPropertySet
extends com.opensymphony.module.propertyset.AbstractPropertySet

This class manages the translation of user information between Crowd and JIRA. It will directly access the Crowd UserManager to fetch or update user details.

As of the time of writing, this class only supports email and displayname - other attributes are ignored.


Field Summary
 
Fields inherited from class com.opensymphony.module.propertyset.AbstractPropertySet
schema
 
Fields inherited from interface com.opensymphony.module.propertyset.PropertySet
BOOLEAN, DATA, DATE, DOUBLE, INT, LONG, OBJECT, PROPERTIES, STRING, TEXT, XML
 
Constructor Summary
CrowdPropertySet()
           
CrowdPropertySet(UserManager userManager)
           
 
Method Summary
 boolean exists(String property)
          Crowd only supports email and fullname properties currently, so these are the only ones we check
protected  Object get(int type, String key)
          Return's a value for the given type and key, if it exists().
 Collection getKeys(String prefix, int type)
          List all keys starting with supplied prefix of certain type.
 String getString(String property)
          This has been overriden to provide specific support for email
 int getType(String key)
          Returns type of value.
 void init(Map config, Map args)
          Initialises the Property Set, specifically the keys and principal
 boolean isSettable(String property)
           
 void remove(String key)
          Removes a property if it is supported (isSettable()) and exists()
protected  void removeAttribute(SOAPPrincipal user, String key)
          Removes the given attribute from the user.
protected  void setImpl(int type, String key, Object value)
          Allows the setting of properties, if they are 'settable', ie isSettable().
 void setKeys(Map keys)
           
 void setPrincipal(SOAPPrincipal principal)
           
 void setString(String property, String value)
          CWD-1190 - Replace an existing property rather than appending.
 boolean supportsType(int type)
           
 
Methods inherited from class com.opensymphony.module.propertyset.AbstractPropertySet
getAsActualType, getBoolean, getData, getDate, getDouble, getInt, getKeys, getKeys, getKeys, getLong, getObject, getProperties, getSchema, getText, getXML, setAsActualType, setBoolean, setData, setDate, setDouble, setInt, setLong, setObject, setProperties, setSchema, setText, setXML, supportsTypes, toString, type, type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CrowdPropertySet

public CrowdPropertySet()

CrowdPropertySet

public CrowdPropertySet(UserManager userManager)
Method Detail

getKeys

public Collection getKeys(String prefix,
                          int type)
                   throws com.opensymphony.module.propertyset.PropertyException
List all keys starting with supplied prefix of certain type. See statics.

Specified by:
getKeys in interface com.opensymphony.module.propertyset.PropertySet
Specified by:
getKeys in class com.opensymphony.module.propertyset.AbstractPropertySet
Parameters:
prefix - String that keys must start with. If null, than all keys shall be returned.
type - Type to list. See static class variables. If null, then all types shall be returned.
Returns:
Unmodifiable Collection of Strings.
Throws:
com.opensymphony.module.propertyset.PropertyException

getType

public int getType(String key)
            throws com.opensymphony.module.propertyset.PropertyException
Returns type of value.

Specified by:
getType in interface com.opensymphony.module.propertyset.PropertySet
Specified by:
getType in class com.opensymphony.module.propertyset.AbstractPropertySet
Returns:
Type of value. See static class variables.
Throws:
com.opensymphony.module.propertyset.PropertyException

remove

public void remove(String key)
            throws com.opensymphony.module.propertyset.PropertyException
Removes a property if it is supported (isSettable()) and exists()

Specified by:
remove in interface com.opensymphony.module.propertyset.PropertySet
Specified by:
remove in class com.opensymphony.module.propertyset.AbstractPropertySet
Throws:
com.opensymphony.module.propertyset.PropertyException

removeAttribute

protected void removeAttribute(SOAPPrincipal user,
                               String key)
Removes the given attribute from the user. If the attribute does not exist, fails silently.

Parameters:
user -
key -

exists

public boolean exists(String property)
               throws com.opensymphony.module.propertyset.PropertyException
Crowd only supports email and fullname properties currently, so these are the only ones we check

Specified by:
exists in interface com.opensymphony.module.propertyset.PropertySet
Specified by:
exists in class com.opensymphony.module.propertyset.AbstractPropertySet
Parameters:
property -
Returns:
true is a property is User.PROPERTY_EMAIL or User.PROPERTY_FULLNAME
Throws:
com.opensymphony.module.propertyset.PropertyException

setImpl

protected void setImpl(int type,
                       String key,
                       Object value)
                throws com.opensymphony.module.propertyset.PropertyException
Allows the setting of properties, if they are 'settable', ie isSettable().

Specified by:
setImpl in class com.opensymphony.module.propertyset.AbstractPropertySet
Parameters:
type - the type, eg. STRING
key - the key for a given property
value - the value of a property, which should be of the passed in type.
Throws:
com.opensymphony.module.propertyset.PropertyException

get

protected Object get(int type,
                     String key)
              throws com.opensymphony.module.propertyset.PropertyException
Return's a value for the given type and key, if it exists().

Specified by:
get in class com.opensymphony.module.propertyset.AbstractPropertySet
Parameters:
type - the type of Object you are looking for, eg STRING
key - the key of the value
Returns:
the value
Throws:
com.opensymphony.module.propertyset.PropertyException

init

public void init(Map config,
                 Map args)
Initialises the Property Set, specifically the keys and principal

Specified by:
init in interface com.opensymphony.module.propertyset.PropertySet
Overrides:
init in class com.opensymphony.module.propertyset.AbstractPropertySet
Parameters:
config -
args -

isSettable

public boolean isSettable(String property)
Specified by:
isSettable in interface com.opensymphony.module.propertyset.PropertySet
Overrides:
isSettable in class com.opensymphony.module.propertyset.AbstractPropertySet

setString

public void setString(String property,
                      String value)
               throws com.opensymphony.module.propertyset.PropertyException
CWD-1190 - Replace an existing property rather than appending.

Specified by:
setString in interface com.opensymphony.module.propertyset.PropertySet
Overrides:
setString in class com.opensymphony.module.propertyset.AbstractPropertySet
Parameters:
property -
value -
Throws:
com.opensymphony.module.propertyset.PropertyException

getString

public String getString(String property)
                 throws com.opensymphony.module.propertyset.PropertyException
This has been overriden to provide specific support for email

Specified by:
getString in interface com.opensymphony.module.propertyset.PropertySet
Overrides:
getString in class com.opensymphony.module.propertyset.AbstractPropertySet
Parameters:
property -
Returns:
Throws:
com.opensymphony.module.propertyset.PropertyException

supportsType

public boolean supportsType(int type)
Specified by:
supportsType in interface com.opensymphony.module.propertyset.PropertySet
Overrides:
supportsType in class com.opensymphony.module.propertyset.AbstractPropertySet

setKeys

public void setKeys(Map keys)

setPrincipal

public void setPrincipal(SOAPPrincipal principal)


Copyright © 2013 Atlassian. All Rights Reserved.