]> git.mxchange.org Git - jfinancials-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Sat, 25 Apr 2020 16:41:39 +0000 (18:41 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 25 Apr 2020 16:41:39 +0000 (18:41 +0200)
- introduced new administrative action backing bean (add/update/delete being
  done here)
- land-line, fax and mobile instances must be intialized with null first, then
  check all respective backing bean properties if they all exist. This fixes
  the NPEs coming from updated constructors
- check Country instance against the interface Country and not not being null
- added missing i18n string

Signed-off-by: Roland Häder <roland@mxchange.org>
12 files changed:
src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsAdminBasicDataWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/business/branchoffice/action/FinancialsAdminBranchOfficeActionWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/business/headquarter/FinancialsAdminHeadquarterWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/business/headquarter/action/FinancialsAdminHeadquarterActionWebRequestBean.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/business/headquarter/action/FinancialsAdminHeadquarterActionWebRequestController.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestBean.java
src/java/org/mxchange/localization/generic_de_DE.properties
src/java/org/mxchange/localization/generic_en_US.properties
web/WEB-INF/templates/admin/headquarter/admin_form_headquarter.tpl
web/WEB-INF/templates/admin/headquarter/admin_form_headquarter_opening_time.tpl
web/admin/headquarter/admin_headquarter_list.xhtml

index dbfb419c7916e16c6c5d54fe644ee5c5a6acbc28..387e1b1495dd8a2ae686a481d41c479e9e39465f 100644 (file)
@@ -198,13 +198,13 @@ public class FinancialsAdminBasicDataWebRequestBean extends BaseFinancialsBean i
                DialableFaxNumber fax = null;
 
                // Are all 3 fields set?
-               if (this.getLandLineAreaCode() != null && this.getLandLineCountry() != null && this.getLandLineNumber() != null) {
+               if (this.getLandLineAreaCode() != null && this.getLandLineCountry() instanceof Country && this.getLandLineNumber() != null) {
                        // Initialize land number number instance
                        landLine = new LandLineNumber(this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
                }
 
                // Are all 3 fields set?
-               if (this.getFaxAreaCode() != null && this.getFaxCountry() != null && this.getFaxNumber() != null) {
+               if (this.getFaxAreaCode() != null && this.getFaxCountry() instanceof Country && this.getFaxNumber() != null) {
                        // Initialzie fax number instance
                        fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
                }
index d84e53ab63974d8d5157b857944389b39366246d..e2ea689fefc67c4e8f654e47e77255a49d17ae0c 100644 (file)
@@ -996,13 +996,13 @@ public class FinancialsAdminBranchOfficeActionWebRequestBean extends BaseFinanci
                DialableFaxNumber fax = null;
 
                // Are all required fields set?
-               if (this.getLandLineAreaCode() != null && this.getLandLineCountry() != null && this.getLandLineNumber() != null) {
+               if (this.getLandLineAreaCode() != null && this.getLandLineCountry() instanceof Country && this.getLandLineNumber() != null) {
                        // Initialize land-line instance
                        landLine = new LandLineNumber(this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
                }
 
                // Are all required fields set?
-               if (this.getFaxAreaCode() != null && this.getFaxCountry() != null && this.getFaxNumber() != null) {
+               if (this.getFaxAreaCode() != null && this.getFaxCountry() instanceof Country && this.getFaxNumber() != null) {
                        // Initialize fax instance
                        fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
                }
index 61b9c5bf2bd472bd7c26cac045efcc09b34e4587..6d97389642cdc6601729f3386d2a456b2dd6aec5 100644 (file)
  */
 package org.mxchange.jfinancials.beans.business.headquarter;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
-import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
-import javax.enterprise.event.Event;
-import javax.enterprise.inject.Any;
-import javax.faces.application.FacesMessage;
-import javax.inject.Inject;
 import javax.inject.Named;
-import org.mxchange.jcontactsbusiness.events.headquarter.added.HeadquarterAddedEvent;
-import org.mxchange.jcontactsbusiness.events.headquarter.added.ObservableHeadquarterAddedEvent;
-import org.mxchange.jcontactsbusiness.exceptions.headquarter.HeadquarterAlreadyAddedException;
-import org.mxchange.jcontactsbusiness.model.employee.Employable;
-import org.mxchange.jcontactsbusiness.model.headquarter.AdminHeadquarterSessionBeanRemote;
-import org.mxchange.jcontactsbusiness.model.headquarter.BusinessHeadquarter;
-import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
-import org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime;
-import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
-import org.mxchange.jcoreee.dates.DayOfTheWeek;
-import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jfinancials.beans.BaseFinancialsBean;
-import org.mxchange.jfinancials.beans.business.headquarter.list.FinancialsHeadquarterListWebViewController;
-import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber;
-import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumber;
-import org.mxchange.jusercore.model.user.User;
 
 /**
  * An administrative bean for headquarter
@@ -55,822 +29,17 @@ import org.mxchange.jusercore.model.user.User;
 @RequestScoped
 public class FinancialsAdminHeadquarterWebRequestBean extends BaseFinancialsBean implements FinancialsAdminHeadquarterWebRequestController {
 
-       /**
-        * Opening times of this headquarter
-        */
-       private static List<OpeningTime> headquarterOpeningTimes;
-
        /**
         * Serial number
         */
        private static final long serialVersionUID = 5_028_697_360_470L;
 
-       /**
-        * EJB for administrative purposes
-        */
-       @EJB (lookup = "java:global/jfinancials-ejb/adminHeadquarter!org.mxchange.jcontactsbusiness.model.headquarter.AdminHeadquarterSessionBeanRemote")
-       private AdminHeadquarterSessionBeanRemote adminHeadquarterBean;
-
-       /**
-        * Area code for fax number
-        */
-       private Integer faxAreaCode;
-
-       /**
-        * Country for fax number
-        */
-       private Country faxCountry;
-
-       /**
-        * Dial number for fax number
-        */
-       private Long faxNumber;
-
-       /**
-        * An event being fired when a headquarter has been successfully added
-        */
-       @Inject
-       @Any
-       private Event<ObservableHeadquarterAddedEvent> headquarterAddedEvent;
-
-       /**
-        * City
-        */
-       private String headquarterCity;
-
-       /**
-        * Headquarter's company name
-        */
-       private String headquarterCompanyName;
-
-       /**
-        * Contact person in headquarter
-        */
-       private Employable headquarterContactEmployee;
-
-       /**
-        * Country
-        */
-       private Country headquarterCountry;
-
-       /**
-        * Email address
-        */
-       private String headquarterEmailAddress;
-
-       /**
-        * House number
-        */
-       private Short headquarterHouseNumber;
-
-       /**
-        * House number's extension
-        */
-       private String headquarterHouseNumberExtension;
-
-       /**
-        * Last house number
-        */
-       private Short headquarterLastHouseNumber;
-
-       /**
-        * A general headquarter controller (backing bean)
-        */
-       @Inject
-       private FinancialsHeadquarterListWebViewController headquarterListController;
-
-       /**
-        * Store
-        */
-       private Short headquarterStore;
-
-       /**
-        * Headquarter street name
-        */
-       private String headquarterStreet;
-
-       /**
-        * Suite number
-        */
-       private Short headquarterSuiteNumber;
-
-       /**
-        * Owning user instance (which this headquarter is assigned to)
-        */
-       private User headquarterUserOwner;
-
-       /**
-        * ZIP code
-        */
-       private Integer headquarterZipCode;
-
-       /**
-        * Area code for land-line number
-        */
-       private Integer landLineAreaCode;
-
-       /**
-        * Country for land-line number
-        */
-       private Country landLineCountry;
-
-       /**
-        * Dial number for land-line number
-        */
-       private Long landLineNumber;
-
-       /**
-        * Ending week day
-        */
-       private DayOfTheWeek openingEndDay;
-
-       /**
-        * Ending time
-        */
-       private Date openingEndTime;
-
-       /**
-        * Starting week day
-        */
-       private DayOfTheWeek openingStartDay;
-
-       /**
-        * Starting time
-        */
-       private Date openingStartTime;
-
        /**
         * Default constructor
         */
        public FinancialsAdminHeadquarterWebRequestBean () {
                // Call super constructor
                super();
-
-               // Is the opening times list there?
-               if (null == headquarterOpeningTimes) {
-                       // Init list
-                       headquarterOpeningTimes = new ArrayList<>(1);
-               }
-       }
-
-       /**
-        * Adds headquarter with all data from this backing bean. First this action
-        * method will validate if the headquarter's address is already registered
-        * and if found, it will output a proper faces message.
-        */
-       public void addHeadquarter () {
-               // Get instance
-               final Headquarter headquarter = this.createHeadquarter();
-
-               // Is the headquarter not created yet?
-               if (this.headquarterListController.isHeadquarterCreatedByRequiredData(headquarter)) {
-                       // Then show proper faces message
-                       this.showFacesMessage("form-admin-add-headquarter-office:headquarterStreet", "ADMIN_HEADQUARTER_ALREADY_CREATED", FacesMessage.SEVERITY_WARN); //NOI18N
-                       return;
-               }
-
-               // Delcare updated instance
-               final Headquarter updatedHeadquarter;
-
-               try {
-                       // Try to call EJB
-                       updatedHeadquarter = this.adminHeadquarterBean.addHeadquarter(headquarter);
-               } catch (final HeadquarterAlreadyAddedException ex) {
-                       // Output message
-                       this.showFacesMessage("form-admin-add-headquarter-office:headquarterStreet", "ADMIN_HEADQUARTER_ALREADY_CREATED", FacesMessage.SEVERITY_ERROR); //NOI18N
-                       return;
-               }
-
-               // Fire event
-               this.headquarterAddedEvent.fire(new HeadquarterAddedEvent(updatedHeadquarter));
-
-               // Clear this bean
-               this.clear();
-       }
-
-       /**
-        * Adds opening time to temporary list which will be sent along with the
-        * headquarter data to the EJB.
-        */
-       public void addOpeningTime () {
-               // Validate all required fields
-               if (this.getOpeningEndDay() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("this.openingEndDay is null"); //NOI18N
-               } else if (this.getOpeningEndTime() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("this.openingEndTime is null"); //NOI18N
-               } else if (this.getOpeningStartDay() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("this.openingStartDay is null"); //NOI18N
-               } else if (this.getOpeningStartTime() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("this.openingStartTime is null"); //NOI18N
-               }
-
-               // Get opening time instance
-               final OpeningTime openingTime = this.createOpeningTimes();
-
-               // Is same found?
-               if (this.isSameOpeningTimeFound(openingTime)) {
-                       // Yes then abort here
-                       this.showFacesMessage("form-admin-add-headquarter-opening-time:openingStartDay", "ADMIN_OPENING_TIME_ALREADY_CREATED", FacesMessage.SEVERITY_WARN); //NOI18N
-                       return;
-               }
-
-               // Add to temporary list
-               headquarterOpeningTimes.add(openingTime);
-
-               // Clear opening time fields
-               this.clearOpeningTime();
-       }
-
-       /**
-        * Getter for fax number's area code
-        * <p>
-        * @return Fax number's area code
-        */
-       public Integer getFaxAreaCode () {
-               return this.faxAreaCode;
-       }
-
-       /**
-        * Setter for fax number's area code
-        * <p>
-        * @param faxAreaCode Fax number's area code
-        */
-       public void setFaxAreaCode (final Integer faxAreaCode) {
-               this.faxAreaCode = faxAreaCode;
-       }
-
-       /**
-        * Getter for fax's country instance
-        * <p>
-        * @return Fax' country instance
-        */
-       public Country getFaxCountry () {
-               return this.faxCountry;
-       }
-
-       /**
-        * Setter for fax's country instance
-        * <p>
-        * @param faxCountry Fax' country instance
-        */
-       public void setFaxCountry (final Country faxCountry) {
-               this.faxCountry = faxCountry;
-       }
-
-       /**
-        * Getter for fax number
-        * <p>
-        * @return Fax number
-        */
-       public Long getFaxNumber () {
-               return this.faxNumber;
-       }
-
-       /**
-        * Setter for fax number
-        * <p>
-        * @param faxNumber Fax number
-        */
-       public void setFaxNumber (final Long faxNumber) {
-               this.faxNumber = faxNumber;
-       }
-
-       /**
-        * Getter for city
-        * <p>
-        * @return City
-        */
-       public String getHeadquarterCity () {
-               return this.headquarterCity;
-       }
-
-       /**
-        * Setter for city
-        * <p>
-        * @param headquarterCity City
-        */
-       public void setHeadquarterCity (final String headquarterCity) {
-               this.headquarterCity = headquarterCity;
-       }
-
-       /**
-        * Getter for headquarter's company name
-        * <p>
-        * @return Headquarter's company name
-        */
-       public String getHeadquarterCompanyName () {
-               return this.headquarterCompanyName;
-       }
-
-       /**
-        * Setter for headquarter's company name
-        * <p>
-        * @param headquarterCompanyName Headquarter's company name
-        */
-       public void setHeadquarterCompanyName (final String headquarterCompanyName) {
-               this.headquarterCompanyName = headquarterCompanyName;
-       }
-
-       /**
-        * Getter for headquarter contact person
-        * <p>
-        * @return Headquarter contact person
-        */
-       public Employable getHeadquarterContactEmployee () {
-               return this.headquarterContactEmployee;
-       }
-
-       /**
-        * Setter for headquarter contact person
-        * <p>
-        * @param headquarterContactEmployee Headquarter contact person
-        */
-       public void setHeadquarterContactEmployee (final Employable headquarterContactEmployee) {
-               this.headquarterContactEmployee = headquarterContactEmployee;
-       }
-
-       /**
-        * Getter for country
-        * <p>
-        * @return Country
-        */
-       public Country getHeadquarterCountry () {
-               return this.headquarterCountry;
-       }
-
-       /**
-        * Setter for country
-        * <p>
-        * @param headquarterCountry Country
-        */
-       public void setHeadquarterCountry (final Country headquarterCountry) {
-               this.headquarterCountry = headquarterCountry;
-       }
-
-       /**
-        * Getter for email address
-        * <p>
-        * @return Email address
-        */
-       public String getHeadquarterEmailAddress () {
-               return this.headquarterEmailAddress;
-       }
-
-       /**
-        * Getter for email address
-        * <p>
-        * @param headquarterEmailAddress Email address
-        */
-       public void setHeadquarterEmailAddress (final String headquarterEmailAddress) {
-               this.headquarterEmailAddress = headquarterEmailAddress;
-       }
-
-       /**
-        * Getter for house number
-        * <p>
-        * @return House number
-        */
-       public Short getHeadquarterHouseNumber () {
-               return this.headquarterHouseNumber;
-       }
-
-       /**
-        * Setter for house number
-        * <p>
-        * @param headquarterHouseNumber House number
-        */
-       public void setHeadquarterHouseNumber (final Short headquarterHouseNumber) {
-               this.headquarterHouseNumber = headquarterHouseNumber;
-       }
-
-       /**
-        * Getter for house number's extension
-        * <p>
-        * @return House number's extension
-        */
-       public String getHeadquarterHouseNumberExtension () {
-               return this.headquarterHouseNumberExtension;
-       }
-
-       /**
-        * Setter for house number's extension
-        * <p>
-        * @param headquarterHouseNumberExtension House number's extension
-        */
-       public void setHeadquarterHouseNumberExtension (final String headquarterHouseNumberExtension) {
-               this.headquarterHouseNumberExtension = headquarterHouseNumberExtension;
-       }
-
-       /**
-        * Getter for last house number
-        * <p>
-        * @return Last house number
-        */
-       public Short getHeadquarterLastHouseNumber () {
-               return this.headquarterLastHouseNumber;
-       }
-
-       /**
-        * Setter for last house number
-        * <p>
-        * @param headquarterLastHouseNumber Last house number
-        */
-       public void setHeadquarterLastHouseNumber (final Short headquarterLastHouseNumber) {
-               this.headquarterLastHouseNumber = headquarterLastHouseNumber;
-       }
-
-       /**
-        * Getter for opening times of this headquarter
-        * <p>
-        * @return Opening times
-        */
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<OpeningTime> getHeadquarterOpeningTimes () {
-               return headquarterOpeningTimes;
-       }
-
-       /**
-        * Setter for opening times of this headquarter
-        * <p>
-        * @param headquarterOpeningTimes Opening times
-        */
-       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
-       public void setHeadquarterOpeningTimes (final List<OpeningTime> headquarterOpeningTimes) {
-               FinancialsAdminHeadquarterWebRequestBean.headquarterOpeningTimes = headquarterOpeningTimes;
-       }
-
-       /**
-        * Getter for store
-        * <p>
-        * @return Store
-        */
-       public Short getHeadquarterStore () {
-               return this.headquarterStore;
-       }
-
-       /**
-        * Setter for store
-        * <p>
-        * @param headquarterStore Store
-        */
-       public void setHeadquarterStore (final Short headquarterStore) {
-               this.headquarterStore = headquarterStore;
-       }
-
-       /**
-        * Getter for street name
-        * <p>
-        * @return Street name
-        */
-       public String getHeadquarterStreet () {
-               return this.headquarterStreet;
-       }
-
-       /**
-        * Setter for street name
-        * <p>
-        * @param headquarterStreet Street name
-        */
-       public void setHeadquarterStreet (final String headquarterStreet) {
-               this.headquarterStreet = headquarterStreet;
-       }
-
-       /**
-        * Getter for suite number
-        * <p>
-        * @return Suite number
-        */
-       public Short getHeadquarterSuiteNumber () {
-               return this.headquarterSuiteNumber;
-       }
-
-       /**
-        * Setter for suite number
-        * <p>
-        * @param headquarterSuiteNumber Suite number
-        */
-       public void setHeadquarterSuiteNumber (final Short headquarterSuiteNumber) {
-               this.headquarterSuiteNumber = headquarterSuiteNumber;
-       }
-
-       /**
-        * Getter for owning user instance
-        * <p>
-        * @return Owning user instance
-        */
-       public User getHeadquarterUserOwner () {
-               return this.headquarterUserOwner;
-       }
-
-       /**
-        * Setter for owning user instance
-        * <p>
-        * @param headquarterUserOwner Owning user instance
-        */
-       public void setHeadquarterUserOwner (final User headquarterUserOwner) {
-               this.headquarterUserOwner = headquarterUserOwner;
-       }
-
-       /**
-        * Getter for ZIP code\
-        * <p>
-        * @return ZIP code
-        */
-       public Integer getHeadquarterZipCode () {
-               return this.headquarterZipCode;
-       }
-
-       /**
-        * Setter for ZIP code\
-        * <p>
-        * @param headquarterZipCode ZIP code
-        */
-       public void setHeadquarterZipCode (final Integer headquarterZipCode) {
-               this.headquarterZipCode = headquarterZipCode;
-       }
-
-       /**
-        * Getter for land-line number's area code
-        * <p>
-        * @return Land-line number's area code
-        */
-       public Integer getLandLineAreaCode () {
-               return this.landLineAreaCode;
-       }
-
-       /**
-        * Setter for land-line number's area code
-        * <p>
-        * @param landLineAreaCode Land-line number's area code
-        */
-       public void setLandLineAreaCode (final Integer landLineAreaCode) {
-               this.landLineAreaCode = landLineAreaCode;
-       }
-
-       /**
-        * Getter for land-line number's country instance
-        * <p>
-        * @return Land-line number's country instance
-        */
-       public Country getLandLineCountry () {
-               return this.landLineCountry;
-       }
-
-       /**
-        * Setter for land-line number's country instance
-        * <p>
-        * @param landLineCountry Land-line number's country instance
-        */
-       public void setLandLineCountry (final Country landLineCountry) {
-               this.landLineCountry = landLineCountry;
-       }
-
-       /**
-        * Getter for land-line number
-        * <p>
-        * @return Land-line number
-        */
-       public Long getLandLineNumber () {
-               return this.landLineNumber;
-       }
-
-       /**
-        * Setter for land-line number
-        * <p>
-        * @param landLineNumber Land-line number
-        */
-       public void setLandLineNumber (final Long landLineNumber) {
-               this.landLineNumber = landLineNumber;
-       }
-
-       /**
-        * Getter for ending week day
-        * <p>
-        * @return Ending week day
-        */
-       public DayOfTheWeek getOpeningEndDay () {
-               return this.openingEndDay;
-       }
-
-       /**
-        * Setter for ending week day
-        * <p>
-        * @param openingEndDay Ending week day
-        */
-       public void setOpeningEndDay (final DayOfTheWeek openingEndDay) {
-               this.openingEndDay = openingEndDay;
-       }
-
-       /**
-        * Getter for ending time
-        * <p>
-        * @return Ending time
-        */
-       @SuppressWarnings ("ReturnOfDateField")
-       public Date getOpeningEndTime () {
-               return this.openingEndTime;
-       }
-
-       /**
-        * Getter for ending time
-        * <p>
-        * @param openingEndTime Ending time
-        */
-       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
-       public void setOpeningEndTime (final Date openingEndTime) {
-               this.openingEndTime = openingEndTime;
-       }
-
-       /**
-        * Getter for starting week day
-        * <p>
-        * @return Starting week day
-        */
-       public DayOfTheWeek getOpeningStartDay () {
-               return this.openingStartDay;
-       }
-
-       /**
-        * Getter for starting week day
-        * <p>
-        * @param openingStartDay Starting week day
-        */
-       public void setOpeningStartDay (final DayOfTheWeek openingStartDay) {
-               this.openingStartDay = openingStartDay;
-       }
-
-       /**
-        * Getter for starting time
-        * <p>
-        * @return Starting time
-        */
-       @SuppressWarnings ("ReturnOfDateField")
-       public Date getOpeningStartTime () {
-               return this.openingStartTime;
-       }
-
-       /**
-        * Getter for starting time
-        * <p>
-        * @param openingStartTime Starting time
-        */
-       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
-       public void setOpeningStartTime (final Date openingStartTime) {
-               this.openingStartTime = openingStartTime;
-       }
-
-       /**
-        * Clears this bean data
-        */
-       private void clear () {
-               // Clear all headquarter data
-               this.setHeadquarterCity(null);
-               this.setHeadquarterCompanyName(null);
-               this.setHeadquarterContactEmployee(null);
-               this.setHeadquarterCountry(null);
-               this.setHeadquarterEmailAddress(null);
-               this.setHeadquarterHouseNumber(null);
-               this.setHeadquarterHouseNumberExtension(null);
-               this.setHeadquarterLastHouseNumber(null);
-               this.setHeadquarterStore(null);
-               this.setHeadquarterStreet(null);
-               this.setHeadquarterSuiteNumber(null);
-               this.setHeadquarterUserOwner(null);
-               this.setHeadquarterZipCode(null);
-               this.setHeadquarterOpeningTimes(null);
-
-               // Extra-clear opening time
-               this.clearOpeningTime();
-       }
-
-       /**
-        * Clears all opening time fields
-        */
-       private void clearOpeningTime () {
-               // Clear all opening time fields
-               this.setOpeningEndDay(null);
-               this.setOpeningEndTime(null);
-               this.setOpeningStartDay(null);
-               this.setOpeningStartTime(null);
-       }
-
-       /**
-        * Prepares an instance of a Headquarter object (entity) with all data from
-        * this bean. If a complete fax number or land-line number was provided, it
-        * will be set in the instance as well.
-        * <p>
-        * @return An instance of a Headquarter class (entity)
-        */
-       private Headquarter createHeadquarter () {
-               // Create new headquarter instance
-               final Headquarter headquarter = new BusinessHeadquarter(this.getHeadquarterCompanyName(), this.getHeadquarterCity(), this.getHeadquarterCountry(), this.getHeadquarterStreet(), this.getHeadquarterZipCode(), this.getHeadquarterHouseNumber());
-
-               // Add all other fields, too
-               headquarter.setHeadquarterContactEmployee(this.getHeadquarterContactEmployee());
-               headquarter.setHeadquarterEmailAddress(this.getHeadquarterEmailAddress());
-               headquarter.setHeadquarterHouseNumberExtension(this.getHeadquarterHouseNumberExtension());
-               headquarter.setHeadquarterLastHouseNumber(this.getHeadquarterLastHouseNumber());
-               headquarter.setHeadquarterStore(this.getHeadquarterStore());
-               headquarter.setHeadquarterSuiteNumber(this.getHeadquarterSuiteNumber());
-               headquarter.setHeadquarterUserOwner(this.getHeadquarterUserOwner());
-
-               // Generate phone number
-               final DialableLandLineNumber landLine = new LandLineNumber(this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
-               final DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
-
-               // Don't set null or wrong references
-               if ((landLine instanceof DialableLandLineNumber) && (landLine.getPhoneCountry() instanceof Country) && (this.getLandLineAreaCode() != null) && (this.getLandLineNumber() != null) && (this.getLandLineAreaCode() > 0) && (this.getLandLineNumber() > 0)) {
-                       // Now the number must be given
-                       if (landLine.getPhoneAreaCode() == null) {
-                               // Is null
-                               throw new NullPointerException("phone.phoneAreaCode is null"); //NOI18N
-                       } else if (landLine.getPhoneAreaCode() < 1) {
-                               // Abort here
-                               throw new IllegalArgumentException("phone.phoneAreaCode is zero or below."); //NOI18N
-                       } else if (landLine.getPhoneNumber() == null) {
-                               // Is null
-                               throw new NullPointerException("phone.phoneNumber is null"); //NOI18N
-                       } else if (landLine.getPhoneNumber() < 1) {
-                               // Abort here
-                               throw new IllegalArgumentException("phone.phoneNumber is zero or below."); //NOI18N
-                       }
-
-                       // Set phone number
-                       headquarter.setHeadquarterLandLineNumber(landLine);
-               }
-
-               // Don't set null or wrong references
-               if ((fax instanceof DialableFaxNumber) && (fax.getPhoneCountry() instanceof Country) && (this.getFaxAreaCode() != null) && (this.getFaxNumber() != null) && (this.getFaxAreaCode() > 0) && (this.getFaxNumber() > 0)) {
-                       // Now the number must be given
-                       if (fax.getPhoneAreaCode() == null) {
-                               // Is null
-                               throw new NullPointerException("fax.phoneAreaCode is null"); //NOI18N
-                       } else if (fax.getPhoneAreaCode() < 1) {
-                               // Abort here
-                               throw new IllegalArgumentException("fax.phoneAreaCode is zero or below."); //NOI18N
-                       } else if (fax.getPhoneNumber() == null) {
-                               // Is null
-                               throw new NullPointerException("fax.phoneNumber is null"); //NOI18N
-                       } else if (fax.getPhoneNumber() < 1) {
-                               // Abort here
-                               throw new IllegalArgumentException("fax.phoneNumber is zero or below."); //NOI18N
-                       }
-
-                       // Set fax number
-                       headquarter.setHeadquarterFaxNumber(fax);
-               }
-               // Is the opening times list filled?
-               if (!this.getHeadquarterOpeningTimes().isEmpty()) {
-                       // Yes, then set in headquarter, too
-                       headquarter.setHeadquarterOpeningTimes(this.getHeadquarterOpeningTimes());
-               }
-
-               // Return fully prepared instance
-               return headquarter;
-       }
-
-       /**
-        * Prepares an instance of a OpeningTimes object (entity) with all data from
-        * this bean. If a complete fax number or land-line number was provided, it
-        * will be set in the instance as well.
-        * <p>
-        * @return An instance of a OpeningTimes class (entity)
-        */
-       private OpeningTime createOpeningTimes () {
-               // Create new openingTime instance
-               final OpeningTime openingTime = new BusinessOpeningTime(this.getOpeningEndDay(), this.getOpeningEndTime(), this.getOpeningStartDay(), this.getOpeningStartTime());
-
-               // Return fully prepared instance
-               return openingTime;
-       }
-
-       /**
-        * Checks if given opening time is already added
-        * <p>
-        * @param openingTime Opening time to be checked
-        * <p>
-        * @return Whether it has been added already
-        */
-       private boolean isSameOpeningTimeFound (final OpeningTime openingTime) {
-               // Default is not found
-               boolean isFound = false;
-
-               // Loop through list
-               for (final OpeningTime ot : this.getHeadquarterOpeningTimes()) {
-                       // Check it
-                       if (Objects.equals(ot, openingTime)) {
-                               // Found same match
-                               isFound = true;
-                               break;
-                       }
-               }
-
-               // Return it
-               return isFound;
        }
 
 }
diff --git a/src/java/org/mxchange/jfinancials/beans/business/headquarter/action/FinancialsAdminHeadquarterActionWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/business/headquarter/action/FinancialsAdminHeadquarterActionWebRequestBean.java
new file mode 100644 (file)
index 0000000..6e2facc
--- /dev/null
@@ -0,0 +1,895 @@
+/*
+ * Copyright (C) 2017 - 2020 Free Software Foundation
+ *
+ * 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.jfinancials.beans.business.headquarter.action;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+import javax.ejb.EJB;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
+import javax.faces.application.FacesMessage;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jcontactsbusiness.events.headquarter.added.HeadquarterAddedEvent;
+import org.mxchange.jcontactsbusiness.events.headquarter.added.ObservableHeadquarterAddedEvent;
+import org.mxchange.jcontactsbusiness.exceptions.headquarter.HeadquarterAlreadyAddedException;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jcontactsbusiness.model.headquarter.AdminHeadquarterSessionBeanRemote;
+import org.mxchange.jcontactsbusiness.model.headquarter.BusinessHeadquarter;
+import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
+import org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime;
+import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
+import org.mxchange.jcoreee.dates.DayOfTheWeek;
+import org.mxchange.jcountry.model.data.Country;
+import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+import org.mxchange.jfinancials.beans.business.headquarter.list.FinancialsHeadquarterListWebViewController;
+import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
+import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber;
+import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
+import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumber;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * An administrative action bean for headquarter
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("adminHeadquarterActionController")
+@RequestScoped
+public class FinancialsAdminHeadquarterActionWebRequestBean extends BaseFinancialsBean implements FinancialsAdminHeadquarterActionWebRequestController {
+
+       /**
+        * Opening times of this headquarter
+        */
+       private static List<OpeningTime> headquarterOpeningTimes;
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 5_028_697_360_472L;
+
+       /**
+        * EJB for administrative purposes
+        */
+       @EJB (lookup = "java:global/jfinancials-ejb/adminHeadquarter!org.mxchange.jcontactsbusiness.model.headquarter.AdminHeadquarterSessionBeanRemote")
+       private AdminHeadquarterSessionBeanRemote adminHeadquarterBean;
+
+       /**
+        * Area code for fax number
+        */
+       private Integer faxAreaCode;
+
+       /**
+        * Country for fax number
+        */
+       private Country faxCountry;
+
+       /**
+        * Dial number for fax number
+        */
+       private Long faxNumber;
+
+       /**
+        * An event being fired when a headquarter has been successfully added
+        */
+       @Inject
+       @Any
+       private Event<ObservableHeadquarterAddedEvent> headquarterAddedEvent;
+
+       /**
+        * City
+        */
+       private String headquarterCity;
+
+       /**
+        * Headquarter's company name
+        */
+       private String headquarterCompanyName;
+
+       /**
+        * Contact person in headquarter
+        */
+       private Employable headquarterContactEmployee;
+
+       /**
+        * Country
+        */
+       private Country headquarterCountry;
+
+       /**
+        * Email address
+        */
+       private String headquarterEmailAddress;
+
+       /**
+        * House number
+        */
+       private Short headquarterHouseNumber;
+
+       /**
+        * House number's extension
+        */
+       private String headquarterHouseNumberExtension;
+
+       /**
+        * Last house number
+        */
+       private Short headquarterLastHouseNumber;
+
+       /**
+        * A general headquarter controller (backing bean)
+        */
+       @Inject
+       private FinancialsHeadquarterListWebViewController headquarterListController;
+
+       /**
+        * Store
+        */
+       private Short headquarterStore;
+
+       /**
+        * Headquarter street name
+        */
+       private String headquarterStreet;
+
+       /**
+        * Suite number
+        */
+       private Short headquarterSuiteNumber;
+
+       /**
+        * Owning user instance (which this headquarter is assigned to)
+        */
+       private User headquarterUserOwner;
+
+       /**
+        * ZIP code
+        */
+       private Integer headquarterZipCode;
+
+       /**
+        * Area code for land-line number
+        */
+       private Integer landLineAreaCode;
+
+       /**
+        * Country for land-line number
+        */
+       private Country landLineCountry;
+
+       /**
+        * Dial number for land-line number
+        */
+       private Long landLineNumber;
+
+       /**
+        * Ending week day
+        */
+       private DayOfTheWeek openingEndDay;
+
+       /**
+        * Ending time
+        */
+       private Date openingEndTime;
+
+       /**
+        * Starting week day
+        */
+       private DayOfTheWeek openingStartDay;
+
+       /**
+        * Starting time
+        */
+       private Date openingStartTime;
+
+       /**
+        * Default constructor
+        */
+       public FinancialsAdminHeadquarterActionWebRequestBean () {
+               // Call super constructor
+               super();
+
+               // Is the opening times list there?
+               if (null == headquarterOpeningTimes) {
+                       // Init list
+                       headquarterOpeningTimes = new ArrayList<>(1);
+               }
+       }
+
+       /**
+        * Adds headquarter with all data from this backing bean. First this action
+        * method will validate if the headquarter's address is already registered
+        * and if found, it will output a proper faces message.
+        */
+       public void addHeadquarter () {
+               // Get instance
+               final Headquarter headquarter = this.createHeadquarter();
+
+               // Is the headquarter not created yet?
+               if (this.headquarterListController.isHeadquarterCreatedByRequiredData(headquarter)) {
+                       // Then show proper faces message
+                       this.showFacesMessage("form-admin-add-headquarter-office:headquarterStreet", "ADMIN_HEADQUARTER_ALREADY_CREATED", FacesMessage.SEVERITY_WARN); //NOI18N
+                       return;
+               }
+
+               // Delcare updated instance
+               final Headquarter updatedHeadquarter;
+
+               try {
+                       // Try to call EJB
+                       updatedHeadquarter = this.adminHeadquarterBean.addHeadquarter(headquarter);
+               } catch (final HeadquarterAlreadyAddedException ex) {
+                       // Output message
+                       this.showFacesMessage("form-admin-add-headquarter-office:headquarterStreet", "ADMIN_HEADQUARTER_ALREADY_CREATED", FacesMessage.SEVERITY_ERROR); //NOI18N
+                       return;
+               }
+
+               // Fire event
+               this.headquarterAddedEvent.fire(new HeadquarterAddedEvent(updatedHeadquarter));
+
+               // Clear this bean
+               this.clear();
+       }
+
+       /**
+        * Adds opening time to temporary list which will be sent along with the
+        * headquarter data to the EJB.
+        */
+       public void addOpeningTime () {
+               // Validate all required fields
+               if (this.getOpeningEndDay() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("this.openingEndDay is null"); //NOI18N
+               } else if (this.getOpeningEndTime() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("this.openingEndTime is null"); //NOI18N
+               } else if (this.getOpeningStartDay() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("this.openingStartDay is null"); //NOI18N
+               } else if (this.getOpeningStartTime() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("this.openingStartTime is null"); //NOI18N
+               }
+
+               // Get opening time instance
+               final OpeningTime openingTime = this.createOpeningTimes();
+
+               // Is same found?
+               if (this.isSameOpeningTimeFound(openingTime)) {
+                       // Yes then abort here
+                       this.showFacesMessage("form-admin-add-headquarter-opening-time:openingStartDay", "ADMIN_OPENING_TIME_ALREADY_CREATED", FacesMessage.SEVERITY_WARN); //NOI18N
+                       return;
+               }
+
+               // Add to temporary list
+               headquarterOpeningTimes.add(openingTime);
+
+               // Clear opening time fields
+               this.clearOpeningTime();
+       }
+
+       /**
+        * Getter for fax number's area code
+        * <p>
+        * @return Fax number's area code
+        */
+       public Integer getFaxAreaCode () {
+               return this.faxAreaCode;
+       }
+
+       /**
+        * Setter for fax number's area code
+        * <p>
+        * @param faxAreaCode Fax number's area code
+        */
+       public void setFaxAreaCode (final Integer faxAreaCode) {
+               this.faxAreaCode = faxAreaCode;
+       }
+
+       /**
+        * Getter for fax's country instance
+        * <p>
+        * @return Fax' country instance
+        */
+       public Country getFaxCountry () {
+               return this.faxCountry;
+       }
+
+       /**
+        * Setter for fax's country instance
+        * <p>
+        * @param faxCountry Fax' country instance
+        */
+       public void setFaxCountry (final Country faxCountry) {
+               this.faxCountry = faxCountry;
+       }
+
+       /**
+        * Getter for fax number
+        * <p>
+        * @return Fax number
+        */
+       public Long getFaxNumber () {
+               return this.faxNumber;
+       }
+
+       /**
+        * Setter for fax number
+        * <p>
+        * @param faxNumber Fax number
+        */
+       public void setFaxNumber (final Long faxNumber) {
+               this.faxNumber = faxNumber;
+       }
+
+       /**
+        * Getter for city
+        * <p>
+        * @return City
+        */
+       public String getHeadquarterCity () {
+               return this.headquarterCity;
+       }
+
+       /**
+        * Setter for city
+        * <p>
+        * @param headquarterCity City
+        */
+       public void setHeadquarterCity (final String headquarterCity) {
+               this.headquarterCity = headquarterCity;
+       }
+
+       /**
+        * Getter for headquarter's company name
+        * <p>
+        * @return Headquarter's company name
+        */
+       public String getHeadquarterCompanyName () {
+               return this.headquarterCompanyName;
+       }
+
+       /**
+        * Setter for headquarter's company name
+        * <p>
+        * @param headquarterCompanyName Headquarter's company name
+        */
+       public void setHeadquarterCompanyName (final String headquarterCompanyName) {
+               this.headquarterCompanyName = headquarterCompanyName;
+       }
+
+       /**
+        * Getter for headquarter contact person
+        * <p>
+        * @return Headquarter contact person
+        */
+       public Employable getHeadquarterContactEmployee () {
+               return this.headquarterContactEmployee;
+       }
+
+       /**
+        * Setter for headquarter contact person
+        * <p>
+        * @param headquarterContactEmployee Headquarter contact person
+        */
+       public void setHeadquarterContactEmployee (final Employable headquarterContactEmployee) {
+               this.headquarterContactEmployee = headquarterContactEmployee;
+       }
+
+       /**
+        * Getter for country
+        * <p>
+        * @return Country
+        */
+       public Country getHeadquarterCountry () {
+               return this.headquarterCountry;
+       }
+
+       /**
+        * Setter for country
+        * <p>
+        * @param headquarterCountry Country
+        */
+       public void setHeadquarterCountry (final Country headquarterCountry) {
+               this.headquarterCountry = headquarterCountry;
+       }
+
+       /**
+        * Getter for email address
+        * <p>
+        * @return Email address
+        */
+       public String getHeadquarterEmailAddress () {
+               return this.headquarterEmailAddress;
+       }
+
+       /**
+        * Getter for email address
+        * <p>
+        * @param headquarterEmailAddress Email address
+        */
+       public void setHeadquarterEmailAddress (final String headquarterEmailAddress) {
+               this.headquarterEmailAddress = headquarterEmailAddress;
+       }
+
+       /**
+        * Getter for house number
+        * <p>
+        * @return House number
+        */
+       public Short getHeadquarterHouseNumber () {
+               return this.headquarterHouseNumber;
+       }
+
+       /**
+        * Setter for house number
+        * <p>
+        * @param headquarterHouseNumber House number
+        */
+       public void setHeadquarterHouseNumber (final Short headquarterHouseNumber) {
+               this.headquarterHouseNumber = headquarterHouseNumber;
+       }
+
+       /**
+        * Getter for house number's extension
+        * <p>
+        * @return House number's extension
+        */
+       public String getHeadquarterHouseNumberExtension () {
+               return this.headquarterHouseNumberExtension;
+       }
+
+       /**
+        * Setter for house number's extension
+        * <p>
+        * @param headquarterHouseNumberExtension House number's extension
+        */
+       public void setHeadquarterHouseNumberExtension (final String headquarterHouseNumberExtension) {
+               this.headquarterHouseNumberExtension = headquarterHouseNumberExtension;
+       }
+
+       /**
+        * Getter for last house number
+        * <p>
+        * @return Last house number
+        */
+       public Short getHeadquarterLastHouseNumber () {
+               return this.headquarterLastHouseNumber;
+       }
+
+       /**
+        * Setter for last house number
+        * <p>
+        * @param headquarterLastHouseNumber Last house number
+        */
+       public void setHeadquarterLastHouseNumber (final Short headquarterLastHouseNumber) {
+               this.headquarterLastHouseNumber = headquarterLastHouseNumber;
+       }
+
+       /**
+        * Getter for opening times of this headquarter
+        * <p>
+        * @return Opening times
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<OpeningTime> getHeadquarterOpeningTimes () {
+               return headquarterOpeningTimes;
+       }
+
+       /**
+        * Setter for opening times of this headquarter
+        * <p>
+        * @param headquarterOpeningTimes Opening times
+        */
+       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+       public void setHeadquarterOpeningTimes (final List<OpeningTime> headquarterOpeningTimes) {
+               FinancialsAdminHeadquarterActionWebRequestBean.headquarterOpeningTimes = headquarterOpeningTimes;
+       }
+
+       /**
+        * Getter for store
+        * <p>
+        * @return Store
+        */
+       public Short getHeadquarterStore () {
+               return this.headquarterStore;
+       }
+
+       /**
+        * Setter for store
+        * <p>
+        * @param headquarterStore Store
+        */
+       public void setHeadquarterStore (final Short headquarterStore) {
+               this.headquarterStore = headquarterStore;
+       }
+
+       /**
+        * Getter for street name
+        * <p>
+        * @return Street name
+        */
+       public String getHeadquarterStreet () {
+               return this.headquarterStreet;
+       }
+
+       /**
+        * Setter for street name
+        * <p>
+        * @param headquarterStreet Street name
+        */
+       public void setHeadquarterStreet (final String headquarterStreet) {
+               this.headquarterStreet = headquarterStreet;
+       }
+
+       /**
+        * Getter for suite number
+        * <p>
+        * @return Suite number
+        */
+       public Short getHeadquarterSuiteNumber () {
+               return this.headquarterSuiteNumber;
+       }
+
+       /**
+        * Setter for suite number
+        * <p>
+        * @param headquarterSuiteNumber Suite number
+        */
+       public void setHeadquarterSuiteNumber (final Short headquarterSuiteNumber) {
+               this.headquarterSuiteNumber = headquarterSuiteNumber;
+       }
+
+       /**
+        * Getter for owning user instance
+        * <p>
+        * @return Owning user instance
+        */
+       public User getHeadquarterUserOwner () {
+               return this.headquarterUserOwner;
+       }
+
+       /**
+        * Setter for owning user instance
+        * <p>
+        * @param headquarterUserOwner Owning user instance
+        */
+       public void setHeadquarterUserOwner (final User headquarterUserOwner) {
+               this.headquarterUserOwner = headquarterUserOwner;
+       }
+
+       /**
+        * Getter for ZIP code\
+        * <p>
+        * @return ZIP code
+        */
+       public Integer getHeadquarterZipCode () {
+               return this.headquarterZipCode;
+       }
+
+       /**
+        * Setter for ZIP code\
+        * <p>
+        * @param headquarterZipCode ZIP code
+        */
+       public void setHeadquarterZipCode (final Integer headquarterZipCode) {
+               this.headquarterZipCode = headquarterZipCode;
+       }
+
+       /**
+        * Getter for land-line number's area code
+        * <p>
+        * @return Land-line number's area code
+        */
+       public Integer getLandLineAreaCode () {
+               return this.landLineAreaCode;
+       }
+
+       /**
+        * Setter for land-line number's area code
+        * <p>
+        * @param landLineAreaCode Land-line number's area code
+        */
+       public void setLandLineAreaCode (final Integer landLineAreaCode) {
+               this.landLineAreaCode = landLineAreaCode;
+       }
+
+       /**
+        * Getter for land-line number's country instance
+        * <p>
+        * @return Land-line number's country instance
+        */
+       public Country getLandLineCountry () {
+               return this.landLineCountry;
+       }
+
+       /**
+        * Setter for land-line number's country instance
+        * <p>
+        * @param landLineCountry Land-line number's country instance
+        */
+       public void setLandLineCountry (final Country landLineCountry) {
+               this.landLineCountry = landLineCountry;
+       }
+
+       /**
+        * Getter for land-line number
+        * <p>
+        * @return Land-line number
+        */
+       public Long getLandLineNumber () {
+               return this.landLineNumber;
+       }
+
+       /**
+        * Setter for land-line number
+        * <p>
+        * @param landLineNumber Land-line number
+        */
+       public void setLandLineNumber (final Long landLineNumber) {
+               this.landLineNumber = landLineNumber;
+       }
+
+       /**
+        * Getter for ending week day
+        * <p>
+        * @return Ending week day
+        */
+       public DayOfTheWeek getOpeningEndDay () {
+               return this.openingEndDay;
+       }
+
+       /**
+        * Setter for ending week day
+        * <p>
+        * @param openingEndDay Ending week day
+        */
+       public void setOpeningEndDay (final DayOfTheWeek openingEndDay) {
+               this.openingEndDay = openingEndDay;
+       }
+
+       /**
+        * Getter for ending time
+        * <p>
+        * @return Ending time
+        */
+       @SuppressWarnings ("ReturnOfDateField")
+       public Date getOpeningEndTime () {
+               return this.openingEndTime;
+       }
+
+       /**
+        * Getter for ending time
+        * <p>
+        * @param openingEndTime Ending time
+        */
+       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+       public void setOpeningEndTime (final Date openingEndTime) {
+               this.openingEndTime = openingEndTime;
+       }
+
+       /**
+        * Getter for starting week day
+        * <p>
+        * @return Starting week day
+        */
+       public DayOfTheWeek getOpeningStartDay () {
+               return this.openingStartDay;
+       }
+
+       /**
+        * Getter for starting week day
+        * <p>
+        * @param openingStartDay Starting week day
+        */
+       public void setOpeningStartDay (final DayOfTheWeek openingStartDay) {
+               this.openingStartDay = openingStartDay;
+       }
+
+       /**
+        * Getter for starting time
+        * <p>
+        * @return Starting time
+        */
+       @SuppressWarnings ("ReturnOfDateField")
+       public Date getOpeningStartTime () {
+               return this.openingStartTime;
+       }
+
+       /**
+        * Getter for starting time
+        * <p>
+        * @param openingStartTime Starting time
+        */
+       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+       public void setOpeningStartTime (final Date openingStartTime) {
+               this.openingStartTime = openingStartTime;
+       }
+
+       /**
+        * Clears this bean data
+        */
+       private void clear () {
+               // Clear all headquarter data
+               this.setHeadquarterCity(null);
+               this.setHeadquarterCompanyName(null);
+               this.setHeadquarterContactEmployee(null);
+               this.setHeadquarterCountry(null);
+               this.setHeadquarterEmailAddress(null);
+               this.setHeadquarterHouseNumber(null);
+               this.setHeadquarterHouseNumberExtension(null);
+               this.setHeadquarterLastHouseNumber(null);
+               this.setHeadquarterStore(null);
+               this.setHeadquarterStreet(null);
+               this.setHeadquarterSuiteNumber(null);
+               this.setHeadquarterUserOwner(null);
+               this.setHeadquarterZipCode(null);
+               this.setHeadquarterOpeningTimes(null);
+
+               // Extra-clear opening time
+               this.clearOpeningTime();
+       }
+
+       /**
+        * Clears all opening time fields
+        */
+       private void clearOpeningTime () {
+               // Clear all opening time fields
+               this.setOpeningEndDay(null);
+               this.setOpeningEndTime(null);
+               this.setOpeningStartDay(null);
+               this.setOpeningStartTime(null);
+       }
+
+       /**
+        * Prepares an instance of a Headquarter object (entity) with all data from
+        * this bean. If a complete fax number or land-line number was provided, it
+        * will be set in the instance as well.
+        * <p>
+        * @return An instance of a Headquarter class (entity)
+        */
+       private Headquarter createHeadquarter () {
+               // Create new headquarter instance
+               final Headquarter headquarter = new BusinessHeadquarter(
+                                                 this.getHeadquarterCompanyName(),
+                                                 this.getHeadquarterCity(),
+                                                 this.getHeadquarterCountry(),
+                                                 this.getHeadquarterStreet(),
+                                                 this.getHeadquarterZipCode(),
+                                                 this.getHeadquarterHouseNumber()
+                                 );
+
+               // Add all other fields, too
+               headquarter.setHeadquarterContactEmployee(this.getHeadquarterContactEmployee());
+               headquarter.setHeadquarterEmailAddress(this.getHeadquarterEmailAddress());
+               headquarter.setHeadquarterHouseNumberExtension(this.getHeadquarterHouseNumberExtension());
+               headquarter.setHeadquarterLastHouseNumber(this.getHeadquarterLastHouseNumber());
+               headquarter.setHeadquarterStore(this.getHeadquarterStore());
+               headquarter.setHeadquarterSuiteNumber(this.getHeadquarterSuiteNumber());
+               headquarter.setHeadquarterUserOwner(this.getHeadquarterUserOwner());
+
+               // Initialize variables
+               DialableLandLineNumber landLine = null;
+               DialableFaxNumber fax = null;
+
+               // Are all fields set?
+               if (this.getLandLineAreaCode() != null && this.getLandLineCountry() instanceof Country && this.getLandLineNumber() != null) {
+                       // Initialize instance
+                       landLine = new LandLineNumber(this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
+               }
+
+               // Are all fields set?
+               if (this.getFaxAreaCode() != null && this.getFaxCountry() instanceof Country && this.getFaxNumber() != null) {
+                       // Initialize instance
+                       fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
+               }
+
+               // Don't set null or wrong references
+               if ((landLine instanceof DialableLandLineNumber) && (landLine.getPhoneCountry() instanceof Country) && (this.getLandLineAreaCode() != null) && (this.getLandLineNumber() != null) && (this.getLandLineAreaCode() > 0) && (this.getLandLineNumber() > 0)) {
+                       // Now the number must be given
+                       if (landLine.getPhoneAreaCode() == null) {
+                               // Is null
+                               throw new NullPointerException("phone.phoneAreaCode is null"); //NOI18N
+                       } else if (landLine.getPhoneAreaCode() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("phone.phoneAreaCode is zero or below."); //NOI18N
+                       } else if (landLine.getPhoneNumber() == null) {
+                               // Is null
+                               throw new NullPointerException("phone.phoneNumber is null"); //NOI18N
+                       } else if (landLine.getPhoneNumber() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("phone.phoneNumber is zero or below."); //NOI18N
+                       }
+
+                       // Set phone number
+                       headquarter.setHeadquarterLandLineNumber(landLine);
+               }
+
+               // Don't set null or wrong references
+               if ((fax instanceof DialableFaxNumber) && (fax.getPhoneCountry() instanceof Country) && (this.getFaxAreaCode() != null) && (this.getFaxNumber() != null) && (this.getFaxAreaCode() > 0) && (this.getFaxNumber() > 0)) {
+                       // Now the number must be given
+                       if (fax.getPhoneAreaCode() == null) {
+                               // Is null
+                               throw new NullPointerException("fax.phoneAreaCode is null"); //NOI18N
+                       } else if (fax.getPhoneAreaCode() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("fax.phoneAreaCode is zero or below."); //NOI18N
+                       } else if (fax.getPhoneNumber() == null) {
+                               // Is null
+                               throw new NullPointerException("fax.phoneNumber is null"); //NOI18N
+                       } else if (fax.getPhoneNumber() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("fax.phoneNumber is zero or below."); //NOI18N
+                       }
+
+                       // Set fax number
+                       headquarter.setHeadquarterFaxNumber(fax);
+               }
+               // Is the opening times list filled?
+               if (!this.getHeadquarterOpeningTimes().isEmpty()) {
+                       // Yes, then set in headquarter, too
+                       headquarter.setHeadquarterOpeningTimes(this.getHeadquarterOpeningTimes());
+               }
+
+               // Return fully prepared instance
+               return headquarter;
+       }
+
+       /**
+        * Prepares an instance of a OpeningTimes object (entity) with all data from
+        * this bean. If a complete fax number or land-line number was provided, it
+        * will be set in the instance as well.
+        * <p>
+        * @return An instance of a OpeningTimes class (entity)
+        */
+       private OpeningTime createOpeningTimes () {
+               // Create new openingTime instance
+               final OpeningTime openingTime = new BusinessOpeningTime(this.getOpeningEndDay(), this.getOpeningEndTime(), this.getOpeningStartDay(), this.getOpeningStartTime());
+
+               // Return fully prepared instance
+               return openingTime;
+       }
+
+       /**
+        * Checks if given opening time is already added
+        * <p>
+        * @param openingTime Opening time to be checked
+        * <p>
+        * @return Whether it has been added already
+        */
+       private boolean isSameOpeningTimeFound (final OpeningTime openingTime) {
+               // Default is not found
+               boolean isFound = false;
+
+               // Loop through list
+               for (final OpeningTime ot : this.getHeadquarterOpeningTimes()) {
+                       // Check it
+                       if (Objects.equals(ot, openingTime)) {
+                               // Found same match
+                               isFound = true;
+                               break;
+                       }
+               }
+
+               // Return it
+               return isFound;
+       }
+
+}
diff --git a/src/java/org/mxchange/jfinancials/beans/business/headquarter/action/FinancialsAdminHeadquarterActionWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/business/headquarter/action/FinancialsAdminHeadquarterActionWebRequestController.java
new file mode 100644 (file)
index 0000000..ec84498
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2017 - 2020 Free Software Foundation
+ *
+ * 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.jfinancials.beans.business.headquarter.action;
+
+import java.io.Serializable;
+
+/**
+ * An interface for administrative headquarter action controller
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface FinancialsAdminHeadquarterActionWebRequestController extends Serializable {
+
+}
index 9af9e3a8bd8847e27b44e83d75f21165cb6ab248..820c1d0c3d56b88d1f1d419e11cfe87bead120a0 100644 (file)
@@ -408,25 +408,46 @@ public class FinancialsAdminContactWebRequestBean extends BaseFinancialsBean imp
                }
 
                // Generate phone number
-               final DialableLandLineNumber landLine = new LandLineNumber(this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
-               final DialableMobileNumber mobile = new MobileNumber(this.getMobileProvider(), this.getMobileNumber());
-               final DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
+               DialableLandLineNumber landLine = null;
+               DialableMobileNumber mobile = null;
+               DialableFaxNumber fax = null;
+
+               // Are all fields set?
+               if (this.getLandLineAreaCode() != null && this.getLandLineCountry() instanceof Country && this.getLandLineNumber() != null) {
+                       // Init instance
+                       landLine = new LandLineNumber(this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
+               }
+
+               // Are all fields set?
+               if (this.getMobileProvider() instanceof MobileProvider && this.getMobileNumber() != null) {
+                       // Initialize instance
+                       mobile = new MobileNumber(this.getMobileProvider(), this.getMobileNumber());
+               }
+
+               // Are all fields set?
+               if (this.getFaxAreaCode() != null && this.getFaxCountry() instanceof Country && this.getFaxNumber() != null) {
+                       // Initialize instance
+                       fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
+               }
 
                // Create new instance
-               final Contact localContact = new UserContact(this.getPersonalTitle(), this.getFirstName(), this.getFamilyName());
+               final Contact localContact = new UserContact(
+                                         this.getPersonalTitle(),
+                                         this.getFirstName(),
+                                         this.getFamilyName()
+                         );
 
                // Add all others
-               localContact.setContactId(this.getContactId());
-               localContact.setContactTitle(this.getAcademicTitle());
                localContact.setContactBirthday(this.getBirthday());
-               localContact.setContactStreet(this.getStreet());
-               localContact.setContactHouseNumber(this.getHouseNumber());
-               localContact.setContactZipCode(this.getZipCode());
                localContact.setContactCity(this.getCity());
+               localContact.setContactComment(this.getComment());
                localContact.setContactCountry(this.getContactCountry());
                localContact.setContactEmailAddress(this.getEmailAddress());
-               localContact.setContactBirthday(this.getBirthday());
-               localContact.setContactComment(this.getComment());
+               localContact.setContactHouseNumber(this.getHouseNumber());
+               localContact.setContactId(this.getContactId());
+               localContact.setContactStreet(this.getStreet());
+               localContact.setContactTitle(this.getAcademicTitle());
+               localContact.setContactZipCode(this.getZipCode());
 
                // Set ownContact
                localContact.setContactOwnContact(Boolean.TRUE);
index 548eea32357cd47818372b9b0c83f60842650257..f8cbb418c6927c53ea6657f9655bc09d75e34eb5 100644 (file)
@@ -759,7 +759,14 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsBean implem
                }
 
                // Create new instance
-               final User newUser = new LoginUser(this.getUserName(), this.getUserProfileMode(), this.getUserMustChangePassword(), UserLoginUtils.encryptPassword(password), UserAccountStatus.CONFIRMED, userContact);
+               final User newUser = new LoginUser(
+                                  this.getUserName(),
+                                  this.getUserProfileMode(),
+                                  this.getUserMustChangePassword(),
+                                  UserLoginUtils.encryptPassword(password),
+                                  UserAccountStatus.CONFIRMED,
+                                  userContact
+                  );
 
                // Get locale from view-root
                final Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
index 186e35b64e17245e5ab83e08d515a6653f35d66a..3a7b35d4cad7f031e07e2f50adb57e670da6303e 100644 (file)
@@ -1222,3 +1222,4 @@ PAGE_TITLE_ADMIN_EDIT_BRANCH_OFFICE=Filiale editieren
 CONTENT_TITLE_ADMIN_EDIT_BRANCH_OFFICE=Filiale editieren:
 ADMIN_EDIT_BRANCH_OFFICE_TITLE=Filiale mit Id-Nummer {0} editieren:
 ADMIN_EDIT_BRANCH_OFFICE_NUMBER_TITLE=Filiale Nummer {1} (Id {0}) editieren:
+BUTTON_ADMIN_EDIT_BRANCH_OFFICE=Filiale \u00e4ndern
index cbb4adcccb72994c49891915b9caef0633443c91..05ef418a5635e5386685f344380ef013c12e5b1b 100644 (file)
@@ -1132,3 +1132,4 @@ PAGE_TITLE_ADMIN_EDIT_BRANCH_OFFICE=Edit branch office
 CONTENT_TITLE_ADMIN_EDIT_BRANCH_OFFICE=Edit branch office:
 ADMIN_EDIT_BRANCH_OFFICE_TITLE=Edit branch office with id {0}:
 ADMIN_EDIT_BRANCH_OFFICE_NUMBER_TITLE=Edit branch office number {1} (Id {0}):
+BUTTON_ADMIN_EDIT_BRANCH_OFFICE=Change branch office
index 9f0e88456ca0b7775095855b621ccc8f86abe480..5035f1199af97041f5004a62720e049be56b11da 100644 (file)
@@ -21,7 +21,7 @@
                        <p:outputLabel for="headquarterCompanyName" value="#{msg.ADMIN_HEADQUARTER_COMPANY_NAME}" />
                        <p:inputText
                                id="headquarterCompanyName"
-                               value="#{adminHeadquarterController.headquarterCompanyName}"
+                               value="#{adminHeadquarterActionController.headquarterCompanyName}"
                                size="30"
                                maxlength="200"
                                required="true"
@@ -34,7 +34,7 @@
                        <p:outputLabel for="headquarterContactEmployee" value="#{msg.ADMIN_ASSIGN_HEADQUARTER_CONTACT_EMPLOYEE}" />
                        <p:selectOneMenu
                                id="headquarterContactEmployee"
-                               value="#{adminHeadquarterController.headquarterContactEmployee}"
+                               value="#{adminHeadquarterActionController.headquarterContactEmployee}"
                                filter="true"
                                filterMatchMode="contains"
                                >
@@ -54,7 +54,7 @@
                        <p:outputLabel for="headquarterUserOwner" value="#{msg.ADMIN_ASSIGN_HEADQUARTER_USER_OWNER}" />
                        <p:selectOneMenu
                                id="headquarterUserOwner"
-                               value="#{adminHeadquarterController.headquarterUserOwner}"
+                               value="#{adminHeadquarterActionController.headquarterUserOwner}"
                                filter="true"
                                filterMatchMode="contains"
                                >
                                id="headquarterEmailAddress"
                                size="40"
                                maxlength="255"
-                               value="#{adminHeadquarterController.headquarterEmailAddress}"
+                               value="#{adminHeadquarterActionController.headquarterEmailAddress}"
                                validatorMessage="#{msg.ENTERED_EMAIL_ADDRESS_IS_INVALID}"
                                >
                                <validator:headquarterEmailAddressValidator allowEmptyRequiredData="true" />
                        </p:inputText>
 
                        <p:outputLabel for="landLineCountry" value="#{msg.ADMIN_ENTER_HEADQUARTER_LAND_LINE_NUMBER}" />
-                       <core:inputLandLineNumberPanelGrid targetController="#{adminHeadquarterController}" />
+                       <core:inputLandLineNumberPanelGrid targetController="#{adminHeadquarterActionController}" />
 
                        <p:outputLabel for="faxCountry" value="#{msg.ADMIN_ENTER_HEADQUARTER_FAX_NUMBER}" />
-                       <core:inputFaxNumberPanelGrid targetController="#{adminHeadquarterController}" />
+                       <core:inputFaxNumberPanelGrid targetController="#{adminHeadquarterActionController}" />
                </p:panelGrid>
        </p:fieldset>
 
                        styleClass="ui-noborder"
                        >
                        <p:outputLabel for="headquarterStreet" value="#{msg.ADMIN_DATA_STREET_NAME}" />
-                       <p:inputText id="headquarterStreet" size="20" maxlength="255" value="#{adminHeadquarterController.headquarterStreet}" required="true" requiredMessage="#{msg.ADMIN_HEADQUARTER_STREET_NAME_REQUIRED}" />
+                       <p:inputText id="headquarterStreet" size="20" maxlength="255" value="#{adminHeadquarterActionController.headquarterStreet}" required="true" requiredMessage="#{msg.ADMIN_HEADQUARTER_STREET_NAME_REQUIRED}" />
 
                        <p:outputLabel for="headquarterHouseNumber" value="#{msg.ADMIN_DATA_HOUSE_NUMBER}" />
-                       <p:inputText id="headquarterHouseNumber" size="3" maxlength="5" value="#{adminHeadquarterController.headquarterHouseNumber}" validatorMessage="#{msg.ENTERED_HOUSE_NUMBER_INVALID}" required="true" requiredMessage="#{msg.ADMIN_HEADQUARTER_HOUSE_NUMBER_REQUIRED}">
+                       <p:inputText id="headquarterHouseNumber" size="3" maxlength="5" value="#{adminHeadquarterActionController.headquarterHouseNumber}" validatorMessage="#{msg.ENTERED_HOUSE_NUMBER_INVALID}" required="true" requiredMessage="#{msg.ADMIN_HEADQUARTER_HOUSE_NUMBER_REQUIRED}">
                                <f:validateLongRange minimum="1" maximum="500" />
                        </p:inputText>
 
                        <p:outputLabel for="headquarterHouseNumberExtension" value="#{msg.ADMIN_DATA_HOUSE_NUMBER_EXTENSION}" />
-                       <p:inputText id="headquarterHouseNumberExtension" size="1" maxlength="255" value="#{adminHeadquarterController.headquarterHouseNumberExtension}" validatorMessage="#{msg.ENTERED_HOUSE_NUMBER_INVALID}" />
+                       <p:inputText id="headquarterHouseNumberExtension" size="1" maxlength="255" value="#{adminHeadquarterActionController.headquarterHouseNumberExtension}" validatorMessage="#{msg.ENTERED_HOUSE_NUMBER_INVALID}" />
 
                        <p:outputLabel for="headquarterLastHouseNumber" value="#{msg.ADMIN_DATA_LAST_HOUSE_NUMBER}" />
-                       <p:inputText id="headquarterLastHouseNumber" size="3" maxlength="5" value="#{adminHeadquarterController.headquarterLastHouseNumber}" validatorMessage="#{msg.ENTERED_HOUSE_NUMBER_INVALID}">
+                       <p:inputText id="headquarterLastHouseNumber" size="3" maxlength="5" value="#{adminHeadquarterActionController.headquarterLastHouseNumber}" validatorMessage="#{msg.ENTERED_HOUSE_NUMBER_INVALID}">
                                <f:validateLongRange minimum="1" maximum="500" />
                        </p:inputText>
 
                        <p:outputLabel for="headquarterStore" value="#{msg.ADMIN_ENTER_DATA_STORE}" />
-                       <p:inputText id="headquarterStore" size="3" maxlength="5" value="#{adminHeadquarterController.headquarterStore}" validatorMessage="#{msg.ENTERED_STORE_INVALID}">
+                       <p:inputText id="headquarterStore" size="3" maxlength="5" value="#{adminHeadquarterActionController.headquarterStore}" validatorMessage="#{msg.ENTERED_STORE_INVALID}">
                                <f:validateLongRange minimum="-5" maximum="200" />
                        </p:inputText>
 
                        <p:outputLabel for="headquarterSuiteNumber" value="#{msg.ADMIN_ENTER_DATA_SUITE_NUMBER}" />
-                       <p:inputText id="headquarterSuiteNumber" size="3" maxlength="5" value="#{adminHeadquarterController.headquarterSuiteNumber}" validatorMessage="#{msg.ENTERED_SUITE_NUMBER_INVALID}">
+                       <p:inputText id="headquarterSuiteNumber" size="3" maxlength="5" value="#{adminHeadquarterActionController.headquarterSuiteNumber}" validatorMessage="#{msg.ENTERED_SUITE_NUMBER_INVALID}">
                                <f:validateLongRange minimum="1" maximum="500" />
                        </p:inputText>
 
                        <p:outputLabel for="headquarterZipCode" value="#{msg.DATA_ZIP_CODE}" />
-                       <p:inputText id="headquarterZipCode" size="5" maxlength="6" value="#{adminHeadquarterController.headquarterZipCode}" required="true" requiredMessage="#{msg.ADMIN_HEADQUARTER_ZIP_CODE_REQUIRED}">
+                       <p:inputText id="headquarterZipCode" size="5" maxlength="6" value="#{adminHeadquarterActionController.headquarterZipCode}" required="true" requiredMessage="#{msg.ADMIN_HEADQUARTER_ZIP_CODE_REQUIRED}">
                                <f:validateLongRange minimum="1" maximum="99999" />
                        </p:inputText>
 
                        <p:outputLabel for="headquarterCity" value="#{msg.ADMIN_DATA_CITY}" />
-                       <p:inputText id="headquarterCity" size="20" maxlength="255" value="#{adminHeadquarterController.headquarterCity}" required="true" requiredMessage="#{msg.ADMIN_HEADQUARTER_CITY_REQUIRED}" />
+                       <p:inputText id="headquarterCity" size="20" maxlength="255" value="#{adminHeadquarterActionController.headquarterCity}" required="true" requiredMessage="#{msg.ADMIN_HEADQUARTER_CITY_REQUIRED}" />
 
                        <p:outputLabel for="headquarterCountry" value="#{msg.ADMIN_SELECT_COUNTRY}" />
-                       <core:outputCountrySelector id="headquarterCountry" value="#{adminHeadquarterController.headquarterCountry}" required="true" requiredMessage="#{msg.ADMIN_HEADQUARTER_COUNTRY_REQUIRED}" />
+                       <core:outputCountrySelector id="headquarterCountry" value="#{adminHeadquarterActionController.headquarterCountry}" required="true" requiredMessage="#{msg.ADMIN_HEADQUARTER_COUNTRY_REQUIRED}" />
                </p:panelGrid>
        </p:fieldset>
 </ui:composition>
index 204795545cb39ede77525b37370b6c99fa73639f..4256ad25af2288444d19bacfc8117606e7d3df8f 100644 (file)
@@ -23,7 +23,7 @@
 
                        <p:selectOneMenu
                                id="openingStartDay"
-                               value="#{adminHeadquarterController.openingStartDay}"
+                               value="#{adminHeadquarterActionController.openingStartDay}"
                                filter="true"
                                filterMatchMode="contains"
                                required="true"
@@ -44,7 +44,7 @@
 
                        <p:selectOneMenu
                                id="openingEndDay"
-                               value="#{adminHeadquarterController.openingEndDay}"
+                               value="#{adminHeadquarterActionController.openingEndDay}"
                                filter="true"
                                filterMatchMode="contains"
                                required="true"
@@ -65,7 +65,7 @@
 
                        <p:calendar
                                id="openingStartTime"
-                               value="#{adminHeadquarterController.openingStartTime}"
+                               value="#{adminHeadquarterActionController.openingStartTime}"
                                pattern="HH:mm"
                                timeOnly="true"
                                stepMinute="5"
@@ -76,7 +76,7 @@
 
                        <p:calendar
                                id="openingEndTime"
-                               value="#{adminHeadquarterController.openingEndTime}"
+                               value="#{adminHeadquarterActionController.openingEndTime}"
                                pattern="HH:mm"
                                timeOnly="true"
                                stepMinute="5"
index 297a5c74503426530cc262b9327b32173e2fdca5..c0d3d1509c12678142c5ab330cf1329d7297b469 100644 (file)
                                                <p:commandButton
                                                        type="submit"
                                                        value="#{msg.BUTTON_ADMIN_ADD_HEADQUARTER}"
-                                                       action="#{adminHeadquarterController.addHeadquarter()}"
+                                                       action="#{adminHeadquarterActionController.addHeadquarter()}"
                                                        update="form-list-headquarters:headquarterList"
                                                        />
                                        </p:panelGrid>
                                <p:dataTable
                                        id="headquarterOpeningTimeList"
                                        var="openingTime"
-                                       value="#{adminHeadquarterController.headquarterOpeningTimes}"
+                                       value="#{adminHeadquarterActionController.headquarterOpeningTimes}"
                                        rows="10"
                                        reflow="true"
                                        summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_HEADQUARTER_OPENING_TIMES}"
                                                <p:commandButton
                                                        type="submit"
                                                        value="#{msg.BUTTON_ADMIN_ADD_HEADQUARTER_OPENING_TIME}"
-                                                       action="#{adminHeadquarterController.addOpeningTime()}"
+                                                       action="#{adminHeadquarterActionController.addOpeningTime()}"
                                                        update="form-list-headquarter-opening-time:headquarterOpeningTimeList"
                                                        />
                                        </p:panelGrid>