From: Roland Haeder Date: Mon, 24 Aug 2015 12:29:18 +0000 (+0200) Subject: Final (hopeful) fixes for new jcore. Still some new method(s) need(s) implementation. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b7663925811eb300b17d07e3f2a0fe6ef44ed337;p=addressbook-swing.git Final (hopeful) fixes for new jcore. Still some new method(s) need(s) implementation. Signed-off-by:Roland Häder --- diff --git a/src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactDatabaseFrontend.java b/src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactDatabaseFrontend.java index 25f8496..3577e17 100644 --- a/src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactDatabaseFrontend.java +++ b/src/org/mxchange/addressbook/database/frontend/contact/AddressbookContactDatabaseFrontend.java @@ -83,12 +83,6 @@ public class AddressbookContactDatabaseFrontend extends BaseDatabaseFrontend imp this.initBackend(); } - /** - * Adds given contact instance to database - * - * @param contact Contact instance - * @throws org.mxchange.addressbook.exceptions.ContactAlreadyAddedException If the contact instance is already found - */ @Override public void addContact (final Contact contact) throws ContactAlreadyAddedException { // Trace message @@ -127,7 +121,7 @@ public class AddressbookContactDatabaseFrontend extends BaseDatabaseFrontend imp // Debug message this.getLogger().debug(MessageFormat.format("result={0}", result)); //NOI18N - } catch (final IOException | BadTokenException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) { + } catch (final IOException | BadTokenException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException | CorruptedDatabaseFileException ex) { // Abort here this.abortProgramWithException(ex); } @@ -136,11 +130,6 @@ public class AddressbookContactDatabaseFrontend extends BaseDatabaseFrontend imp this.getLogger().trace("CALLED!"); //NOI18N } - /** - * Shuts down the database layer - * @throws java.sql.SQLException If an SQL error occurs - * @throws java.io.IOException If an IO error occurs - */ @Override public void doShutdown () throws SQLException, IOException { // Trace message @@ -226,14 +215,8 @@ public class AddressbookContactDatabaseFrontend extends BaseDatabaseFrontend imp throw new UnsupportedOperationException("Not supported yet: rowIndex=" + rowIndex); } - /** - * Checks if given Contact is found - * - * @param contact Contact instance to check - * @return Whether the given Contact instance is found - */ @Override - public boolean isContactFound (final Contact contact) throws BadTokenException { + public boolean isContactFound (final Contact contact) throws BadTokenException, IOException, CorruptedDatabaseFileException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { // Trace message this.getLogger().trace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N @@ -246,8 +229,16 @@ public class AddressbookContactDatabaseFrontend extends BaseDatabaseFrontend imp // Default is not found boolean isFound = false; + // Init search instance (but empty) + SearchableCriteria criteria = new SearchCriteria(); + + // Look for all entries and compare here. Else all entries needs to be compared with many AND statements + Result result = this.getBackend().doSelectByCriteria(criteria); + + // Debug message + this.getLogger().debug(MessageFormat.format("result({0})={1}", result.size(), result)); // Start iteration - Iterator iterator = this.getBackend().iterator(); + Iterator iterator = result.iterator(); // Check all entries while (iterator.hasNext()) { @@ -272,16 +263,6 @@ public class AddressbookContactDatabaseFrontend extends BaseDatabaseFrontend imp return isFound; } - /** - * Checks whether own contact is found in database - * - * @return Whether own contact is found - * @throws org.mxchange.jcore.exceptions.BadTokenException Continued throw - * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged - * @throws java.lang.NoSuchMethodException If a method cannot be found - * @throws java.lang.IllegalAccessException If a method is not accessible - * @throws java.lang.reflect.InvocationTargetException Any other problems? - */ @Override public boolean isOwnContactFound () throws SQLException, IOException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { // Get search criteria instance