/** * @param searchCriteria * @param fieldsForLookup */ protected void buildReportForSearchCriteia( List<ContractsGrantsReportSearchCriteriaDataHolder> searchCriteria, Map fieldsForLookup) { DataDictionaryService dataDictionaryService = SpringContext.getBean(DataDictionaryService.class); for (Object field : fieldsForLookup.keySet()) { String fieldString = (ObjectUtils.isNull(field)) ? "" : field.toString(); String valueString = (ObjectUtils.isNull(fieldsForLookup.get(field))) ? "" : fieldsForLookup.get(field).toString(); if (!fieldString.equals("") && !valueString.equals("") && !CGConstants.ReportsConstants.reportSearchCriteriaExceptionList.contains( fieldString)) { ContractsGrantsReportSearchCriteriaDataHolder criteriaData = new ContractsGrantsReportSearchCriteriaDataHolder(); String label = dataDictionaryService.getAttributeLabel(Award.class, fieldString); criteriaData.setSearchFieldLabel(label); criteriaData.setSearchFieldValue(valueString); searchCriteria.add(criteriaData); } } }
/** * This method sends out emails for upcoming milestones. * * @see org.kuali.kfs.module.ar.service.CGEmailService#sendEmail(java.util.List, * org.kuali.kfs.module.ar.businessobject.Award) */ @Override public void sendEmail(List<Milestone> milestones, ContractsAndGrantsBillingAward award) { LOG.debug("sendEmail() starting"); MailMessage message = new MailMessage(); message.setFromAddress(mailService.getBatchMailingList()); message.setSubject(getEmailSubject(ArConstants.REMINDER_EMAIL_SUBJECT)); message .getToAddresses() .add(award.getAwardPrimaryFundManager().getFundManager().getEmailAddress()); StringBuffer body = new StringBuffer(); String messageKey = kualiConfigurationService.getPropertyValueAsString( ArKeyConstants.MESSAGE_CG_UPCOMING_MILESTONES_EMAIL_LINE_1); body.append(MessageFormat.format(messageKey, new Object[] {null})); body.append(award.getProposalNumber() + ".\n\n"); for (Milestone milestone : milestones) { String milestoneNumber = dataDictionaryService.getAttributeLabel(Milestone.class, "milestoneNumber"); String milestoneDescription = dataDictionaryService.getAttributeLabel(Milestone.class, "milestoneDescription"); String milestoneAmount = dataDictionaryService.getAttributeLabel(Milestone.class, "milestoneAmount"); String milestoneExpectedCompletionDate = dataDictionaryService.getAttributeLabel( Milestone.class, "milestoneExpectedCompletionDate"); String milestoneActualCompletionDate = dataDictionaryService.getAttributeLabel(Milestone.class, "milestoneActualCompletionDate"); body.append(milestoneNumber + ": " + milestone.getMilestoneNumber() + " \n"); body.append(milestoneDescription + ": " + milestone.getMilestoneDescription() + " \n"); body.append(milestoneAmount + ": " + milestone.getMilestoneAmount() + " \n"); body.append( milestoneExpectedCompletionDate + ": " + milestone.getMilestoneExpectedCompletionDate() + " \n"); body.append("\n\n"); } body.append("\n\n"); messageKey = kualiConfigurationService.getPropertyValueAsString( ArKeyConstants.MESSAGE_CG_UPCOMING_MILESTONES_EMAIL_LINE_2); body.append(MessageFormat.format(messageKey, new Object[] {null}) + "\n\n"); message.setMessage(body.toString()); try { mailService.sendMessage(message); } catch (InvalidAddressException ex) { // TODO Auto-generated catch block LOG.error("InvalidAddressException ", ex); } catch (MessagingException ex) { // TODO Auto-generated catch block LOG.error("MessagingException ", ex); } }