Beispiel #1
0
  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());
    }
  }