]> git.mxchange.org Git - jjobs-war.git/blobdiff - src/java/org/mxchange/jjobs/beans/country/JobsAdminCountryWebRequestBean.java
Closed internal TODO: (please cherry-pick this)
[jjobs-war.git] / src / java / org / mxchange / jjobs / beans / country / JobsAdminCountryWebRequestBean.java
index eed8f3b2173366a568a3b0d432c475264f127b2d..9b6117fe5f5f17fd6106d848e414f0b93b83087f 100644 (file)
@@ -34,6 +34,7 @@ import org.mxchange.jcountry.data.CountrySingletonBeanRemote;
 import org.mxchange.jcountry.events.AdminAddedCountryEvent;
 import org.mxchange.jcountry.events.AdminEventCountryAdded;
 import org.mxchange.jcountry.exceptions.CountryAlreadyAddedException;
+import org.mxchange.jjobs.beans.BaseJobsController;
 
 /**
  * An administrative country bean
@@ -42,7 +43,7 @@ import org.mxchange.jcountry.exceptions.CountryAlreadyAddedException;
  */
 @Named ("adminCountryController")
 @RequestScoped
-public class JobsAdminCountryWebRequestBean implements JobsAdminCountryWebRequestController {
+public class JobsAdminCountryWebRequestBean extends BaseJobsController implements JobsAdminCountryWebRequestController {
 
        /**
         * Serial number
@@ -115,7 +116,7 @@ public class JobsAdminCountryWebRequestBean implements JobsAdminCountryWebReques
        }
 
        @Override
-       public void addCountry () {
+       public String addCountry () {
                // Create new country object
                Country country = new CountryData();
 
@@ -123,7 +124,7 @@ public class JobsAdminCountryWebRequestBean implements JobsAdminCountryWebReques
                country.setCountryAbroadDialPrefix(this.getCountryAbroadDialPrefix());
                country.setCountryCode(this.getCountryCode());
                country.setCountryExternalDialPrefix(this.getCountryExternalDialPrefix());
-               country.setCountryI18nkey(this.getCountryI18nKey());
+               country.setCountryI18nKey(this.getCountryI18nKey());
                country.setCountryIsLocalPrefixRequired(this.getCountryIsLocalPrefixRequired());
                country.setCountryPhoneCode(this.getCountryPhoneCode());
 
@@ -147,8 +148,8 @@ public class JobsAdminCountryWebRequestBean implements JobsAdminCountryWebReques
                // Fire event
                this.addedCountryEvent.fire(new AdminEventCountryAdded(updatedCountry));
 
-               // Clear bean
-               this.clear();
+               // Redirect to list
+               return "admin_list_country"; //NOI18N
        }
 
        @Override
@@ -222,19 +223,6 @@ public class JobsAdminCountryWebRequestBean implements JobsAdminCountryWebReques
                return (!this.allCountries().isEmpty());
        }
 
-       /**
-        * Clears this bean
-        */
-       private void clear () {
-               // Clear all
-               this.setCountryAbroadDialPrefix(null);
-               this.setCountryCode(null);
-               this.setCountryExternalDialPrefix(null);
-               this.setCountryI18nKey(null);
-               this.setCountryIsLocalPrefixRequired(null);
-               this.setCountryPhoneCode(null);
-       }
-
        /**
         * Checks if given country is already added by iterating over the whole list
         * and try to find it.
@@ -259,7 +247,7 @@ public class JobsAdminCountryWebRequestBean implements JobsAdminCountryWebReques
                        Country next = iterator.next();
 
                        // Is country code or i18n the same?
-                       if ((Objects.equals(country.getCountryCode(), next.getCountryCode())) || (Objects.equals(country.getCountryI18nkey(), next.getCountryI18nkey()))) {
+                       if ((Objects.equals(country.getCountryCode(), next.getCountryCode())) || (Objects.equals(country.getCountryI18nKey(), next.getCountryI18nKey()))) {
                                // Yes, then abort search
                                isAdded = true;
                                break;