package testfactorymethod;

import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;

public class Main {

    public static void main(String[] args) throws NotFoundException, InstantiationException, IllegalAccessException {
        try {
            SimpleDataSource.init("bd.properties");
            
            FuncionarioDAO obj = SimpleDataSource.getFabrica().makeFuncionarioDAO();
            ArrayList lst = (ArrayList) obj.listarFuncionarios();
            Iterator<Funcionario> iter = lst.iterator();
            
            while ( iter.hasNext()){
            	Funcionario f = iter.next();
            	System.out.println(f.getMatricula());
            	System.out.println(f.getNome());
            }
            /*
            Funcionario f = new Funcionario();
            f.setID(12);
            f.setDatacontratacao("12/12/2006");
            f.setMatricula(12345);
            f.setNome("Joćo Paulo");
            obj.incluir(f);
            */
            
        } catch(SQLException ex) {
            ex.printStackTrace();
        } catch(ClassNotFoundException ex) {
            ex.printStackTrace();
        } catch(IOException ex) {
            ex.printStackTrace();
        }
    }
    
}
