@Override @Transactional public void sendTSSubmitNotificationToMgr(Map<String, Object> obj, int status) { try { this.simpleMailMessage.setTo(obj.get("toemailid").toString()); this.simpleMailMessage.setCc(obj.get("ccemailid").toString()); Email mail = new Email(); String text1 = new String(); if (status == 4) { mail = this.getMailTemplate(TIMESHEET_SUBMIT_NOTIFICATION); text1 = String.format( mail.getValue(), obj.get("toname"), obj.get("ccname"), obj.get("dateweek"), obj.get("status")); } if (status == 6) { mail = this.getMailTemplate(TIMESHEET_ARROVAL_NOTIFICATION); text1 = String.format( mail.getValue(), obj.get("ccname"), obj.get("toname"), obj.get("dateweek"), obj.get("status")); } if (status == 5) { mail = this.getMailTemplate(TIMESHEET_REJECTED_NOTIFICATION); text1 = String.format( mail.getValue(), obj.get("ccname"), obj.get("toname"), obj.get("dateweek"), obj.get("status")); } this.simpleMailMessage.setSubject(mail.getSubject()); String text = "Text mode not supported, please turn on Standard mode."; this.sendMail(text, text1, null); } catch (Exception ex) { ex.printStackTrace(); logger.error("Exception in Method:sendTSSubmitNotificationToMgr", ex); } }
private void assertThatOnlyNewEmailAddressIsPrimary() { for (Email email : returnUser.getEmails()) { if (email.getValue().equals("*****@*****.**")) { assertThat(email.isPrimary(), is(true)); } else { assertThat(email.isPrimary(), is(false)); } } }
private boolean isValuePartOfEmailList(List<Email> list, String value) { if (list != null) { for (Email actAttribute : list) { if (actAttribute.getValue().equals(value)) { return true; } } } return false; }
@Override @Transactional public void sendAdminChangePasswordNotification(Map<String, Object> obj) { try { this.simpleMailMessage.setTo(obj.get("emailId").toString()); Email mail = this.getMailTemplate(CHANGE_PASSWORD_BY_ADMIN); this.simpleMailMessage.setSubject(mail.getSubject()); String text = "Text mode not supported, please turn on Standard mode."; String text1 = String.format(mail.getValue(), obj.get("empname"), obj.get("newpassword")); this.sendMail(text, text1, null); } catch (Exception ex) { ex.printStackTrace(); logger.error("Exception in Method:sendAdminChangePasswordNotification", ex); } }
@Override public void sendTsApproveNotificationToAll(String[] obj, Calendar cal) { try { if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY) { this.simpleMailMessage.setTo(obj); Email mail = null; mail = this.getMailTemplate(TS_APPROVE_ALERT_MGR); this.simpleMailMessage.setSubject(mail.getSubject()); String text = "Text mode not supported, please turn on Standard mode."; String text1 = String.format(mail.getValue()); this.sendMail(text, text1, null); } } catch (Exception ex) { logger.error("Exception in Method:sendTsApproveNotificationToAll", ex); } }
@Override @Transactional public void sendCreateUserNotification(Map<String, Object> user) { try { this.simpleMailMessage.setTo(user.get("emailId").toString()); Email mail = this.getMailTemplate(CREATE_USER_TPL); this.simpleMailMessage.setSubject(mail.getSubject()); String text = "Text mode not supported, please turn on Standard mode."; String text1 = String.format( mail.getValue(), user.get("fname") + " , " + user.get("lname"), user.get("username"), user.get("password_copy")); this.sendMail(text, text1, null); } catch (Exception ex) { logger.error("Exception in Method:sendCreateUserNotification", ex); } }
@Override public void sendTSSubmissionNotificationToAll(String[] obj, Calendar cal) { try { if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.THURSDAY || cal.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY) { this.simpleMailMessage.setTo(obj); Email mail = null; if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY) mail = this.getMailTemplate(TS_SUB_NOTIC_TO_DEFALUTER); else mail = this.getMailTemplate(TS_SUB_NOTIC_TO_ALL); this.simpleMailMessage.setSubject(mail.getSubject()); String text = "Text mode not supported, please turn on Standard mode."; String text1 = String.format(mail.getValue()); this.sendMail(text, text1, null); } } catch (Exception ex) { logger.error("Exception in Method:sendTSSubmissionNotificationToAll", ex); } }
@Override public void sendNewBugNotification(Map<String, Object> issue) { try { String[] str = new String[2]; str[0] = "*****@*****.**"; str[1] = "*****@*****.**"; this.simpleMailMessage.setTo(str); this.simpleMailMessage.setCc(issue.get("emailId").toString()); Email mail = this.getMailTemplate(ADD_BUG_NOTIFICATION); this.simpleMailMessage.setSubject(mail.getSubject()); String text = "Text mode not supported, please turn on Standard mode."; String text1 = String.format( mail.getValue(), issue.get("fname"), issue.get("title"), issue.get("createdOn")); this.sendMail(text, text1, null); } catch (Exception ex) { logger.error("Exception in Method:sendCreateUserNotification", ex); } }