]> git.mxchange.org Git - jaddressbook-lib.git/blob - Addressbook/src/org/mxchange/addressbook/manager/contact/AddressbookContactManager.java
980c64b69490f047bb9727a651d8f1e6965ef889
[jaddressbook-lib.git] / Addressbook / src / org / mxchange / addressbook / manager / contact / AddressbookContactManager.java
1 /*
2  * Copyright (C) 2015 Roland Haeder
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 package org.mxchange.addressbook.manager.contact;
18
19 import java.io.IOException;
20 import java.lang.reflect.InvocationTargetException;
21 import java.sql.SQLException;
22 import java.text.MessageFormat;
23 import java.util.ArrayList;
24 import java.util.Arrays;
25 import java.util.Iterator;
26 import java.util.List;
27 import org.mxchange.addressbook.client.AddressbookClient;
28 import org.mxchange.addressbook.database.frontend.contact.AddressbookContactDatabaseFrontend;
29 import org.mxchange.addressbook.database.frontend.contact.AddressbookContactFrontend;
30 import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
31 import org.mxchange.jcore.client.Client;
32 import org.mxchange.jcore.contact.Contact;
33 import org.mxchange.jcore.contact.Gender;
34 import org.mxchange.jcore.exceptions.BadTokenException;
35 import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
36 import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
37 import org.mxchange.jcore.manager.BaseManager;
38
39 /**
40  * A manager for contacts.
41  *
42  * @author Roland Haeder
43  * @version 0.0
44  */
45 public class AddressbookContactManager extends BaseManager implements ManageableAddressbookContact {
46
47         /**
48          * Column name list
49          */
50         private final List<String> columnNames;
51
52         /**
53          * A AddressbookContactFrontend instance
54          */
55         private final AddressbookContactFrontend contactDatabase;
56
57         /**
58          * Translated column name list
59          */
60         private final List<String> translatedColumnNames;
61
62         /**
63          * Constructor which accepts maxContacts for maximum (initial) contacts and
64          * a client instance.
65          *
66          * @param client Client instance to use
67          * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the database backend is not supported
68          * @throws java.sql.SQLException If an SQL error occurs
69          */
70         public AddressbookContactManager (final Client client) throws UnsupportedDatabaseBackendException, SQLException {
71                 // Trace message
72                 this.getLogger().trace(MessageFormat.format("client={1} - CALLED!", client)); //NOI18N
73
74                 // Make sure all parameters are set correctly
75                 if (client == null) {
76                         // Abort here
77                         throw new NullPointerException("client is null"); //NOI18N
78                 }
79
80                 // Set client instance
81                 this.setClient(client);
82
83                 // Init database connection
84                 this.contactDatabase = new AddressbookContactDatabaseFrontend(this);
85
86                 // Initialize list
87                 this.columnNames = new ArrayList<>(15);
88                 this.translatedColumnNames = new ArrayList<>(15);
89
90                 // And fill it
91                 this.fillColumnNamesFromBundle();
92
93                 // Debug message
94                 //* NOISY-DEBUG: */ this.getLogger().debug("client=" + client);
95         }
96
97         /**
98          * Adds given Contact instance to list
99          *
100          * @param contact Contact instance to add
101          */
102         @Override
103         public void addContact (final Contact contact)  throws ContactAlreadyAddedException {
104                 // Trace message
105                 this.getLogger().trace(MessageFormat.format("contact={0} - CALLED!", contact)); //NOI18N
106
107                 // Contact instance must not be null
108                 if (contact == null) {
109                         // Abort here
110                         throw new NullPointerException("contact is null"); //NOI18N
111                 }
112
113                 // Add it
114                 this.getContactDatabase().addContact(contact);
115
116                 // Trace message
117                 this.getLogger().trace("EXIT!"); //NOI18N
118         }
119
120         /**
121          * Let the user add a new other address
122          */
123         @Override
124         public void doAddOtherAddress () {
125                 throw new UnsupportedOperationException("Not supported yet."); //NOI18N
126         }
127
128         /**
129          * Let the user change address data
130          *
131          * @param contact Instance to change data
132          */
133         @Override
134         public void doChangeAddressData (final Contact contact) {
135                 // Trace message
136                 this.getLogger().trace(MessageFormat.format("contact={0} CALLED!", contact)); //NOI18N
137
138                 // Contact must not be null
139                 if (contact == null) {
140                         // Abort here
141                         throw new NullPointerException("contact is null"); //NOI18N
142                 }
143
144                 // Get and cast client instance
145                 AddressbookClient client = (AddressbookClient) this.getClient();
146
147                 // First display it again
148                 client.displayAddressBox(contact);
149
150                 // Is it own data?
151                 if (contact.isOwnContact()) {
152                         // Deligate to client
153                         client.doChangeOwnAddressData(contact);
154                 } else {
155                         // Other contact's address data to change
156                         throw new UnsupportedOperationException("Changing contact entries not finished."); //NOI18N
157                 }
158
159                 // Trace message
160                 this.getLogger().trace("EXIT!"); //NOI18N
161         }
162
163         /**
164          * Let the user change "name data"
165          *
166          * @param contact Instance to change data
167          */
168         @Override
169         public void doChangeNameData (final Contact contact) {
170                 // Trace message
171                 this.getLogger().trace(MessageFormat.format("contact={0} CALLED!", contact)); //NOI18N
172
173                 // Contact must not be null
174                 if (contact == null) {
175                         // Abort here
176                         throw new NullPointerException("contact is null"); //NOI18N
177                 }
178
179                 // Get and cast client instance
180                 AddressbookClient client = (AddressbookClient) this.getClient();
181
182                 // First display them again
183                 client.displayNameBox(contact);
184
185                 // Is this own data?
186                 if (contact.isOwnContact()) {
187                         // Re-ask own data
188                         client.doChangeOwnNameData(contact);
189                 } else {
190                         // Then re-ask them ...
191                         throw new UnsupportedOperationException("Changing contact entries not finished."); //NOI18N
192                 }
193
194                 // Trace message
195                 this.getLogger().trace("EXIT!"); //NOI18N
196         }
197
198         /**
199          * Let the user change other address
200          */
201         @Override
202         public void doChangeOtherAddress () {
203                 throw new UnsupportedOperationException("Not supported yet."); //NOI18N
204         }
205
206         /**
207          * Let the user change other data
208          *
209          * @param contact Instance to change data
210          * @todo Didn't handle birthday
211          */
212         @Override
213         public void doChangeOtherData (final Contact contact) {
214                 // Trace message
215                 this.getLogger().trace(MessageFormat.format("contact={0} CALLED!", contact)); //NOI18N
216
217                 // Contact must not be null
218                 if (contact == null) {
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().trace("EXIT!"); //NOI18N
240         }
241
242         /**
243          * Allows the user to change his/her own data
244          */
245         @Override
246         public void doChangeOwnData () {
247                 // Trace message
248                 this.getLogger().trace("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);
267
268                 // Display contact
269                 contact.show(this.getClient());
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().catching(ex);
279                 }
280
281                 // Trace message
282                 this.getLogger().trace("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 {
298                 // Trace message
299                 this.getLogger().trace("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().trace("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          * 
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().trace("CALLED!"); //NOI18N
343
344                 // Shut down the database layer
345                 this.getContactDatabase().doShutdown();
346
347                 // Trace message
348                 this.getLogger().trace("EXIT!"); //NOI18N
349         }
350
351         /**
352          * Asks the user for his/her cellphone number
353          *
354          * @return User's cellphone number
355          */
356         @Override
357         public String enterOwnCellNumber () {
358                 // Trace message
359                 this.getLogger().trace("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          *
370          * @return City's name of the user
371          */
372         @Override
373         public String enterOwnCity () {
374                 // Trace message
375                 this.getLogger().trace("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          *
386          * @return City's name of the user
387          */
388         @Override
389         public String enterOwnComment () {
390                 // Trace message
391                 this.getLogger().trace("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          *
402          * @return User's company name
403          */
404         @Override
405         public String enterOwnCompanyName () {
406                 // Trace message
407                 this.getLogger().trace("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          *
418          * @return User's own country code
419          */
420         @Override
421         public String enterOwnCountryCode () {
422                 // Trace message
423                 this.getLogger().trace("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          *
434          * @return User's own country code
435          */
436         @Override
437         public String enterOwnEmailAddress () {
438                 // Trace message
439                 this.getLogger().trace("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          *
450          * @return Family name of the user
451          */
452         @Override
453         public String enterOwnFamilyName () {
454                 // Trace message
455                 this.getLogger().trace("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          *
466          * @return Family name of the user
467          */
468         @Override
469         public String enterOwnFaxNumber () {
470                 // Trace message
471                 this.getLogger().trace("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 gender, until a valid has been entered
481          *
482          * @return Gender of the user
483          */
484         @Override
485         public Gender enterOwnGender () {
486                 // Trace message
487                 this.getLogger().trace("CALLED!"); //NOI18N
488
489                 // Get and cast client instance
490                 AddressbookClient client = (AddressbookClient) this.getClient();
491
492                 return client.enterGender("Bitte geben Sie die Anrede ein: (M=Herr, F=Frau, C=Firma): ");
493         }
494
495         /**
496          * Asks the user for phone number
497          *
498          * @return Phone number of the user
499          */
500         @Override
501         public String enterOwnPhoneNumber () {
502                 // Trace message
503                 this.getLogger().trace("CALLED!"); //NOI18N
504
505                 // Get and cast client instance
506                 AddressbookClient client = (AddressbookClient) this.getClient();
507
508                 return client.enterString(5, 30, "Bitte geben Sie Ihre Telefonnummer an: ", true);
509         }
510
511         /**
512          * Asks the user for own street (including number)
513          *
514          * @return Own street an number
515          */
516         @Override
517         public String enterOwnStreet () {
518                 // Trace message
519                 this.getLogger().trace("CALLED!"); //NOI18N
520
521                 // Get and cast client instance
522                 AddressbookClient client = (AddressbookClient) this.getClient();
523
524                 return client.enterString(5, 50, "Bitte geben Sie Ihre Strasse und Hausnummer ein: ", false);
525         }
526
527         /**
528          * Asks the user for surname
529          *
530          * @return Surname of the user
531          */
532         @Override
533         public String enterOwnSurname () {
534                 // Trace message
535                 this.getLogger().trace("CALLED!"); //NOI18N
536
537                 // Get and cast client instance
538                 AddressbookClient client = (AddressbookClient) this.getClient();
539
540                 return client.enterString(2, 50, "Bitte geben Sie Ihren Vornamen ein: ", false);
541         }
542
543         /**
544          * Asks the user for own ZIP code
545          *
546          * @return ZIP code
547          */
548         @Override
549         public int enterOwnZipCode () {
550                 // Trace message
551                 this.getLogger().trace("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         /**
567          * Getter for column name at given index.
568          *
569          * @param columnIndex Column index
570          * @return Database column name
571          */
572         @Override
573         public String getColumnName (final int columnIndex) {
574                 assert (this.columnNames instanceof List) : "this.columnNames is not initialized"; //NOI18N
575
576                 // Get column name at index
577                 return this.columnNames.get(columnIndex);
578         }
579
580         /**
581          * Getter for translated column name at given index.
582          *
583          * @param columnIndex Column index
584          * @return Human-readable column name
585          */
586         @Override
587         public String getTranslatedColumnName (final int columnIndex) {
588                 assert (this.translatedColumnNames instanceof List) : "this.translatedColumnNames is not initialized"; //NOI18N
589
590                 // Get column name at index
591                 return this.translatedColumnNames.get(columnIndex);
592         }
593
594         /**
595          * Somewhat "getter" for value from given row and column index
596          *
597          * @param rowIndex Row index
598          * @param columnIndex Column index
599          * @return Value from given row/column
600          */
601         @Override
602         public Object getValueFromRowColumn (final int rowIndex, final int columnIndex) {
603                 // Trace message
604                 this.getLogger().trace(MessageFormat.format("rowIndex={0},columnIndex={1} CALLED!", rowIndex, columnIndex));
605
606                 // Then get specific row from database which is a Contact instance
607                 Contact contact = this.getContactDatabase().readSingleContact(rowIndex);
608
609                 // Debug message
610                 this.getLogger().debug(MessageFormat.format("contact={0}", contact));
611
612                 // It may return null
613                 if (contact == null) {
614                         // Nothing found
615                         this.getLogger().warn("contact is null - returning null ...");
616                         return null;
617                 }
618
619                 // Convert column index -> name
620                 String columnName = this.getColumnName(columnIndex);
621
622                 // Debug message
623                 this.getLogger().debug(MessageFormat.format("columnName={0}", columnName));
624
625                 // Now get that column
626                 Object value = null;
627                 try {
628                         value = contact.getValueFromColumn(columnName);
629                 } catch (final IllegalArgumentException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
630                         this.abortProgramWithException(ex);
631                 }
632
633                 // Trace message
634                 this.getLogger().trace(MessageFormat.format("value={0} - EXIT!", value));
635
636                 // Return it
637                 return value;
638         }
639
640         /**
641          * Checks whether own contact is already added by checking all entries for
642          * isOwnContact flag
643          *
644          * @return Whether own contact is already added
645          */
646         @Override
647         public boolean isOwnContactAdded () {
648                 // Trace message
649                 this.getLogger().trace("CALLED!"); //NOI18N
650
651                 // Init variable
652                 boolean isAdded = false;
653
654                 try {
655                         // Deligate this call to frontend
656                         isAdded = this.getContactDatabase().isOwnContactFound();
657                 } catch (final SQLException | IOException | BadTokenException ex) {
658                         // Something bad happened
659                         this.abortProgramWithException(ex);
660                 }
661
662                 // Trace message
663                 this.getLogger().trace(MessageFormat.format("isAdded={0} : EXIT!", isAdded)); //NOI18N
664
665                 // Return result
666                 return isAdded;
667         }
668
669         /**
670          * Adds given contact to address book and flushes all entries to database
671          *
672          * @param contact Contact being added
673          * @todo Add check for book size
674          */
675         @Override
676         public void registerContact (final Contact contact) {
677                 // Trace message
678                 this.getLogger().trace(MessageFormat.format("contact={0} CALLED!", contact)); //NOI18N
679
680                 // Sanity check
681                 if (contact == null) {
682                         // Abort here
683                         throw new NullPointerException("contact is null"); //NOI18N
684                 }
685
686                 // Debug message
687                 /* NOISY-DEBUG: */ this.getLogger().debug(MessageFormat.format("Adding '{0}' '{1}' at pos '{2}' ...", contact.getSurname(), contact.getFamilyName(), this.size())); //NOI18N
688                 try {
689                         // Check if contact is found
690                         if (this.getContactDatabase().isContactFound(contact)) {
691                                 // Contact already added
692                                 // @todo Do something here
693                         } else if ((contact.isOwnContact()) && (this.isOwnContactAdded())) {
694                                 // Own contact already added
695                                 // @todo Do something
696                         }
697
698                         // Add contact to internal list
699                         this.addContact(contact);
700                 } catch (final ContactAlreadyAddedException ex) {
701                         // Abort here
702                         this.abortProgramWithException(ex);
703                 } catch (final BadTokenException ex) {
704                         // Abort here
705                         this.abortProgramWithException(ex);
706                 }
707
708                 // Trace message
709                 this.getLogger().trace("EXIT!"); //NOI18N
710         }
711
712         /**
713          * Getter for size
714          *
715          * @return size of contact "book"
716          */
717         @Override
718         public final int size () {
719                 // Init size
720                 int size = -1;
721
722                 try {
723                         size = this.getContactDatabase().getContactsCount();
724                 } catch (final SQLException ex) {
725                         // Something happened
726                         this.abortProgramWithException(ex);
727                 }
728
729                 // Return amount
730                 return size;
731         }
732
733         /**
734          * Fills the column names array with strings from bundle
735          */
736         private void fillColumnNamesFromBundle () {
737                 assert (this.columnNames instanceof List) : "this.columnNames is not initialized"; //NOI18N
738                 assert (this.translatedColumnNames instanceof List) : "this.translatedColumnNames is not initialized"; //NOI18N
739
740                 // Debug message
741                 this.getLogger().trace("CALLED!"); //NOI18N
742
743                 // First get an iterator from key set to iterate over
744                 Iterator<String> iterator = this.getBundle().keySet().iterator();
745
746                 // Then iterate over all
747                 while (iterator.hasNext()) {
748                         // Get next element
749                         String key = iterator.next();
750
751                         // Does the key start with AddressbookContactManager.columnName ?
752                         if (key.startsWith("ContactManager.columnName")) { //NOI18N
753                                 // This is the wanted entry.
754                                 this.getLogger().debug(MessageFormat.format("key={0}", key)); //NOI18N
755
756                                 // Convert string to array based on delimiter '.'
757                                 String[] tokens = this.getArrayFromString(key, ".", 4);
758
759                                 // Token array must contain 4 elements (AddressbookContactManager.columnName.foo.text)
760                                 assert(tokens.length == 4) : MessageFormat.format("Array tokens contains not 4 elements: {0}", Arrays.toString(tokens));
761
762                                 // Get pre-last element
763                                 String columnName = tokens[tokens.length - 2];
764
765                                 // Debug message
766                                 this.getLogger().debug(MessageFormat.format("columnName={0} - adding ...", columnName));
767
768                                 // So add it
769                                 this.columnNames.add(columnName);
770                                 this.translatedColumnNames.add(this.getBundle().getString(key));
771                         }
772                 }
773
774                 // Debug message
775                 this.getLogger().trace(MessageFormat.format("getColumnCount()={0}: EXIT!", this.getColumnCount())); //NOI18N
776         }
777
778         /**
779          * A AddressbookContactFrontend instance
780          *
781          * @return the database
782          */
783         private AddressbookContactFrontend getContactDatabase () {
784                 return this.contactDatabase;
785         }
786
787         /**
788          * "Getter" for own contact instance or null if not found
789          *
790          * @return Contact instance or null
791          */
792         private Contact getOwnContact () {
793                 // Trace message
794                 this.getLogger().trace("CALLED!"); //NOI18N
795
796                 // Deligate this call to database frontend
797                 Contact contact = this.getContactDatabase().getOwnContact();
798
799                 // Trace message
800                 this.getLogger().trace(MessageFormat.format("contact={0} - EXIT!", contact)); //NOI18N
801
802                 // Return instance or null
803                 return contact;
804         }
805 }