コード例 #1
0
  public List<String> getIdsSolicitud() {
    this.session = null;
    this.transaction = null;

    try {
      this.session = NewHibernateUtil.getSessionFactory().openSession();
      this.idsSolicitud = new ArrayList<>();
      ISolicitudDao solicitudDao = new SolicitudDao();
      this.transaction = this.session.beginTransaction();
      List<Solicitud> solicitudesTemp = solicitudDao.getAll(this.session);
      for (Solicitud solicitud : solicitudesTemp) {
        this.idsSolicitud.add(String.valueOf(solicitud.getIdSolicitud()));
      }
      this.transaction.commit();
      System.out.println("Size: " + this.idsSolicitud.size());
      return this.idsSolicitud;
    } catch (Exception ex) {
      if (this.transaction != null) {
        transaction.rollback();
      }
      FacesContext.getCurrentInstance()
          .addMessage(
              null, new FacesMessage(FacesMessage.SEVERITY_FATAL, "Error", ex.getMessage()));
      return null;
    } finally {
      if (this.session != null) {
        this.session.close();
      }
    }
  }
コード例 #2
0
  public List<Solicitud> getSolicitudesPendientesReasignacion() {
    this.session = null;
    this.transaction = null;

    try {
      this.session = NewHibernateUtil.getSessionFactory().openSession();
      ISolicitudDao solicitudDao = new SolicitudDao();
      this.transaction = this.session.beginTransaction();
      this.solicitudes = solicitudDao.getSolicitudesPendientesReasignacion(this.session);
      this.transaction.commit();
      return this.solicitudes;
    } catch (Exception ex) {
      if (this.transaction != null) {
        transaction.rollback();
      }
      FacesContext.getCurrentInstance()
          .addMessage(
              null, new FacesMessage(FacesMessage.SEVERITY_FATAL, "Error", ex.getMessage()));
      return null;
    } finally {
      if (this.session != null) {
        this.session.close();
      }
    }
  }
コード例 #3
0
  public List<SelectItem> getSelectItemsOneOperario() {
    this.session = null;
    this.transaction = null;

    try {
      this.session = NewHibernateUtil.getSessionFactory().openSession();
      this.selectItemsOneOperario = new ArrayList<>();
      IOperarioDao operarioDao = new OperarioDao();
      this.transaction = this.session.beginTransaction();
      // List<Operario> operarios = areaServicioDao.findAllArea(this.session);
      List<Operario> operarios = operarioDao.getAll(this.session);
      selectItemsOneOperario.clear();
      for (Operario operario : operarios) {
        SelectItem selectItem =
            new SelectItem(
                operario.getIdOperario(), operario.getNombre() + " " + operario.getApPaterno());
        this.selectItemsOneOperario.add(selectItem);
      }
      this.transaction.commit();

      return selectItemsOneOperario;
    } catch (Exception ex) {
      if (this.transaction != null) {
        transaction.rollback();
      }
      FacesContext.getCurrentInstance()
          .addMessage(
              null, new FacesMessage(FacesMessage.SEVERITY_FATAL, "Error", ex.getMessage()));
      return null;
    } finally {
      if (this.session != null) {
        this.session.close();
      }
    }
  }
コード例 #4
0
  public void modificarServicio() {
    this.session = null;
    this.transaction = null;

    try {
      this.session = NewHibernateUtil.getSessionFactory().openSession();
      ISolicitudDao solicitudDao = new SolicitudDao();
      this.transaction = this.session.beginTransaction();
      solicitudDao.modificarSolicitud(this.session, this.solicitud);
      this.transaction.commit();
    } catch (Exception ex) {
      if (this.transaction != null) {
        transaction.rollback();
      }
      FacesContext.getCurrentInstance()
          .addMessage(
              null, new FacesMessage(FacesMessage.SEVERITY_FATAL, "Error", ex.getMessage()));
    } finally {
      if (this.session != null) {
        this.session.close();
      }
    }
  }