Source:
<code>public void sendEmailToEndorseds() { CronJob cronJob = new CronJob(); cronJob.setName(Constants.CRON_MAIL_ENDORSEMENT_JOB); cronJob.setStartTimestamp(new Date()); Date lastExecutedCronJob = findLastExecutedCronJob(Constants.CRON_MAIL_ENDORSEMENT_JOB); try { List<TechGalleryUser> usersList = techGalleryUserDao.findAll(); for (TechGalleryUser techGalleryUser : usersList) { List<Endorsement> endorsementsList = endorsementDao.findAllEndorsementsStartingFrom(techGalleryUser, lastExecutedCronJob); if (endorsementsList != null) { <START> TechGalleryActivitiesTO activities = <END> new TechGalleryActivitiesTO(Constants.APP_NAME, null, new ArrayList<TechnologyActivitiesTO>()); for (Endorsement endorsement : endorsementsList) { TechnologyActivitiesTO endorsementActivity = new TechnologyActivitiesTO(endorsement.getEndorserEntity(), endorsement.getTechnologyEntity(), null, null, null); activities.getTechnologyActivitiesTo().add(endorsementActivity); } if (!activities.getTechnologyActivitiesTo().isEmpty()) { EmailConfig email = new EmailConfig(EmailTypeEnum.ENDORSED, EmailTypeEnum.ENDORSED.getSubject() + activities.getFormattedTimestamp(), activities, techGalleryUser.getEmail()); emailService.push(email); } } } cronJob.setEndTimestamp(new Date()); cronJob.setCronStatus(CronStatus.SUCCESS); } catch (Exception e) { _LOG.info(e.getMessage()); cronJob.setEndTimestamp(new Date()); cronJob.setCronStatus(CronStatus.FAILURE); cronJob.setDescription(e.getMessage()); } cronJobsDao.add(cronJob); }</code><technical_language>@brunoliberal I great if email TOs name related email. I TechGalleryActivitiesEmailTemplateTO. put in email package</technical_language>

Target:
public void sendEmailToEndorseds() { CronJob cronJob = new CronJob(); cronJob.setName(Constants.CRON_MAIL_ENDORSEMENT_JOB); cronJob.setStartTimestamp(new Date()); Date lastExecutedCronJob = findLastExecutedCronJob(Constants.CRON_MAIL_ENDORSEMENT_JOB); try { List<TechGalleryUser> usersList = techGalleryUserDao.findAll(); for (TechGalleryUser techGalleryUser : usersList) { List<Endorsement> endorsementsList = endorsementDao.findAllEndorsementsStartingFrom(techGalleryUser, lastExecutedCronJob); if (endorsementsList != null) { TechGalleryActivitiesEmailTemplateTO activities = new TechGalleryActivitiesEmailTemplateTO(Constants.APP_NAME, null, new ArrayList<TechnologyActivitiesEmailTemplateTO>()); for (Endorsement endorsement : endorsementsList) { TechnologyActivitiesEmailTemplateTO endorsementActivity = new TechnologyActivitiesEmailTemplateTO(endorsement.getEndorserEntity(), endorsement.getTechnologyEntity(), null, null, null); activities.getTechnologyActivitiesTo().add(endorsementActivity); } if (!activities.getTechnologyActivitiesTo().isEmpty()) { EmailConfig email = new EmailConfig(EmailTypeEnum.ENDORSED, EmailTypeEnum.ENDORSED.getSubject() + activities.getFormattedTimestamp(), activities, techGalleryUser.getEmail()); emailService.push(email); } } } cronJob.setEndTimestamp(new Date()); cronJob.setCronStatus(CronStatus.SUCCESS); } catch (Exception e) { _LOG.info(e.getMessage()); cronJob.setEndTimestamp(new Date()); cronJob.setCronStatus(CronStatus.FAILURE); cronJob.setDescription(e.getMessage()); } cronJobsDao.add(cronJob); }