]> git.mxchange.org Git - jfinancials-lib.git/blob - src/org/mxchange/addressbook/model/addressbook/AddressbookSessionBeanRemote.java
Added business method countAllUserSharedAddressbooks()
[jfinancials-lib.git] / src / org / mxchange / addressbook / model / addressbook / AddressbookSessionBeanRemote.java
1 /*
2  * Copyright (C) 2015 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.addressbook.exceptions.AddressbookNameAlreadyUsedException;
23 import org.mxchange.addressbook.exceptions.AddressbookNotFoundException;
24 import org.mxchange.addressbook.model.addressbook.entry.AddressbookEntry;
25 import org.mxchange.jusercore.model.user.User;
26
27 /**
28  * A remote session interface for addressbook handling
29  * <p>
30  * @author Roland Haeder
31  */
32 @Remote
33 public interface AddressbookSessionBeanRemote extends Serializable {
34
35         /**
36          * Count all shared address books by given user
37          * <p>
38          * @param user User instance
39          * <p>
40          * @return Count of all user's shared address books
41          */
42         Integer countAllUserSharedAddressbooks (final User user);
43
44         /**
45          * Some getter for an address book instance from given id number. If the
46          * address book is not found, an exception is thrown.
47          * <p>
48          * @param addressbookId Id number for address book instance
49          * <p>
50          * @return Address book instance
51          * <p>
52          * @throws org.mxchange.addressbook.exceptions.AddressbookNotFoundException
53          * If the address book cannot be found by given id number
54          * @throws NullPointerException If addressbookId is null
55          * @throws IllegalArgumentException If the id number is below 1
56          */
57         public Addressbook getAddressbookById (final Long addressbookId) throws AddressbookNotFoundException;
58
59         /**
60          * Returns a list of all entries of given address book, whether the assigned
61          * user is the "owner" or "sharer" of the entry.
62          * <p>
63          * @param addressbook Address book instance
64          * <p>
65          * @return List of all entries
66          */
67         List<AddressbookEntry> allEntries (final Addressbook addressbook);
68
69         /**
70          * Some "getter" for a list of address books the logged-in user has created
71          * <p>
72          * @param loggedInUser Logged-in user
73          * <p>
74          * @return List of all address books
75          */
76         List<Addressbook> getUsersList (final User loggedInUser);
77
78         /**
79          * Creates given address book by persisting it. A User instance must be set,
80          * else an exception is thrown.
81          * <p>
82          * @param addressbook Address book instance to create
83          * <p>
84          * @return Updated address book instance
85          * <p>
86          * @throws
87          * org.mxchange.addressbook.exceptions.AddressbookNameAlreadyUsedException
88          * If the address book's name has already been used by the user.
89          */
90         Addressbook createAddressbook (final Addressbook addressbook) throws AddressbookNameAlreadyUsedException;
91
92         /**
93          * Checks whether the given address book id is used (means available).
94          * <p>
95          * @param addressbookId Address book id to check
96          * <p>
97          * @return Whether the id is valid
98          */
99         boolean isAddressbookIdUsed (final Long addressbookId);
100
101         /**
102          * Checks if the given address book's name is already used by the user.
103          * <p>
104          * @param addressbook Address bok instance to check
105          * <p>
106          * @return Whether the name has already been used by the user
107          */
108         boolean isAddressbookNameUsed (final Addressbook addressbook);
109 }