com.atlassian.crowd.integration.osuser
Class PrioritizedCompositePropertySet

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

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

PrioritizedCompositePropertySet composes multiple PropertySets into a unified view of the underlying properties. The order of the underlying PropertySets is significant and affects the value that is returned for a particular property key. The first PropertySet that contains the value is the holder of the official value.

Note however that if any underlying PropertySet defines a particular key as read-only, then that property will be read-only, even though a higher PropertySet may be read-write. This is done to preserve the contract of the PropertySet interface, in particular the semantics of remove(String) which otherwise would not actually remove the property but allow the previously shadowed value to be returned.


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
 
Method Summary
 boolean exists(java.lang.String key)
          Does a property exist in the delegated property sets in order.
protected  java.lang.Object get(int type, java.lang.String key)
          Copied from com.opensymphony.module.propertyset.aggregate.AggregatePropertySet and modified to perform the get operation on the highest property set.
 java.util.Collection getKeys(java.lang.String prefix, int type)
          Returns a collection of keys that are retrieved from all providers.
 int getType(java.lang.String key)
          Returns the type of the property.
 boolean isSettable(java.lang.String property)
          Determine whether the delegates will allow the property to be set.
 void remove(java.lang.String key)
          Remove property with given key from all underlying property sets.It removes the property from all property sets.
protected  void setImpl(int type, java.lang.String key, java.lang.Object value)
          Copied from com.opensymphony.module.propertyset.aggregate.AggregatePropertySet and modified to perform the set operation on the highest property set.
 
Methods inherited from class com.opensymphony.module.propertyset.AbstractPropertySet
getAsActualType, getBoolean, getData, getDate, getDouble, getInt, getKeys, getKeys, getKeys, getLong, getObject, getProperties, getSchema, getString, getText, getXML, init, setAsActualType, setBoolean, setData, setDate, setDouble, setInt, setLong, setObject, setProperties, setSchema, setString, setText, setXML, supportsType, supportsTypes, toString, type, type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getKeys

public java.util.Collection getKeys(java.lang.String prefix,
                                    int type)
                             throws com.opensymphony.module.propertyset.PropertyException
Returns a collection of keys that are retrieved from all providers.

Specified by:
getKeys in interface com.opensymphony.module.propertyset.PropertySet
Specified by:
getKeys in class com.opensymphony.module.propertyset.AbstractPropertySet
Parameters:
prefix - prefix
type - property type
Returns:
keys collection of combined keys from all providers
Throws:
com.opensymphony.module.propertyset.PropertyException - if any of the delegated property sets throws it

getType

public int getType(java.lang.String key)
            throws com.opensymphony.module.propertyset.PropertyException
Returns the type of the property. Returns zero (undefined type) if the property doesn't exist in the delegated property sets.

Specified by:
getType in interface com.opensymphony.module.propertyset.PropertySet
Specified by:
getType in class com.opensymphony.module.propertyset.AbstractPropertySet
Parameters:
key - property key to find the type of
Returns:
property type as an integer that matches the definitions on the PropertySet interface.
Throws:
com.opensymphony.module.propertyset.PropertyException - if one of the underlying property set delegates does

exists

public boolean exists(java.lang.String key)
               throws com.opensymphony.module.propertyset.PropertyException
Does a property exist in the delegated property sets in order.

Specified by:
exists in interface com.opensymphony.module.propertyset.PropertySet
Specified by:
exists in class com.opensymphony.module.propertyset.AbstractPropertySet
Parameters:
key - property key to check
Returns:
true if the property exists in any of the delegated property sets
Throws:
com.opensymphony.module.propertyset.PropertyException - if one of the underlying property set delegates does

remove

public void remove(java.lang.String key)
            throws com.opensymphony.module.propertyset.PropertyException
Remove property with given key from all underlying property sets.It removes the property from all property sets. It stops when first non-settable property set that contains the given property is found. If this proprty set is found before the property is removed from any other previous property sets, new PropertyException is thrown.

Specified by:
remove in interface com.opensymphony.module.propertyset.PropertySet
Specified by:
remove in class com.opensymphony.module.propertyset.AbstractPropertySet
Parameters:
key - key of the property to remove
Throws:
com.opensymphony.module.propertyset.PropertyException - if property is first found but cannot be removed from the property set

isSettable

public boolean isSettable(java.lang.String property)
Determine whether the delegates will allow the property to be set. This is firstly based on whether the property currently exists in any of the delegates, if so then that delegate is used to determine whether it is settable. If it doesn't exist then ask any of the delegates if the property is settable.

Specified by:
isSettable in interface com.opensymphony.module.propertyset.PropertySet
Overrides:
isSettable in class com.opensymphony.module.propertyset.AbstractPropertySet
Parameters:
property - the property name
Returns:
true if the property is settable

setImpl

protected void setImpl(int type,
                       java.lang.String key,
                       java.lang.Object value)
                throws com.opensymphony.module.propertyset.PropertyException
Copied from com.opensymphony.module.propertyset.aggregate.AggregatePropertySet and modified to perform the set operation on the highest property set.

Specified by:
setImpl in class com.opensymphony.module.propertyset.AbstractPropertySet
Throws:
com.opensymphony.module.propertyset.PropertyException

get

protected java.lang.Object get(int type,
                               java.lang.String key)
                        throws com.opensymphony.module.propertyset.PropertyException
Copied from com.opensymphony.module.propertyset.aggregate.AggregatePropertySet and modified to perform the get operation on the highest property set.

Specified by:
get in class com.opensymphony.module.propertyset.AbstractPropertySet
Throws:
com.opensymphony.module.propertyset.PropertyException


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.