Exemplo n.º 1
0
 public void cargaListaUpcs() {
   boolean ok = false;
   RequestContext context = RequestContext.getCurrentInstance();
   FacesMessage fMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Aviso:", "cargaListaUpcs");
   this.listaUpcs = new ArrayList<SelectItem>();
   Upc u0 = this.nuevoLista(this.upc.getIdProducto());
   this.listaUpcs.add(new SelectItem(u0, u0.toString()));
   try {
     this.dao = new DAOUpcs();
     for (Upc u : this.dao.obtenerUpcs(this.upc.getIdProducto())) {
       this.listaUpcs.add(new SelectItem(u, u.toString()));
     }
     ok = true;
   } catch (NamingException ex) {
     fMsg.setDetail(ex.getMessage());
   } catch (SQLException ex) {
     fMsg.setDetail(ex.getErrorCode() + " " + ex.getMessage());
   }
   if (!ok) {
     FacesContext.getCurrentInstance().addMessage(null, fMsg);
   }
   context.addCallbackParam("okUpc", ok);
 }
Exemplo n.º 2
0
 public void copia(Upc u) {
   this.upc.setUpc(u.getUpc());
   this.upc.setIdProducto(u.getIdProducto());
   this.upc.setActual(u.isActual());
 }