2 * Copyright (C) 2016 Roland Haeder
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.shares;
19 import java.io.Serializable;
20 import java.util.List;
21 import org.mxchange.jaddressbookcore.events.sharing.AddressbookSharingEvent;
22 import org.mxchange.jaddressbookcore.model.addressbook.Addressbook;
23 import org.mxchange.jaddressbookcore.model.addressbook.shared.ShareableAddressbook;
24 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
25 import org.mxchange.jusercore.model.user.User;
28 * Controller interface sharing address books
30 * @author Roland Haeder<roland@mxchange.org>
32 public interface AddressbookSharesWebSessionController extends Serializable {
35 * Observer method for ended sharing events
37 * @param event Event instance
39 void afterAdressbookShareEnded (final AddressbookSharingEvent event);
42 * Observer method for started sharing events
44 * @param event Event instance
46 void afterAdressbookShareStarted (final AddressbookSharingEvent event);
49 * This method is called when a user has successfully logged in his/her
54 void afterLoginEvent (final UserLoggedInEvent event);
57 * Returns a list of all address books the user is sharing with others.
59 * @return List of all shared address books
61 List<ShareableAddressbook> allShares ();
64 * Getter for share instance
66 * @return Share instance
68 ShareableAddressbook getShare ();
71 * Setter for share instance
73 * @param share Share instance
75 void setShare (final ShareableAddressbook share);
78 * Getter for sharee's user id
80 * @return Sharee's user id
82 Long getShareeUserId ();
85 * Setter for sharee's user id
87 * @param shareeUserId Sharee's user id
89 void setShareeUserId (final Long shareeUserId);
92 * Checks if the sharee's user id is empty.
94 * @return Whether the sharee's user id is empty.
96 boolean isShareeUserIdEmpty ();
99 * Checks whether the sharee's user id is set
101 * @return Whether the sharee's user id is set
103 boolean isShareeUserIdSet ();
106 * Checks wether the current user is sharing address books with others
108 * @return Whether the current user is sharing address books
110 boolean isSharingAddressbooks ();
113 * Starts an address book share between currently logged-in user and
114 * assigned user for current address book.
116 * @param user User instance
117 * @param addressbook Address book instance
119 * @return Redirect target
121 String startSharing (final User user, final Addressbook addressbook);