]> git.mxchange.org Git - jjobs-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Thu, 20 Apr 2017 09:29:15 +0000 (11:29 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 20 Apr 2017 09:43:07 +0000 (11:43 +0200)
- let's get rid of all these debug messages

Signed-off-by: Roland Häder <roland@mxchange.org>
19 files changed:
src/java/org/mxchange/jjobs/beans/BaseJobsController.java
src/java/org/mxchange/jjobs/beans/confirmlink/JobsConfirmationLinkWebRequestBean.java
src/java/org/mxchange/jjobs/beans/contact/JobsAdminContactWebRequestBean.java
src/java/org/mxchange/jjobs/beans/contact/phone/JobsAdminContactPhoneWebRequestBean.java
src/java/org/mxchange/jjobs/beans/contact/phone/JobsContactPhoneWebSessionBean.java
src/java/org/mxchange/jjobs/beans/helper/JobsWebRequestHelperBean.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/helper/JobsWebRequestHelperController.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/helper/JobsWebViewHelperBean.java [deleted file]
src/java/org/mxchange/jjobs/beans/helper/JobsWebViewHelperController.java [deleted file]
src/java/org/mxchange/jjobs/beans/localization/JobsLocalizationSessionBean.java
src/java/org/mxchange/jjobs/beans/phone/JobsAdminPhoneWebRequestBean.java
src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestBean.java
src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestController.java
src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebApplicationBean.java
src/java/org/mxchange/jjobs/validator/emailaddress/JobsEmailAddressValidator.java
src/java/org/mxchange/jjobs/validator/names/JobsNameValidator.java
src/java/org/mxchange/jjobs/validator/password/JobsUserPasswordValidator.java
src/java/org/mxchange/jjobs/validator/privacy_terms/JobsPrivacyTermsCheckboxValidator.java
src/java/org/mxchange/jjobs/validator/user/JobsUserIdValidator.java

index 6bff292d461f50838599d35e60c06dc582d0af2d..03acfab3b2296bb1b22996c71814cb678d4d4db6 100644 (file)
@@ -137,9 +137,6 @@ public abstract class BaseJobsController implements Serializable {
         * @return Whether the entered password is to weak
         */
        protected boolean isWeakPassword (final String password) {
-               // Log message
-               System.out.println(this.getClass().getSimpleName() + ":isWeakPassword: password=" + password + " - CALLED!");
-
                // Is parameter set?
                if (null == password) {
                        // Throw NPE
@@ -149,15 +146,9 @@ public abstract class BaseJobsController implements Serializable {
                // Get score value
                double passwordScore = UserUtils.calculatePasswordScore(password);
 
-               // Log message
-               System.out.println(this.getClass().getSimpleName() + ".isWeakPassword: passwordScore=" + passwordScore);
-
                // Is the score within range?
                boolean isWeak = (passwordScore <= this.getIntegerContextParameter("min_user_password_score")); //NOI18N
 
-               // Log message
-               System.out.println(this.getClass().getSimpleName() + ".isWeakPassword: isWeak=" + isWeak + " - EXIT!");
-
                // Return it
                return isWeak;
        }
@@ -170,9 +161,6 @@ public abstract class BaseJobsController implements Serializable {
         * @param cause Causing exception
         */
        protected void showFacesMessage (final String clientId, final Throwable cause) {
-               // Trace message
-               System.out.println(MessageFormat.format("showFacesMessage: clientId={0},cause={1} - CALLED!", clientId, cause));
-
                // Get context and add message
                this.showFacesMessage(clientId, cause.getMessage());
        }
index d49aae87381c762440230f1906fe7cc289c8e18f..6a2565d25948b009e449ec5a0c4d439a1d5da9c9 100644 (file)
@@ -31,7 +31,6 @@ import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.jcoreee.utils.FacesUtils;
 import org.mxchange.jjobs.beans.BaseJobsController;
-import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController;
 import org.mxchange.jjobs.beans.user.JobsUserWebSessionController;
 import org.mxchange.jusercore.events.confirmation.UserConfirmedAccountEvent;
 import org.mxchange.jusercore.exceptions.UserStatusConfirmedException;
@@ -40,6 +39,7 @@ import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
 import org.mxchange.jusercore.model.user.status.UserAccountStatus;
 import org.mxchange.jusercore.events.confirmation.ObservableUserConfirmedAccountEvent;
+import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
 
 /**
  * A web request bean for confirmation link handling
@@ -59,7 +59,7 @@ public class JobsConfirmationLinkWebRequestBean extends BaseJobsController imple
         * Bean helper
         */
        @Inject
-       private JobsWebViewHelperController beanHelper;
+       private JobsWebRequestHelperController beanHelper;
 
        /**
         * Confirmation key
index b4c598255ede6a5548dfa57fa312e33b8e723f95..29a39907de3f91428b228c3af793ef989687633a 100644 (file)
@@ -42,7 +42,6 @@ import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
 import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException;
 import org.mxchange.jcountry.data.Country;
 import org.mxchange.jjobs.beans.BaseJobsController;
-import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController;
 import org.mxchange.jphone.phonenumbers.DialableNumber;
 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
@@ -52,6 +51,7 @@ import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
 import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.deleted.ObservableAdminDeletedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
 
 /**
  * An administrative user controller (bean)
@@ -83,7 +83,7 @@ public class JobsAdminContactWebRequestBean extends BaseJobsController implement
         * Bean helper
         */
        @Inject
-       private JobsWebViewHelperController beanHelper;
+       private JobsWebRequestHelperController beanHelper;
 
        /**
         * Birth day
index b54c6728966fc4584552ee8e1aa477bd908a1624..3f20b39c1dbac19380fbc0d5aa3740256f81708f 100644 (file)
@@ -37,7 +37,6 @@ import org.mxchange.jcontacts.events.mobile.unlinked.AdminUnlinkedMobileNumberEv
 import org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote;
 import org.mxchange.jcountry.data.Country;
 import org.mxchange.jjobs.beans.BaseJobsController;
-import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController;
 import org.mxchange.jjobs.beans.phone.JobsAdminPhoneWebRequestController;
 import org.mxchange.jphone.exceptions.PhoneNumberAlreadyLinkedException;
 import org.mxchange.jphone.exceptions.PhoneNumberNotLinkedException;
@@ -57,6 +56,7 @@ import org.mxchange.jcontacts.events.landline.linked.ObservableAdminLinkedLandLi
 import org.mxchange.jcontacts.events.landline.unlinked.ObservableAdminUnlinkedLandLineNumberEvent;
 import org.mxchange.jcontacts.events.mobile.linked.ObservableAdminLinkedMobileNumberEvent;
 import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent;
+import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
 
 /**
  * An administrative contact phone controller (bean)
@@ -113,7 +113,7 @@ public class JobsAdminContactPhoneWebRequestBean extends BaseJobsController impl
         * Bean helper
         */
        @Inject
-       private JobsWebViewHelperController beanHelper;
+       private JobsWebRequestHelperController beanHelper;
 
        /**
         * Event being fired when a fax number has been unlinked
index 73a316887c6669fd3aece83135a350ff53a6c093..7a55240b9389d0afd5c8d6a937acb40c62890fbf 100644 (file)
@@ -29,7 +29,6 @@ import javax.inject.Named;
 import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jjobs.beans.BaseJobsController;
 import org.mxchange.jjobs.beans.contact.JobsContactWebSessionController;
-import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController;
 import org.mxchange.jphone.phonenumbers.DialableNumber;
 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
@@ -40,6 +39,7 @@ import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContac
 import org.mxchange.jcontacts.events.fax.unlinked.ObservableAdminUnlinkedFaxNumberEvent;
 import org.mxchange.jcontacts.events.landline.unlinked.ObservableAdminUnlinkedLandLineNumberEvent;
 import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent;
+import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
 
 /**
  * An administrative contact phone controller (bean)
@@ -59,7 +59,7 @@ public class JobsContactPhoneWebSessionBean extends BaseJobsController implement
         * Bean helper
         */
        @Inject
-       private JobsWebViewHelperController beanHelper;
+       private JobsWebRequestHelperController beanHelper;
 
        /**
         * General contact controller
diff --git a/src/java/org/mxchange/jjobs/beans/helper/JobsWebRequestHelperBean.java b/src/java/org/mxchange/jjobs/beans/helper/JobsWebRequestHelperBean.java
new file mode 100644 (file)
index 0000000..5aaa40e
--- /dev/null
@@ -0,0 +1,403 @@
+/*
+ * Copyright (C) 2016 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.helper;
+
+import java.text.MessageFormat;
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jcontacts.contact.Contact;
+import org.mxchange.jjobs.beans.BaseJobsController;
+import org.mxchange.jjobs.beans.contact.JobsAdminContactWebRequestController;
+import org.mxchange.jjobs.beans.phone.JobsAdminPhoneWebRequestController;
+import org.mxchange.jjobs.beans.user.JobsAdminUserWebRequestController;
+import org.mxchange.jjobs.beans.user.JobsUserWebSessionController;
+import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
+import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
+import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * A general helper for beans
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("beanHelper")
+@RequestScoped
+public class JobsWebRequestHelperBean extends BaseJobsController implements JobsWebRequestHelperController {
+
+       /**
+        * Call-stack instance (5 may show BeanELResolver.getValue as caller)
+        */
+       private static final short THREAD_STACK = 5;
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 17_258_793_567_145_701L;
+
+       /**
+        * Administrative contact controller
+        */
+       @Inject
+       private JobsAdminContactWebRequestController adminContactController;
+
+       /**
+        * Administrative phone controller
+        */
+       @Inject
+       private JobsAdminPhoneWebRequestController adminPhoneController;
+
+       /**
+        * Administrative user controller
+        */
+       @Inject
+       private JobsAdminUserWebRequestController adminUserController;
+
+       /**
+        * Contact instance
+        */
+       private Contact contact;
+
+       /**
+        * Fax number
+        */
+       private DialableFaxNumber faxNumber;
+
+       /**
+        * Land-line number
+        */
+       private DialableLandLineNumber landLineNumber;
+
+       /**
+        * Mobile number
+        */
+       private DialableMobileNumber mobileNumber;
+
+       /**
+        * User instance
+        */
+       private User user;
+
+       /**
+        * Regular user controller
+        */
+       @Inject
+       private JobsUserWebSessionController userController;
+
+       /**
+        * Default constructor
+        */
+       public JobsWebRequestHelperBean () {
+               // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[3].getClassName(), Thread.currentThread().getStackTrace()[3].getMethodName());
+               // System.out.println(MessageFormat.format("{0}: Constructed, caller: {1}", this.getClass().getSimpleName(), caller));
+       }
+
+       @Override
+       public void copyContactToController () {
+               // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[THREAD_STACK].getClassName(), Thread.currentThread().getStackTrace()[THREAD_STACK].getMethodName());
+               // System.out.println(MessageFormat.format("{0}.copyContactToController: CALLED, caller: {2}", this.getClass().getSimpleName(), this.contact, caller));
+
+               // Validate contact instance
+               if (this.getContact() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("this.contact is null"); //NOI18N
+               } else if (this.getContact().getContactId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("this.contact.contactId is null"); //NOI18N
+               } else if (this.getContact().getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalStateException(MessageFormat.format("this.contact.contactId={0} is not valid.", this.getContact().getContactId())); //NOI18N
+               }
+
+               // Set all phone instances
+               this.setPhoneInstances(this.getContact());
+
+               // Set all fields: user
+               this.adminContactController.copyContactToController(this.getContact());
+       }
+
+       @Override
+       public void copyFaxNumberToController () {
+               // Validate fax instance
+               if (this.getFaxNumber() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("this.faxNumber is null");
+               } else if (this.getFaxNumber().getPhoneId() == null) {
+                       // Throw again
+                       throw new NullPointerException("this.faxNumber.phoneId is null");
+               } else if (this.getFaxNumber().getPhoneId() < 1) {
+                       // Invalid id number
+                       throw new IllegalArgumentException(MessageFormat.format("this.faxNumber.phoneId={0} is not valid", this.getFaxNumber().getPhoneId()));
+               } else if (this.getFaxNumber().getPhoneAreaCode() == null) {
+                       // Throw again
+                       throw new NullPointerException("this.faxNumber.phoneAreaCode is null");
+               } else if (this.getFaxNumber().getPhoneAreaCode() < 1) {
+                       // Invalid id number
+                       throw new IllegalArgumentException(MessageFormat.format("this.faxNumber.phoneAreaCode={0} is not valid", this.getFaxNumber().getPhoneAreaCode()));
+               } else if (this.getFaxNumber().getPhoneCountry() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("this.faxNumber.phoneCountry is null");
+               } else if (this.getFaxNumber().getPhoneCountry().getCountryId() == null) {
+                       // ... throw again
+                       throw new NullPointerException("this.faxNumber.phoneCountry.countryId is null");
+               } else if (this.getFaxNumber().getPhoneCountry().getCountryId() < 1) {
+                       // Invalid id
+                       throw new IllegalArgumentException(MessageFormat.format("this.faxNumber.phoneCountry.countryId={0} is invalid", this.getFaxNumber().getPhoneCountry().getCountryId()));
+               } else if (this.getFaxNumber().getPhoneNumber() == null) {
+                       // Throw NPE again ...
+                       throw new NullPointerException("this.faxNumber.phoneNumber is null");
+               } else if (this.getFaxNumber().getPhoneNumber() < 1) {
+                       // Invalid id number
+                       throw new IllegalArgumentException(MessageFormat.format("this.faxNumber.phoneNumber={0} is not valid", this.getFaxNumber().getPhoneNumber()));
+               }
+
+               // Copy all (changeable) data fields to admin controller
+               this.adminPhoneController.setPhoneAreaCode(this.getFaxNumber().getPhoneAreaCode());
+               this.adminPhoneController.setPhoneCountry(this.getFaxNumber().getPhoneCountry());
+               this.adminPhoneController.setPhoneNumber(this.getFaxNumber().getPhoneNumber());
+       }
+
+       @Override
+       public void copyLandLineNumberToController () {
+               // Validate land-line instance
+               if (this.getLandLineNumber() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("this.landLineNumber is null");
+               } else if (this.getLandLineNumber().getPhoneId() == null) {
+                       // Throw again
+                       throw new NullPointerException("this.landLineNumber.phoneId is null");
+               } else if (this.getLandLineNumber().getPhoneId() < 1) {
+                       // Invalid id number
+                       throw new IllegalArgumentException(MessageFormat.format("this.landLineNumber.phoneId={0} is not valid", this.getLandLineNumber().getPhoneId()));
+               } else if (this.getLandLineNumber().getPhoneAreaCode() == null) {
+                       // Throw again
+                       throw new NullPointerException("this.landLineNumber.phoneAreaCode is null");
+               } else if (this.getLandLineNumber().getPhoneAreaCode() < 1) {
+                       // Invalid id number
+                       throw new IllegalArgumentException(MessageFormat.format("this.landLineNumber.phoneAreaCode={0} is not valid", this.getFaxNumber().getPhoneAreaCode()));
+               } else if (this.getLandLineNumber().getPhoneCountry() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("this.landLineNumber.phoneCountry is null");
+               } else if (this.getLandLineNumber().getPhoneCountry().getCountryId() == null) {
+                       // ... throw again
+                       throw new NullPointerException("this.landLineNumber.phoneCountry.countryId is null");
+               } else if (this.getLandLineNumber().getPhoneCountry().getCountryId() < 1) {
+                       // Invalid id
+                       throw new IllegalArgumentException(MessageFormat.format("this.landLineNumber.phoneCountry.countryId={0} is invalid", this.getLandLineNumber().getPhoneCountry().getCountryId()));
+               } else if (this.getLandLineNumber().getPhoneNumber() == null) {
+                       // Throw NPE again ...
+                       throw new NullPointerException("this.landLineNumber.phoneNumber is null");
+               } else if (this.getLandLineNumber().getPhoneNumber() < 1) {
+                       // Invalid id number
+                       throw new IllegalArgumentException(MessageFormat.format("this.landLineNumber.phoneNumber={0} is not valid", this.getLandLineNumber().getPhoneNumber()));
+               }
+
+               // Copy all (changeable) data fields to admin controller
+               this.adminPhoneController.setPhoneAreaCode(this.getLandLineNumber().getPhoneAreaCode());
+               this.adminPhoneController.setPhoneCountry(this.getLandLineNumber().getPhoneCountry());
+               this.adminPhoneController.setPhoneNumber(this.getLandLineNumber().getPhoneNumber());
+       }
+
+       @Override
+       public void copyMobileNumberToController () {
+               // Validate mobile instance
+               if (this.getMobileNumber() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("this.mobileNumber is null");
+               } else if (this.getMobileNumber().getPhoneId() == null) {
+                       // Throw again
+                       throw new NullPointerException("this.mobileNumber.phoneId is null");
+               } else if (this.getMobileNumber().getPhoneId() < 1) {
+                       // Invalid id number
+                       throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber.phoneId={0} is not valid", this.getMobileNumber().getPhoneId()));
+               } else if (this.getMobileNumber().getMobileProvider() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("this.mobileNumber.mobileProvider is null");
+               } else if (this.getMobileNumber().getMobileProvider().getProviderId() == null) {
+                       // ... throw again
+                       throw new NullPointerException("this.mobileNumber.mobileProvider.providerId is null");
+               } else if (this.getMobileNumber().getMobileProvider().getProviderId() < 1) {
+                       // Invalid id
+                       throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber.mobileProvider.providerId={0} is invalid", this.getMobileNumber().getMobileProvider().getProviderId()));
+               } else if (this.getMobileNumber().getPhoneNumber() == null) {
+                       // Throw NPE again ...
+                       throw new NullPointerException("this.mobileNumber.phoneNumber is null");
+               } else if (this.getMobileNumber().getPhoneNumber() < 1) {
+                       // Invalid id number
+                       throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber.phoneNumber={0} is not valid", this.getMobileNumber().getPhoneNumber()));
+               }
+
+               // Copy all (changeable) data fields to admin controller
+               this.adminPhoneController.setMobileProvider(this.getMobileNumber().getMobileProvider());
+               this.adminPhoneController.setPhoneNumber(this.getMobileNumber().getPhoneNumber());
+       }
+
+       @Override
+       public void copyUserToController () {
+               // Log message
+               //* NOISY-DEBUG: */ System.out.println("AdminHelper::copyUserToController - CALLED!"); //NOI18N
+
+               // Validate user instance
+               if (this.getUser() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("this.user is null");
+               } else if (this.getUser().getUserId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("this.user.userId is null");
+               } else if (this.getUser().getUserId() < 1) {
+                       // Not valid
+                       throw new IllegalStateException(MessageFormat.format("this.user.userId={0} is not valid.", this.getUser().getUserId()));
+               }
+
+               // Get contact
+               Contact userContact = this.getUser().getUserContact();
+
+               // Set contact here, too. This avoids parameters that cannot auto-complete in IDEs.
+               this.setContact(userContact);
+
+               // Set all phone instances
+               this.setPhoneInstances(userContact);
+
+               // Set all fields: user
+               this.userController.setUserName(this.getUser().getUserName());
+               this.adminUserController.setUserName(this.getUser().getUserName());
+       }
+
+       @Override
+       public Contact getContact () {
+               // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[THREAD_STACK].getClassName(), Thread.currentThread().getStackTrace()[THREAD_STACK].getMethodName());
+               // System.out.println(MessageFormat.format("{0}: Returning this.contact={1}, caller: {2}", this.getClass().getSimpleName(), this.contact, caller));
+               return this.contact;
+       }
+
+       @Override
+       public void setContact (final Contact contact) {
+               // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[THREAD_STACK].getClassName(), Thread.currentThread().getStackTrace()[THREAD_STACK].getMethodName());
+               // System.out.println(MessageFormat.format("{0}: Setting contact={1}, previous: {2}, caller: {3}", this.getClass().getSimpleName(), contact, this.contact, caller));
+               this.contact = contact;
+       }
+
+       @Override
+       public String getContactUsageMessageKey (final Contact contact) {
+               // The contact must be valid
+               if (null == contact) {
+                       // Throw NPE
+                       throw new NullPointerException("contact is null"); //NOI18N
+               } else if (contact.getContactId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("contact.contactId is null"); //NOI18N
+               } else if (contact.getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N
+               }
+
+               // Default key is "unused"
+               String messageKey = "CONTACT_IS_UNUSED"; //NOI18N
+
+               // Check user
+               boolean isUserContact = this.userController.isContactFound(contact);
+
+               // Check user first
+               if (isUserContact) {
+                       // Only user
+                       messageKey = "CONTACT_IS_USER"; //NOI18N
+               }
+
+               // Return message key
+               return messageKey;
+       }
+
+       @Override
+       public DialableFaxNumber getFaxNumber () {
+               return this.faxNumber;
+       }
+
+       @Override
+       public void setFaxNumber (final DialableFaxNumber faxNumber) {
+               this.faxNumber = faxNumber;
+       }
+
+       @Override
+       public DialableLandLineNumber getLandLineNumber () {
+               return this.landLineNumber;
+       }
+
+       @Override
+       public void setLandLineNumber (final DialableLandLineNumber landLineNumber) {
+               this.landLineNumber = landLineNumber;
+       }
+
+       @Override
+       public DialableMobileNumber getMobileNumber () {
+               return this.mobileNumber;
+       }
+
+       @Override
+       public void setMobileNumber (final DialableMobileNumber mobileNumber) {
+               this.mobileNumber = mobileNumber;
+       }
+
+       @Override
+       public User getUser () {
+               return this.user;
+       }
+
+       @Override
+       public void setUser (final User user) {
+               this.user = user;
+       }
+
+       /**
+        * Set's all given contact's phone instances: land-line, mobile and
+        * faxNumber
+        * <p>
+        * @param contact Contact to set phone instances for
+        */
+       private void setPhoneInstances (final Contact contact) {
+               // The contact must be valid
+               if (null == contact) {
+                       // Throw NPE
+                       throw new NullPointerException("contact is null"); //NOI18N
+               } else if (contact.getContactId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("contact.contactId is null"); //NOI18N
+               } else if (contact.getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N
+               }
+
+               // Is mobile set?
+               if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
+                       // Yes, then set it in admin controller
+                       this.setMobileNumber(contact.getContactMobileNumber());
+               }
+
+               // Is land-line set?
+               if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) {
+                       // Yes, then set it in admin controller
+                       this.setLandLineNumber(contact.getContactLandLineNumber());
+               }
+
+               // Is faxNumber set?
+               if (contact.getContactFaxNumber() instanceof DialableFaxNumber) {
+                       // Yes, then set it in admin controller
+                       this.setFaxNumber(contact.getContactFaxNumber());
+               }
+       }
+
+}
diff --git a/src/java/org/mxchange/jjobs/beans/helper/JobsWebRequestHelperController.java b/src/java/org/mxchange/jjobs/beans/helper/JobsWebRequestHelperController.java
new file mode 100644 (file)
index 0000000..d289fb7
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2016 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.helper;
+
+import java.io.Serializable;
+import org.mxchange.jcontacts.contact.Contact;
+import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
+import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
+import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * An interface for general bean helper
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface JobsWebRequestHelperController extends Serializable {
+
+       /**
+        * Copies currently set fax number's data to admin phone controller
+        */
+       void copyFaxNumberToController ();
+
+       /**
+        * Copies currently set land-line number's data to admin phone controller
+        */
+       void copyLandLineNumberToController ();
+
+       /**
+        * Copies currently set mobile number's data to admin phone controller
+        */
+       void copyMobileNumberToController ();
+
+       /**
+        * Copies currently set contact instance's data to adminContactController
+        */
+       void copyContactToController ();
+
+       /**
+        * Copies currently set user instance's data to adminUserController
+        */
+       void copyUserToController ();
+
+       /**
+        * Returns a message key depending on if this contact is a user and/or a
+        * contact. If this contact is unused, a default key is returned.
+        * <p>
+        * @param contact Contact instance to check
+        * <p>
+        * @return Message key
+        */
+       String getContactUsageMessageKey (final Contact contact);
+
+       /**
+        * Getter for contact instance
+        * <p>
+        * @return Contact instance
+        */
+       Contact getContact ();
+
+       /**
+        * Setter for contact instance
+        * <p>
+        * @param contact Contact instance
+        */
+       void setContact (final Contact contact);
+
+       /**
+        * Getter for user instance
+        * <p>
+        * @return User instance
+        */
+       User getUser ();
+
+       /**
+        * Setter for user instance
+        * <p>
+        * @param user User instance
+        */
+       void setUser (final User user);
+
+       /**
+        * Getter for dialable mobile number
+        * <p>
+        * @return Dialable mobile number
+        */
+       DialableMobileNumber getMobileNumber ();
+
+       /**
+        * Setter for dialable mobile number
+        * <p>
+        * @param mobileNumber Dialable mobile number
+        */
+       void setMobileNumber (final DialableMobileNumber mobileNumber);
+
+       /**
+        * Getter for dialable land-line number
+        * <p>
+        * @return Dialable land-line number
+        */
+       DialableLandLineNumber getLandLineNumber ();
+
+       /**
+        * Setter for dialable land-line number
+        * <p>
+        * @param landLine Dialable land-line number
+        */
+       void setLandLineNumber (final DialableLandLineNumber landLine);
+
+       /**
+        * Getter for dialable fax number
+        * <p>
+        * @return Dialable fax number
+        */
+       DialableFaxNumber getFaxNumber ();
+
+       /**
+        * Setter for dialable fax number
+        * <p>
+        * @param faxNumber Dialable fax number
+        */
+       void setFaxNumber (final DialableFaxNumber faxNumber);
+
+}
diff --git a/src/java/org/mxchange/jjobs/beans/helper/JobsWebViewHelperBean.java b/src/java/org/mxchange/jjobs/beans/helper/JobsWebViewHelperBean.java
deleted file mode 100644 (file)
index f9d6da6..0000000
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jjobs.beans.helper;
-
-import java.text.MessageFormat;
-import javax.faces.view.ViewScoped;
-import javax.inject.Inject;
-import javax.inject.Named;
-import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jjobs.beans.BaseJobsController;
-import org.mxchange.jjobs.beans.contact.JobsAdminContactWebRequestController;
-import org.mxchange.jjobs.beans.phone.JobsAdminPhoneWebRequestController;
-import org.mxchange.jjobs.beans.user.JobsAdminUserWebRequestController;
-import org.mxchange.jjobs.beans.user.JobsUserWebSessionController;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * A general helper for beans
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Named ("beanHelper")
-@ViewScoped
-public class JobsWebViewHelperBean extends BaseJobsController implements JobsWebViewHelperController {
-
-       /**
-        * Call-stack instance (5 may show BeanELResolver.getValue as caller)
-        */
-       private static final short THREAD_STACK = 5;
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 17_258_793_567_145_701L;
-
-       /**
-        * Administrative contact controller
-        */
-       @Inject
-       private JobsAdminContactWebRequestController adminContactController;
-
-       /**
-        * Administrative phone controller
-        */
-       @Inject
-       private JobsAdminPhoneWebRequestController adminPhoneController;
-
-       /**
-        * Administrative user controller
-        */
-       @Inject
-       private JobsAdminUserWebRequestController adminUserController;
-
-       /**
-        * Contact instance
-        */
-       private Contact contact;
-
-       /**
-        * Fax number
-        */
-       private DialableFaxNumber faxNumber;
-
-       /**
-        * Land-line number
-        */
-       private DialableLandLineNumber landLineNumber;
-
-       /**
-        * Mobile number
-        */
-       private DialableMobileNumber mobileNumber;
-
-       /**
-        * User instance
-        */
-       private User user;
-
-       /**
-        * Regular user controller
-        */
-       @Inject
-       private JobsUserWebSessionController userController;
-
-       /**
-        * Default constructor
-        */
-       public JobsWebViewHelperBean () {
-               // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[3].getClassName(), Thread.currentThread().getStackTrace()[3].getMethodName());
-               // System.out.println(MessageFormat.format("{0}: Constructed, caller: {1}", this.getClass().getSimpleName(), caller));
-       }
-
-       @Override
-       public void copyContactToController () {
-               // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[THREAD_STACK].getClassName(), Thread.currentThread().getStackTrace()[THREAD_STACK].getMethodName());
-               // System.out.println(MessageFormat.format("{0}.copyContactToController: CALLED, caller: {2}", this.getClass().getSimpleName(), this.contact, caller));
-
-               // Validate contact instance
-               if (this.getContact() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("this.contact is null"); //NOI18N
-               } else if (this.getContact().getContactId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("this.contact.contactId is null"); //NOI18N
-               } else if (this.getContact().getContactId() < 1) {
-                       // Not valid
-                       throw new IllegalStateException(MessageFormat.format("this.contact.contactId={0} is not valid.", this.getContact().getContactId())); //NOI18N
-               }
-
-               // Set all phone instances
-               this.setPhoneInstances(this.getContact());
-
-               // Set all fields: user
-               this.adminContactController.copyContactToController(this.getContact());
-       }
-
-       @Override
-       public void copyFaxNumberToController () {
-               // Validate fax instance
-               if (this.getFaxNumber() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("this.faxNumber is null");
-               } else if (this.getFaxNumber().getPhoneId() == null) {
-                       // Throw again
-                       throw new NullPointerException("this.faxNumber.phoneId is null");
-               } else if (this.getFaxNumber().getPhoneId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("this.faxNumber.phoneId={0} is not valid", this.getFaxNumber().getPhoneId()));
-               } else if (this.getFaxNumber().getPhoneAreaCode() == null) {
-                       // Throw again
-                       throw new NullPointerException("this.faxNumber.phoneAreaCode is null");
-               } else if (this.getFaxNumber().getPhoneAreaCode() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("this.faxNumber.phoneAreaCode={0} is not valid", this.getFaxNumber().getPhoneAreaCode()));
-               } else if (this.getFaxNumber().getPhoneCountry() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("this.faxNumber.phoneCountry is null");
-               } else if (this.getFaxNumber().getPhoneCountry().getCountryId() == null) {
-                       // ... throw again
-                       throw new NullPointerException("this.faxNumber.phoneCountry.countryId is null");
-               } else if (this.getFaxNumber().getPhoneCountry().getCountryId() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("this.faxNumber.phoneCountry.countryId={0} is invalid", this.getFaxNumber().getPhoneCountry().getCountryId()));
-               } else if (this.getFaxNumber().getPhoneNumber() == null) {
-                       // Throw NPE again ...
-                       throw new NullPointerException("this.faxNumber.phoneNumber is null");
-               } else if (this.getFaxNumber().getPhoneNumber() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("this.faxNumber.phoneNumber={0} is not valid", this.getFaxNumber().getPhoneNumber()));
-               }
-
-               // Copy all (changeable) data fields to admin controller
-               this.adminPhoneController.setPhoneAreaCode(this.getFaxNumber().getPhoneAreaCode());
-               this.adminPhoneController.setPhoneCountry(this.getFaxNumber().getPhoneCountry());
-               this.adminPhoneController.setPhoneNumber(this.getFaxNumber().getPhoneNumber());
-       }
-
-       @Override
-       public void copyLandLineNumberToController () {
-               // Validate land-line instance
-               if (this.getLandLineNumber() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("this.landLineNumber is null");
-               } else if (this.getLandLineNumber().getPhoneId() == null) {
-                       // Throw again
-                       throw new NullPointerException("this.landLineNumber.phoneId is null");
-               } else if (this.getLandLineNumber().getPhoneId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("this.landLineNumber.phoneId={0} is not valid", this.getLandLineNumber().getPhoneId()));
-               } else if (this.getLandLineNumber().getPhoneAreaCode() == null) {
-                       // Throw again
-                       throw new NullPointerException("this.landLineNumber.phoneAreaCode is null");
-               } else if (this.getLandLineNumber().getPhoneAreaCode() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("this.landLineNumber.phoneAreaCode={0} is not valid", this.getFaxNumber().getPhoneAreaCode()));
-               } else if (this.getLandLineNumber().getPhoneCountry() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("this.landLineNumber.phoneCountry is null");
-               } else if (this.getLandLineNumber().getPhoneCountry().getCountryId() == null) {
-                       // ... throw again
-                       throw new NullPointerException("this.landLineNumber.phoneCountry.countryId is null");
-               } else if (this.getLandLineNumber().getPhoneCountry().getCountryId() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("this.landLineNumber.phoneCountry.countryId={0} is invalid", this.getLandLineNumber().getPhoneCountry().getCountryId()));
-               } else if (this.getLandLineNumber().getPhoneNumber() == null) {
-                       // Throw NPE again ...
-                       throw new NullPointerException("this.landLineNumber.phoneNumber is null");
-               } else if (this.getLandLineNumber().getPhoneNumber() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("this.landLineNumber.phoneNumber={0} is not valid", this.getLandLineNumber().getPhoneNumber()));
-               }
-
-               // Copy all (changeable) data fields to admin controller
-               this.adminPhoneController.setPhoneAreaCode(this.getLandLineNumber().getPhoneAreaCode());
-               this.adminPhoneController.setPhoneCountry(this.getLandLineNumber().getPhoneCountry());
-               this.adminPhoneController.setPhoneNumber(this.getLandLineNumber().getPhoneNumber());
-       }
-
-       @Override
-       public void copyMobileNumberToController () {
-               // Validate mobile instance
-               if (this.getMobileNumber() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("this.mobileNumber is null");
-               } else if (this.getMobileNumber().getPhoneId() == null) {
-                       // Throw again
-                       throw new NullPointerException("this.mobileNumber.phoneId is null");
-               } else if (this.getMobileNumber().getPhoneId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber.phoneId={0} is not valid", this.getMobileNumber().getPhoneId()));
-               } else if (this.getMobileNumber().getMobileProvider() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("this.mobileNumber.mobileProvider is null");
-               } else if (this.getMobileNumber().getMobileProvider().getProviderId() == null) {
-                       // ... throw again
-                       throw new NullPointerException("this.mobileNumber.mobileProvider.providerId is null");
-               } else if (this.getMobileNumber().getMobileProvider().getProviderId() < 1) {
-                       // Invalid id
-                       throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber.mobileProvider.providerId={0} is invalid", this.getMobileNumber().getMobileProvider().getProviderId()));
-               } else if (this.getMobileNumber().getPhoneNumber() == null) {
-                       // Throw NPE again ...
-                       throw new NullPointerException("this.mobileNumber.phoneNumber is null");
-               } else if (this.getMobileNumber().getPhoneNumber() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber.phoneNumber={0} is not valid", this.getMobileNumber().getPhoneNumber()));
-               }
-
-               // Copy all (changeable) data fields to admin controller
-               this.adminPhoneController.setMobileProvider(this.getMobileNumber().getMobileProvider());
-               this.adminPhoneController.setPhoneNumber(this.getMobileNumber().getPhoneNumber());
-       }
-
-       @Override
-       public void copyUserToController () {
-               // Log message
-               //* NOISY-DEBUG: */ System.out.println("AdminHelper::copyUserToController - CALLED!"); //NOI18N
-
-               // Validate user instance
-               if (this.getUser() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("this.user is null");
-               } else if (this.getUser().getUserId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("this.user.userId is null");
-               } else if (this.getUser().getUserId() < 1) {
-                       // Not valid
-                       throw new IllegalStateException(MessageFormat.format("this.user.userId={0} is not valid.", this.getUser().getUserId()));
-               }
-
-               // Get contact
-               Contact userContact = this.getUser().getUserContact();
-
-               // Set contact here, too. This avoids parameters that cannot auto-complete in IDEs.
-               this.setContact(userContact);
-
-               // Set all phone instances
-               this.setPhoneInstances(userContact);
-
-               // Set all fields: user
-               this.userController.setUserName(this.getUser().getUserName());
-               this.adminUserController.setUserName(this.getUser().getUserName());
-       }
-
-       @Override
-       public Contact getContact () {
-               // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[THREAD_STACK].getClassName(), Thread.currentThread().getStackTrace()[THREAD_STACK].getMethodName());
-               // System.out.println(MessageFormat.format("{0}: Returning this.contact={1}, caller: {2}", this.getClass().getSimpleName(), this.contact, caller));
-               return this.contact;
-       }
-
-       @Override
-       public void setContact (final Contact contact) {
-               // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[THREAD_STACK].getClassName(), Thread.currentThread().getStackTrace()[THREAD_STACK].getMethodName());
-               // System.out.println(MessageFormat.format("{0}: Setting contact={1}, previous: {2}, caller: {3}", this.getClass().getSimpleName(), contact, this.contact, caller));
-               this.contact = contact;
-       }
-
-       @Override
-       public String getContactUsageMessageKey (final Contact contact) {
-               // The contact must be valid
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N
-               }
-
-               // Default key is "unused"
-               String messageKey = "CONTACT_IS_UNUSED"; //NOI18N
-
-               // Check user
-               boolean isUserContact = this.userController.isContactFound(contact);
-
-               // Check user first
-               if (isUserContact) {
-                       // Only user
-                       messageKey = "CONTACT_IS_USER"; //NOI18N
-               }
-
-               // Return message key
-               return messageKey;
-       }
-
-       @Override
-       public DialableFaxNumber getFaxNumber () {
-               return this.faxNumber;
-       }
-
-       @Override
-       public void setFaxNumber (final DialableFaxNumber faxNumber) {
-               this.faxNumber = faxNumber;
-       }
-
-       @Override
-       public DialableLandLineNumber getLandLineNumber () {
-               return this.landLineNumber;
-       }
-
-       @Override
-       public void setLandLineNumber (final DialableLandLineNumber landLineNumber) {
-               this.landLineNumber = landLineNumber;
-       }
-
-       @Override
-       public DialableMobileNumber getMobileNumber () {
-               return this.mobileNumber;
-       }
-
-       @Override
-       public void setMobileNumber (final DialableMobileNumber mobileNumber) {
-               this.mobileNumber = mobileNumber;
-       }
-
-       @Override
-       public User getUser () {
-               return this.user;
-       }
-
-       @Override
-       public void setUser (final User user) {
-               this.user = user;
-       }
-
-       /**
-        * Set's all given contact's phone instances: land-line, mobile and
-        * faxNumber
-        * <p>
-        * @param contact Contact to set phone instances for
-        */
-       private void setPhoneInstances (final Contact contact) {
-               // The contact must be valid
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N
-               }
-
-               // Is mobile set?
-               if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
-                       // Yes, then set it in admin controller
-                       this.setMobileNumber(contact.getContactMobileNumber());
-               }
-
-               // Is land-line set?
-               if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) {
-                       // Yes, then set it in admin controller
-                       this.setLandLineNumber(contact.getContactLandLineNumber());
-               }
-
-               // Is faxNumber set?
-               if (contact.getContactFaxNumber() instanceof DialableFaxNumber) {
-                       // Yes, then set it in admin controller
-                       this.setFaxNumber(contact.getContactFaxNumber());
-               }
-       }
-
-}
diff --git a/src/java/org/mxchange/jjobs/beans/helper/JobsWebViewHelperController.java b/src/java/org/mxchange/jjobs/beans/helper/JobsWebViewHelperController.java
deleted file mode 100644 (file)
index bff572b..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jjobs.beans.helper;
-
-import java.io.Serializable;
-import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
-import org.mxchange.jusercore.model.user.User;
-
-/**
- * An interface for general bean helper
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface JobsWebViewHelperController extends Serializable {
-
-       /**
-        * Copies currently set fax number's data to admin phone controller
-        */
-       void copyFaxNumberToController ();
-
-       /**
-        * Copies currently set land-line number's data to admin phone controller
-        */
-       void copyLandLineNumberToController ();
-
-       /**
-        * Copies currently set mobile number's data to admin phone controller
-        */
-       void copyMobileNumberToController ();
-
-       /**
-        * Copies currently set contact instance's data to adminContactController
-        */
-       void copyContactToController ();
-
-       /**
-        * Copies currently set user instance's data to adminUserController
-        */
-       void copyUserToController ();
-
-       /**
-        * Returns a message key depending on if this contact is a user and/or a
-        * contact. If this contact is unused, a default key is returned.
-        * <p>
-        * @param contact Contact instance to check
-        * <p>
-        * @return Message key
-        */
-       String getContactUsageMessageKey (final Contact contact);
-
-       /**
-        * Getter for contact instance
-        * <p>
-        * @return Contact instance
-        */
-       Contact getContact ();
-
-       /**
-        * Setter for contact instance
-        * <p>
-        * @param contact Contact instance
-        */
-       void setContact (final Contact contact);
-
-       /**
-        * Getter for user instance
-        * <p>
-        * @return User instance
-        */
-       User getUser ();
-
-       /**
-        * Setter for user instance
-        * <p>
-        * @param user User instance
-        */
-       void setUser (final User user);
-
-       /**
-        * Getter for dialable mobile number
-        * <p>
-        * @return Dialable mobile number
-        */
-       DialableMobileNumber getMobileNumber ();
-
-       /**
-        * Setter for dialable mobile number
-        * <p>
-        * @param mobileNumber Dialable mobile number
-        */
-       void setMobileNumber (final DialableMobileNumber mobileNumber);
-
-       /**
-        * Getter for dialable land-line number
-        * <p>
-        * @return Dialable land-line number
-        */
-       DialableLandLineNumber getLandLineNumber ();
-
-       /**
-        * Setter for dialable land-line number
-        * <p>
-        * @param landLine Dialable land-line number
-        */
-       void setLandLineNumber (final DialableLandLineNumber landLine);
-
-       /**
-        * Getter for dialable fax number
-        * <p>
-        * @return Dialable fax number
-        */
-       DialableFaxNumber getFaxNumber ();
-
-       /**
-        * Setter for dialable fax number
-        * <p>
-        * @param faxNumber Dialable fax number
-        */
-       void setFaxNumber (final DialableFaxNumber faxNumber);
-
-}
index f95bf02a6e05cec00c25cea1e053c5cb0c209633..75bcc4f166a44a8a5b68fa623b73355826348cd1 100644 (file)
@@ -90,21 +90,17 @@ public class JobsLocalizationSessionBean extends BaseJobsController implements J
                        throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLoggedOutUser(), event.getLoggedOutUser().getUserId())); //NOI18N
                }
 
