]> git.mxchange.org Git - jcontacts-lib.git/blob - src/org/mxchange/jcontacts/model/contact/ContactSessionBeanRemote.java
Continued:
[jcontacts-lib.git] / src / org / mxchange / jcontacts / model / contact / ContactSessionBeanRemote.java
1 /*
2  * Copyright (C) 2016, 2017 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 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.jcontacts.model.contact;
18
19 import org.mxchange.jcontacts.model.contact.Contact;
20 import java.io.Serializable;
21 import java.util.List;
22 import javax.ejb.Remote;
23 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
24
25 /**
26  * A remote interface for general contact purposes
27  * <p>
28  * @author Roland Häder<roland@mxchange.org>
29  */
30 @Remote
31 public interface ContactSessionBeanRemote extends Serializable {
32
33         /**
34          * Checks whether the given email address is already registered. The email
35          * address should be validated by EmailAddressValidator before calling this
36          * method.
37          * <p>
38          * @param emailAddress Email address to check
39          * <p>
40          * @return Whether the email address is already registered
41          */
42         boolean isEmailAddressRegistered (final String emailAddress);
43
44         /**
45          * Checks if the given contact can be found by checking the whole list.
46          * <p>
47          * @param contact Contact instance to check
48          * <p>
49          * @return Whether the found instance or null
50          */
51         Contact lookupContact (final Contact contact);
52
53         /**
54          * Updates given contact data
55          * <p>
56          * @param contact Contact data to update
57          * @param isMobileUnlinked Whether a mobile entry has been unlinked in
58          * contact instance
59          * @param isLandlineUnlinked Whether a land-line entry has been unlinked in
60          * contact instance
61          * @param isFaxUnlinked Whether a fax entry has been unlinked in contact
62          * instance
63          * <p>
64          * @return Updated contact instance
65          */
66         Contact updateContactData (final Contact contact, final boolean isMobileUnlinked, final boolean isLandlineUnlinked, final boolean isFaxUnlinked);
67
68         /**
69          * Updates given contact in database. Please note that the id number must be
70          * set. This method should also make sure that mobile, land-line and fix
71          * numbers are updated, too.
72          * <p>
73          * @param contact Contact to update
74          * <p>
75          * @return Updated contact instance
76          */
77         Contact updateContactData (final Contact contact);
78
79         /**
80          * Returns a list of all found contacts
81          * <p>
82          * @return A list of call contacts
83          */
84         List<Contact> allContacts ();
85
86         /**
87          * Returns a list of all registered email addresses.
88          * <p>
89          * @return A list of all email addresses
90          */
91         List<String> allEmailAddresses ();
92
93         /**
94          * Returns a contact instance which has the given id number.
95          * <p>
96          * @param contactId Contact id
97          * <p>
98          * @return Contact instance
99          * <p>
100          * @throws ContactNotFoundException If the contact was not found
101          */
102         Contact findContactById (final Long contactId) throws ContactNotFoundException;
103
104         /**
105          * Returns a contact instance which has the given email address.
106          * <p>
107          * @param emailAddress Email address
108          * <p>
109          * @return Contact instance
110          * <p>
111          * @throws ContactNotFoundException If the contact was not found
112          */
113         Contact findContactByEmailAddress (final String emailAddress) throws ContactNotFoundException;
114
115 }