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