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.ConferenciaComissaoService;
import com.rjconsultores.ventaboletos.service.CorridaService;
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;

/**
 * @author valdevir_rj
 *
 */
public class GeneracionConferenciaMovimentoJob implements Job {
	private static Logger log = LogManager.getLogger(GeneracionConferenciaMovimentoJob.class);
	private CorridaService corridaService;

	private ConferenciaComissaoService conferenciaComissaoService;


	public CorridaService getCorridaService() {
		return corridaService;
	}

	public void setCorridaService(CorridaService corridaService) {
		this.corridaService = corridaService;
	}

	@Override
	public void execute(JobExecutionContext jec) throws JobExecutionException {
		log.info("Inicio do job de geração de Conferência de Momvimento.");
		ApplicationContext appContext = AppContext.getApplicationContext();
		conferenciaComissaoService = (ConferenciaComissaoService) appContext.getBean("conferenciaComissaoService");
		conferenciaComissaoService.generacionAutomaticaConferencia();
		log.info("Fim do job de geração de Conferência de Momvimento..");
	}


}
