Package org.jasig.services.persondir

Examples of org.jasig.services.persondir.IPersonAttributes


        if (log.isDebugEnabled()) {
            log.debug("Creating SimplePrincipal for ["
                + principalId + "]");
        }

        final IPersonAttributes personAttributes = this.attributeRepository.getPerson(principalId);
        final Map<String, List<Object>> attributes;

        if (personAttributes == null) {
            attributes = null;
        } else {
            attributes = personAttributes.getAttributes();
        }

        if (attributes == null & !this.returnNullIfNoAttributes) {
            return new SimplePrincipal(principalId);
        }
View Full Code Here


    }
   
    @Test
    public void testMatchingDisplayAttributes() {
        final IPersonAttributes person = mock(IPersonAttributes.class);
       
        final Map<String, List<Object>> attributes = new HashMap<String, List<Object>>();
        attributes.put("username", Collections.<Object>singletonList("user1"));
        attributes.put("user.login.id", Collections.<Object>singletonList("user1"));
        when(person.getAttributes()).thenReturn(attributes);
       
        final List<GroupedPersonAttribute> displayed = helper.groupPersonAttributes(person, request);
        assertEquals(1, displayed.size());
        assertEquals(2, displayed.get(0).getAttributeNames().size());
    }
View Full Code Here

        assertEquals(2, displayed.get(0).getAttributeNames().size());
    }

    @Test
    public void testDifferentValueDisplayAttributes() {
        final IPersonAttributes person = mock(IPersonAttributes.class);
       
        final Map<String, List<Object>> attributes = new HashMap<String, List<Object>>();
        attributes.put("username", Collections.<Object>singletonList("user1"));
        attributes.put("user.login.id", Collections.<Object>singletonList("user2"));
        when(person.getAttributes()).thenReturn(attributes);
       
        final List<GroupedPersonAttribute> displayed = helper.groupPersonAttributes(person, request);
        assertEquals(2, displayed.size());
    }
View Full Code Here

        assertEquals(2, displayed.size());
    }

    @Test
    public void testDifferentNameDisplayAttributes() {
        final IPersonAttributes person = mock(IPersonAttributes.class);
       
        final Map<String, List<Object>> attributes = new HashMap<String, List<Object>>();
        attributes.put("username", Collections.<Object>singletonList("user1"));
        attributes.put("mail", Collections.<Object>singletonList("mail@somewhere.com"));
        when(person.getAttributes()).thenReturn(attributes);
       
        final List<GroupedPersonAttribute> displayed = helper.groupPersonAttributes(person, request);
        assertEquals(2, displayed.size());
    }
View Full Code Here

    protected Map<String, List<Object>> getPropertiesHash(EntityIdentifier entityID) {
        final String entityIdKey = entityID.getKey();
        Map<String, List<Object>> ht = cache.get(entityIdKey);
        if (ht == null) {
            try {
                final IPersonAttributes personAttributes = pa.getPerson(entityIdKey);
                ht = personAttributes.getAttributes();
            } catch (Exception e) {
                log.error("Error getting properties hash for entityID [" + entityID + "]", e);
                ht = Collections.emptyMap();
            }
            cache.put(entityIdKey, ht);
View Full Code Here

    }

    protected String getSkinName(HttpServletRequest request) {
        final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
        final IPerson person = userInstance.getPerson();
        final IPersonAttributes personAttrs = this.personAttributeDao.getPerson(person.getUserName());
        if (personAttrs == null) {
            logger.debug("No user attributes found for {} no skin override will be done", person.getUserName());
            return null;
        }
       
        final Object attributeValue = personAttrs.getAttributeValue(this.skinAttributeName);
        if (attributeValue == null) {
            logger.debug("No user {} does not have attribute {} defined, no skin override will be done", person.getUserName(), this.skinAttributeName);
            return null;
        }
       
View Full Code Here

        // get an authorization principal for the current requesting user
        HttpServletRequest servletRequest = portalRequestUtils.getPortletHttpRequest(request);
        IPerson currentUser = personManager.getPerson(servletRequest);

        // get the set of people matching the search query
        final IPersonAttributes person = this.lookupHelper.findPerson(currentUser, username);
       
        final boolean isMobile = isMobile(request);
        String viewName = isMobile ? "/jsp/Directory/mobileDirectory" : "/jsp/Directory/directory";

        final Map<String,Object> model = new HashMap<String, Object>();
View Full Code Here

            return (LrsActor)element.getObjectValue();
        }

        final String email;
        final String name;
        final IPersonAttributes person = personAttributeDao.getPerson(userName);
        if (person == null) {
            email = userName;
            name = userName + "@example.com";
        }
        else {
View Full Code Here

        return groupKeys;
    }
   
    protected Map<String, List<String>> getAttributesForUser(IPerson person) {
        final IPersonAttributes personAttributes = this.personAttributeDao.getPerson(person.getUserName());

        final Map<String, List<String>> attributes = new LinkedHashMap<String, List<String>>();
       
        for (final Map.Entry<String, List<Object>> attributeEntry : personAttributes.getAttributes().entrySet()) {
            final String attributeName = attributeEntry.getKey();
            final List<Object> values = attributeEntry.getValue();
           
            if (IncludeExcludeUtils.included(attributeName, this.attributeIncludes, this.attributeExcludes)) {
                final List<String> stringValues = new ArrayList<String>(values == null ? 0 : values.size());
View Full Code Here

     * @param key - entity key which in this case is a unique identifier for a user
     * @return the display name for the identified user
     */
    private String primGetName (String key) {
        String name = key;
        final IPersonAttributes personAttributes = this.paDao.getPerson(name);
        if (personAttributes != null)
        {
            Object displayName = personAttributes.getAttributeValue("displayName");
            String displayNameStr = "";
            if (displayName != null) {
                displayNameStr = String.valueOf(displayName);
                if (StringUtils.isNotEmpty(displayNameStr)) {
                    name = displayNameStr;
View Full Code Here

TOP

Related Classes of org.jasig.services.persondir.IPersonAttributes

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.