2 * Copyright (C) 2016, 2017 Free Software Foundation
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.shared;
19 import java.io.Serializable;
20 import java.util.List;
21 import javax.ejb.Remote;
22 import org.mxchange.jaddressbook.model.addressbook.Addressbook;
23 import org.mxchange.jaddressbookshare.exceptions.UserAlreadySharingAddressbookException;
24 import org.mxchange.jaddressbookshare.model.addressbook.shared.ShareableAddressbook;
25 import org.mxchange.jusercore.model.user.User;
28 * A remote interface for sharing address books
30 * @author Roland Häder<roland@mxchange.org>
33 public interface AddressbookShareSessionBeanRemote extends Serializable {
36 * Retrieves a list of all users this user is not sharing the given address
39 * @param user User instance
40 * @param addressbook Address book instance
42 * @return List of users
44 List<User> allUsersNotSharing (final User user, final Addressbook addressbook);
47 * Count all shared address books by given user
49 * @param user User instance
51 * @return Count of all user's shared address books
53 Integer countAllUserSharedAddressbooks (final User user);
56 * Retrieves a list of all user's shared address books. The list contains
57 * only the shares. But the address books and sharee can be easily
60 * @param user User instance to get list of shared address books (shares)
63 * @return List of shares (= shared address book entries)
65 List<ShareableAddressbook> allSharedAddressbooks (final User user);
68 * Starts an address book share between currently logged-in user and
69 * assigned user for current address book.
71 * @param sharee User sharee instance
72 * @param addressbook Address book instance
74 * @return Updated share instance
76 * @throws UserAlreadySharingAddressbookException When the user is already
77 * sharing the address book
79 ShareableAddressbook startSharing (final User sharee, final Addressbook addressbook) throws UserAlreadySharingAddressbookException;
82 * Checks if the given user is sharing address books with others
84 * @param user User instance
86 * @return Whether the user is sharing address books
88 Boolean isUserSharingAddressbooks (final User user);