]> git.mxchange.org Git - jfinancials-lib.git/blob - src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactFrontend.java
213575eb3de7d6a5b3bc3972c7da47139e1c3628
[jfinancials-lib.git] / 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.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;
27
28 /**
29  * An interface for addressbook contact database frontends
30  *
31  * @author Roland Häder
32  */
33 public interface AddressbookContactFrontend extends DatabaseFrontend {
34
35         /**
36          * Adds given contact instance to database
37          *
38          * @param contact Contact instance to add
39          * @throws org.mxchange.addressbook.exceptions.ContactAlreadyAddedException If the contact is already added
40          */
41         public void addContact (final Contact contact) throws ContactAlreadyAddedException;
42
43         /**
44          * Some "getter" for total contacts count
45          *
46          * @return Total contacts count
47          * @throws java.sql.SQLException If any SQL error occurs
48          */
49         public int getContactsCount () throws SQLException;
50
51         /**
52          * Checks if given Contact is found
53          * 
54          * @param contact Contact instance to check
55          * @return Whether the given Contact instance is found
56          * @throws java.sql.SQLException If an SQL error occurs
57          * @throws java.io.IOException If an IO error occurs
58          * @throws org.mxchange.jcore.exceptions.BadTokenException Continued throw
59          * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
60          * @throws java.lang.NoSuchMethodException If a method cannot be found
61          * @throws java.lang.IllegalAccessException If a method is not accessible
62          * @throws java.lang.reflect.InvocationTargetException Any other problems?
63          */
64         public boolean isContactFound (final Contact contact) throws SQLException, IOException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
65
66         /**
67          * Some "getter" for own contact instance
68          *
69          * @return Own contact instance
70          */
71         public Contact getOwnContact ();
72
73         /**
74          * Checks whether own contact is found
75          * 
76          * @return Whether own contact is found
77          * @throws java.sql.SQLException If any SQL error occurs
78          * @throws java.io.IOException If an IO error occurs
79          * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
80          * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
81          * @throws java.lang.NoSuchMethodException If a method cannot be found
82          * @throws java.lang.IllegalAccessException If a method is not accessible
83          * @throws java.lang.reflect.InvocationTargetException Any other problems?
84          */
85         public boolean isOwnContactFound () throws SQLException, IOException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
86
87         /**
88          * Reads a single row and parses it to a contact instance
89          *
90          * @param rowIndex Row index (also how much to skip)
91          * @return Contact instance
92          */
93         public Contact readSingleContact (final int rowIndex);
94 }