protected Map < String , String > generateUserInfo ( final IPersonAttributes personAttributes , final List < ? extends UserAttribute > expectedUserAttributes , HttpServletRequest httpServletRequest ) { final Map < String , String > portletUserAttributes = new HashMap < String , String > ( expectedUserAttributes . size ( ) ) ; // Copy expected attributes to the USER_INFO Map final Map < String , List < Object > > attributes = personAttributes . getAttributes ( ) ; for ( final UserAttribute userAttributeDD : expectedUserAttributes ) { final String attributeName = userAttributeDD . getName ( ) ; // TODO a personAttributes.hasAttribute(String) API is needed here, if hasAttribute and // null then put the key with no value in the returned map if ( attributes . containsKey ( attributeName ) ) { final Object valueObj = personAttributes . getAttributeValue ( attributeName ) ; final String value = valueObj == null ? null : String . valueOf ( valueObj ) ; portletUserAttributes . put ( attributeName , value ) ; } } return portletUserAttributes ; }
Using the Map of portal user attributes and a List of expected attributes generate the USER_INFO map for the portlet