net.incongru.berkano.user.hibernate
Class HibernatedUserPropertyAccessor

java.lang.Object
  extended by net.incongru.berkano.user.hibernate.HibernatedUserPropertyAccessor
All Implemented Interfaces:
UserPropertyAccessor

public class HibernatedUserPropertyAccessor
extends java.lang.Object
implements UserPropertyAccessor

An helper class to retrieve user/group properties.

Version:
$Revision: 1.3 $
Author:
greg, $Author: gj $ (last edit)

Constructor Summary
HibernatedUserPropertyAccessor()
           
 
Method Summary
 java.lang.Object aggregate(User u, java.lang.String key)
          This method glues all values found for the given user and property name.
 java.lang.Object getFirstValue(User u, java.lang.String key)
          Returns the first value encountered for this key.
 java.lang.Object getGroupSingleValue(User u, java.lang.String key)
          Returns a single value found for this key, following the following rules: The user's properties are not taken into account If the property is defined in multiple groups, an exception will be thrown The property will be return from group level if it is defined in only one of the user's groups. Null will be returned if the property can't be found
 java.util.Collection getGroupValues(User u, java.lang.String key)
          Returns a collection aggregating the different values of this property found in all of the user's groups' properties.
 java.lang.Object getSingleValue(User u, java.lang.String key)
          Returns a single value found for this key, following the following rules: If the property is defined at user level, it will be returned, regardless of the groups' properties If the property is defined in multiple groups, an exception will be thrown The property will be return from group level if it is defined in only one of the user's groups. Null will be returned if the property can't be found
 java.lang.Object getUserOnlyValue(User u, java.lang.String key)
          Returns a value from the user's properties, not taking the groups properties into account
 java.util.Collection getValues(User u, java.lang.String key)
          Returns a collection aggregating the different values of this property found in both the user's properties and all of the user's groups' properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernatedUserPropertyAccessor

public HibernatedUserPropertyAccessor()
Method Detail

getUserOnlyValue

public java.lang.Object getUserOnlyValue(User u,
                                         java.lang.String key)
Returns a value from the user's properties, not taking the groups properties into account

Specified by:
getUserOnlyValue in interface UserPropertyAccessor

getFirstValue

public java.lang.Object getFirstValue(User u,
                                      java.lang.String key)
Returns the first value encountered for this key. Searches first in the user's properties, then in groups' properties. This is non-deterministic, since multiple groups could have the same property with different values. However, it will always first return the user's own property if it is set.

Specified by:
getFirstValue in interface UserPropertyAccessor

getSingleValue

public java.lang.Object getSingleValue(User u,
                                       java.lang.String key)
Returns a single value found for this key, following the following rules:

Specified by:
getSingleValue in interface UserPropertyAccessor

getGroupSingleValue

public java.lang.Object getGroupSingleValue(User u,
                                            java.lang.String key)
Returns a single value found for this key, following the following rules:

Specified by:
getGroupSingleValue in interface UserPropertyAccessor

getValues

public java.util.Collection getValues(User u,
                                      java.lang.String key)
Returns a collection aggregating the different values of this property found in both the user's properties and all of the user's groups' properties. Returns a empty collection if the property is not found, will never return null.

Specified by:
getValues in interface UserPropertyAccessor

getGroupValues

public java.util.Collection getGroupValues(User u,
                                           java.lang.String key)
Returns a collection aggregating the different values of this property found in all of the user's groups' properties. (not the user's direct properties) Returns a empty collection if the property is not found, will never return null.

Specified by:
getGroupValues in interface UserPropertyAccessor

aggregate

public java.lang.Object aggregate(User u,
                                  java.lang.String key)
This method glues all values found for the given user and property name. In the case of collections, it returns them as a collection that includes all the element of each of them. Same for arrays and maps. An exception is thrown for other types.

Specified by:
aggregate in interface UserPropertyAccessor


Copyright © 2004-2007. All Rights Reserved.