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