2 * Copyright (C) 2015 Roland Haeder
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.
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.
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/>.
17 package org.mxchange.addressbook.model.addressbook;
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;
28 * A remote session interface for addressbook handling
30 * @author Roland Haeder
33 public interface AddressbookSessionBeanRemote extends Serializable {
36 * Some getter for an address book instance from given id number. If the
37 * address book is not found, an exception is thrown.
39 * @param addressbookId Id number for address book instance
40 * @return Address book instance
41 * @throws org.mxchange.addressbook.exceptions.AddressbookNotFoundException
42 * If the address book cannot be found by given id number
43 * @throws NullPointerException If addressbookId is null
44 * @throws IllegalArgumentException If the id number is below 1
46 public Addressbook getAddressbookById (final Long addressbookId) throws AddressbookNotFoundException;
49 * Returns a list of all entries of given address book, whether the assigned
50 * user is the "owner" or "sharer" of the entry.
52 * @param addressbook Address book instance
54 * @return List of all entries
56 List<AddressbookEntry> allEntries (final Addressbook addressbook);
59 * Some "getter" for a list of address books the logged-in user has created
61 * @param loggedInUser Logged-in user
63 * @return List of all address books
65 List<Addressbook> getUsersList (final User loggedInUser);
68 * Creates given address book by persisting it. A User instance must be set,
69 * else an exception is thrown.
71 * @param addressbook Address book instance to create
73 * @return Updated address book instance
76 * org.mxchange.addressbook.exceptions.AddressbookNameAlreadyUsedException
77 * If the address book's name has already been used by the user.
79 Addressbook createAddressbook (final Addressbook addressbook) throws AddressbookNameAlreadyUsedException;
82 * Checks whether the given address book id is used (means available).
84 * @param addressbookId Address book id to check
85 * @return Whether the id is valid
87 boolean isAddressbookIdUsed (final Long addressbookId);
90 * Checks if the given address book's name is already used by the user.
92 * @param addressbook Address bok instance to check
94 * @return Whether the name has already been used by the user
96 boolean isAddressbookNameUsed (final Addressbook addressbook);