Package br.com.procempa.modus.session

Examples of br.com.procempa.modus.session.PersistentAccess


    }
  }
 
  private void insertLocal(){
    try {
      PersistentAccess pa = PersistentAccessFactory.getInstance();
     
      Curso c = new Curso();
      c.setNome("Curso de Sincroniza��o");
      c.setLocal("Procempa");
      c.setEmenta("Inserido no local");

      pa.persist(c);
    } catch (NamingException e1) {
      e1.printStackTrace();
    }   
  }
View Full Code Here


 
  private void insertMain(){

    try {
     
      PersistentAccess mainPa = PersistentAccessFactory.getInstanceMain();
     
      Curso c = new Curso();
      c.setNome("Curso de Sincroniza��o");
      c.setLocal("Procempa");
      c.setEmenta("Inserido no main");

      mainPa.persist(c);
    } catch (Exception e){
      e.printStackTrace();
    }
  }
View Full Code Here

    turma.setVagas(turma.getVagas() - 1);
   
    List<String> messages = new ArrayList<String>();
    turma = TurmaDataServices.persist(turma,messages);

    PersistentAccess pa = PersistentAccessFactory.getInstance();
    Inscricao inscricao = new Inscricao();
    inscricao.setUsuario(u);
    inscricao.setTurma(turma);
    pa.persist(inscricao);
     
    List<Encontro> encontros = EncontroDataServices.getList(turma);
    for (Encontro encontro : encontros) {
     
      Presenca presenca = new Presenca();
View Full Code Here

  }
 
  public static Inscricao getInscricao(Long id) {
    Inscricao inscricao = null;
    try {
      PersistentAccess pa = PersistentAccessFactory.getInstance();
      inscricao = (Inscricao) pa.find(Inscricao.class, id);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return inscricao;
  }
View Full Code Here

    return inscricao;
  }
 
  public static List<Inscricao> getList(Turma turma) throws Exception {
    List<Inscricao> inscritos = new ArrayList<Inscricao>();
    PersistentAccess pa = PersistentAccessFactory.getInstance();
    HashMap<String, Object> params = new HashMap<String, Object>();
    params.put("turma", turma);
    List<Persistent> list = pa.search("FROM Inscricao WHERE turma = :turma",params);
    for (Persistent persistent : list) {
      inscritos.add((Inscricao) persistent);
    }
    return inscritos;
  }
View Full Code Here

    return inscritos;
  }
 
  public static List<Inscricao> getList() throws Exception {
    List<Inscricao> inscritos = new ArrayList<Inscricao>();
    PersistentAccess pa = PersistentAccessFactory.getInstance();
    List<Persistent> list = pa.search("FROM Inscricao");
    for (Persistent persistent : list) {
      inscritos.add((Inscricao) persistent);
    }
    return inscritos;
  }
View Full Code Here

    return inscritos;
  }
 
  public static List<Inscricao> getList(Usuario usuario) throws Exception {
    List<Inscricao> inscritos = new ArrayList<Inscricao>();
    PersistentAccess pa = PersistentAccessFactory.getInstance();
    HashMap<String, Object> params = new HashMap<String, Object>();
    params.put("usuario", usuario);
    List<Persistent> list = pa.search("FROM Inscricao WHERE usuario = :usuario",params);
    for (Persistent persistent : list) {
      inscritos.add((Inscricao) persistent);
    }
    return inscritos;
  }
View Full Code Here

    return inscritos;
  }
 
  public static List<Inscricao> getList(Curso curso) throws Exception {
    List<Inscricao> inscritos = new ArrayList<Inscricao>();
    PersistentAccess pa = PersistentAccessFactory.getInstance();
    HashMap<String, Object> params = new HashMap<String, Object>();
    params.put("curso", curso);
    List<Persistent> list = pa.search("FROM Inscricao WHERE turma.curso = :curso",params);
    for (Persistent persistent : list) {
      inscritos.add((Inscricao) persistent);
    }
    return inscritos;
  }
View Full Code Here

  }
 
 
  public static void remove(Long id) throws Exception {
    try {
      PersistentAccess pa = PersistentAccessFactory.getInstance();
      Inscricao inscrito = (Inscricao) pa.find(Inscricao.class, id);
      pa.remove(inscrito);
    } catch (Exception e) {
      throw new Exception(e.getClass().getName() + ": " + e.getMessage());
    }
  }
View Full Code Here

public class EncontroDataServices implements DataServices{

  public static List<Encontro> getList() throws Exception {
    List<Encontro> encontros = new ArrayList<Encontro>();
    PersistentAccess pa = PersistentAccessFactory.getInstance();
    List<Persistent> list = pa.search("FROM Encontro");
    for (Persistent persistent : list) {
      encontros.add((Encontro) persistent);
    }
    return encontros;
  }
View Full Code Here

TOP

Related Classes of br.com.procempa.modus.session.PersistentAccess

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.