2 * Copyright (C) 2016 - 2020 Free Software Foundation
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License as
6 * published by the Free Software Foundation, either version 3 of the
7 * License, or (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 Affero General Public License for more details.
14 * You should have received a copy of the GNU Affero General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.addressbook.beans.addressbook.share;
19 import java.io.Serializable;
20 import java.util.List;
21 import org.mxchange.jaddressbook.model.addressbook.Addressbook;
22 import org.mxchange.jaddressbookshare.model.addressbook.shared.ShareableAddressbook;
23 import org.mxchange.jusercore.model.user.User;
26 * Controller interface sharing address books
28 * @author Roland Häder<roland@mxchange.org>
30 public interface AddressbookSharesWebSessionController extends Serializable {
33 * Returns a list of all address books the user is sharing with others.
35 * @return List of all shared address books
37 List<ShareableAddressbook> allShares ();
40 * Getter for share instance
42 * @return Share instance
44 ShareableAddressbook getShare ();
47 * Setter for share instance
49 * @param share Share instance
51 void setShare (final ShareableAddressbook share);
54 * Getter for sharee's user id
56 * @return Sharee's user id
58 Long getShareeUserId ();
61 * Setter for sharee's user id
63 * @param shareeUserId Sharee's user id
65 void setShareeUserId (final Long shareeUserId);
68 * Checks if the sharee's user id is empty.
70 * @return Whether the sharee's user id is empty.
72 boolean isShareeUserIdEmpty ();
75 * Checks whether the sharee's user id is set
77 * @return Whether the sharee's user id is set
79 boolean isShareeUserIdSet ();
82 * Checks wether the current user is sharing address books with others
84 * @return Whether the current user is sharing address books
86 boolean isSharingAddressbooks ();
89 * Starts an address book share between currently logged-in user and
90 * assigned user for current address book.
92 * @param user User instance
93 * @param addressbook Address book instance
95 * @return Redirect target
97 String startSharing (final User user, final Addressbook addressbook);
100 * Count all shared address books by given user id
102 * @param user User instance to look for
104 * @return Count of user's shared address books
106 Integer countAllUserSharedAddressbooks (final User user);
109 * Retrieves a list of all users this user is not sharing this address book
112 * @return List of not sharing users
114 List<User> allUsersNotSharing ();