-               // Trace message
-               //* NOISY-DEBUG: */ System.out.println("LandingLocalizationSessionBean:afterUserLogin - EXIT!"); //NOI18N
+               // Clear this bean as well
+               this.clear();
        }
 
        @Override
        public String getLanguage () {
-               //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("JobsLocalizationSessionBean::getLanguage(): locale.language={0} - EXIT!", this.getLocale().getLanguage())); //NOI18N
                return this.getLocale().getLanguage().toLowerCase();
        }
 
        @Override
        public void setLanguage (final String language) {
-               // Log trace message
-               //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("JobsLocalizationSessionBean::setLanguage: language={0} - CALLED!", language)); //NOI18N
-
                // Is the language null?
                if (null == language) {
                        // This may sometimes happen, so abort here
@@ -120,26 +116,18 @@ public class JobsLocalizationSessionBean extends BaseJobsController implements J
                // Get new locale with upper-case country code
                Locale loc = new Locale(splits[0], splits[1]);
 
-               // Log debug message
-               //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("JobsLocalizationSessionBean::setLanguage: loc={0}", loc)); //NOI18N
-
                // Set it here and in the JSF context
                this.setLocale(loc);
                FacesContext.getCurrentInstance().getViewRoot().setLocale(loc);
-
-               // Log trace message
-               //* NOISY-DEBUG: */ System.out.println("JobsLocalizationSessionBean::setLanguage: EXIT!"); //NOI18N
        }
 
        @Override
        public Locale getLocale () {
-               //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("JobsLocalizationSessionBean::getLocale(): locale={0} - EXIT!", this.locale)); //NOI18N
                return this.locale;
        }
 
        @Override
        public void setLocale (final Locale locale) {
-               //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("JobsLocalizationSessionBean::setLocale(): locale={0} - CALLED!", locale)); //NOI18N
                this.locale = locale;
        }
 
@@ -157,20 +145,20 @@ public class JobsLocalizationSessionBean extends BaseJobsController implements J
         */
        @PostConstruct
        public void init () {
-               // Log trace message
-               //* NOISY-DEBUG: */ System.out.println("JobsLocalizationSessionBean::init: CALLED!"); //NOI18N
-
                // Create locale instance from context
                Locale loc = FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
 
-               // Log debug message
-               //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("JobsLocalizationSessionBean::init: loc={0}", loc)); //NOI18N
-
                // Set it here
                this.setLocale(loc);
+       }
 
-               // Log trace message
-               //* NOISY-DEBUG: */ System.out.println("JobsLocalizationSessionBean::init: EXIT!"); //NOI18N
+       /**
+        * Clears this bean
+        */
+       private void clear () {
+               // Clear all fields
+               this.setLanguage(null);
+               this.setLocale(null);
        }
 
 }
