]> git.mxchange.org Git - jjobs-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Tue, 23 Aug 2016 10:16:21 +0000 (12:16 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 24 Aug 2016 19:42:11 +0000 (21:42 +0200)
- edit/delete(Fax|LandLine|Mobile)Data() must have the phone number being handled over as a parameter
- the instance in beanHelper is null on POST (-back)
- setting onPostback="true" overrides the set value (from JSF page)
- so it needs to be as a parameter

src/java/org/mxchange/jjobs/beans/phone/JobsAdminPhoneWebRequestBean.java
src/java/org/mxchange/jjobs/beans/phone/JobsAdminPhoneWebRequestController.java
src/java/org/mxchange/jjobs/validator/booleans/JobsUserProfileVisibilityValidator.java
web/admin/fax/admin_fax_delete.xhtml
web/admin/fax/admin_fax_edit.xhtml
web/admin/landline/admin_landline_delete.xhtml
web/admin/landline/admin_landline_edit.xhtml
web/admin/mobile/admin_mobile_delete.xhtml
web/admin/mobile/admin_mobile_edit.xhtml

index 22ae9972442c640dadf3b496127523ef8066f909..596d0a3e5d8e3cb8620d171342ecee7035993adb 100644 (file)
@@ -212,74 +212,77 @@ public class JobsAdminPhoneWebRequestBean extends BaseJobsController implements
        }
 
        @Override
