}
@Override
- public void addAddressbook () {
+ public String addAddressbook () {
// Is this name already used?
if (!this.loginController.isUserLoggedIn()) {
// Not logged in
throw new FaceletException("This method can only be called as logged-in user."); //NOI18N
} else if (this.getAddressbookName() == null) {
// Address book name is null
- throw new NullPointerException("addressbookName is null");
+ throw new NullPointerException("addressbookName is null"); //NOI18N
} else if (this.getAddressbookName().isEmpty()) {
// Address book name is empty
- throw new IllegalStateException("addressbookName is empty.");
+ throw new IllegalStateException("addressbookName is empty."); //NOI18N
} else if (this.isAddressbookNameUsed(this.getAddressbookName())) {
// Already used by this user
throw new FaceletException(MessageFormat.format("Address book name {0} already used.", this.getAddressbookName())); //NOI18N
// Add address book entry to list
this.addressbookList.add(updatedAddressbook);
+
+ // All fine
+ return "login_own_addressbooks"; //NOI18N
} catch (final AddressbookNameAlreadyUsedException ex) {
// Throw again as cause
throw new FaceletException(ex);
public boolean hasCreatedAddressbooks ();
/**
- * Creates a new address book with a name. For this method to work it is
- * vital that the user is logged into his/her account.
+ * Creates a new address book with a name and redirects to proper target.
+ * For this method to work it is vital that the user is logged into his/her
+ * account.
+ * <p>
+ * @return Target to redirect to
*/
- public void addAddressbook ();
+ public String addAddressbook ();
/**
* Getter for address book name