index 6c7426285b1cf2674b7b82e7dfc28f9ecfca2d1e..ee37c9e057f70feba9e5dffcd04566d154c85dd8 100644 (file)
@@ -30,7 +30,6 @@ import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.jcountry.data.Country;
 import org.mxchange.jjobs.beans.BaseJobsController;
-import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController;
 import org.mxchange.jphone.events.fax.deleted.AdminDeletedFaxNumberEvent;
 import org.mxchange.jphone.events.fax.deleted.AdminFaxNumberDeletedEvent;
 import org.mxchange.jphone.events.fax.removed.AdminFaxNumberRemovedFromListEvent;
@@ -54,6 +53,7 @@ import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
 import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
 import org.mxchange.jphone.phonenumbers.phone.AdminPhoneSessionBeanRemote;
+import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
 
 /**
  * Administrative controller (bean) for phone numbers
@@ -83,7 +83,7 @@ public class JobsAdminPhoneWebRequestBean extends BaseJobsController implements
         * Bean helper
         */
        @Inject
-       private JobsWebViewHelperController beanHelper;
+       private JobsWebRequestHelperController beanHelper;
 
        /**
         * Choosen fax number
index 99b8fe5f0b327e3e73d001dc681a6e01862e635c..c2b32f4593eb5b1e7c43437cfeb2161a35779f46 100644 (file)
@@ -34,15 +34,22 @@ import org.mxchange.jcoreee.utils.FacesUtils;
 import org.mxchange.jjobs.beans.BaseJobsController;
 import org.mxchange.jjobs.beans.contact.JobsAdminContactWebRequestController;
 import org.mxchange.jjobs.beans.contact.JobsContactWebSessionController;
-import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController;
+import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
 import org.mxchange.jjobs.beans.localization.JobsLocalizationSessionController;
 import org.mxchange.jusercore.container.login.UserLoginContainer;
+import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent;
 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
+import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
 import org.mxchange.jusercore.events.user.delete.AdminDeletedUserEvent;
+import org.mxchange.jusercore.events.user.delete.ObservableAdminDeletedUserEvent;
 import org.mxchange.jusercore.events.user.linked.AdminLinkedUserEvent;
+import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent;
 import org.mxchange.jusercore.events.user.locked.AdminLockedUserEvent;
+import org.mxchange.jusercore.events.user.locked.ObservableAdminLockedUserEvent;
 import org.mxchange.jusercore.events.user.unlocked.AdminUnlockedUserEvent;
+import org.mxchange.jusercore.events.user.unlocked.ObservableAdminUnlockedUserEvent;
 import org.mxchange.jusercore.events.user.update.AdminUpdatedUserDataEvent;
+import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataEvent;
 import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
 import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
@@ -57,13 +64,6 @@ import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
 import org.mxchange.jusercore.model.user.UserUtils;
 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
 import org.mxchange.jusercore.model.user.status.UserAccountStatus;
-import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent;
-import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
-import org.mxchange.jusercore.events.user.delete.ObservableAdminDeletedUserEvent;
-import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent;
-import org.mxchange.jusercore.events.user.locked.ObservableAdminLockedUserEvent;
-import org.mxchange.jusercore.events.user.unlocked.ObservableAdminUnlockedUserEvent;
-import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataEvent;
 
 /**
  * A user controller (bean)
@@ -101,7 +101,7 @@ public class JobsAdminUserWebRequestBean extends BaseJobsController implements J
         * Bean helper
         */
        @Inject
