private String relatedControllerOutcome() { String relatedControllerString = JsfUtil.getRequestParameter("jsfcrud.relatedController"); String relatedControllerTypeString = JsfUtil.getRequestParameter("jsfcrud.relatedControllerType"); if (relatedControllerString != null && relatedControllerTypeString != null) { FacesContext context = FacesContext.getCurrentInstance(); Object relatedController = context .getApplication() .getELResolver() .getValue(context.getELContext(), null, relatedControllerString); try { Class<?> relatedControllerType = Class.forName(relatedControllerTypeString); Method detailSetupMethod = relatedControllerType.getMethod("detailSetup"); return (String) detailSetupMethod.invoke(relatedController); } catch (ClassNotFoundException e) { throw new FacesException(e); } catch (NoSuchMethodException e) { throw new FacesException(e); } catch (IllegalAccessException e) { throw new FacesException(e); } catch (InvocationTargetException e) { throw new FacesException(e); } } return null; }
public String create() { try { utx.begin(); } catch (Exception ex) { } try { Exception transactionException = null; getJpaController().create(ofertas); try { utx.commit(); } catch (javax.transaction.RollbackException ex) { transactionException = ex; } catch (Exception ex) { } if (transactionException == null) { JsfUtil.addSuccessMessage("Ofertas was successfully created."); } 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 listSetup(); }
public String remove() { String idAsString = JsfUtil.getRequestParameter("jsfcrud.currentOfertas"); Integer id = new Integer(idAsString); try { utx.begin(); } catch (Exception ex) { } try { Exception transactionException = null; getJpaController().remove(getJpaController().find(id)); try { utx.commit(); } catch (javax.transaction.RollbackException ex) { transactionException = ex; } catch (Exception ex) { } if (transactionException == null) { JsfUtil.addSuccessMessage("Ofertas was successfully deleted."); } 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 relatedOrListOutcome(); }
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; }
public Ofertas getOfertas() { if (ofertas == null) { ofertas = (Ofertas) JsfUtil.getObjectFromRequestParameter("jsfcrud.currentOfertas", converter, null); } if (ofertas == null) { ofertas = new Ofertas(); } return ofertas; }
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(); }
public SelectItem[] getOfertasItemsAvailableSelectOne() { return JsfUtil.getSelectItems(getJpaController().findAll(), true); }