Add classes for E-mail scheduling.
This commit is contained in:
parent
9adff9de0b
commit
a43a2365bb
3 changed files with 63 additions and 0 deletions
|
|
@ -0,0 +1,15 @@
|
||||||
|
package org.libreplan.importers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by
|
||||||
|
* @author Vova Perebykivskiy <vova@libreplan-enterprise.com>
|
||||||
|
* on 13.10.15.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface ISendEmail {
|
||||||
|
void sendEmail();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package org.libreplan.importers;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.config.BeanDefinition;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by
|
||||||
|
* @author Vova Perebykivskiy <vova@libreplan-enterprise.com>
|
||||||
|
* on 13.10.15.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||||
|
public class SendEmail implements ISendEmail {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendEmail() {
|
||||||
|
System.out.println("SendEmail class!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package org.libreplan.importers;
|
||||||
|
|
||||||
|
import org.quartz.JobExecutionContext;
|
||||||
|
import org.quartz.JobExecutionException;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by
|
||||||
|
* @author Vova Perebykivskiy <vova@libreplan-enterprise.com>
|
||||||
|
* on 13.10.15.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class SendEmailJob extends QuartzJobBean {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
|
||||||
|
ApplicationContext applicationContext = (ApplicationContext) context.getJobDetail().
|
||||||
|
getJobDataMap().get("applicationContext");
|
||||||
|
|
||||||
|
ISendEmail sendEmail = (ISendEmail) applicationContext.getBean("sendEmail");
|
||||||
|
|
||||||
|
sendEmail.sendEmail();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue