]> git.mxchange.org Git - addressbook-swing.git/blob - Addressbook/src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactFrontend.java
5c2cc8a24f1e77389e94d1aac49155cc9ce3e8e9
[addressbook-swing.git] / Addressbook / src / org / mxchange / addressbook / database / frontend / contact / AddressbookContactFrontend.java
1 /*
2  * Copyright (C) 2015 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.addressbook.database.frontend.contact;
18
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;
24
25 /**
26  * An interface for addressbook contact database frontends
27  *
28  * @author Roland Häder
29  */
30 public interface AddressbookContactFrontend extends DatabaseFrontend {
31
32         /**
33          * Adds given contact instance to database
34          *
35          * @param contact Contact instance to add
36          * @throws org.mxchange.addressbook.exceptions.ContactAlreadyAddedException If the contact is already added
37          */
38         public void addContact (final Contact contact) throws ContactAlreadyAddedException;
39
40         /**
41          * Some "getter" for total contacts count
42          *
43          * @return Total contacts count
44          * @throws java.sql.SQLException If any SQL error occurs
45          */
46         public int getContactsCount () throws SQLException;
47
48         /**
49          * Checks if given Contact is found
50          * 
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
54          */
55         public boolean isContactFound (final Contact contact) throws BadTokenException;
56
57         /**
58          * Some "getter" for own contact instance
59          *
60          * @return Own contact instance
61          */
62         public Contact getOwnContact ();
63
64         /**
65          * Checks whether own contact is found
66          * 
67          * @return Whether own contact is found
68          * @throws java.sql.SQLException If any SQL error occurs
69          */
70         public boolean isOwnContactFound () throws SQLException;
71
72         /**
73          * Reads a single row and parses it to a contact instance
74          *
75          * @param rowIndex Row index (also how much to skip)
76          * @return Contact instance
77          */
78         public Contact readSingleContact (final int rowIndex);
79 }