コード例 #1
0
 private String scalarSetup(String destination) {
   reset(false);
   ofertas =
       (Ofertas) JsfUtil.getObjectFromRequestParameter("jsfcrud.currentOfertas", converter, null);
   if (ofertas == null) {
     String requestOfertasString = JsfUtil.getRequestParameter("jsfcrud.currentOfertas");
     JsfUtil.addErrorMessage("The ofertas with id " + requestOfertasString + " no longer exists.");
     return relatedOrListOutcome();
   }
   return destination;
 }
コード例 #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();
 }