]> git.mxchange.org Git - jfinancials-lib.git/blobdiff - src/org/mxchange/addressbook/model/addressbook/AddressbookSessionBeanRemote.java
Refacture:
[jfinancials-lib.git] / src / org / mxchange / addressbook / model / addressbook / AddressbookSessionBeanRemote.java
index 4af9c91f2ce30ecd896a8c1639481118d7c351e1..bfc99a4137ad7ba4c7f41f30cc36c9de9040350c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Roland Haeder
+ * Copyright (C) 2016 Roland Haeder
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,17 +19,65 @@ 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.jaddressbookcore.exceptions.AddressbookNameAlreadyUsedException;
+import org.mxchange.jaddressbookcore.exceptions.AddressbookNotFoundException;
+import org.mxchange.jaddressbookcore.model.addressbook.Addressbook;
+import org.mxchange.jaddressbookcore.model.addressbook.entry.AddressbookEntry;
 import org.mxchange.jusercore.model.user.User;
 
 /**
  * A remote session interface for addressbook handling
  * <p>
- * @author Roland Haeder
+ * @author Roland Haeder<roland@mxchange.org>
  */
 @Remote
 public interface AddressbookSessionBeanRemote extends Serializable {
 
+       /**
+        * Retrieves a list of all users this user is not sharing the given address
+        * book with.
+        * <p>
+        * @param user User instance
+        * @param addressbook Address book instance
+        * <p>
+        * @return List of users
+        */
+       List<User> allUsersNotSharing (final User user, final Addressbook addressbook);
+
+       /**
+        * Count all shared address books by given user
+        * <p>
+        * @param user User instance
+        * <p>
+        * @return Count of all user's shared address books
+        */
+       Integer countAllUserSharedAddressbooks (final User user);
+
+       /**
+        * 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
+        * <p>
+        * @return Address book instance
+        * <p>
+        * @throws org.mxchange.jaddressbookcore.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
+        */
+       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>
@@ -37,7 +85,7 @@ public interface AddressbookSessionBeanRemote extends Serializable {
         * <p>
         * @return List of all address books
         */
-       public List<Addressbook> getUsersList (final User loggedInUser);
+       List<Addressbook> getUsersAddressbookList (final User loggedInUser);
 
        /**
         * Creates given address book by persisting it. A User instance must be set,
@@ -48,10 +96,19 @@ public interface AddressbookSessionBeanRemote extends Serializable {
         * @return Updated address book instance
         * <p>
         * @throws
-        * org.mxchange.addressbook.exceptions.AddressbookNameAlreadyUsedException
+        * org.mxchange.jaddressbookcore.exceptions.AddressbookNameAlreadyUsedException
         * If the address book's name has already been used by the user.
         */
-       public Addressbook createAddressbook (final Addressbook addressbook) throws AddressbookNameAlreadyUsedException;
+       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
+        * <p>
+        * @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.
@@ -60,5 +117,5 @@ public interface AddressbookSessionBeanRemote extends Serializable {
         * <p>
         * @return Whether the name has already been used by the user
         */
-       public boolean isAddressbookNameUsed (final Addressbook addressbook);
+       boolean isAddressbookNameUsed (final Addressbook addressbook);
 }