/**
  * Listar Ano Estudo
  *
  * @param ano
  * @return
  */
 public List<AlunoVariavel> listaAnoEstudo(AnoEstudo ano) {
   PersistenceContext pc = DAOFactory.createPersistenceContext();
   AlunoVariavelDAO dao = DAOFactory.getAlunoVariavelDAO(pc);
   List<AlunoVariavel> result = dao.listaAnoEstudo(ano);
   pc.commitAndClose();
   return result;
 }
 public AlunoVariavel getAluno(int aluno) {
   PersistenceContext pc = DAOFactory.createPersistenceContext();
   AlunoVariavelDAO dao = DAOFactory.getAlunoVariavelDAO(pc);
   AlunoVariavel result = dao.getAluno(aluno);
   pc.commitAndClose();
   return result;
 }
 /**
  * Listarkey.
  *
  * @param key the key
  * @return the list
  */
 public List<AlunoVariavel> listarkey(int key) {
   PersistenceContext pc = DAOFactory.createPersistenceContext();
   AlunoVariavelDAO dao = DAOFactory.getAlunoVariavelDAO(pc);
   List<AlunoVariavel> result = dao.listarKey(key);
   pc.commitAndClose();
   return result;
 }
 public int update(int id, int grupo) {
   PersistenceContext pc = DAOFactory.createPersistenceContext();
   AlunoVariavelDAO dao = DAOFactory.getAlunoVariavelDAO(pc);
   dao.update(id, grupo);
   pc.commitAndClose();
   return id;
 }
 public List<Periodo> listarPeriodo(String p) {
   PersistenceContext pc = DAOFactory.createPersistenceContext();
   PeriodoDAO dao = DAOFactory.getPeriodoDAO(pc);
   List<Periodo> result = dao.listByPeriodo(p);
   pc.commitAndClose();
   return result;
 }
 /**
  * Atualizar aluno variavel.
  *
  * @param p the p
  * @return the aluno variavel
  */
 public AlunoVariavel atualizarAlunoVariavel(AlunoVariavel p) {
   PersistenceContext pc = DAOFactory.createPersistenceContext();
   AlunoVariavelDAO dao = DAOFactory.getAlunoVariavelDAO(pc);
   dao.atualizar(p);
   pc.commitAndClose();
   return p;
 }
 /**
  * Listarkey.
  *
  * @param key the key
  * @return the list
  */
 public List<Periodo> listarkey(int key) {
   PersistenceContext pc = DAOFactory.createPersistenceContext();
   PeriodoDAO dao = DAOFactory.getPeriodoDAO(pc);
   List<Periodo> result = dao.listarKey(key);
   pc.commitAndClose();
   return result;
 }
 /**
  * Atualizar periodo.
  *
  * @param p the p
  * @return the periodo
  */
 public Periodo atualizarPeriodo(Periodo p) {
   PersistenceContext pc = DAOFactory.createPersistenceContext();
   PeriodoDAO dao = DAOFactory.getPeriodoDAO(pc);
   dao.atualizar(p);
   pc.commitAndClose();
   return p;
 }
 /**
  * Criar calendario.
  *
  * @param p the p
  * @return the calendario
  */
 public Calendario criarCalendario(Calendario p) {
   PersistenceContext pc = DAOFactory.createPersistenceContext();
   CalendarioDAO dao = DAOFactory.getCalendarioDAO(pc);
   dao.criar(p);
   pc.commitAndClose();
   return p;
 }
 public List<Calendario> listarEvento(int id) throws ParseException {
   PersistenceContext pc = DAOFactory.createPersistenceContext();
   CalendarioDAO dao = DAOFactory.getCalendarioDAO(pc);
   List<Calendario> result = dao.listarEvento(id);
   pc.commitAndClose();
   return result;
 }
  /**
   * Listar todos.
   *
   * @return the list
   */
  public List<AlunoVariavel> listarTodos(int status) {
    PersistenceContext pc = DAOFactory.createPersistenceContext();
    AlunoVariavelDAO dao = DAOFactory.getAlunoVariavelDAO(pc);
    List<AlunoVariavel> result = dao.listAll(status);

    pc.commitAndClose();
    return result;
  }
  /**
   * Listar todos.
   *
   * @return the list
   */
  public List<Calendario> listaFeriado(int ano) {
    PersistenceContext pc = DAOFactory.createPersistenceContext();
    CalendarioDAO dao = DAOFactory.getCalendarioDAO(pc);
    List<Calendario> result = dao.listFeriados(ano);

    pc.commitAndClose();
    return result;
  }
  /**
   * Listar todos.
   *
   * @return the list
   */
  public List<Calendario> listarFiltroData(Date dataInicio, Date dataFim) {
    PersistenceContext pc = DAOFactory.createPersistenceContext();
    CalendarioDAO dao = DAOFactory.getCalendarioDAO(pc);
    List<Calendario> result = dao.listFiltroData(dataInicio, dataFim);

    pc.commitAndClose();
    return result;
  }
  /**
   * Listar todos.
   *
   * @return the list
   */
  public List<Calendario> listarTodos() {
    PersistenceContext pc = DAOFactory.createPersistenceContext();
    CalendarioDAO dao = DAOFactory.getCalendarioDAO(pc);
    List<Calendario> result = dao.listAll();

    pc.commitAndClose();
    return result;
  }