]> git.mxchange.org Git - jcontacts-core.git/blobdiff - src/org/mxchange/jcontacts/contact/UserContact.java
check on user instance
[jcontacts-core.git] / src / org / mxchange / jcontacts / contact / UserContact.java
index a0b8299af470e2a3fd5ffb66b85e0c407934d7e4..b176ccf1c526581e2a90357a4a5bfab022c292d8 100644 (file)
@@ -68,8 +68,13 @@ import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
                        )
                }
 )
-@NamedQueries(
-               @NamedQuery(name = "AllContactsByCellphone", query = "SELECT c FROM contacts AS c WHERE c.contactCellphoneNumber = :cellPhone ORDER BY c.contactId ASC")
+@NamedQueries (
+               {
+                       @NamedQuery( name = "AllContacts", query = "SELECT c FROM contacts AS c ORDER BY c.contactId ASC"),
+                       @NamedQuery( name = "AllContactEmailAddresses", query = "SELECT c.contactEmailAddress FROM contacts AS c ORDER BY c.contactId ASC"),
+                       @NamedQuery (name = "AllContactsByCellphone", query = "SELECT c FROM contacts AS c WHERE c.contactCellphoneNumber = :cellPhone ORDER BY c.contactId ASC"),
+                       @NamedQuery (name = "SearchContactById", query = "SELECT c FROM contacts AS c WHERE c.contactId = :contactId")
+               }
 )
 public class UserContact implements Contact {
 
@@ -243,6 +248,12 @@ public class UserContact implements Contact {
 
        @Override
        public void copyAll (final Contact contact) {
+               // Contact should be valid
+               if (null == contact) {
+                       // Throw NPE
+                       throw new NullPointerException("contact is null"); //NOI18N
+               }
+
                // Copy all:
                // - base data
                this.setContactFirstName(contact.getContactFirstName());