-       private JobsWebViewHelperController beanHelper;
+       private JobsWebRequestHelperController beanHelper;
 
        /**
         * Regular contact controller
@@ -358,13 +358,10 @@ public class JobsAdminUserWebRequestBean extends BaseJobsController implements J
                // Get user instance
                User registeredUser = event.getRegisteredUser();
 
-               // Debug message
-               //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("UserWebBean:afterRegistration: registeredUser={0}", registeredUser)); //NOI18N
+               // @TODO Nothing to do with the user here?
+
                // Clear all data
                this.clear();
-
-               // Trace message
-               //* NOISY-DEBUG: */ System.out.println("UserWebBean:afterRegistration: EXIT!"); //NOI18N
        }
 
        @Override
index 38a3ab941a0a2fcae769cca15c558343778ce36d..d5599e858bca5e5879c368cfefe15510b632b554 100644 (file)
@@ -17,8 +17,8 @@
 package org.mxchange.jjobs.beans.user;
 
 import java.io.Serializable;
-import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent;
+import org.mxchange.jusercore.model.user.User;
 
 /**
  * An interface for user beans
index 0ff70e1031a83105576ff2d7c4d036a688b28db6..7fa87f57f9694f9afc8369064ef9094835c484e4 100644 (file)
@@ -33,7 +33,6 @@ import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.jjobs.beans.BaseJobsController;
-import org.mxchange.jjobs.beans.helper.JobsWebViewHelperController;
 import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jusercore.model.user.activity.LogableUserActivity;
 import org.mxchange.jusercore.model.user.activity.UserActivityLog;
@@ -52,6 +51,7 @@ import org.mxchange.jusercore.events.user.password_change.ObservableUpdatedUserP
 import org.mxchange.jusercore.events.user.unlocked.ObservableAdminUnlockedUserEvent;
 import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataEvent;
 import org.mxchange.jusercore.events.user.update.ObservableUpdatedUserPersonalDataEvent;
+import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
 
 /**
  * A controller (bean) for user activity log
@@ -71,7 +71,7 @@ public class JobsUserActivityWebApplicationBean extends BaseJobsController imple
         * Bean helper
         */
        @Inject
