Package br.com.procempa.modus.entity

Examples of br.com.procempa.modus.entity.Inscricao


   
    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);
  }
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

   
    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) {
     
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();
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

       
        Integer action = ConfirmationView.showDeleteConfirmation("Excluir esse usu�rio do curso?");
       
        switch (action){
        case ConfirmViewAction.YES:
          Inscricao inscricao = (Inscricao) getTable().getValueAt(
              getTable().getSelectedRows()[0], -1);
          try {
            InscricaoDataServices.remove(inscricao.getId());
            getTableModel().refresh();
          } catch (Exception e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
          }
View Full Code Here

  protected void setUp() throws Exception {
    pa = PersistentAccessFactory.getInstance();
  }
 
  public void testInsertInscricao() throws Exception {
    Inscricao inscricao  = new Inscricao();
   
    Turma turma = (Turma)pa.find(Turma.class, new Long(1));
    inscricao.setTurma(turma);
   
    Usuario usuario = UsuarioDataServices.getUsuario(new Long(1));
    inscricao.setUsuario(usuario);
   
    inscricao = (Inscricao) pa.persist(inscricao);
   
    assertEquals(inscricao.getTurma().getNome(),turma.getNome());
  }
View Full Code Here

    }
   
    if(rs.getString(6) == null){
      p.setInscricao(null);
    } else {
      Inscricao i = new Inscricao();
      p.setInscricao(i);
      p.getInscricao().setId(rs.getLong(5));
    }   

    return p;
View Full Code Here

  }

  public PreparedStatement prepareStatement(ResultSet rs,
      PreparedStatement statement, List<String> messages)
      throws Exception {
    Inscricao i = (Inscricao) getObject(rs);

    statement.setLong(1, i.getId());
    statement.setDate(2, new java.sql.Date(i.getTimestamp().getTime()));
    statement.setNull(3, Types.NULL);

    if (!(i.getTurma() == null)) {
      statement.setLong(4, i.getTurma().getId());
    } else {
      statement.setNull(4, Types.NULL);
      messages.add("Registro de INSCRICAO (id: " + i.getId()
          + ") com chave estrangeira de Turma = NULL");
    }

    if (!(i.getUsuario() == null)) {
      statement.setLong(5, i.getUsuario().getId());
    } else {
      statement.setNull(5, Types.NULL);
      messages.add("Registro de INSCRICAO (id: " + i.getId()
          + ") com chave estrangeira de Usuario = NULL");
    }

    return statement;
  }
View Full Code Here

    return statement;
  }

  public Persistent getObject(ResultSet rs) throws Exception {
    Inscricao i = new Inscricao();

    i.setId(rs.getLong(1));
    i.setTimestamp(new Timestamp(rs.getDate(2).getTime()));

    if (rs.getString(3) == null) {
      i.setTurma(null);
    } else {
      Turma t = new Turma();
      i.setTurma(t);
      i.getTurma().setId(rs.getLong(3));
    }

    if (rs.getString(4) == null) {
      i.setUsuario(null);
    } else {
      Usuario u = new Usuario();
      i.setUsuario(u);
      i.getUsuario().setId(rs.getLong(4));
    }

    return i;
  }
View Full Code Here

TOP

Related Classes of br.com.procempa.modus.entity.Inscricao

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.