public void validateCreate(FacesContext facesContext, UIComponent component, Object value) { Plataforma newPlataforma = new Plataforma(); String newPlataformaString = converter.getAsString(FacesContext.getCurrentInstance(), null, newPlataforma); String plataformaString = converter.getAsString(FacesContext.getCurrentInstance(), null, plataforma); if (!newPlataformaString.equals(plataformaString)) { createSetup(); } }
public String edit() { String plataformaString = converter.getAsString(FacesContext.getCurrentInstance(), null, plataforma); String currentPlataformaString = JsfUtil.getRequestParameter("jsfcrud.currentPlataforma"); if (plataformaString == null || plataformaString.length() == 0 || !plataformaString.equals(currentPlataformaString)) { String outcome = editSetup(); if ("plataforma_edit".equals(outcome)) { JsfUtil.addErrorMessage("Could not edit plataforma. Try again."); } return outcome; } try { utx.begin(); } catch (Exception ex) { } try { Exception transactionException = null; getJpaController().edit(plataforma); try { utx.commit(); } catch (javax.transaction.RollbackException ex) { transactionException = ex; } catch (Exception ex) { } if (transactionException == null) { JsfUtil.addSuccessMessage("Plataforma 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(); }