Package org.ejbca.core.model.ra

Examples of org.ejbca.core.model.ra.UserNotificationParamGen


                        Certificate adminCert = admin.getAdminInformation().getX509Certificate();
                        String approvalAdminDN = CertTools.getSubjectDN(adminCert);
                        if (log.isDebugEnabled()) {
                            log.debug("approvalAdminDN: " + approvalAdminDN);
                        }
                        UserNotificationParamGen paramGen = new UserNotificationParamGen(data, approvalAdminDN, findUser(admin, admin.getUsername()));
                        /*
                         * substitute any $ fields in the receipient and from
                         * fields
                         */
                        rcptemail = paramGen.interpolate(rcptemail);
                        String fromemail = paramGen.interpolate(not.getNotificationSender());
                        String subject = paramGen.interpolate(not.getNotificationSubject());
                        String message = paramGen.interpolate(not.getNotificationMessage());
                        MailSender.sendMailOrThrow(fromemail, Arrays.asList(rcptemail), MailSender.NO_CC, subject, message, MailSender.NO_ATTACHMENTS);
                        String logmsg = intres.getLocalizedMessage("ra.sentnotification", data.getUsername(), rcptemail);
                        logSession.log(admin, data.getCAId(), LogConstants.MODULE_RA, new Date(), data.getUsername(), null,
                                LogConstants.EVENT_INFO_NOTIFICATION, logmsg);
                    } catch (Exception e) {
View Full Code Here


                  if (userDataVO.getEmail() == null || userDataVO.getEmail().trim().equals("")) {
                    String msg = intres.getLocalizedMessage("services.errorworker.errornoemail", userDataVO.getUsername());
                    log.info(msg);
                  } else {
                    // Populate end user message
                    String message = new UserNotificationParamGen(userDataVO).interpolate(getEndUserMessage());
                    MailActionInfo mailActionInfo = new MailActionInfo(userDataVO.getEmail(), getEndUserSubject(), message);
                    userEmailQueue.add(new EmailCertData(userDataVO.getUsername(), mailActionInfo));
                  }
                }
                if (isSendToAdmins()) {
                  // Populate admin message
                  String message = new UserNotificationParamGen(userDataVO).interpolate(getAdminMessage());
                  MailActionInfo mailActionInfo = new MailActionInfo(null, getAdminSubject(), message);
                  adminEmailQueue.add(new EmailCertData(userDataVO.getUsername(), mailActionInfo));
                }
            } catch (Exception e) {
                log.error("Error running service work: ", e);
View Full Code Here

                                    String msg = intres.getLocalizedMessage("services.errorworker.errornoemail", username);
                                    log.info(msg);
                                } else {
                                    // Populate end user message
                                    log.debug("Adding to email queue for user: " + userData.getEmail());
                                    String message = new UserNotificationParamGen(userData, cert).interpolate(getEndUserMessage());
                                    MailActionInfo mailActionInfo = new MailActionInfo(userData.getEmail(), getEndUserSubject(), message);
                                    userEmailQueue.add(new EmailCertData(fingerprint, mailActionInfo));
                                }
                            }
                        } else {
                            log.debug("Trying to send notification to user, but no UserData can be found for user '" + username
                                    + "', will only send to admin if admin notifications are defined.");
                        }
                        if (isSendToAdmins()) {
                            // If we did not have any user for this, we will simply use empty values for substitution
                            if (userData == null) {
                                userData = new UserDataVO();
                                userData.setUsername(username);
                            }
                            // Populate admin message
                            log.debug("Adding to email queue for admin");
                            String message = new UserNotificationParamGen(userData, cert).interpolate(getAdminMessage());
                            MailActionInfo mailActionInfo = new MailActionInfo(null, getAdminSubject(), message);
                            adminEmailQueue.add(new EmailCertData(fingerprint, mailActionInfo));
                        }
                        if (!isSendToEndUsers() && !isSendToAdmins()) {
                            // a little bit of a kludge to make JUnit testing feasible...
View Full Code Here

TOP

Related Classes of org.ejbca.core.model.ra.UserNotificationParamGen

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.