]> git.mxchange.org Git - addressbook-lib.git/blob - src/org/mxchange/addressbook/manager/contact/AddressbookContactManager.java
Better compare this way:
[addressbook-lib.git] / src / org / mxchange / addressbook / manager / contact / AddressbookContactManager.java
1 /*
2  * Copyright (C) 2015 Roland Haeder
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.manager.contact;
18
19 import java.io.IOException;
20 import java.lang.reflect.InvocationTargetException;
21 import java.sql.SQLException;
22 import java.text.MessageFormat;
23 import java.util.ArrayList;
24 import java.util.Arrays;
25 import java.util.Iterator;
26 import java.util.List;
27 import org.mxchange.addressbook.client.AddressbookClient;
28 import org.mxchange.addressbook.database.frontend.contact.AddressbookContactDatabaseFrontend;
29 import org.mxchange.addressbook.database.frontend.contact.AddressbookContactFrontend;
30 import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
31 import org.mxchange.jcore.client.Client;
32 import org.mxchange.jcore.contact.Contact;
33 import org.mxchange.jcore.contact.Gender;
34 import org.mxchange.jcore.database.frontend.DatabaseFrontend;
35 import org.mxchange.jcore.database.storage.Storeable;
36 import org.mxchange.jcore.exceptions.BadTokenException;
37 import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
38 import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
39 import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
40 import org.mxchange.jcore.manager.BaseManager;
41
42 /**
43  * A manager for contacts.
44  *
45  * @author Roland Haeder
46  * @version 0.0
47  */
48 public class AddressbookContactManager extends BaseManager implements ManageableAddressbookContact {
49
50         /**
51          * Column name list
52          */
53         private final List<String> columnNames;
54
55         /**
56          * Translated column name list
57          */
58         private final List<String> translatedColumnNames;
59
60         /**
61          * Constructor which accepts maxContacts for maximum (initial) contacts and
62          * a client instance.
63          *
64          * @param client Client instance to use
65          * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the configured database backend is not supported
66          * @throws java.sql.SQLException If an SQL error occurs
67          */
68         public AddressbookContactManager (final Client client) throws UnsupportedDatabaseBackendException, SQLException {
69                 // Trace message
70                 this.getLogger().trace(MessageFormat.format("client={1} - CALLED!", client)); //NOI18N
71
72                 // Make sure all parameters are set correctly
73                 if (null == client) {
74                         // Abort here
75                         throw new NullPointerException("client is null"); //NOI18N
76                 }
77
78                 // Set client instance
79                 this.setClient(client);
80
81                 // Init database connection
82                 DatabaseFrontend frontend = new AddressbookContactDatabaseFrontend(this);
83                 this.setFrontend(frontend);
84
85                 // Initialize list
86                 this.columnNames = new ArrayList<>(15);
87                 this.translatedColumnNames = new ArrayList<>(15);
88
89                 // And fill it
90                 this.fillColumnNamesFromBundle();
91
92                 // Debug message
93                 //* NOISY-DEBUG: */ this.getLogger().debug("client=" + client);
94         }
95
96         /**
97          * Adds given Contact instance to list
98          *
99          * @param contact Contact instance to add
100          */
101         @Override
102         public void addContact (final Contact contact)  throws ContactAlreadyAddedException {
103                 // Trace message
104                 this.getLogger().trace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N
105
106                 // Contact instance must not be null
107                 if (null == contact) {
108                         // Abort here
109                         throw new NullPointerException("contact is null"); //NOI18N
110                 }
111
112                 // Add it
113                 ((AddressbookContactFrontend) this.getFrontend()).addContact(contact);
114
115                 // Trace message
116                 this.getLogger().trace("EXIT!"); //NOI18N
117         }
118
119         /**
120          * Let the user add a new other address
121          */
122         @Override
123         public void doAddOtherAddress () {
124                 throw new UnsupportedOperationException("Not supported yet."); //NOI18N
125         }
126
127         /**
128          * Let the user change address data
129          *
130          * @param contact Instance to change data
131          */
132         @Override
133         public void doChangeAddressData (final Contact contact) {
134                 // Trace message
135                 this.getLogger().trace(MessageFormat.format("contact={0} CALLED!", contact)); //NOI18N
136
137                 // Contact must not be null
138                 if (null == contact) {
139                         // Abort here
140                         throw new NullPointerException("contact is null"); //NOI18N
141                 }
142
143                 // Get and cast client instance
144                 AddressbookClient client = (AddressbookClient) this.getClient();
145
146                 // First display it again
147                 client.displayAddressBox(contact);
148
149                 // Is it own data?
150                 if (contact.isOwnContact()) {
151                         // Deligate to client
152                         client.doChangeOwnAddressData(contact);
153                 } else {
154                         // Other contact's address data to change
155                         throw new UnsupportedOperationException("Changing contact entries not finished."); //NOI18N
156                 }
157
158                 // Trace message
159                 this.getLogger().trace("EXIT!"); //NOI18N
160         }
161
162         /**
163          * Let the user change "name data"
164          *
165          * @param contact Instance to change data
166          */
167         @Override
168         public void doChangeNameData (final Contact contact) {
169                 // Trace message
170                 this.getLogger().trace(MessageFormat.format("contact={0} CALLED!", contact)); //NOI18N
171
172                 // Contact must not be null
173                 if (null == contact) {
174                         // Abort here
175                         throw new NullPointerException("contact is null"); //NOI18N
176                 }
177
178                 // Get and cast client instance
179                 AddressbookClient client = (AddressbookClient) this.getClient();
180
181                 // First display them again
182                 client.displayNameBox(contact);
183
184                 // Is this own data?
185                 if (contact.isOwnContact()) {
186                         // Re-ask own data
187                         client.doChangeOwnNameData(contact);
188                 } else {
189                         // Then re-ask them ...
190                         throw new UnsupportedOperationException("Changing contact entries not finished."); //NOI18N
191                 }
192
193                 // Trace message
194                 this.getLogger().trace("EXIT!"); //NOI18N
195         }
196
197         /**
198          * Let the user change other address
199          */
200         @Override
201         public void doChangeOtherAddress () {
202                 throw new UnsupportedOperationException("Not supported yet."); //NOI18N
203         }
204
205         /**
206          * Let the user change other data
207          *
208          * @param contact Instance to change data
209          * @todo Didn't handle birthday
210          */
211         @Override
212         public void doChangeOtherData (final Contact contact) {
213                 // Trace message
214                 this.getLogger().trace(MessageFormat.format("contact={0} CALLED!", contact)); //NOI18N
215
216                 // Contact must not be null
217                 if (null == contact) {
218                         // Abort here
219                         throw new NullPointerException("contact is null"); //NOI18N
220                 }
221
222                 // Get and cast client instance
223                 AddressbookClient client = (AddressbookClient) this.getClient();
224
225                 // First display them again
226                 client.displayOtherDataBox(contact);
227
228                 // Is this own data?
229                 if (contact.isOwnContact()) {
230                         // Re-ask own data
231                         client.doChangeOwnOtherData(contact);
232                 } else {
233                         // Then re-ask them ...
234                         throw new UnsupportedOperationException("Changing contact entries not finished."); //NOI18N
235                 }
236
237                 // Trace message
238                 this.getLogger().trace("EXIT!"); //NOI18N
239         }
240
241         /**
242          * Allows the user to change his/her own data
243          */
244         @Override
245         public void doChangeOwnData () throws IOException , BadTokenException, CorruptedDatabaseFileException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException{
246                 // Trace message
247                 this.getLogger().trace("CALLED!"); //NOI18N
248
249                 /*
250                  * First check if the user has registered own contact, before that
251                  * nothing can be changed.
252                  */
253                 if (!this.isOwnContactAdded()) {
254                         // Not added
255                         this.getClient().outputMessage("Sie haben noch nicht Ihre Daten eingegeben."); //NOI18N
256
257                         // Skip any below code
258                         return;
259                 }
260
261                 // Instance
262                 Contact contact = this.getOwnContact();
263
264                 // It must be found
265                 assert (contact instanceof Contact);
266
267                 // Display contact
268                 contact.show(this.getClient());
269
270                 // Get and cast client instance
271                 AddressbookClient client = (AddressbookClient) this.getClient();
272
273                 try {
274                         // Ask user what to change
275                         client.userChooseChangeContactData(contact);
276                 } catch (final UnhandledUserChoiceException ex) {
277                         this.getLogger().catching(ex);
278                 }
279
280                 // Trace message
281                 this.getLogger().trace("EXIT!"); //NOI18N
282         }
283
284         /**
285          * Let the user delete other address
286          */
287         @Override
288         public void doDeleteOtherAddress () {
289                 throw new UnsupportedOperationException("Not supported yet."); //NOI18N
290         }
291
292         /**
293          * Asks user for own data
294          */
295         @Override
296         public void doEnterOwnData () throws ContactAlreadyAddedException, IOException , BadTokenException {
297                 // Trace message
298                 this.getLogger().trace("CALLED!"); //NOI18N
299
300                 // Is own contact already added?
301                 if (this.isOwnContactAdded()) {
302                         // Don't continue here
303                         throw new ContactAlreadyAddedException();
304                 }
305
306                 // Get and cast client instance
307                 AddressbookClient client = (AddressbookClient) this.getClient();
308
309                 // Deligate this call to the client
310                 Contact contact = client.doEnterOwnData();
311
312                 // Is it set?
313                 if (contact instanceof Contact) {
314                         // Add it to contact "book"
315                         this.registerContact(contact);
316                 }
317
318                 // Trace message
319                 this.getLogger().trace("EXIT!"); //NOI18N
320         }
321
322         @Override
323         public void doListContacts () {
324                 throw new UnsupportedOperationException("Not supported yet."); //NOI18N
325         }
326
327         @Override
328         public void doSearchContacts () {
329                 throw new UnsupportedOperationException("Not supported yet."); //NOI18N
330         }
331
332         /**
333          * Shuts down this contact manager
334          * 
335          * @throws java.sql.SQLException If an SQL error occurs
336          * @throws java.io.IOException If an IO error occurs
337          */
338         @Override
339         public void doShutdown () throws SQLException, IOException {
340                 // Trace message
341                 this.getLogger().trace("CALLED!"); //NOI18N
342
343                 // Shut down the database layer
344                 ((AddressbookContactFrontend) this.getFrontend()).doShutdown();
345
346                 // Trace message
347                 this.getLogger().trace("EXIT!"); //NOI18N
348         }
349
350         /**
351          * Asks the user for his/her cellphone number
352          *
353          * @return User's cellphone number
354          */
355         @Override
356         public String enterOwnCellNumber () {
357                 // Trace message
358                 this.getLogger().trace("CALLED!"); //NOI18N
359
360                 // Get and cast client instance
361                 AddressbookClient client = (AddressbookClient) this.getClient();
362
363                 return client.enterString(5, 30, "Bitte geben Sie Ihre Handynummer an: ", true);
364         }
365
366         /**
367          * Asks the user for his/her city's name
368          *
369          * @return City's name of the user
370          */
371         @Override
372         public String enterOwnCity () {
373                 // Trace message
374                 this.getLogger().trace("CALLED!"); //NOI18N
375
376                 // Get and cast client instance
377                 AddressbookClient client = (AddressbookClient) this.getClient();
378
379                 return client.enterString(3, 50, "Bitte geben Sie Ihre Wohnort ein: ", false);
380         }
381
382         /**
383          * Asks the user for his/her city's name
384          *
385          * @return City's name of the user
386          */
387         @Override
388         public String enterOwnComment () {
389                 // Trace message
390                 this.getLogger().trace("CALLED!"); //NOI18N
391
392                 // Get and cast client instance
393                 AddressbookClient client = (AddressbookClient) this.getClient();
394
395                 return client.enterString(0, 100, "Kommentar zu Ihrem Eintrag: ", true);
396         }
397
398         /**
399          * Asks the user for his/her company name
400          *
401          * @return User's company name
402          */
403         @Override
404         public String enterOwnCompanyName () {
405                 // Trace message
406                 this.getLogger().trace("CALLED!"); //NOI18N
407
408                 // Get and cast client instance
409                 AddressbookClient client = (AddressbookClient) this.getClient();
410
411                 return client.enterString(5, 50, "Bitte geben Sie Ihre Firmenbezeichnung ein: ", true);
412         }
413
414         /**
415          * Asks user for his/her own country code
416          *
417          * @return User's own country code
418          */
419         @Override
420         public String enterOwnCountryCode () {
421                 // Trace message
422                 this.getLogger().trace("CALLED!"); //NOI18N
423
424                 // Get and cast client instance
425                 AddressbookClient client = (AddressbookClient) this.getClient();
426
427                 return client.enterString(2, 2, "Bitte geben Sie den zweistelligen Ländercode von Ihrem Land ein: ", false).toUpperCase();
428         }
429
430         /**
431          * Asks user for his/her own country code
432          *
433          * @return User's own country code
434          */
435         @Override
436         public String enterOwnEmailAddress () {
437                 // Trace message
438                 this.getLogger().trace("CALLED!"); //NOI18N
439
440                 // Get and cast client instance
441                 AddressbookClient client = (AddressbookClient) this.getClient();
442
443                 return client.enterString(10, 50, "Bitte geben Sie Ihre Email-Adresse ein: ", true);
444         }
445
446         /**
447          * Asks the user for family name
448          *
449          * @return Family name of the user
450          */
451         @Override
452         public String enterOwnFamilyName () {
453                 // Trace message
454                 this.getLogger().trace("CALLED!"); //NOI18N
455
456                 // Get and cast client instance
457                 AddressbookClient client = (AddressbookClient) this.getClient();
458
459                 return client.enterString(2, 50, "Bitte geben Sie Ihren Nachnamen ein: ", false);
460         }
461
462         /**
463          * Asks the user for family name
464          *
465          * @return Family name of the user
466          */
467         @Override
468         public String enterOwnFaxNumber () {
469                 // Trace message
470                 this.getLogger().trace("CALLED!"); //NOI18N
471
472                 // Get and cast client instance
473                 AddressbookClient client = (AddressbookClient) this.getClient();
474
475                 return client.enterString(5, 30, "Bitte geben Sie Ihre Faxnummer an: ", true);
476         }
477
478         /**
479          * Asks the user for surname
480          *
481          * @return Surname of the user
482          */
483         @Override
484         public String enterOwnFirstName () {
485                 // Trace message
486                 this.getLogger().trace("CALLED!"); //NOI18N
487                 
488                 // Get and cast client instance
489                 AddressbookClient client = (AddressbookClient) this.getClient();
490                 
491                 return client.enterString(2, 50, "Bitte geben Sie Ihren Vornamen ein: ", false);
492         }
493
494         /**
495          * Asks the user for gender, until a valid has been entered
496          *
497          * @return Gender of the user
498          */
499         @Override
500         public Gender enterOwnGender () {
501                 // Trace message
502                 this.getLogger().trace("CALLED!"); //NOI18N
503
504                 // Get and cast client instance
505                 AddressbookClient client = (AddressbookClient) this.getClient();
506
507                 return client.enterGender("Bitte geben Sie die Anrede ein: (M=Herr, F=Frau, C=Firma): ");
508         }
509
510         /**
511          * Asks the user for phone number
512          *
513          * @return Phone number of the user
514          */
515         @Override
516         public String enterOwnPhoneNumber () {
517                 // Trace message
518                 this.getLogger().trace("CALLED!"); //NOI18N
519
520                 // Get and cast client instance
521                 AddressbookClient client = (AddressbookClient) this.getClient();
522
523                 return client.enterString(5, 30, "Bitte geben Sie Ihre Telefonnummer an: ", true);
524         }
525
526         /**
527          * Asks the user for own street (including number)
528          *
529          * @return Own street an number
530          */
531         @Override
532         public String enterOwnStreet () {
533                 // Trace message
534                 this.getLogger().trace("CALLED!"); //NOI18N
535
536                 // Get and cast client instance
537                 AddressbookClient client = (AddressbookClient) this.getClient();
538
539                 return client.enterString(5, 50, "Bitte geben Sie Ihre Strasse und Hausnummer ein: ", false);
540         }
541
542         /**
543          * Asks the user for own ZIP code
544          *
545          * @return ZIP code
546          */
547         @Override
548         public int enterOwnZipCode () {
549                 // Trace message
550                 this.getLogger().trace("CALLED!"); //NOI18N
551
552                 // Get and cast client instance
553                 AddressbookClient client = (AddressbookClient) this.getClient();
554
555                 return client.enterInt(0, 99_999, "Bitte geben Sie Ihre Postleitzahl ein: ");
556         }
557
558         @Override
559         public final int getColumnCount () {
560                 assert (this.columnNames instanceof List) : "this.columnNames is not initialized"; //NOI18N
561
562                 return this.columnNames.size();
563         }
564
565         /**
566          * Getter for column name at given index.
567          *
568          * @param columnIndex Column index
569          * @return Database column name
570          */
571         @Override
572         public String getColumnName (final int columnIndex) {
573                 assert (this.columnNames instanceof List) : "this.columnNames is not initialized"; //NOI18N
574
575                 // Get column name at index
576                 return this.columnNames.get(columnIndex);
577         }
578
579         /**
580          * Getter for translated column name at given index.
581          *
582          * @param columnIndex Column index
583          * @return Human-readable column name
584          */
585         @Override
586         public String getTranslatedColumnName (final int columnIndex) {
587                 assert (this.translatedColumnNames instanceof List) : "this.translatedColumnNames is not initialized"; //NOI18N
588
589                 // Get column name at index
590                 return this.translatedColumnNames.get(columnIndex);
591         }
592
593         /**
594          * Somewhat "getter" for value from given row and column index
595          *
596          * @param rowIndex Row index
597          * @param columnIndex Column index
598          * @return Value from given row/column
599          */
600         @Override
601         public Object getValueFromRowColumn (final int rowIndex, final int columnIndex) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
602                 // Trace message
603                 this.getLogger().trace(MessageFormat.format("rowIndex={0},columnIndex={1} CALLED!", rowIndex, columnIndex));
604
605                 // Then get specific row from database which is a Contact instance
606                 Storeable storeable = this.getFrontend().getStoreableAtRow(rowIndex);
607
608                 // Debug message
609                 this.getLogger().debug(MessageFormat.format("storeable={0}", storeable));
610
611                 // It may return null
612                 if (null == storeable) {
613                         // Nothing found
614                         this.getLogger().warn("contact is null - returning null ...");
615                         return null;
616                 }
617
618                 // Convert column index -> name
619                 String columnName = this.getColumnName(columnIndex);
620
621                 // Debug message
622                 this.getLogger().debug(MessageFormat.format("columnName={0}", columnName));
623
624                 // Now get that column
625                 Object value = null;
626                 try {
627                         value = storeable.getValueFromColumn(columnName);
628                 } catch (final IllegalArgumentException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
629                         this.abortProgramWithException(ex);
630                 }
631
632                 // Trace message
633                 this.getLogger().trace(MessageFormat.format("value={0} - EXIT!", value));
634
635                 // Return it
636                 return value;
637         }
638
639         /**
640          * Checks whether own contact is already added by checking all entries for
641          * isOwnContact flag
642          *
643          * @return Whether own contact is already added
644          */
645         @Override
646         public boolean isOwnContactAdded () throws IOException, BadTokenException {
647                 // Trace message
648                 this.getLogger().trace("CALLED!"); //NOI18N
649
650                 // Init variable
651                 boolean isAdded = false;
652
653                 try {
654                         // Deligate this call to frontend
655                         isAdded = ((AddressbookContactFrontend) this.getFrontend()).isOwnContactFound();
656                 } catch (final SQLException | IOException | BadTokenException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
657                         // Something bad happened
658                         this.abortProgramWithException(ex);
659                 }
660
661                 // Trace message
662                 this.getLogger().trace(MessageFormat.format("isAdded={0} : EXIT!", isAdded)); //NOI18N
663
664                 // Return result
665                 return isAdded;
666         }
667
668         /**
669          * Adds given contact to address book and flushes all entries to database
670          *
671          * @param contact Contact being added
672          * @todo Add check for book size
673          */
674         @Override
675         public void registerContact (final Contact contact) {
676                 // Trace message
677                 this.getLogger().trace(MessageFormat.format("contact={0} CALLED!", contact)); //NOI18N
678
679                 // Sanity check
680                 if (null == contact) {
681                         // Abort here
682                         throw new NullPointerException("contact is null"); //NOI18N
683                 }
684                 try {
685                         // Debug message
686                         /* NOISY-DEBUG: */ this.getLogger().debug(MessageFormat.format("Adding '{0}' '{1}' at pos '{2}' ...", contact.getFirstName(), contact.getFamilyName(), this.size())); //NOI18N
687
688                 // Check if contact is found
689                         if (((AddressbookContactFrontend) this.getFrontend()).isContactFound(contact)) {
690                                 // Contact already added
691                                 // @todo Do something here
692                         } else if ((contact.isOwnContact()) && (this.isOwnContactAdded())) {
693                                 // Own contact already added
694                                 // @todo Do something
695                         }
696
697                         // Add contact to internal list
698                         this.addContact(contact);
699                 } catch (final ContactAlreadyAddedException | BadTokenException | SQLException | IOException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
700                         // Abort here
701                         this.abortProgramWithException(ex);
702                 }
703
704                 // Trace message
705                 this.getLogger().trace("EXIT!"); //NOI18N
706         }
707
708         @Override
709         public final int size () throws IOException {
710                 // Init size
711                 int size = -1;
712
713                 try {
714                         size = ((AddressbookContactFrontend) this.getFrontend()).getContactsCount();
715                 } catch (final SQLException ex) {
716                         // Something happened
717                         this.abortProgramWithException(ex);
718                 }
719
720                 // Return amount
721                 return size;
722         }
723
724         /**
725          * Fills the column names array with strings from bundle
726          */
727         private void fillColumnNamesFromBundle () {
728                 assert (this.columnNames instanceof List) : "this.columnNames is not initialized"; //NOI18N
729                 assert (this.translatedColumnNames instanceof List) : "this.translatedColumnNames is not initialized"; //NOI18N
730
731                 // Debug message
732                 this.getLogger().trace("CALLED!"); //NOI18N
733
734                 // First get an iterator from key set to iterate over
735                 Iterator<String> iterator = this.getBundle().keySet().iterator();
736
737                 // Then iterate over all
738                 while (iterator.hasNext()) {
739                         // Get next element
740                         String key = iterator.next();
741
742                         // Does the key start with AddressbookContactManager.columnName ?
743                         if (key.startsWith("ContactManager.columnName")) { //NOI18N
744                                 // This is the wanted entry.
745                                 this.getLogger().debug(MessageFormat.format("key={0}", key)); //NOI18N
746
747                                 // Convert string to array based on delimiter '.'
748                                 String[] tokens = this.getArrayFromString(key, ".", 4);
749
750                                 // Token array must contain 4 elements (AddressbookContactManager.columnName.foo.text)
751                                 assert(tokens.length == 4) : MessageFormat.format("Array tokens contains not 4 elements: {0}", Arrays.toString(tokens));
752
753                                 // Get pre-last element
754                                 String columnName = tokens[tokens.length - 2];
755
756                                 // Debug message
757                                 this.getLogger().debug(MessageFormat.format("columnName={0} - adding ...", columnName));
758
759                                 // So add it
760                                 this.columnNames.add(columnName);
761                                 this.translatedColumnNames.add(this.getBundle().getString(key));
762                         }
763                 }
764
765                 // Debug message
766                 this.getLogger().trace(MessageFormat.format("getColumnCount()={0}: EXIT!", this.getColumnCount())); //NOI18N
767         }
768
769         /**
770          * "Getter" for own contact instance or null if not found
771          *
772          * @return Contact instance or null
773          * @throws java.sql.SQLException If an SQL error occurs
774          * @throws java.io.IOException If an IO error occurs
775          * @throws org.mxchange.jcore.exceptions.BadTokenException Continued throw
776          * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
777          * @throws java.lang.NoSuchMethodException If a method cannot be found
778          * @throws java.lang.IllegalAccessException If a method is not accessible
779          * @throws java.lang.reflect.InvocationTargetException Any other problems?
780          */
781         private Contact getOwnContact () throws IOException, BadTokenException, CorruptedDatabaseFileException, SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
782                 // Trace message
783                 this.getLogger().trace("CALLED!"); //NOI18N
784
785                 // Deligate this call to database frontend
786                 Contact contact = ((AddressbookContactFrontend) this.getFrontend()).getOwnContact();
787
788                 // Trace message
789                 this.getLogger().trace(MessageFormat.format("contact={0} - EXIT!", contact)); //NOI18N
790
791                 // Return instance or null
792                 return contact;
793         }
794 }