]> git.mxchange.org Git - jjobs-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Wed, 17 Aug 2016 15:06:28 +0000 (17:06 +0200)
committerRoland Haeder <roland@mxchange.org>
Sun, 21 Aug 2016 19:44:05 +0000 (21:44 +0200)
- fixed wrong copyFooToController() method for fax/land-line
- and implemented those missing methods

src/java/org/mxchange/jjobs/beans/helper/JobsWebRequestController.java
src/java/org/mxchange/jjobs/beans/helper/JobsWebRequestHelper.java
web/admin/fax/admin_fax_edit.xhtml
web/admin/landline/admin_landline_edit.xhtml

index bc7b7f599b13354df8fb29140a78f84d8d9adbf7..538211a53cf3e18908d978ece28cae9dc530471b 100644 (file)
@@ -31,7 +31,17 @@ import org.mxchange.jusercore.model.user.User;
 public interface JobsWebRequestController extends Serializable {
 
        /**
-        * Copies currently set mobile instance's data to admin phone controller
+        * 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 ();
 
index 85acc7edcbab2b450c7ddc6fb0902cebcc09673f..32393096cb571279a212a62e6b9a5ffb5d245546 100644 (file)
@@ -113,6 +113,86 @@ public class JobsWebRequestHelper implements JobsWebRequestController {
                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.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.getFaxNumber().getPhoneAreaCode()== null) {
+                       // Throw again
+                       throw new NullPointerException("this.landLineNumber.phoneAreaCode is null");
+               } else if (this.getFaxNumber().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.setPhoneCountry(this.getLandLineNumber().getPhoneCountry());
+               this.adminPhoneController.setPhoneNumber(this.getLandLineNumber().getPhoneNumber());
+       }
+
        @Override
        public void copyMobileNumberToController () {
                // Validate mobile instance
index af1336577b78ddc586c0dde43ef2522f05a10b2e..c700ac1c9b466023a8f9f9583a1f2b55c72ed9a9 100644 (file)
@@ -9,7 +9,7 @@
 
        <f:metadata>
                <f:viewParam name="phoneId" value="#{beanHelper.faxNumber}" converter="FaxNumberConverter" required="true" requiredMessage="#{msg.ERROR_PARAMETER_PHONE_ID_NOT_SET}" />
-               <f:viewAction action="#{beanHelper.copyMobileNumberToController()}" />
+               <f:viewAction action="#{beanHelper.copyFaxNumberToController()}" />
        </f:metadata>
 
        <ui:composition template="/WEB-INF/templates/admin/admin_base.tpl">
index c44d9e2e37a06ba8c31d030d1efe98a956c94bb3..6269f8ea1bafd7ff74c05eb23f61b1ec2366cf8a 100644 (file)
@@ -9,7 +9,7 @@
 
        <f:metadata>
                <f:viewParam name="phoneId" value="#{beanHelper.landLineNumber}" converter="LandLineNumberConverter" required="true" requiredMessage="#{msg.ERROR_PARAMETER_PHONE_ID_NOT_SET}" />
-               <f:viewAction action="#{beanHelper.copyMobileNumberToController()}" />
+               <f:viewAction action="#{beanHelper.copyLandLineNumberToController()}" />
        </f:metadata>
 
        <ui:composition template="/WEB-INF/templates/admin/admin_base.tpl">