-       private JobsWebViewHelperController beanHelper;
+       private JobsWebRequestHelperController beanHelper;
 
        /**
         * EJB for user activity log
index 5985a731883b14ac03188647682166b05e74db32..1fe96ee93b8ac01b30647dfe7430533f53403b85 100644 (file)
@@ -68,9 +68,6 @@ public class JobsEmailAddressValidator extends BaseStringValidator implements Va
 
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
-               // Trace message
-               //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
-
                // The required field
                String[] requiredFields = {"emailAddress", "emailAddressRepeat", "resendEmailAddress"}; //NOI18N
 
@@ -93,6 +90,24 @@ public class JobsEmailAddressValidator extends BaseStringValidator implements Va
                        // Not matching
                        throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, message, message));
                }
+
+               // Get client id (aka form id)
+               String clientId = component.getClientId();
+
+               // Is the email address already registered?
+               if ((!clientId.endsWith("resendEmailAddress")) && (this.contactBean.isEmailAddressRegistered(emailAddress))) { //NOI18N
+                       // Generate message
+                       String message = MessageFormat.format("Email address {0} is already registered.", emailAddress); //NOI18N
+
+                       // No, then abort here
+                       throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_INFO, message, message));
+               } else if ((clientId.endsWith("resendEmailAddress")) && (!this.contactBean.isEmailAddressRegistered(emailAddress))) { //NOI18N
+                       // Generate message
+                       String message = MessageFormat.format("Email address {0} is not registered.", emailAddress); //NOI18N
+
+                       // No, then abort here
+                       throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_INFO, message, message));
+               }
        }
 
 }
index 507b45b65b7e3eda89f8609d04ea8816751ef66a..1b8912ab279c4944bf186ed45e47bb9b79e848e8 100644 (file)
@@ -38,16 +38,11 @@ public class JobsNameValidator extends BaseStringValidator implements Validator
 
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
-               // Trace message
-               //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
-
                // All accepted, required fields
                String[] requiredFields = {"firstName", "familyName", "city", "street", "addressbookName"}; //NOI18N
 
                // Pre-validation (example: not null, not a string, empty string ...)
                super.preValidate(context, component, value, requiredFields, false);
-
-               // Trace message
-               //* NOISY-DEBUG: */ System.out.println("validate: EXIT!"); //NOI18N
        }
