protected Set < AggregatedGroupMapping > getGroupsForEvent ( PortalEvent event ) { final Set < AggregatedGroupMapping > groupMappings = new LinkedHashSet < AggregatedGroupMapping > ( ) ; if ( event instanceof LoginEvent ) { for ( final String groupKey : ( ( LoginEvent ) event ) . getGroups ( ) ) { final AggregatedGroupMapping groupMapping = this . aggregatedGroupLookupDao . getGroupMapping ( groupKey ) ; if ( groupMapping != null ) { groupMappings . add ( groupMapping ) ; } } } else { final String userName = event . getUserName ( ) ; final IGroupMember groupMember = this . compositeGroupService . getGroupMember ( userName , IPerson . class ) ; for ( @ SuppressWarnings ( "unchecked" ) final Iterator < IEntityGroup > containingGroups = this . compositeGroupService . findParentGroups ( groupMember ) ; containingGroups . hasNext ( ) ; ) { final IEntityGroup group = containingGroups . next ( ) ; final AggregatedGroupMapping groupMapping = this . aggregatedGroupLookupDao . getGroupMapping ( group . getServiceName ( ) . toString ( ) , group . getName ( ) ) ; groupMappings . add ( groupMapping ) ; } } return groupMappings ; }
Get groups for the event