]> git.mxchange.org Git - jfinancials-lib.git/blob - src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactFrontend.java
Updated jcore + some more fixes for changed database backend (Table Data Gateway...
[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 an SQL error occurs
48          * @throws java.io.IOException If an IO error occurs
49          */
50         public int getContactsCount () throws SQLException, IOException;
51
52         /**
53          * Checks if given Contact is found
54          * 
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?
64          */
65         public boolean isContactFound (final Contact contact) throws SQLException, IOException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
66
67         /**
68          * Some "getter" for own contact instance
69          *
70          * @return Own contact instance
71          */
72         public Contact getOwnContact ();
73
74         /**
75          * Checks whether own contact is found
76          * 
77          * @return Whether own contact is found
78          * @throws java.sql.SQLException If any SQL error occurs
79          * @throws java.io.IOException If an IO error occurs
80          * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
81          * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
82          * @throws java.lang.NoSuchMethodException If a method cannot be found
83          * @throws java.lang.IllegalAccessException If a method is not accessible
84          * @throws java.lang.reflect.InvocationTargetException Any other problems?
85          */
86         public boolean isOwnContactFound () throws SQLException, IOException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
87
88         /**
89          * Reads a single row and parses it to a contact instance
90          *
91          * @param rowIndex Row index (also how much to skip)
92          * @return Contact instance
93          */
94         public Contact readSingleContact (final int rowIndex);
95 }