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.contact.Contact;
21 import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
22 import org.mxchange.jcore.database.frontend.DatabaseFrontend;
23 import org.mxchange.jcore.exceptions.BadTokenException;
27 * @author Roland Häder
29 public interface ContactFrontend extends DatabaseFrontend {
32 * Adds given contact instance to database
34 * @param contact Contact instance to add
35 * @throws org.mxchange.addressbook.exceptions.ContactAlreadyAddedException If the contact is already added
37 public void addContact (final Contact contact) throws ContactAlreadyAddedException;
40 * Shuts down the database layer
42 public void doShutdown ();
45 * Some "getter" for total contacts count
47 * @return Total contacts count
48 * @throws java.sql.SQLException If any SQL error occurs
50 public int getContactsCount () throws SQLException;
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 org.mxchange.jcore.exceptions.BadTokenException Continued throw
59 public boolean isContactFound (final Contact contact) throws BadTokenException;
62 * Some "getter" for own contact instance
64 * @return Own contact instance
66 public Contact getOwnContact ();
69 * Checks whether own contact is found
71 * @return Whether own contact is found
72 * @throws java.sql.SQLException If any SQL error occurs
74 public boolean isOwnContactFound () throws SQLException;
77 * Reads a single row and parses it to a contact instance
79 * @param rowIndex Row index (also how much to skip)
80 * @return Contact instance
82 public Contact readSingleContact (final int rowIndex);