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