]> git.mxchange.org Git - jfinancials-lib.git/blobdiff - src/org/mxchange/addressbook/model/addressbook/AddressbookSessionBeanRemote.java
Continued:
[jfinancials-lib.git] / src / org / mxchange / addressbook / model / addressbook / AddressbookSessionBeanRemote.java
index d0806bd6cc22b714fe456b338f9d9e500e9c0cda..fc3231091225e99dafbbf9c32ccad4cdbac4af79 100644 (file)
 package org.mxchange.addressbook.model.addressbook;
 
 import java.io.Serializable;
+import java.util.List;
 import javax.ejb.Remote;
+import org.mxchange.addressbook.exceptions.AddressbookNameAlreadyUsedException;
+import org.mxchange.addressbook.exceptions.AddressbookNotFoundException;
+import org.mxchange.addressbook.model.addressbook.entry.AddressbookEntry;
+import org.mxchange.jusercore.model.user.User;
 
 /**
  * A remote session interface for addressbook handling
@@ -26,4 +31,67 @@ import javax.ejb.Remote;
  */
 @Remote
 public interface AddressbookSessionBeanRemote extends Serializable {
+
+       /**
+        * Some getter for an address book instance from given id number. If the
+        * address book is not found, an exception is thrown.
+        * <p>
+        * @param addressbookId Id number for address book instance
+        * @return Address book instance
+        * @throws org.mxchange.addressbook.exceptions.AddressbookNotFoundException
+        * If the address book cannot be found by given id number
+        * @throws NullPointerException If addressbookId is null
+        * @throws IllegalArgumentException If the id number is below 1
+        */
+       public Addressbook getAddressbookById (final Long addressbookId) throws AddressbookNotFoundException;
+
+       /**
+        * Returns a list of all entries of given address book, whether the assigned
+        * user is the "owner" or "sharer" of the entry.
+        * <p>
+        * @param addressbook Address book instance
+        * <p>
+        * @return List of all entries
+        */
+       List<AddressbookEntry> allEntries (final Addressbook addressbook);
+
+       /**
+        * Some "getter" for a list of address books the logged-in user has created
+        * <p>
+        * @param loggedInUser Logged-in user
+        * <p>
+        * @return List of all address books
+        */
+       List<Addressbook> getUsersList (final User loggedInUser);
+
+       /**
+        * Creates given address book by persisting it. A User instance must be set,
+        * else an exception is thrown.
+        * <p>
+        * @param addressbook Address book instance to create
+        * <p>
+        * @return Updated address book instance
+        * <p>
+        * @throws
+        * org.mxchange.addressbook.exceptions.AddressbookNameAlreadyUsedException
+        * If the address book's name has already been used by the user.
+        */
+       Addressbook createAddressbook (final Addressbook addressbook) throws AddressbookNameAlreadyUsedException;
+
+       /**
+        * Checks whether the given address book id is used (means available).
+        * <p>
+        * @param addressbookId Address book id to check
+        * @return Whether the id is valid
+        */
+       boolean isAddressbookIdUsed (final Long addressbookId);
+
+       /**
+        * Checks if the given address book's name is already used by the user.
+        * <p>
+        * @param addressbook Address bok instance to check
+        * <p>
+        * @return Whether the name has already been used by the user
+        */
+       boolean isAddressbookNameUsed (final Addressbook addressbook);
 }