+
 }
index ec513437cc04682512ef0a37b4e09008bd7086bc..fa771d3daa8f3bd15aed310d0cda978829b62a4a 100644 (file)
@@ -56,9 +56,6 @@ public class JobsUserPasswordValidator extends BaseStringValidator implements Va
 
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
-               // Trace message
-               // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
-
                // The required field
                String[] requiredFields = {"currentPassword"}; //NOI18N
 
@@ -76,9 +73,6 @@ public class JobsUserPasswordValidator extends BaseStringValidator implements Va
                        throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Password mismatching.", "The password the user has entered does not match the stored password.")); //NOI18N
                }
                 */
-
-               // Trace message
-               // NOISY-DEBUG: this.loggerBeanLocal.logTrace("validate: EXIT!"); //NOI18N
        }
 
 }
index 76f26adfa2a8047c6bb0456318f99fdff0c2307f..ddaec6a82e583e8227e2ed758caa33afe28d442b 100644 (file)
@@ -38,16 +38,10 @@ public class JobsPrivacyTermsCheckboxValidator extends BaseBooleanValidator impl
 
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
-               // Trace message
-               //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
-
                // All accepted, required fields
                String[] requiredFields = {"privacy", "terms"}; //NOI18N
 
                // Pre-validation (example: not null, not a string, empty string ...)
                super.preValidate(context, component, value, requiredFields, false);
