]> git.mxchange.org Git - jaddressbook-share-lib.git/blob - src/org/mxchange/addressbook/model/addressbook/AddressbookSessionBeanRemote.java
opps, messed up addressbook-lib and jaddressbook-lib. The first one is a sub-project...
[jaddressbook-share-lib.git] / src / org / mxchange / addressbook / model / addressbook / AddressbookSessionBeanRemote.java
1 /*
2  * Copyright (C) 2016 Roland Haeder
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 package org.mxchange.addressbook.model.addressbook;
18
19 import java.io.Serializable;
20 import java.util.List;
21 import javax.ejb.Remote;
22 import org.mxchange.jaddressbookcore.exceptions.AddressbookNameAlreadyUsedException;
23 import org.mxchange.jaddressbookcore.exceptions.AddressbookNotFoundException;
24 import org.mxchange.jaddressbookcore.model.addressbook.Addressbook;
25 import org.mxchange.jaddressbookcore.model.addressbook.entry.AddressbookEntry;
26 import org.mxchange.jusercore.model.user.User;
27
28 /**
29  * A remote session interface for addressbook handling
30  * <p>
31  * @author Roland Haeder<roland@mxchange.org>
32  */
33 @Remote
34 public interface AddressbookSessionBeanRemote extends Serializable {
35
36         /**
37          * Retrieves a list of all users this user is not sharing the given address
38          * book with.
39          * <p>
40          * @param user User instance
41          * @param addressbook Address book instance
42          * <p>
43          * @return List of users
44          */
45         List<User> allUsersNotSharing (final User user, final Addressbook addressbook);
46
47         /**
48          * Count all shared address books by given user
49          * <p>
50          * @param user User instance
51          * <p>
52          * @return Count of all user's shared address books
53          */
54         Integer countAllUserSharedAddressbooks (final User user);
55
56         /**
57          * Some getter for an address book instance from given id number. If the
58          * address book is not found, an exception is thrown.
59          * <p>
60          * @param addressbookId Id number for address book instance
61          * <p>
62          * @return Address book instance
63          * <p>
64          * @throws org.mxchange.jaddressbookcore.exceptions.AddressbookNotFoundException
65          * If the address book cannot be found by given id number
66          * @throws NullPointerException If addressbookId is null
67          * @throws IllegalArgumentException If the id number is below 1
68          */
69         Addressbook getAddressbookById (final Long addressbookId) throws AddressbookNotFoundException;
70
71         /**
72          * Returns a list of all entries of given address book, whether the assigned
73          * user is the "owner" or "sharer" of the entry.
74          * <p>
75          * @param addressbook Address book instance
76          * <p>
77          * @return List of all entries
78          */
79         List<AddressbookEntry> allEntries (final Addressbook addressbook);
80
81         /**
82          * Some "getter" for a list of address books the logged-in user has created
83          * <p>
84          * @param loggedInUser Logged-in user
85          * <p>
86          * @return List of all address books
87          */
88         List<Addressbook> getUsersAddressbookList (final User loggedInUser);
89
90         /**
91          * Creates given address book by persisting it. A User instance must be set,
92          * else an exception is thrown.
93          * <p>
94          * @param addressbook Address book instance to create
95          * <p>
96          * @return Updated address book instance
97          * <p>
98          * @throws
99          * org.mxchange.jaddressbookcore.exceptions.AddressbookNameAlreadyUsedException
100          * If the address book's name has already been used by the user.
101          */
102         Addressbook createAddressbook (final Addressbook addressbook) throws AddressbookNameAlreadyUsedException;
103
104         /**
105          * Checks whether the given address book id is used (means available).
106          * <p>
107          * @param addressbookId Address book id to check
108          * <p>
109          * @return Whether the id is valid
110          */
111         boolean isAddressbookIdUsed (final Long addressbookId);
112
113         /**
114          * Checks if the given address book's name is already used by the user.
115          * <p>
116          * @param addressbook Address bok instance to check
117          * <p>
118          * @return Whether the name has already been used by the user
119          */
120         boolean isAddressbookNameUsed (final Addressbook addressbook);
121 }