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