コード例 #1
0
 public void validateCreate(FacesContext facesContext, UIComponent component, Object value) {
   Ofertas newOfertas = new Ofertas();
   String newOfertasString =
       converter.getAsString(FacesContext.getCurrentInstance(), null, newOfertas);
   String ofertasString = converter.getAsString(FacesContext.getCurrentInstance(), null, ofertas);
   if (!newOfertasString.equals(ofertasString)) {
     createSetup();
   }
 }
コード例 #2
0
 public String edit() {
   String ofertasString = converter.getAsString(FacesContext.getCurrentInstance(), null, ofertas);
   String currentOfertasString = JsfUtil.getRequestParameter("jsfcrud.currentOfertas");
   if (ofertasString == null
       || ofertasString.length() == 0
       || !ofertasString.equals(currentOfertasString)) {
     String outcome = editSetup();
     if ("ofertas_edit".equals(outcome)) {
       JsfUtil.addErrorMessage("Could not edit ofertas. Try again.");
     }
     return outcome;
   }
   try {
     utx.begin();
   } catch (Exception ex) {
   }
   try {
     Exception transactionException = null;
     getJpaController().edit(ofertas);
     try {
       utx.commit();
     } catch (javax.transaction.RollbackException ex) {
       transactionException = ex;
     } catch (Exception ex) {
     }
     if (transactionException == null) {
       JsfUtil.addSuccessMessage("Ofertas was successfully updated.");
     } else {
       JsfUtil.ensureAddErrorMessage(transactionException, "A persistence error occurred.");
     }
   } catch (Exception e) {
     try {
       utx.rollback();
     } catch (Exception ex) {
     }
     JsfUtil.ensureAddErrorMessage(e, "A persistence error occurred.");
     return null;
   }
   return detailSetup();
 }