/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rjconsultores.ventaboletos.web.gui.controladores.job;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.context.ApplicationContext;

import com.rjconsultores.ventaboletos.service.CorridaService;
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;

/**
 *
 * @author Rafius
 */
public class GeneracionCorridaJob implements Job {

    private static Logger log = LogManager.getLogger(GeneracionCorridaJob.class);
    
    
    @Override
    public void execute(JobExecutionContext jec) throws JobExecutionException {
        log.info("Inicio do job de gera��o de corridas.");

        ApplicationContext appContext = AppContext.getApplicationContext();
        CorridaService cs = (CorridaService) appContext.getBean("corridaService");
        cs.generarCorridaAutomatica();

        log.info("Fim do job de gera��o de corridas.");
    }
}
