Package entidades

Examples of entidades.MotivosDelPreso


    private void cargarListaAsignada(Preso p) {
        List<MotivosDelPreso> lista = ec.createQuery("select mp from MotivosDelPreso mp where mp.preso=:preso and mp.condena is null", MotivosDelPreso.class).setParameter("preso", p).getResultList();
        DefaultListModel model = new DefaultListModel();
        mdsAsig = new ArrayList<MotivoDetencion>();
        for (int i = 0; i < lista.size(); i++) {
            MotivosDelPreso motivosDelPreso1 = lista.get(i);
            MotivoDetencion motivoDetencion = motivosDelPreso1.getMotivoDetencion();
            mdsAsig.add(motivoDetencion);
            model.addElement(motivoDetencion.getId() + "-" + motivoDetencion.getDescripcion());
            listaAsignada.setModel(model);
        }
View Full Code Here


    private void persistirMotivos(Preso p) {
        bajar_motivos();
        for (int i = 0; i < mdsAsig.size(); i++) {
            MotivoDetencion motivoDetencion = mdsAsig.get(i);
            MotivosDelPreso mdp = new MotivosDelPreso(motivoDetencion, p, new Timestamp(new Date().getTime()), null);
            ec.persist(mdp, false);
        }
    }
View Full Code Here

    }

    private void bajar_motivos(){
        List<MotivosDelPreso> lista = ec.createQuery("select mp from MotivosDelPreso mp where mp.preso = :preso and mp.condena is null", MotivosDelPreso.class).setParameter("preso", p).getResultList();
        for (int i = 0; i < lista.size(); i++){
            MotivosDelPreso mp = lista.get(i);
            ec.deleteEntity(mp, false);
        }
    }
View Full Code Here

                        p = (Preso) ec.createQuery("select p from Preso p where p.nroPreso = :nro", Preso.class).setParameter("nro", nro).getSingleResult();
                        condena.setPreso(p);
                       
                        ec.persist(condena, false);
                        for (int i = 0; i < agregados.size(); i++) {
                            MotivosDelPreso motivo = agregados.get(i);
                            if (motivo.getPreso().getNropreso() == condena.getPreso().getNropreso()) {
                                motivo.setCondena(condena);
                                ec.updateEntity(motivo, false);
                            }
                        }
                        TipoEstadoPreso tep = (TipoEstadoPreso) ec.createQuery("select t from TipoEstadoPreso t where t.descripcion = 'Condenado'", TipoEstadoPreso.class).getSingleResult();
                        EstadoPreso estPre = new EstadoPreso(p, tep, new Timestamp(new Date().getTime()));
View Full Code Here

    private void refrescarLista(DefaultListModel lista, ArrayList<MotivosDelPreso> mot){
        lista.clear();

        if (!mot.isEmpty()) {
            for (int i = 0; i < mot.size(); i++) {
                MotivosDelPreso motivo = mot.get(i);
                lista.addElement((i + 1) + " - " + motivo.getMotivoDetencion().getDescripcion());
            }
        }
    }
View Full Code Here

                    if (JOptionPane.showConfirmDialog(MotivosDelPresoController.this, "Desea Guardar?", "Guardar", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                        Integer id = Integer.valueOf(nroPresoText.getText());
                        Preso p = (Preso) ec.createQuery("select p from Preso p where p.nroPreso = :id", Preso.class).setParameter("id",id).getSingleResult();
               
                        for (int i = 0; i < agregados.size(); i++){
                            MotivosDelPreso motivo = new MotivosDelPreso();
               
                            motivo.setCondena(null);
                            motivo.setMotivoDetencion(new MotivoDetencion(agregados.get(i).getDescripcion()));
                            motivo.setFecha(new Timestamp(new Date().getTime()));
               
                            motivo.setPreso(p);
                   
                            if (i < (agregados.size() - 1)) {
                                ec.persist(motivo, false);
                            } else {
                                ec.persist(motivo, true);
View Full Code Here

TOP

Related Classes of entidades.MotivosDelPreso

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.