Thanks, this is what I've got:

package org.jasig.services.persondir.support;

import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.jasig.services.persondir.IPersonAttributes;

/**
 * A static IPersonAttributeDao.
 * Backed by a single Map which this implementation will always return.
 *
 * <br>
 * <br>
 * Configuration:
 * <table border="1">
 *     <tr>
 *         <th align="left">Property</th>
 *         <th align="left">Description</th>
 *         <th align="left">Required</th>
 *         <th align="left">Default</th>
 *     </tr>
 *     <tr>
 *         <td align="right" valign="top">backingMap</td>
 *         <td>
 *             This Map will always be returned for any query.
 *         </td>
 *         <td valign="top">No</td>
 *         <td valign="top">null</td>
 *     </tr>
 * </table>
 */
public class StaticPersonAttributeDao extends
AbstractDefaultAttributePersonAttributeDao {
    private Map<String, List> backingMap;

    public StaticPersonAttributeDao() {
    }

    public StaticPersonAttributeDao(Map<String, List> backingMap) {
        this.setBackingMap(backingMap);
    }

    public Set<String> getPossibleUserAttributeNames() {
        return Collections.unmodifiableSet(this.backingMap.keySet());
    }
    
    public Set<String> getAvailableQueryAttributes() {
        return null;
    }
    
    /* (non-Javadoc)
     * @see
org.jasig.services.persondir.IPersonAttributeDao#getPeopleWithMultivaluedAttributes(java.util.Map)
     */
    public Set<IPersonAttributes>
getPeopleWithMultivaluedAttributes(Map<String, List> query) {
        if (query == null) {
            throw new IllegalArgumentException("Illegal to invoke
getPeople(Map) with a null argument.");
        }
        
        final IUsernameAttributeProvider usernameAttributeProvider =
this.getUsernameAttributeProvider();
        final String username =
usernameAttributeProvider.getUsernameFromQuery(query);
        
        final IPersonAttributes mappedPerson = new NamedPersonImpl(username,
this.backingMap);
        
        if (mappedPerson == null) {
            return null;
        }

        return Collections.singleton(mappedPerson);
    }

    /**
     * Get the Map which this stub object will return for all legal
invocations of
     * attributesForUser()
     *
     * @return Returns the backingMap.
     */
    public Map<String, List> getBackingMap() {
        return this.backingMap;
    }

    /**
     * Set the Map which this stub object will return for all legal
invocations of
     * attributesForUser().
     *
     * @param backingMap The backingMap to set, may not be null.
     */
    public void setBackingMap(final Map<String, List> backingMap) {
        this.backingMap = backingMap;
    }
}





scott_battaglia wrote:
> 
> I'm not an expert on PersonDirectory, but please feel free to post it and
> I'll provide whatever feedback I can.
> 
> Cheers,
> Scott
> 
> 
> On Wed, Aug 26, 2009 at 2:18 AM, HansDB <[email protected]> wrote:
> 
>>
>> Did some more checking and I don't think there is any kind of
>> implementation
>> available in person directoy that does what I need it to do (the
>> StubPersonAttributeDao comes close, but close isn't good enough :p).
>>
>> So I did write a little something extra myself ... which does seem to
>> work.
>> But since it's been a while since I've actually done any Java programming
>> (think years) and considering I'm still relatively new at the combination
>> of
>> things like Java, Maven, Spring, etc. I was wondering if anyone here
>> considers themselves familiar enough with PersonDirectory to have a quick
>> glance at the code I wrote ?
>> --
>> View this message in context:
>> http://www.nabble.com/CAS-Attributes-tp25025959p25147208.html
>> Sent from the CAS Users mailing list archive at Nabble.com.
>>
>>
>> --
>> You are currently subscribed to [email protected] as:
>> [email protected]
>> To unsubscribe, change settings or access archives, see
>> http://www.ja-sig.org/wiki/display/JSG/cas-user
>>
> 
> -- 
> You are currently subscribed to [email protected] as:
> [email protected]
> To unsubscribe, change settings or access archives, see
> http://www.ja-sig.org/wiki/display/JSG/cas-user
> 

-- 
View this message in context: 
http://www.nabble.com/CAS-Attributes-tp25025959p25167533.html
Sent from the CAS Users mailing list archive at Nabble.com.


-- 
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

Reply via email to