private EmailConfig _getShoppingConfigOrderEmail() { String orderEmailSubject = "[$COMPANY_NAME$] Order #[$ORDER_NUMBER$]"; String orderEmailBody = ContentUtil.get("messages/en_US/shopping_config_order_email_body.tmpl"); EmailConfig orderEmail = new EmailConfig(orderEmailSubject, orderEmailBody); return orderEmail; }
private EmailConfig _getShoppingConfigShippingEmail() { String shippingEmailSubject = "[$COMPANY_NAME$] Order #[$ORDER_NUMBER$] Shipped"; String shippingEmailBody = ContentUtil.get("messages/en_US/shopping_config_shipping_email_body.tmpl"); EmailConfig shippingEmail = new EmailConfig(shippingEmailSubject, shippingEmailBody); return shippingEmail; }
private EmailConfig _getUserConfigRegistrationEmail() { String registrationEmailSubject = "[$COMPANY_NAME$] Portal Account"; String registrationEmailBody = ContentUtil.get("messages/en_US/user_config_registration_email_body.tmpl"); EmailConfig registrationEmail = new EmailConfig(registrationEmailSubject, registrationEmailBody); return registrationEmail; }
public static String getEmailMessageUpdatedSubjectPrefix(PortletPreferences preferences) { String emailMessageUpdatedSubject = preferences.getValue("email-message-updated-subject-prefix", StringPool.BLANK); if (Validator.isNotNull(emailMessageUpdatedSubject)) { return emailMessageUpdatedSubject; } else { return ContentUtil.get(PropsValues.MESSAGE_BOARDS_EMAIL_MESSAGE_UPDATED_SUBJECT_PREFIX); } }
public static String getEmailMessageUpdatedSignature(PortletPreferences preferences) { String emailMessageUpdatedSignature = preferences.getValue("email-message-updated-signature", StringPool.BLANK); if (Validator.isNotNull(emailMessageUpdatedSignature)) { return emailMessageUpdatedSignature; } else { return ContentUtil.get(PropsValues.MESSAGE_BOARDS_EMAIL_MESSAGE_UPDATED_SIGNATURE); } }
public static String getEmailMessageUpdatedBody(PortletPreferences preferences) { String emailMessageUpdatedBody = preferences.getValue("email-message-updated-body", StringPool.BLANK); if (Validator.isNotNull(emailMessageUpdatedBody)) { return emailMessageUpdatedBody; } else { return ContentUtil.get(PropsValues.MESSAGE_BOARDS_EMAIL_MESSAGE_UPDATED_BODY); } }
private EmailConfig _getJournalApprovalRequestedEmail() { String approvalRequestedEmailSubject = "[$PORTLET_NAME$] Article Approval Requested: " + "[$ARTICLE_ID$]/[$ARTICLE_VERSION$]"; String approvalRequestedEmailBody = ContentUtil.get("messages/en_US/journal_article_approval_requested.tmpl"); EmailConfig approvalRequestedEmail = new EmailConfig(approvalRequestedEmailSubject, approvalRequestedEmailBody); return approvalRequestedEmail; }
protected String doTransform( ThemeDisplay themeDisplay, Map<String, String> tokens, String viewMode, String languageId, String xml, String script) throws Exception { UnsyncByteArrayOutputStream unsyncByteArrayOutputStream = new UnsyncByteArrayOutputStream(); long companyId = GetterUtil.getLong(tokens.get("company_id")); Company company = CompanyLocalServiceUtil.getCompanyById(companyId); long groupId = GetterUtil.getLong(tokens.get("group_id")); String journalTemplatesPath = VelocityResourceListener.JOURNAL_SEPARATOR + StringPool.SLASH + companyId + StringPool.SLASH + groupId; String randomNamespace = PwdGenerator.getPassword(PwdGenerator.KEY3, 4) + StringPool.UNDERLINE; Locale locale = LocaleUtil.fromLanguageId(languageId); XSLErrorListener xslErrorListener = new XSLErrorListener(locale); StreamSource xmlSource = new StreamSource(new UnsyncStringReader(xml)); TransformerFactory transformerFactory = TransformerFactory.newInstance(); transformerFactory.setURIResolver(new URIResolver(tokens, languageId)); transformerFactory.setErrorListener(xslErrorListener); try { StreamSource scriptSource = new StreamSource(new UnsyncStringReader(script)); Transformer transformer = transformerFactory.newTransformer(scriptSource); transformer.setParameter("company", company); transformer.setParameter("companyId", new Long(companyId)); transformer.setParameter("groupId", String.valueOf(groupId)); transformer.setParameter("journalTemplatesPath", journalTemplatesPath); transformer.setParameter("viewMode", viewMode); transformer.setParameter("locale", locale); transformer.setParameter("permissionChecker", PermissionThreadLocal.getPermissionChecker()); transformer.setParameter("randomNamespace", randomNamespace); transformer.transform(xmlSource, new StreamResult(unsyncByteArrayOutputStream)); } catch (Exception e1) { String errorTemplate = ContentUtil.get(PropsValues.JOURNAL_ERROR_TEMPLATE_XSL); StreamSource scriptSource = new StreamSource(new UnsyncStringReader(errorTemplate)); Transformer transformer = transformerFactory.newTransformer(scriptSource); transformer.setParameter("company", company); transformer.setParameter("companyId", new Long(companyId)); transformer.setParameter("groupId", String.valueOf(groupId)); transformer.setParameter("journalTemplatesPath", journalTemplatesPath); transformer.setParameter("locale", locale); transformer.setParameter("randomNamespace", randomNamespace); transformer.setParameter("exception", xslErrorListener.getMessageAndLocation()); transformer.setParameter("script", script); if (xslErrorListener.getLocation() != null) { transformer.setParameter("column", new Integer(xslErrorListener.getColumnNumber())); transformer.setParameter("line", new Integer(xslErrorListener.getLineNumber())); } transformer.transform(xmlSource, new StreamResult(unsyncByteArrayOutputStream)); } return unsyncByteArrayOutputStream.toString(StringPool.UTF8); }