-
-               // Trace message
-               //* NOISY-DEBUG: */ System.out.println("validate: EXIT!"); //NOI18N
        }
 }
index 99ca192e2f57a76472a089451294030152399eb4..66daec0f7395c06f796a8f589137790be0a8b16a 100644 (file)
@@ -82,7 +82,7 @@ public class JobsUserIdValidator extends BaseLongValidator implements Validator
         */
        public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) {
                // Trace message
-               // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("UserIdValidator:afterRegistrationEvent: event={0} - CALLED!", event)); //NOI18N
+               // NOISY-DEBUG: this.loggerBeanLocal.logTrace(MessageFormat.format("UserIdValidator:afterUserRegistrationEvent: event={0} - CALLED!", event)); //NOI18N
 
                // event should not be null
                if (null == event) {
@@ -103,13 +103,13 @@ public class JobsUserIdValidator extends BaseLongValidator implements Validator
                User registeredUser = event.getRegisteredUser();
 
                // Debug message
-               // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("UserIdValidator:afterRegistrationEvent: registeredUser={0}", registeredUser)); //NOI18N
+               // NOISY-DEBUG: this.loggerBeanLocal.logDebug(MessageFormat.format("UserIdValidator:afterUserRegistrationEvent: registeredUser={0}", registeredUser)); //NOI18N
 
                // Update cache
                JobsUserIdValidator.cachedStatus.add(registeredUser.getUserId());
 
                // Trace message
-               // NOISY-DEBUG: this.loggerBeanLocal.logTrace("UserIdValidator:afterRegistrationEvent: EXIT!"); //NOI18N
+               // NOISY-DEBUG: this.loggerBeanLocal.logTrace("UserIdValidator:afterUserRegistrationEvent: EXIT!"); //NOI18N
        }
 
        @Override