]> git.mxchange.org Git - addressbook-war.git/blob - src/java/org/mxchange/addressbook/beans/addressbook/AddressbookWebSessionController.java
ported project to new libraries jaddressbook-share-core/lib
[addressbook-war.git] / src / java / org / mxchange / addressbook / beans / addressbook / AddressbookWebSessionController.java
1 /*
2  * Copyright (C) 2016 Roland Häder
3  *
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.
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 Affero General Public License for more details.
13  *
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/>.
16  */
17 package org.mxchange.addressbook.beans.addressbook;
18
19 import java.io.Serializable;
20 import java.util.Calendar;
21 import java.util.List;
22 import org.mxchange.jaddressbook.model.addressbook.Addressbook;
23 import org.mxchange.jaddressbook.model.addressbook.entry.AddressbookEntry;
24 import org.mxchange.jusercore.model.user.User;
25
26 /**
27  * An interface for address book beans
28  * <p>
29  * @author Roland Häder<roland@mxchange.org>
30  */
31 public interface AddressbookWebSessionController extends Serializable {
32
33         /**
34          * Checks whether the user has created addressbooks. For this method to work
35          * it is vital that the user is logged into his/her account.
36          * <p>
37          * @return Whether the user has created at least one addressbook
38          */
39         boolean hasCreatedAddressbooks ();
40
41         /**
42          * Creates a new address book with a name and redirects to proper target.
43          * For this method to work it is vital that the user is logged into his/her
44          * account.
45          * <p>
46          * @return Target to redirect to
47          */
48         String addAddressbook ();
49
50         /**
51          * Getter for address book name
52          * <p>
53          * @return Address book name
54          */
55         String getAddressbookName ();
56
57         /**
58          * Setter for address book name
59          * <p>
60          * @param addressbookName Address book name
61          */
62         void setAddressbookName (final String addressbookName);
63
64         /**
65          * Checks if the given address book name is already used by the user.
66          * <p>
67          * @param addressbookName Address book name to check
68          * <p>
69          * @return Whether the name has already been used by the user
70          */
71         boolean isAddressbookNameUsed (final String addressbookName);
72
73         /**
74          * Returns all address books with this user
75          * <p>
76          * @return A list of all address books by this user
77          */
78         List<Addressbook> allAddressbooks ();
79
80         /**
81          * Returns a list of all address book entries for given address book
82          * <p>
83          * @param addressbook Address book instance
84          * <p>
85          * @return List of all entries
86          */
87         List<AddressbookEntry> allEntries (final Addressbook addressbook);
88
89         /**
90          * Size of all entries in given address book
91          * <p>
92          * @param addressbook Address book instance
93          * <p>
94          * @return Size of the entries in address book
95          */
96         int allEntriesSize (final Addressbook addressbook);
97
98         /**
99          * Getter for address book id number
100          * <p>
101          * @return Address book id number
102          */
103         Long getAddressbookId ();
104
105         /**
106          * Setter for address book id number
107          * <p>
108          * @param addressbookId Address book id number
109          */
110         void setAddressbookId (final Long addressbookId);
111
112         /**
113          * Getter for address book user (owner)
114          * <p>
115          * @return Address book user (owner)
116          */
117         User getAddressbookUser ();
118
119         /**
120          * Setter for address book user (owner)
121          * <p>
122          * @param addressbookUser Address book user (owner)
123          */
124         void setAddressbookUser (final User addressbookUser);
125
126         /**
127          * Getter for when the address book has been created
128          * <p>
129          * @return When the address book has been created
130          */
131         Calendar getAddressbookCreated ();
132
133         /**
134          * Setter for when the address book has been created
135          * <p>
136          * @param addressbookCreated When the address book has been created
137          */
138         void setAddressbookCreated (final Calendar addressbookCreated);
139
140         /**
141          * Checks if the user is logged in and if so if it matches the current
142          * address book owner.
143          * <p>
144          * @return Whether the owner matches currently logged-in user
145          */
146         boolean isOwnAddressbook ();
147
148         /**
149          * Checks if the owner of the current address book is NOT matching the
150          * logged-in user.
151          * <p>
152          * @return Whether the user does NOT match
153          */
154         boolean isOtherAddressbook ();
155
156         /**
157          * Getter for address book instance
158          * <p>
159          * @return Address book instance
160          */
161         Addressbook getAddressbook ();
162
163         /**
164          * Setter for address book instance
165          * <p>
166          * @param addressbook Address book instance
167          */
168         void setAddressbook (final Addressbook addressbook);
169
170         /**
171          * Checks wether an address book has been loaded by checking the id number.
172          * <p>
173          * @return Whether the address book is loaded
174          */
175         boolean isAddressbookLoaded ();
176
177         /**
178          * Loads address book from current id
179          * <p>
180          * @return Whether the address book was found
181          */
182         boolean loadAddressbook ();
183 }