using generalsystemsetting instead of properties settings for mail
Change-Id: I7997ebb0e0232f181338fb8a9a53053a1f348ef7
This commit is contained in:
parent
cb0b37d1cd
commit
dcf768ebd5
@ -8,7 +8,9 @@ import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import se.su.dsv.scipro.data.dao.interfaces.GeneralSystemSettingsDao;
|
||||
import se.su.dsv.scipro.data.dao.interfaces.MailEventDao;
|
||||
import se.su.dsv.scipro.data.dataobjects.GeneralSystemSettings;
|
||||
import se.su.dsv.scipro.data.dataobjects.MailEvent;
|
||||
import se.su.dsv.scipro.data.dataobjects.User;
|
||||
import se.su.dsv.scipro.util.Mail;
|
||||
@ -19,20 +21,16 @@ public class MailEventWorker extends AbstractWorker {
|
||||
|
||||
@Autowired
|
||||
private MailEventDao mailEventDao;
|
||||
@Autowired
|
||||
private GeneralSystemSettingsDao generalSystemSettingsDao;
|
||||
@Autowired
|
||||
private Mail mail;
|
||||
|
||||
public MailEventWorker(){ }
|
||||
|
||||
@Override
|
||||
protected void doManualTransactionWork(){
|
||||
|
||||
Properties props;
|
||||
try {
|
||||
props = PropsUtils.load("email.properties");
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
throw new RuntimeException(e1);
|
||||
}
|
||||
|
||||
List<MailEvent> mailEvents = new ArrayList<MailEvent>();
|
||||
|
||||
this.beginTransaction();
|
||||
@ -65,9 +63,8 @@ public class MailEventWorker extends AbstractWorker {
|
||||
//TODO test-
|
||||
//String[] tmp = new String[]{"mpeters@dsv.su.se"};
|
||||
|
||||
boolean sendMailEnabled = Boolean.parseBoolean(props.getProperty("sendMailEnabled"));
|
||||
if( sendMailEnabled ){ //If false, mail-events "vanish"
|
||||
Mail.mail(fromName, fromEmail, recipientsEmails /* tmp */, replyToEmails, subject, messageBody, props, false);
|
||||
if( generalSystemSettingsDao.getGeneralSystemSettingsInstance().isMailNotifications() ){ //If false, mail-events "vanish"
|
||||
mail.mail(fromName, fromEmail, recipientsEmails /* tmp */, replyToEmails, subject, messageBody, false);
|
||||
}
|
||||
mailEvent = mailEventDao.reLoad(mailEvent); //Re-attach to session so delete works
|
||||
mailEventDao.delete(mailEvent);
|
||||
|
Loading…
x
Reference in New Issue
Block a user