Beispiel #1
0
 // A cada 30 segundos
 @Schedule(second = "*/30", minute = "*", hour = "*", persistent = false)
 public void abrirAvaliacoes() {
   try {
     avaliacaoEJB.abrirAvaliacoes();
   } catch (InfnetException e) {
     e.printStackTrace();
   }
 }
Beispiel #2
0
 // A cada 30 segundos
 @Schedule(second = "*/30", minute = "*", hour = "*", persistent = false)
 public void processarAvaliacoes() throws FileNotFoundException {
   try {
     System.out.println("Ta na Timer processar");
     avaliacaoEJB.processarAvaliacoes();
   } catch (FileNotFoundException fne) {
     fne.printStackTrace();
   } catch (InfnetException e) {
     e.printStackTrace();
   }
 }
 @PostConstruct
 public void init() {
   String id =
       FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("id");
   try {
     avaliacaoAluno = avaliacaoEJB.criarAvaliacaoAluno(id);
   } catch (InfnetException ex) {
     ex.printStackTrace();
     FacesContext context = FacesContext.getCurrentInstance();
     context.addMessage(
         null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Erro", ex.getMessage()));
   }
   alternativas = repositorio.listar(Alternativa.class);
 }
 public void salvar() {
   try {
     avaliacaoEJB.submeterAvaliacaoAluno(avaliacaoAluno);
     FacesContext context = FacesContext.getCurrentInstance();
     context.addMessage(
         null,
         new FacesMessage(
             FacesMessage.SEVERITY_INFO, "Informação", "Avaliação Submetida com Sucesso!"));
   } catch (InfnetException ex) {
     ex.printStackTrace();
     FacesContext context = FacesContext.getCurrentInstance();
     context.addMessage(
         null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Erro", ex.getMessage()));
   }
 }