List groups = user.getUserGroups();
List groups = user.getUserGroupsRelatedByUserGroupLnk();
    public void run()    {        try        {            Address adr = user.getAddress();            if (adr != null && adr.getAddressEmail() != null)            {                String fileName = ReportGenerator.FILE_DATE_FORMATTER.format( new Date() );                String mailAddress = adr.getAddressEmail();                String format = StringUtil.defaultIfNull( user.getUserPreferedReportFormat(), "html" ).toLowerCase();                List groups = user.getUserGroups();                String[] paths = new String[groups.size() + 2];                paths[0] = ReportGenerator.getReportFilePathForReportSource( user );                paths[1] = ReportGenerator.getReportFilePathForReportSource( user.getClient() );                for (int i = 0; i < groups.size(); i++)                {                    paths[i + 2] = ReportGenerator.getReportFilePathForReportSource( (UserGroup) groups.get( i ) );                }                EMail mail = new EMail( smtp_from, mailAddress, "InfoQuiver SearchReports " + ReportGenerator.DATE_FORMATTER.format( new Date() ) );                                //add all reports as attachements                for (int i = 0; i < paths.length; i++)                {                    File file = new File( paths[i] + fileName + "." + format );                    if( file.exists() )                    {                        mail.addAttachment( file.getAbsolutePath() );                    }                    else                    {                        logger.warn( "Report file " + file.getAbsolutePath() + " not found!" );                    }                }                                //add all neccessary graphics as attachements                if( format.equals("html") )                {                    File dir = new File("images");                    File[] images = dir.listFiles();                    for( int i = 0; i < images.length; i++)                    {                        if( images[i].isFile() )                        {                            mail.addAttachment( images[i].getAbsolutePath() );                        }                    }                                    }                                SmtpClient client = new SmtpClient( smtp_host, smtp_login, smtp_pwd );                client.send( mail );            }        }        catch ( TorqueException e )        {            logger.error( "Database error while peparing dispatching of reports for user " + user.getUserId() + " failed!", e );        }        catch ( MessagingException e )        {                        logger.error( "Mail error while dispatching reports for user " + user.getUserId() + "!", e);        }    }