public void addSubscriber() { try { if (program.getListEditing() == null) { throw new RuntimeException( "List is not set yet but you still manage to come to this page? Notify your admin immediately! =)"); } subService.subscribe(program.getListEditingId(), this.getFieldValues()); FacesMessenger.setFacesMessage( program.getFormName(), FacesMessage.SEVERITY_FATAL, "Subscriber added!", null); // How to redirect to List editing panel? program.refresh(); } catch (EJBException ex) { // Transaction did not go through // Throwable cause = ex.getCause(); FacesMessenger.setFacesMessage( formName, FacesMessage.SEVERITY_ERROR, "Error with transaction", ex.getMessage()); } catch (EntityNotFoundException ex) { FacesMessenger.setFacesMessage(formName, FacesMessage.SEVERITY_ERROR, ex.getMessage(), ""); } catch (IncompleteDataException ex) { FacesMessenger.setFacesMessage(formName, FacesMessage.SEVERITY_ERROR, ex.getMessage(), ""); } catch (DataValidationException ex) { FacesMessenger.setFacesMessage(formName, FacesMessage.SEVERITY_ERROR, ex.getMessage(), ""); } catch (RelationshipExistsException ex) { FacesMessenger.setFacesMessage( formName, FacesMessage.SEVERITY_ERROR, "Subscriber already exist in this list", ""); } catch (Exception ex) { FacesMessenger.setFacesMessage( formName, FacesMessage.SEVERITY_ERROR, ex.getClass().getSimpleName(), ex.getMessage()); } }
public void loadListFields() { try { long listId = program.getListEditingId(); // to improve performance // no! it's necessary else there will be nullpointerexception :p if (listId <= 0) { return; } List<SubscriptionListField> fieldList = subService.getFieldsForSubscriptionList(listId); this.program.setFieldList(fieldList); } catch (EJBException ex) { FacesMessenger.setFacesMessage( program.getFormName(), FacesMessage.SEVERITY_ERROR, ex.getMessage(), null); } }