package com.github.neunkasulle.chronocommand.control;

import com.github.neunkasulle.chronocommand.model.User;
import com.github.neunkasulle.chronocommand.model.UserDAO;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.util.List;

/**
 * Created by Dav on 09.02.2016.
 */
public class MonthlyReminder implements Job {

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        String message = "Last day to check out your time sheet";
        List<User> supervisor = UserDAO.getInstance().getUsersByRole(UserDAO.getInstance().getRoleByName("supervisor"));//TODO wait for #15
        for (User user : supervisor) {
            TimeSheetControl.getInstance().sendEmail(user, message);
        }
    }
}

@@ -48,16 +48,72 @@
 ntrol;%0A%0A
+import com.github.neunkasulle.chronocommand.model.Role;%0A
 import c
@@ -630,25 +630,26 @@
 t%3CUser%3E 
-superviso
+proletarie
 r = User
@@ -721,42 +721,280 @@
 ame(
-%22supervisor%22));//TODO wait for #15
+Role.PERM_PROLETARIER));%0A        for (User user : proletarier) %7B%0A            TimeSheetControl.getInstance().sendEmail(user, message);%0A        %7D%0A        List%3CUser%3E supervisor = UserDAO.getInstance().getUsersByRole(UserDAO.getInstance().getRoleByName(Role.PERM_SUPERVISOR));
 %0A   

send monthly reminder to all user which can have a timesheet