/*
 * Created on 27-sep-2004
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.fenalco.utilities.fileloader;

import java.sql.Date;
import java.sql.Time;

/**
 * @author andres
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class FileProcessedEvent implements Event
{

	private String fileName;
	
	private int productsLoaded;
	
	private int errors;
	
	private Date date;
	
	private Time time;
	
	public FileProcessedEvent( String fileName )
	{
		date = new Date( ( new java.util.Date( ) ).getTime() );
		time = new Time( ( new java.util.Date( ) ).getTime() );
		this.fileName = fileName;
		productsLoaded = 0;
		errors = 0;
	}
	
	

	/* (non-Javadoc)
	 * @see com.fenalco.utilities.fileloader.Event#getFileName()
	 */
	public String getFileName()
	{
		return fileName;
	}

	/* (non-Javadoc)
	 * @see com.fenalco.utilities.fileloader.Event#getStatus()
	 */
	public String getStatus()
	{
		String status = "Se cargaron correctamente " + productsLoaded
						+ " y hubo " + errors + " errores.";
		return status;
	}

	/* (non-Javadoc)
	 * @see com.fenalco.utilities.fileloader.Event#getTime()
	 */
	public String getTime()
	{
		return date.toString() + " " + time.toString();
	}
	
	public void addProduct( )
	{
		productsLoaded++;
	}
	
	public void addError( )
	{
		errors++;
	}
}
