From 7ad1d4c4c17a968429290a37a43107fcbde8e423 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 27 Apr 2016 12:30:07 +0200 Subject: [PATCH] added redirection outcomes to all "addFoo" methods --- .../beans/country/PizzaAdminCountryWebRequestBean.java | 5 ++++- .../country/PizzaAdminCountryWebRequestController.java | 7 +++++-- .../PizzaAdminMobileProviderWebRequestBean.java | 5 ++++- .../PizzaAdminMobileProviderWebRequestController.java | 6 ++++-- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/java/org/mxchange/pizzaapplication/beans/country/PizzaAdminCountryWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/country/PizzaAdminCountryWebRequestBean.java index 9a1be700..014bcbe6 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/country/PizzaAdminCountryWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/country/PizzaAdminCountryWebRequestBean.java @@ -115,7 +115,7 @@ public class PizzaAdminCountryWebRequestBean implements PizzaAdminCountryWebRequ } @Override - public void addCountry () { + public String addCountry () { // Create new country object Country country = new CountryData(); @@ -146,6 +146,9 @@ public class PizzaAdminCountryWebRequestBean implements PizzaAdminCountryWebRequ // Fire event this.addedCountryEvent.fire(new AdminEventCountryAdded(updatedCountry)); + + // Redirect to list + return "admin_list_country"; //NOI18N } @Override diff --git a/src/java/org/mxchange/pizzaapplication/beans/country/PizzaAdminCountryWebRequestController.java b/src/java/org/mxchange/pizzaapplication/beans/country/PizzaAdminCountryWebRequestController.java index 64222449..d0e7d9f6 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/country/PizzaAdminCountryWebRequestController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/country/PizzaAdminCountryWebRequestController.java @@ -35,9 +35,12 @@ public interface PizzaAdminCountryWebRequestController extends Serializable { List allCountries (); /** - * Adds country to all relevant beans and sends it to the EJB. + * Adds country to all relevant beans and sends it to the EJB. A redirect + * should happen after successfull creation. + *

+ * @return Redirect outcome */ - void addCountry (); + String addCountry (); /** * Checks whether countries has been registered diff --git a/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java index 465e5de6..1e587dc6 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java @@ -106,7 +106,7 @@ public class PizzaAdminMobileProviderWebRequestBean implements PizzaAdminMobileP } @Override - public void addMobileProvider () { + public String addMobileProvider () { // Create mobile provider instance MobileProvider mobileProvider = new CellphoneProvider(this.getProviderDialPrefix(), this.getProviderName(), this.getProviderCountry(), this.getProviderMailPattern()); @@ -129,6 +129,9 @@ public class PizzaAdminMobileProviderWebRequestBean implements PizzaAdminMobileP // Fire event this.providerAddedEvent.fire(new AdminMobileProviderAddedEvent(updatedProvider)); + + // Redirect to list + return "admin_list_mobile_provider"; //NOI18N } @Override diff --git a/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestController.java b/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestController.java index 558de55b..d3d340ac 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestController.java @@ -32,9 +32,11 @@ public interface PizzaAdminMobileProviderWebRequestController extends Serializab /** * Adds a mobile provider to database by calling the EJB. A pre-check on * dial-prefix and country combination is done, if found, an exception is - * thrown. + * thrown. A redirect should take place after successfull creation. + *

+ * @return Redirect outcome */ - void addMobileProvider (); + String addMobileProvider (); /** * Returns a list of all mobile providers -- 2.39.5