-       public String deleteMobileData () {
+       public String deleteMobileData (final DialableMobileNumber mobileNumber) {
+               // Log message
+               System.out.println(MessageFormat.format("{0}.deleteMobileData: mobileNumber={1} - CALLED!", this.getClass().getSimpleName(), mobileNumber)); //NOI18N
+
                // Is all data set
-               if (this.beanHelper.getMobileNumber() == null) {
+               if (mobileNumber == null) {
                        // Not set, throw NPE
-                       throw new NullPointerException("this.beanHelper.mobileNumber is null"); //NOI18N
-               } else if (this.beanHelper.getMobileNumber().getPhoneId() == null) {
+                       throw new NullPointerException("mobileNumber is null"); //NOI18N
+               } else if (mobileNumber.getPhoneId() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("this.beanHelper.mobileNumber.phoneId is null"); //NOI18N
-               } else if (this.beanHelper.getMobileNumber().getPhoneId() < 1) {
+                       throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N
+               } else if (mobileNumber.getPhoneId() < 1) {
                        // Invalid number
-                       throw new IllegalArgumentException(MessageFormat.format("this.beanHelper.mobileNumber.phoneId={0} is not valid", this.beanHelper.getMobileNumber().getPhoneId())); //NOI18N
-               } else if (this.beanHelper.getMobileNumber().getMobileProvider() == null) {
+                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", mobileNumber.getPhoneId())); //NOI18N
+               } else if (mobileNumber.getMobileProvider() == null) {
                        // Throw NPE
-                       throw new NullPointerException("this.beanHelper.mobileNumber.mobileProvider is null"); //NOI18N
-               } else if (this.beanHelper.getMobileNumber().getMobileProvider().getProviderId() == null) {
+                       throw new NullPointerException("mobileNumber.mobileProvider is null"); //NOI18N
+               } else if (mobileNumber.getMobileProvider().getProviderId() == null) {
                        // ... throw again
-                       throw new NullPointerException("this.beanHelper.mobileNumber.mobileProvider.providerId is null"); //NOI18N
-               } else if (this.beanHelper.getMobileNumber().getMobileProvider().getProviderId() < 1) {
+                       throw new NullPointerException("mobileNumber.mobileProvider.providerId is null"); //NOI18N
+               } else if (mobileNumber.getMobileProvider().getProviderId() < 1) {
                        // Id not valid
-                       throw new IllegalArgumentException(MessageFormat.format("this.beanHelper.mobileNumber.mobileProvider.providerId={0} is not valid.", this.beanHelper.getMobileNumber().getMobileProvider().getProviderId())); //NOI18N
-               } else if (this.beanHelper.getMobileNumber().getPhoneNumber() == null) {
+                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileProvider.providerId={0} is not valid.", mobileNumber.getMobileProvider().getProviderId())); //NOI18N
+               } else if (mobileNumber.getPhoneNumber() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("this.beanHelper.mobileNumber.phoneNumber is null"); //NOI18N
-               } else if (this.beanHelper.getMobileNumber().getPhoneNumber() < 1) {
+                       throw new NullPointerException("mobileNumber.phoneNumber is null"); //NOI18N
+               } else if (mobileNumber.getPhoneNumber() < 1) {
                        // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("this.beanHelper.mobileNumber.phoneNumber={0} is not valid.", this.beanHelper.getMobileNumber().getPhoneNumber())); //NOI18N
+                       throw new NullPointerException(MessageFormat.format("mobileNumber.phoneNumber={0} is not valid.", mobileNumber.getPhoneNumber())); //NOI18N
                }
 
                // Call EJB
-               this.adminPhoneBean.deleteMobileData(this.beanHelper.getMobileNumber());
+               this.adminPhoneBean.deleteMobileData(mobileNumber);
 
                // Fire event
-               this.mobileNumberDeletedEvent.fire(new AdminMobileNumberDeletedEvent(this.beanHelper.getMobileNumber()));
+               this.mobileNumberDeletedEvent.fire(new AdminMobileNumberDeletedEvent(mobileNumber));
 
                // All fine, redirect
                return "admin_list_mobile"; //NOI18N
        }
 
        @Override
-       public String editMobileData () {
+       public String editMobileData (final DialableMobileNumber mobileNumber) {
                // Log message
-               System.out.println(MessageFormat.format("{0}.editMobileData: CALLED!", this.getClass().getSimpleName())); //NOI18N
+               System.out.println(MessageFormat.format("{0}.editMobileData: mobileNumber={1} - CALLED!", this.getClass().getSimpleName(), mobileNumber)); //NOI18N
 
                // Is all data set
-               if (this.beanHelper.getMobileNumber() == null) {
+               if (mobileNumber == null) {
                        // Not set, throw NPE
-                       throw new NullPointerException("this.beanHelper.mobileNumber is null"); //NOI18N
-               } else if (this.beanHelper.getMobileNumber().getPhoneId() == null) {
+                       throw new NullPointerException("mobileNumber is null"); //NOI18N
+               } else if (mobileNumber.getPhoneId() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("this.beanHelper.mobileNumber.phoneId is null"); //NOI18N
-               } else if (this.beanHelper.getMobileNumber().getPhoneId() < 1) {
+                       throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N
+               } else if (mobileNumber.getPhoneId() < 1) {
                        // Invalid number
-                       throw new IllegalArgumentException(MessageFormat.format("this.beanHelper.mobileNumber.phoneId={0} is not valid", this.beanHelper.getMobileNumber().getPhoneId())); //NOI18N
-               } else if (this.beanHelper.getMobileNumber().getMobileProvider() == null) {
+                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", mobileNumber.getPhoneId())); //NOI18N
+               } else if (mobileNumber.getMobileProvider() == null) {
                        // Throw NPE
-                       throw new NullPointerException("this.beanHelper.mobileNumber.mobileProvider is null"); //NOI18N
-               } else if (this.beanHelper.getMobileNumber().getMobileProvider().getProviderId() == null) {
+                       throw new NullPointerException("mobileNumber.mobileProvider is null"); //NOI18N
+               } else if (mobileNumber.getMobileProvider().getProviderId() == null) {
                        // ... throw again
-                       throw new NullPointerException("this.beanHelper.mobileNumber.mobileProvider.providerId is null"); //NOI18N
-               } else if (this.beanHelper.getMobileNumber().getMobileProvider().getProviderId() < 1) {
+                       throw new NullPointerException("mobileNumber.mobileProvider.providerId is null"); //NOI18N
+               } else if (mobileNumber.getMobileProvider().getProviderId() < 1) {
                        // Id not valid
-                       throw new IllegalArgumentException(MessageFormat.format("this.beanHelper.mobileNumber.mobileProvider.providerId={0} is not valid.", this.beanHelper.getMobileNumber().getMobileProvider().getProviderId())); //NOI18N
-               } else if (this.beanHelper.getMobileNumber().getPhoneNumber() == null) {
+                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileProvider.providerId={0} is not valid.", mobileNumber.getMobileProvider().getProviderId())); //NOI18N
+               } else if (mobileNumber.getPhoneNumber() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("this.beanHelper.mobileNumber.phoneNumber is null"); //NOI18N
-               } else if (this.beanHelper.getMobileNumber().getPhoneNumber() < 1) {
+                       throw new NullPointerException("mobileNumber.phoneNumber is null"); //NOI18N
+               } else if (mobileNumber.getPhoneNumber() < 1) {
                        // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("this.beanHelper.mobileNumber.phoneNumber={0} is not valid.", this.beanHelper.getMobileNumber().getPhoneNumber())); //NOI18N
+                       throw new NullPointerException(MessageFormat.format("mobileNumber.phoneNumber={0} is not valid.", mobileNumber.getPhoneNumber())); //NOI18N
                } else if (this.getMobileProvider() == null) {
                        // Not provided
                        this.showFacesMessage("form_edit_mobile:mobileProvider", "ERROR_ADMIN_NO_MOBILE_PROVIDER_SELECTED"); //NOI18N
@@ -297,10 +300,10 @@ public class JobsAdminPhoneWebRequestBean extends BaseJobsController implements
                }
 
                // Log message
-               System.out.println(MessageFormat.format("{0}.editMobileData: this.mobileProvider.providerId={1},this.beanHelper.mobileNumber.mobileProvider.providerId={2},this.phoneNumber={3},this.beanHelper.mobileNumber.phoneNumber={4}", this.getClass().getSimpleName(), this.getMobileProvider().getProviderId(), this.beanHelper.getMobileNumber().getMobileProvider().getProviderId(), this.getPhoneNumber(), this.beanHelper.getMobileNumber().getPhoneNumber())); //NOI18N
+               System.out.println(MessageFormat.format("{0}.editMobileData: this.mobileProvider.providerId={1},mobileNumber.mobileProvider.providerId={2},this.phoneNumber={3},mobileNumber.phoneNumber={4}", this.getClass().getSimpleName(), this.getMobileProvider().getProviderId(), mobileNumber.getMobileProvider().getProviderId(), this.getPhoneNumber(), mobileNumber.getPhoneNumber())); //NOI18N
 
                // Is the mobile provider and number the same?
-               if ((Objects.equals(this.getMobileProvider(), this.beanHelper.getMobileNumber().getMobileProvider())) && (Objects.equals(this.getPhoneNumber(), this.beanHelper.getMobileNumber().getPhoneNumber()))) {
+               if ((Objects.equals(this.getMobileProvider(), mobileNumber.getMobileProvider())) && (Objects.equals(this.getPhoneNumber(), mobileNumber.getPhoneNumber()))) {
                        // Log message
                        System.out.println(MessageFormat.format("{0}.editMobileData: No difference - EXIT!", this.getClass().getSimpleName())); //NOI18N
 
@@ -312,11 +315,11 @@ public class JobsAdminPhoneWebRequestBean extends BaseJobsController implements
                }
 
                // Set all data
-               this.beanHelper.getMobileNumber().setMobileProvider(this.getMobileProvider());
-               this.beanHelper.getMobileNumber().setPhoneNumber(this.getPhoneNumber());
+               mobileNumber.setMobileProvider(this.getMobileProvider());
+               mobileNumber.setPhoneNumber(this.getPhoneNumber());
 
                // Send to bean
-               DialableMobileNumber updatedNumber = this.adminPhoneBean.updateMobileData(this.beanHelper.getMobileNumber());
+               DialableMobileNumber updatedNumber = this.adminPhoneBean.updateMobileData(mobileNumber);
 
                // Fire event
                this.mobileNumberUpdatedEvent.fire(new AdminMobileNumberUpdatedEvent(updatedNumber));
index 278b72e940534da3255163c242315f012202fbba..436a48d1040aa219a1832cb933685e5a2ed7f71f 100644 (file)
@@ -58,16 +58,20 @@ public interface JobsAdminPhoneWebRequestController extends Serializable {
        /**
         * Deletes given mobile entry data
         * <p>
+        * @param mobileNumber Mobile number to delete
+        * <p>
         * @return Redirect outcome
         */
-       String deleteMobileData ();
+       String deleteMobileData (final DialableMobileNumber mobileNumber);
 
        /**
         * Changes mobile entry data
         * <p>
+        * @param mobileNumber Mobile number to change data
+        * <p>
         * @return Redirect outcome
         */
-       String editMobileData ();
+       String editMobileData (final DialableMobileNumber mobileNumber);
 
        /**
         * Getter for mobile provider
index 2b948d292aba9a737c734bddc7abaded3a5b07e9..0fcf0e6a1681628f6936cbd2148f4c851a3a2e13 100644 (file)
@@ -16,7 +16,6 @@
  */
 package org.mxchange.jjobs.validator.booleans;
 
-import java.text.MessageFormat;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.validator.FacesValidator;
@@ -39,20 +38,11 @@ public class JobsUserProfileVisibilityValidator extends BaseBooleanValidator imp
 
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
-               // Log message
-               System.out.println(MessageFormat.format("{0}.validate: context={1},component={2},value={3} - CALLED!", this.getClass().getSimpleName(), context, component, value));
-
                // The required field
                String[] requiredFields = {"landLineAreaCode", "landLineNumber", "faxAreaCode", "faxNumber", "mobileNumber"}; //NOI18N
 
-               // Log message
-               System.out.println(MessageFormat.format("{0}.validate: component.clientId={1}", this.getClass().getSimpleName(), component.getClientId()));
-
                // Pre-validation (example: not null, not a string, empty string ...)
                super.preValidate(context, component, value, requiredFields, true);
-
-               // Log message
-               System.out.println(MessageFormat.format("{0}.validate: EXIT!", this.getClass().getSimpleName()));
        }
 
 }
index 508a6ff0ddd6583d8560971490c2065b8c1dbfd8..d16f48864259cc144cc1cc19549b0abab8eb5360 100644 (file)
@@ -41,7 +41,7 @@
                                        </div>
 
                                        <div class="table_footer">
-                                               <h:commandButton styleClass="delete_button" type="submit" id="delete_fax" value="#{msg.BUTTON_ADMIN_DELETE_FAX}" action="#{adminPhoneController.deleteMobileData()}" />
+                                               <h:commandButton styleClass="delete_button" type="submit" id="delete_fax" value="#{msg.BUTTON_ADMIN_DELETE_FAX}" action="#{adminPhoneController.deleteFaxData(beanHelper.faxNumber)}" />
                                        </div>
                                </h:panelGroup>
                        </h:form>
index a15bc787dcd8b43b0cbf3740eed3a4d3f6dc8e6b..e9947aba7448b4bcb47abe0542e5f7d2b1ee8e6d 100644 (file)
@@ -36,7 +36,7 @@
 
                                        <div class="table_footer">
                                                <h:commandButton styleClass="reset right_space" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
-                                               <h:commandButton styleClass="submit" type="submit" id="edit_fax" value="#{msg.BUTTON_ADMIN_EDIT_FAX_NUMBER}" action="#{adminPhoneController.editMobileData()}" />
+                                               <h:commandButton styleClass="submit" type="submit" id="edit_fax" value="#{msg.BUTTON_ADMIN_EDIT_FAX_NUMBER}" action="#{adminPhoneController.editFaxData(beanHelper.faxNumber)}" />
                                        </div>
                                </h:panelGroup>
                        </h:form>
index f0079984ce777b623728beb439b1f1e57053192d..193d26b7c5742b816ca955d0b84f2479028c755e 100644 (file)
@@ -41,7 +41,7 @@
                                        </div>
 
                                        <div class="table_footer">
-                                               <h:commandButton styleClass="delete_button" type="submit" id="delete_landline" value="#{msg.BUTTON_ADMIN_DELETE_LAND_LINE}" action="#{adminPhoneController.deleteMobileData()}" />
+                                               <h:commandButton styleClass="delete_button" type="submit" id="delete_landline" value="#{msg.BUTTON_ADMIN_DELETE_LAND_LINE}" action="#{adminPhoneController.deleteLandLineData(beanHelper.landLineNumber)}" />
                                        </div>
                                </h:panelGroup>
                        </h:form>
index 6a25bc4c879f8ff2ca0ef800aaec007756f2b0bd..0cd4560ea73b5ec10905015294f8d57ec81ecea1 100644 (file)
@@ -36,7 +36,7 @@
 
                                        <div class="table_footer">
                                                <h:commandButton styleClass="reset right_space" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
-                                               <h:commandButton styleClass="submit" type="submit" id="edit_landline" value="#{msg.BUTTON_ADMIN_EDIT_LAND_LINE_NUMBER}" action="#{adminPhoneController.editMobileData()}" />
+                                               <h:commandButton styleClass="submit" type="submit" id="edit_landline" value="#{msg.BUTTON_ADMIN_EDIT_LAND_LINE_NUMBER}" action="#{adminPhoneController.editLandLineData(beanHelper.landLineNumber)}" />
                                        </div>
                                </h:panelGroup>
                        </h:form>
index 7f0d5b902a0a19f43e9127da07886d6e7405c830..401efee601d87b2a41ccf159a568c111413cf48d 100644 (file)
@@ -41,7 +41,7 @@
                                        </div>
 
                                        <div class="table_footer">
-                                               <h:commandButton styleClass="delete_button" type="submit" id="delete_mobile" value="#{msg.BUTTON_ADMIN_DELETE_MOBILE_NUMBER}" action="#{adminPhoneController.deleteMobileData()}" />
+                                               <h:commandButton styleClass="delete_button" type="submit" id="delete_mobile" value="#{msg.BUTTON_ADMIN_DELETE_MOBILE_NUMBER}" action="#{adminPhoneController.deleteMobileData(beanHelper.mobileNumber)}" />
                                        </div>
                                </h:panelGroup>
                        </h:form>
index b2ff95ddb38a76b2f3e5cb5e4842632d702d3856..f8062a1fc29443edb7f1c822aacabd443c1fcca0 100644 (file)
@@ -36,7 +36,7 @@
 
                                        <div class="table_footer">
                                                <h:commandButton styleClass="reset right_space" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
-                                               <h:commandButton styleClass="submit" type="submit" id="edit_mobile" value="#{msg.BUTTON_ADMIN_EDIT_MOBILE_NUMBER}" action="#{adminPhoneController.editMobileData()}" />
+                                               <h:commandButton styleClass="submit" type="submit" id="edit_mobile" value="#{msg.BUTTON_ADMIN_EDIT_MOBILE_NUMBER}" action="#{adminPhoneController.editMobileData(beanHelper.mobileNumber)}" />
                                        </div>
                                </h:panelGroup>
                        </h:form>