private void processSubject() throws Exception{
if (getSubjectTemplate() != null
&& getSubjectTemplate().length() > 0) {
if (mailDocumentFactoryTextProcessor==null) initProcessors();
SOSTextProcessor processor = null;
if (getSubjectTemplateType() == TEMPLATE_TYPE_FACTORY || getSubjectTemplateType() == TEMPLATE_TYPE_FACTORY_FILE) {
// use Document Factory Text Processor
processor = mailDocumentFactoryTextProcessor;
} else{
// use Plain Text Processor
processor = mailPlainTextProcessor;
}
if (getSubjectTemplateType() == TEMPLATE_TYPE_FACTORY_FILE || getSubjectTemplateType() == TEMPLATE_TYPE_PLAIN_FILE){
File subjectTemplateFile = new File (getSubjectTemplate());
processor.setLanguage(getLanguage());
setSubject(processor.process(readFile(subjectTemplateFile), replacements));
}else{
if (!getLanguage().equals(processor.getLanguage())) {
processor.setLanguage(getLanguage());
processor.setForceReload(true);
processor.getTemplates();
}
setSubject(processor.process(processor.getTemplate(getSubjectTemplate()), replacements));
}
}
}