package net.sourceforge.fenixedu.domain.candidate; import java.util.List; import net.sourceforge.fenixedu._development.PropertiesManager; import net.sourceforge.fenixedu.domain.RootDomainObject; import net.sourceforge.fenixedu.domain.candidate.util.EmailTemplateFormatter; import net.sourceforge.fenixedu.domain.candidate.util.EmailTemplateFormatter.ReplacableToken; import pt.ist.fenixWebFramework.services.Service; public class CandidateRegistrationEmailTemplates extends CandidateRegistrationEmailTemplates_Base { protected CandidateRegistrationEmailTemplates() { super(); setRootDomainObject(RootDomainObject.getInstance()); } public static synchronized CandidateRegistrationEmailTemplates getInstance() { final List templates = RootDomainObject.getInstance() .getCandidateRegistrationEmailTemplates(); return templates.isEmpty() ? createInstance() : templates.get(0); } @Service private static CandidateRegistrationEmailTemplates createInstance() { return new CandidateRegistrationEmailTemplates(); } public String getFormattedEmailSubjectWithLinkForRegistration(String url) { return EmailTemplateFormatter.formatMessage(getEmailSubjectWithLinkForRegistration(), new ReplacableToken("\\{url\\}", url)); } public String getFormattedEmailSubjectWithLoginInformation(String username, String password) { return EmailTemplateFormatter.formatMessage(getEmailSubjectWithLoginInformation(), new ReplacableToken("\\{username\\}", username), new ReplacableToken("\\{password\\}", password)); } public String getFormattedEmailSubjectWithLoginInformationAfterMerge(String usernameTarget, String usernameSource) { return EmailTemplateFormatter.formatMessage(getEmailSubjectWithLoginInformationAfterMerge(), new ReplacableToken( "\\{usernameTarget\\}", usernameTarget), new ReplacableToken("\\{usernameSource\\}", usernameSource)); } public String getFormattedEmailSubjectWithPaymentCodes(String entity, String code, String amount, String degreeName, String degreeNameEnglish) { return EmailTemplateFormatter.formatMessage(getEmailSubjectWithPaymentCodes(), new ReplacableToken("\\{entidade\\}", entity), new ReplacableToken("\\{referencia\\}", code), new ReplacableToken("\\{montante\\}", amount), new ReplacableToken("\\{curso\\}", degreeName), new ReplacableToken("\\{course\\}", degreeNameEnglish)); } public String getFormattedEmailSubjectPaymentReceived(String degreeName, String degreeNameEnglish) { return EmailTemplateFormatter.formatMessage(getEmailSubjectPaymentReceived(), new ReplacableToken("\\{curso\\}", degreeName), new ReplacableToken("\\{course\\}", degreeNameEnglish)); } public String getFormattedEmailSubjectPaypalSubmition(String degreeName, String degreeNameEnglish) { return EmailTemplateFormatter.formatMessage(getEmailSubjectPaypalSubmition(), new ReplacableToken("\\{curso\\}", degreeName), new ReplacableToken("\\{course\\}", degreeNameEnglish)); } public String getFormattedEmailBodyWithLinkForRegistration(String url) { return EmailTemplateFormatter .formatMessage(getEmailBodyWithLinkForRegistration(), new ReplacableToken("\\{link\\}", url)); } public String getFormattedEmailBodyWithLoginInformation(String username, String password) { return EmailTemplateFormatter.formatMessage(getEmailBodyWithLoginInformation(), new ReplacableToken("\\{username\\}", username), new ReplacableToken("\\{password\\}", password), new ReplacableToken("\\{login\\}", PropertiesManager.getProperty("login.html.link.fenix.iscte.pt"))); } public String getFormattedEmailBodyWithLoginInformationAfterMerge(String usernameTarget, String usernameSource) { return EmailTemplateFormatter.formatMessage(getEmailBodyWithLoginInformationAfterMerge(), new ReplacableToken( "\\{usernameTarget\\}", usernameTarget), new ReplacableToken("\\{usernameSource\\}", usernameSource)); } public String getFormattedEmailBodyWithPaymentCodes(String entity, String code, String amount, String degreeName, String degreeNameEnglish) { return EmailTemplateFormatter.formatMessage(getEmailBodyWithPaymentCodes(), new ReplacableToken("\\{entidade\\}", entity), new ReplacableToken("\\{referencia\\}", code), new ReplacableToken("\\{montante\\}", amount), new ReplacableToken("\\{curso\\}", degreeName), new ReplacableToken("\\{course\\}", degreeNameEnglish)); } public String getFormattedEmailBodyPaymentReceived(String degreeName, String degreeNameEnglish) { return EmailTemplateFormatter.formatMessage(getEmailBodyPaymentReceived(), new ReplacableToken("\\{curso\\}", degreeName), new ReplacableToken("\\{course\\}", degreeNameEnglish)); } public String getFormattedEmailBodyPaypalSubmition(String degreeName, String degreeNameEnglish) { return EmailTemplateFormatter.formatMessage(getEmailBodyPaypalSubmition(), new ReplacableToken("\\{curso\\}", degreeName), new ReplacableToken("\\{course\\}", degreeNameEnglish)); } }