com.atlassian.crowd.integration.osuser
Class PrioritizedCompositePropertySet

java.lang.Object
  extended by AbstractPropertySet
      extended by com.atlassian.crowd.integration.osuser.PrioritizedCompositePropertySet

public class PrioritizedCompositePropertySet
extends 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.


Method Summary
 boolean exists(String key)
          Does a property exist in the delegated property sets in order.
protected  Object get(int type, String key)
          Copied from com.opensymphony.module.propertyset.aggregate.AggregatePropertySet and modified to perform the get operation on the highest property set.
 Collection getKeys(String prefix, int type)
          Returns a collection of keys that are retrieved from all providers.
 int getType(String key)
          Returns the type of the property.
 boolean isSettable(String property)
          Determine whether the delegates will allow the property to be set.
 void remove(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, String key, 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getKeys

public Collection getKeys(String prefix,
                          int type)
                   throws PropertyException
Returns a collection of keys that are retrieved from all providers.

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
PropertyException

getType

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

Parameters:
key - property key to find the type of
Returns:
property type as an integer that matches the definitions on the PropertySet interface.
Throws:
PropertyException - if one of the underlying property set delegates does

exists

public boolean exists(String key)
               throws PropertyException
Does a property exist in the delegated property sets in order.

Parameters:
key - property key to check
Returns:
true if the property exists in any of the delegated property sets
Throws:
PropertyException - if one of the underlying property set delegates does

remove

public void remove(String key)
            throws 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.

Parameters:
key - key of the property to remove
Throws:
PropertyException - if property is first found but cannot be removed from the property set

isSettable

public boolean isSettable(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.

Parameters:
property - the property name
Returns:
true if the property is settable

setImpl

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

Throws:
PropertyException

get

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

Throws:
PropertyException


Copyright © 2006 Atlassian Software Systems. All Rights Reserved.