2 * Copyright (C) 2015 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.addressbook.database.frontend.contact;
19 import java.io.IOException;
20 import java.lang.reflect.InvocationTargetException;
21 import java.sql.SQLException;
22 import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
23 import org.mxchange.jcore.contact.Contact;
24 import org.mxchange.jcore.database.frontend.DatabaseFrontend;
25 import org.mxchange.jcore.exceptions.BadTokenException;
26 import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
29 * An interface for addressbook contact database frontends
31 * @author Roland Häder
33 public interface AddressbookContactFrontend extends DatabaseFrontend {
36 * Adds given contact instance to database
38 * @param contact Contact instance to add
39 * @throws org.mxchange.addressbook.exceptions.ContactAlreadyAddedException If the contact is already added
41 public void addContact (final Contact contact) throws ContactAlreadyAddedException;
44 * Some "getter" for total contacts count
46 * @return Total contacts count
47 * @throws java.sql.SQLException If an SQL error occurs
48 * @throws java.io.IOException If an IO error occurs
50 public int getContactsCount () throws SQLException, IOException;
53 * Checks if given Contact is found
55 * @param contact Contact instance to check
56 * @return Whether the given Contact instance is found
57 * @throws java.sql.SQLException If an SQL error occurs
58 * @throws java.io.IOException If an IO error occurs
59 * @throws org.mxchange.jcore.exceptions.BadTokenException Continued throw
60 * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
61 * @throws java.lang.NoSuchMethodException If a method cannot be found
62 * @throws java.lang.IllegalAccessException If a method is not accessible
63 * @throws java.lang.reflect.InvocationTargetException Any other problems?
65 public boolean isContactFound (final Contact contact) throws SQLException, IOException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
68 * Some "getter" for own contact instance
70 * @return Own contact instance
71 * @throws java.sql.SQLException If an SQL error occurs
72 * @throws java.io.IOException If an IO error occurs
73 * @throws org.mxchange.jcore.exceptions.BadTokenException Continued throw
74 * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
75 * @throws java.lang.NoSuchMethodException If a method cannot be found
76 * @throws java.lang.IllegalAccessException If a method is not accessible
77 * @throws java.lang.reflect.InvocationTargetException Any other problems?
79 public Contact getOwnContact () throws IOException, BadTokenException, CorruptedDatabaseFileException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
82 * Checks whether own contact is found
84 * @return Whether own contact is found
85 * @throws java.sql.SQLException If any SQL error occurs
86 * @throws java.io.IOException If an IO error occurs
87 * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
88 * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
89 * @throws java.lang.NoSuchMethodException If a method cannot be found
90 * @throws java.lang.IllegalAccessException If a method is not accessible
91 * @throws java.lang.reflect.InvocationTargetException Any other problems?
93 public boolean isOwnContactFound () throws SQLException, IOException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;