2 * Copyright (C) 2016, 2017 Roland Häder
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.
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.
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/>.
17 package org.mxchange.jcontacts.model.contact;
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;
26 * A remote interface for general contact purposes
28 * @author Roland Häder<roland@mxchange.org>
31 public interface ContactSessionBeanRemote extends Serializable {
34 * Checks whether the given email address is already registered. The email
35 * address should be validated by EmailAddressValidator before calling this
38 * @param emailAddress Email address to check
40 * @return Whether the email address is already registered
42 boolean isEmailAddressRegistered (final String emailAddress);
45 * Checks if the given contact can be found by checking the whole list.
47 * @param contact Contact instance to check
49 * @return Whether the found instance or null
51 Contact lookupContact (final Contact contact);
54 * Updates given contact data
56 * @param contact Contact data to update
57 * @param isMobileUnlinked Whether a mobile entry has been unlinked in
59 * @param isLandlineUnlinked Whether a land-line entry has been unlinked in
61 * @param isFaxUnlinked Whether a fax entry has been unlinked in contact
64 * @return Updated contact instance
66 Contact updateContactData (final Contact contact, final boolean isMobileUnlinked, final boolean isLandlineUnlinked, final boolean isFaxUnlinked);
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.
73 * @param contact Contact to update
75 * @return Updated contact instance
77 Contact updateContactData (final Contact contact);
80 * Returns a list of all found contacts
82 * @return A list of call contacts
84 List<Contact> allContacts ();
87 * Returns a list of all registered email addresses.
89 * @return A list of all email addresses
91 List<String> allEmailAddresses ();
94 * Returns a contact instance which has the given id number.
96 * @param contactId Contact id
98 * @return Contact instance
100 * @throws ContactNotFoundException If the contact was not found
102 Contact findContactById (final Long contactId) throws ContactNotFoundException;
105 * Returns a contact instance which has the given email address.
107 * @param emailAddress Email address
109 * @return Contact instance
111 * @throws ContactNotFoundException If the contact was not found
113 Contact findContactByEmailAddress (final String emailAddress) throws ContactNotFoundException;