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