]> git.mxchange.org Git - jaddressbook-share-lib.git/blob - src/org/mxchange/addressbook/model/shared/SharedAddressbooksSessionBeanRemote.java
56a38fd11fa659b9bbf73b3094b4cccf8e9f68c2
[jaddressbook-share-lib.git] / src / org / mxchange / addressbook / model / shared / SharedAddressbooksSessionBeanRemote.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.shared;
18
19 import java.io.Serializable;
20 import java.util.List;
21 import javax.ejb.Remote;
22 import org.mxchange.jaddressbookcore.exceptions.UserAlreadySharingAddressbookException;
23 import org.mxchange.jaddressbookcore.model.addressbook.Addressbook;
24 import org.mxchange.jaddressbookcore.model.addressbook.shared.ShareableAddressbook;
25 import org.mxchange.jusercore.model.user.User;
26
27 /**
28  * A remote interface for sharing address books
29  * <p>
30  * @author Roland Haeder<roland@mxchange.org>
31  */
32 @Remote
33 public interface SharedAddressbooksSessionBeanRemote extends Serializable {
34
35         /**
36          * Retrieves a list of all user's shared address books. The list contains
37          * only the shares. But the address books and sharee can be easily
38          * extracted.
39          * <p>
40          * @param user User instance to get list of shared address books (shares)
41          * from
42          * <p>
43          * @return List of shares (= shared address book entries)
44          */
45         List<ShareableAddressbook> allSharedAddressbooks (final User user);
46
47         /**
48          * Starts an address book share between currently logged-in user and
49          * assigned user for current address book.
50          * <p>
51          * @param sharee User sharee instance
52          * @param addressbook Address book instance
53          * <p>
54          * @return Updated share instance
55          * <p>
56          * @throws UserAlreadySharingAddressbookException When the user is already
57          * sharing the address book
58          */
59         ShareableAddressbook startSharing (final User sharee, final Addressbook addressbook) throws UserAlreadySharingAddressbookException;
60
61         /**
62          * Checks if the given user is sharing address books with others
63          * <p>
64          * @param user User instance
65          *
66          * @return Whether the user is sharing address books
67          */
68         Boolean isUserSharingAddressbooks (final User user);
69
70 }