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.sql.SQLException;
20 import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
21 import org.mxchange.jcore.contact.Contact;
22 import org.mxchange.jcore.database.frontend.DatabaseFrontend;
23 import org.mxchange.jcore.exceptions.BadTokenException;
26 * An interface for addressbook contact database frontends
28 * @author Roland Häder
30 public interface AddressbookContactFrontend extends DatabaseFrontend {
33 * Adds given contact instance to database
35 * @param contact Contact instance to add
36 * @throws org.mxchange.addressbook.exceptions.ContactAlreadyAddedException If the contact is already added
38 public void addContact (final Contact contact) throws ContactAlreadyAddedException;
41 * Some "getter" for total contacts count
43 * @return Total contacts count
44 * @throws java.sql.SQLException If any SQL error occurs
46 public int getContactsCount () throws SQLException;
49 * Checks if given Contact is found
51 * @param contact Contact instance to check
52 * @return Whether the given Contact instance is found
53 * @throws org.mxchange.jcore.exceptions.BadTokenException Continued throw
55 public boolean isContactFound (final Contact contact) throws BadTokenException;
58 * Some "getter" for own contact instance
60 * @return Own contact instance
62 public Contact getOwnContact ();
65 * Checks whether own contact is found
67 * @return Whether own contact is found
68 * @throws java.sql.SQLException If any SQL error occurs
70 public boolean isOwnContactFound () throws SQLException;
73 * Reads a single row and parses it to a contact instance
75 * @param rowIndex Row index (also how much to skip)
76 * @return Contact instance
78 public Contact readSingleContact (final int rowIndex);