]> git.mxchange.org Git - jjobs-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Fri, 24 Apr 2020 03:05:31 +0000 (05:05 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 10 Jun 2020 17:41:03 +0000 (19:41 +0200)
- added view admin-edit-branch-office view including backing bean action method
- added navigation rule from admin-edit-branch-office to
  admin-list-branch-offices view, including redirect
- added event observer for when an administrator has updated a branch office
- renamed adminBranchOfficeController to adminBranchOfficeActionController
- added many missing i18n strings
- renamed i18n string

Signed-off-by: Roland Häder <roland@mxchange.org>
24 files changed:
src/java/org/mxchange/jjobs/beans/business/branchoffice/JobsAdminBranchOfficeWebRequestBean.java
src/java/org/mxchange/jjobs/beans/business/branchoffice/list/JobsBranchOfficeListWebViewBean.java
src/java/org/mxchange/jjobs/beans/business/branchoffice/list/JobsBranchOfficeListWebViewController.java
src/java/org/mxchange/jjobs/beans/business/department/action/JobsAdminBranchOfficeActionWebRequestBean.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/business/department/action/JobsAdminBranchOfficeActionWebRequestController.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/business/department/list/JobsDepartmentListWebViewBean.java
src/java/org/mxchange/jjobs/beans/business/headquarter/JobsAdminHeadquarterWebRequestBean.java
src/java/org/mxchange/jjobs/beans/contact/JobsAdminContactWebRequestBean.java
src/java/org/mxchange/jjobs/beans/contact/JobsContactWebRequestBean.java
src/java/org/mxchange/jjobs/beans/contact/list/JobsContactListWebViewBean.java
src/java/org/mxchange/jjobs/beans/contact/mobile/JobsAdminContactMobileWebRequestBean.java
src/java/org/mxchange/jjobs/beans/contact/mobile/JobsContactMobileWebRequestBean.java
src/java/org/mxchange/jjobs/beans/contact/phone/JobsAdminContactPhoneWebRequestBean.java
src/java/org/mxchange/jjobs/beans/contact/phone/JobsContactPhoneWebRequestBean.java
src/java/org/mxchange/jjobs/beans/mobile/list/JobsMobileListWebViewBean.java
src/java/org/mxchange/jjobs/beans/phone/list/JobsPhoneListWebViewBean.java
src/java/org/mxchange/jjobs/converter/business/branchoffice/JobsBranchOfficeConverter.java
src/java/org/mxchange/localization/generic_de_DE.properties
src/java/org/mxchange/localization/generic_en_US.properties
web/WEB-INF/faces-config.xml
web/WEB-INF/templates/admin/branch_office/admin_form_branch_office_data.tpl
web/WEB-INF/templates/admin/branch_office/admin_form_branch_opening_time.tpl
web/admin/branch_office/admin_branch_office_edit.xhtml [new file with mode: 0644]
web/admin/branch_office/admin_branch_office_list.xhtml

index 62a018db67356663c3d13c2597924fc0d570a124..a3ed888b39ec9c630d3b5e2a030974d8a963da99 100644 (file)
  */
 package org.mxchange.jjobs.beans.business.branchoffice;
 
-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.branchoffice.added.BranchOfficeAddedEvent;
-import org.mxchange.jcontactsbusiness.events.branchoffice.added.ObservableBranchOfficeAddedEvent;
-import org.mxchange.jcontactsbusiness.exceptions.branchoffice.BranchOfficeAlreadyAddedException;
-import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
-import org.mxchange.jcontactsbusiness.model.branchoffice.AdminBranchOfficeSessionBeanRemote;
-import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
-import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffices;
-import org.mxchange.jcontactsbusiness.model.branchoffice.BusinessBranchOffice;
-import org.mxchange.jcontactsbusiness.model.employee.Employable;
-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.jjobs.beans.BaseJobsBean;
-import org.mxchange.jjobs.beans.business.branchoffice.list.JobsBranchOfficeListWebViewController;
-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 branch offices
@@ -57,913 +29,17 @@ import org.mxchange.jusercore.model.user.User;
 @RequestScoped
 public class JobsAdminBranchOfficeWebRequestBean extends BaseJobsBean implements JobsAdminBranchOfficeWebRequestController {
 
-       /**
-        * Opening times of this branch office
-        */
-       private static List<OpeningTime> branchOpeningTimes;
-
        /**
         * Serial number
         */
        private static final long serialVersionUID = 5_028_697_360_461L;
 
-       /**
-        * EJB for administrative purposes
-        */
-       @EJB (lookup = "java:global/jjobs-ejb/adminBranchOffice!org.mxchange.jcontactsbusiness.model.branchoffice.AdminBranchOfficeSessionBeanRemote")
-       private AdminBranchOfficeSessionBeanRemote adminBranchOfficeBean;
-
-       /**
-        * City
-        */
-       private String branchCity;
-
-       /**
-        * Assigned company for this branch office
-        */
-       private BasicData branchCompany;
-
-       /**
-        * Contact person in branch office
-        */
-       private Employable branchContactEmployee;
-
-       /**
-        * Country
-        */
-       private Country branchCountry;
-
-       /**
-        * Email address
-        */
-       private String branchEmailAddress;
-
-       /**
-        * House number
-        */
-       private Short branchHouseNumber;
-
-       /**
-        * House number's extension (a,b,c,...)
-        */
-       private String branchHouseNumberExtension;
-
-       /**
-        * Last house number
-        */
-       private Short branchLastHouseNumber;
-
-       /**
-        * Number of branch office
-        */
-       private Long branchNumber;
-
-       /**
-        * An event being fired when a branch office has been successfully added
-        */
-       @Inject
-       @Any
-       private Event<ObservableBranchOfficeAddedEvent> branchOfficeAddedEvent;
-
-       /**
-        * A list branch office controller (backing bean)
-        */
-       @Inject
-       private JobsBranchOfficeListWebViewController branchOfficeListController;
-
-       /**
-        * Owner/leader of branch office
-        */
-       private Employable branchOwner;
-
-       /**
-        * Store
-        */
-       private Short branchStore;
-
-       /**
-        * Branch office street name
-        */
-       private String branchStreet;
-
-       /**
-        * Suite number
-        */
-       private Short branchSuiteNumber;
-
-       /**
-        * Owning user instance (which this branch office is assigned to)
-        */
-       private User branchUserOwner;
-
-       /**
-        * ZIP code
-        */
-       private Integer branchZipCode;
-
-       /**
-        * Area code for fax number
-        */
-       private Integer faxAreaCode;
-
-       /**
-        * Country for fax number
-        */
-       private Country faxCountry;
-
-       /**
-        * Dial number for fax number
-        */
-       private Long faxNumber;
-
-       /**
-        * 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 JobsAdminBranchOfficeWebRequestBean () {
                // Call super constructor
                super();
-
-               // Is the opening times list there?
-               if (null == branchOpeningTimes) {
-                       // Init list
-                       branchOpeningTimes = new ArrayList<>(1);
-               }
-       }
-
-       /**
-        * Adds branch office with all data from this backing bean. First this
-        * action method will validate if the branch office's address is already
-        * registered and if found, it will output a proper faces message.
-        */
-       public void addBranchOffice () {
-               // Get instance
-               final BranchOffice branchOffice = this.createBranchOffice();
-
-               // Is the branch office not created yet?
-               if (this.isBranchOfficeCreatedByRequiredData(branchOffice)) {
-                       // Then show proper faces message
-                       this.showFacesMessage("form-admin-add-branch-office:branchStreet", "ADMIN_BRANCH_OFFICE_ALREADY_CREATED", FacesMessage.SEVERITY_WARN); //NOI18N
-                       return;
-               }
-
-               // Delcare updated instance
-               final BranchOffice updatedOffice;
-
-               try {
-                       // Try to call EJB
-                       updatedOffice = this.adminBranchOfficeBean.addBranchOffice(branchOffice);
-               } catch (final BranchOfficeAlreadyAddedException ex) {
-                       // Output message
-                       this.showFacesMessage("form-admin-add-branch-office:branchStreet", "ADMIN_BRANCH_OFFICE_ALREADY_CREATED", FacesMessage.SEVERITY_ERROR); //NOI18N
-                       return;
-               }
-
-               // Fire event
-               this.branchOfficeAddedEvent.fire(new BranchOfficeAddedEvent(updatedOffice));
-
-               // Clear this bean
-               this.clear();
-       }
-
-       /**
-        * Adds opening time to temporary list which will be sent along with the
-        * branch office 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-branch-opening-time:openingStartDay", "ADMIN_OPENING_TIME_ALREADY_CREATED", FacesMessage.SEVERITY_WARN); //NOI18N
-                       return;
-               }
-
-               // Add to temporary list
-               branchOpeningTimes.add(openingTime);
-
-               // Clear opening time fields
-               this.clearOpeningTime();
-       }
-
-       /**
-        * Getter for city
-        * <p>
-        * @return City
-        */
-       public String getBranchCity () {
-               return this.branchCity;
-       }
-
-       /**
-        * Setter for city
-        * <p>
-        * @param branchCity City
-        */
-       public void setBranchCity (final String branchCity) {
-               this.branchCity = branchCity;
-       }
-
-       /**
-        * Getter for basic company data
-        * <p>
-        * @return Basic company data
-        */
-       public BasicData getBranchCompany () {
-               return this.branchCompany;
-       }
-
-       /**
-        * Setter for basic company data
-        * <p>
-        * @param branchCompany Basic company data
-        */
-       public void setBranchCompany (final BasicData branchCompany) {
-               this.branchCompany = branchCompany;
-       }
-
-       /**
-        * Getter for branch office contact person
-        * <p>
-        * @return Branch office contact person
-        */
-       public Employable getBranchContactEmployee () {
-               return this.branchContactEmployee;
-       }
-
-       /**
-        * Setter for branch office contact person
-        * <p>
-        * @param branchContactEmployee Branch office contact person
-        */
-       public void setBranchContactEmployee (final Employable branchContactEmployee) {
-               this.branchContactEmployee = branchContactEmployee;
-       }
-
-       /**
-        * Getter for country
-        * <p>
-        * @return Country
-        */
-       public Country getBranchCountry () {
-               return this.branchCountry;
-       }
-
-       /**
-        * Setter for country
-        * <p>
-        * @param branchCountry Country
-        */
-       public void setBranchCountry (final Country branchCountry) {
-               this.branchCountry = branchCountry;
-       }
-
-       /**
-        * Getter for email address
-        * <p>
-        * @return Email address
-        */
-       public String getBranchEmailAddress () {
-               return this.branchEmailAddress;
-       }
-
-       /**
-        * Getter for email address
-        * <p>
-        * @param branchEmailAddress Email address
-        */
-       public void setBranchEmailAddress (final String branchEmailAddress) {
-               this.branchEmailAddress = branchEmailAddress;
-       }
-
-       /**
-        * Getter for house number
-        * <p>
-        * @return House number
-        */
-       public Short getBranchHouseNumber () {
-               return this.branchHouseNumber;
-       }
-
-       /**
-        * Setter for house number
-        * <p>
-        * @param branchHouseNumber House number
-        */
-       public void setBranchHouseNumber (final Short branchHouseNumber) {
-               this.branchHouseNumber = branchHouseNumber;
-       }
-
-       /**
-        * Getter for house number's extension
-        * <p>
-        * @return House number's extension
-        */
-       public String getBranchHouseNumberExtension () {
-               return this.branchHouseNumberExtension;
-       }
-
-       /**
-        * Setter for house number's extension
-        * <p>
-        * @param branchHouseNumberExtension House number's extension
-        */
-       public void setBranchHouseNumberExtension (final String branchHouseNumberExtension) {
-               this.branchHouseNumberExtension = branchHouseNumberExtension;
-       }
-
-       /**
-        * Getter for last house number
-        * <p>
-        * @return Last house number
-        */
-       public Short getBranchLastHouseNumber () {
-               return this.branchLastHouseNumber;
-       }
-
-       /**
-        * Setter for last house number
-        * <p>
-        * @param branchLastHouseNumber Last house number
-        */
-       public void setBranchLastHouseNumber (final Short branchLastHouseNumber) {
-               this.branchLastHouseNumber = branchLastHouseNumber;
-       }
-
-       /**
-        * Getter for branch office number
-        * <p>
-        * @return Branch office number
-        */
-       public Long getBranchNumber () {
-               return this.branchNumber;
-       }
-
-       /**
-        * Setter for branch office number
-        * <p>
-        * @param branchNumber Branch office number
-        */
-       public void setBranchNumber (final Long branchNumber) {
-               this.branchNumber = branchNumber;
-       }
-
-       /**
-        * Getter for opening times of this branch office
-        * <p>
-        * @return Opening times
-        */
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<OpeningTime> getBranchOpeningTimes () {
-               return branchOpeningTimes;
-       }
-
-       /**
-        * Setter for opening times of this branch office
-        * <p>
-        * @param branchOpeningTimes Opening times
-        */
-       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
-       public void setBranchOpeningTimes (final List<OpeningTime> branchOpeningTimes) {
-               JobsAdminBranchOfficeWebRequestBean.branchOpeningTimes = branchOpeningTimes;
-       }
-
-       /**
-        * Getter for branch office contact person
-        * <p>
-        * @return Branch office contact person
-        */
-       public Employable getBranchOwner () {
-               return this.branchOwner;
-       }
-
-       /**
-        * Setter for branch office contact person
-        * <p>
-        * @param branchOwner Branch office contact person
-        */
-       public void setBranchOwner (final Employable branchOwner) {
-               this.branchOwner = branchOwner;
-       }
-
-       /**
-        * Getter for store
-        * <p>
-        * @return Store
-        */
-       public Short getBranchStore () {
-               return this.branchStore;
-       }
-
-       /**
-        * Setter for store
-        * <p>
-        * @param branchStore Store
-        */
-       public void setBranchStore (final Short branchStore) {
-               this.branchStore = branchStore;
-       }
-
-       /**
-        * Getter for street name
-        * <p>
-        * @return Street name
-        */
-       public String getBranchStreet () {
-               return this.branchStreet;
-       }
-
-       /**
-        * Setter for street name
-        * <p>
-        * @param branchStreet Street name
-        */
-       public void setBranchStreet (final String branchStreet) {
-               this.branchStreet = branchStreet;
-       }
-
-       /**
-        * Getter for suite number
-        * <p>
-        * @return Suite number
-        */
-       public Short getBranchSuiteNumber () {
-               return this.branchSuiteNumber;
-       }
-
-       /**
-        * Setter for suite number
-        * <p>
-        * @param branchSuiteNumber Suite number
-        */
-       public void setBranchSuiteNumber (final Short branchSuiteNumber) {
-               this.branchSuiteNumber = branchSuiteNumber;
-       }
-
-       /**
-        * Getter for owning user instance
-        * <p>
-        * @return Owning user instance
-        */
-       public User getBranchUserOwner () {
-               return this.branchUserOwner;
-       }
-
-       /**
-        * Setter for owning user instance
-        * <p>
-        * @param branchUserOwner Owning user instance
-        */
-       public void setBranchUserOwner (final User branchUserOwner) {
-               this.branchUserOwner = branchUserOwner;
-       }
-
-       /**
-        * Getter for ZIP code\
-        * <p>
-        * @return ZIP code
-        */
-       public Integer getBranchZipCode () {
-               return this.branchZipCode;
-       }
-
-       /**
-        * Setter for ZIP code\
-        * <p>
-        * @param branchZipCode ZIP code
-        */
-       public void setBranchZipCode (final Integer branchZipCode) {
-               this.branchZipCode = branchZipCode;
-       }
-
-       /**
-        * 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 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 branch office data
-               this.setBranchCity(null);
-               this.setBranchCompany(null);
-               this.setBranchContactEmployee(null);
-               this.setBranchCountry(null);
-               this.setBranchEmailAddress(null);
-               this.setBranchHouseNumber(null);
-               this.setBranchHouseNumberExtension(null);
-               this.setBranchLastHouseNumber(null);
-               this.setBranchNumber(null);
-               this.setBranchOwner(null);
-               this.setBranchStore(null);
-               this.setBranchStreet(null);
-               this.setBranchSuiteNumber(null);
-               this.setBranchUserOwner(null);
-               this.setBranchZipCode(null);
-
-               // Opening times list
-               this.setBranchOpeningTimes(new ArrayList<OpeningTime>(1));
-
-               // Fax and land-line number
-               this.setFaxAreaCode(null);
-               this.setFaxCountry(null);
-               this.setFaxNumber(null);
-               this.setLandLineAreaCode(null);
-               this.setLandLineCountry(null);
-               this.setLandLineNumber(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 BranchOffice 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 BranchOffice class (entity)
-        */
-       private BranchOffice createBranchOffice () {
-               // Create new branch office instance
-               final BranchOffice branchOffice = new BusinessBranchOffice(this.getBranchCity(), this.getBranchCompany(), this.getBranchCountry(), this.getBranchStreet(), this.getBranchZipCode(), this.getBranchHouseNumber());
-
-               // Add all other fields, too
-               branchOffice.setBranchContactEmployee(this.getBranchContactEmployee());
-               branchOffice.setBranchEmailAddress(this.getBranchEmailAddress());
-               branchOffice.setBranchHouseNumberExtension(this.getBranchHouseNumberExtension());
-               branchOffice.setBranchLastHouseNumber(this.getBranchLastHouseNumber());
-               branchOffice.setBranchNumber(this.getBranchNumber());
-               branchOffice.setBranchOwnerEmployee(this.getBranchOwner());
-               branchOffice.setBranchStore(this.getBranchStore());
-               branchOffice.setBranchSuiteNumber(this.getBranchSuiteNumber());
-               branchOffice.setBranchUserOwner(this.getBranchUserOwner());
-
-               // 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
-                       branchOffice.setBranchLandLineNumber(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
-                       branchOffice.setBranchFaxNumber(fax);
-               }
-               // Is the opening times list filled?
-               if (!this.getBranchOpeningTimes().isEmpty()) {
-                       // Yes, then set in branch office, too
-                       branchOffice.setBranchOpeningTimes(this.getBranchOpeningTimes());
-               }
-
-               // Return fully prepared instance
-               return branchOffice;
-       }
-
-       /**
-        * 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 whether the given branch office's address is already found in
-        * local cache. Please note that this method fully relies on the cache, so
-        * you must always fire proper events that add/update/delete entries in
-        * cache.
-        * <p>
-        * @param branchOffice Branch office to check it's address
-        * <p>
-        * @return Whether the address has been found
-        */
-       private boolean isBranchOfficeCreatedByRequiredData (final BranchOffice branchOffice) {
-               // Get full list from other bean
-               final List<BranchOffice> branchOffices = this.branchOfficeListController.getAllBranchOffices();
-
-               // Default is not found
-               boolean isFound = false;
-
-               // Now check each entry
-               for (final BranchOffice bo : branchOffices) {
-                       // Is same address?
-                       if (BranchOffices.isSameAddress(bo, branchOffice)) {
-                               // Found one
-                               isFound = true;
-                               break;
-                       }
-               }
-
-               // Return flag
-               return isFound;
-       }
-
-       /**
-        * 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.getBranchOpeningTimes()) {
-                       // Check it
-                       if (Objects.equals(ot, openingTime)) {
-                               // Found same match
-                               isFound = true;
-                               break;
-                       }
-               }
-
-               // Return it
-               return isFound;
        }
 
 }
index 0a23589e92e15fde0730cb146d174b6f060ade4b..543474cea94822356d773a794aa2cb6f0f2b9ca0 100644 (file)
@@ -19,6 +19,7 @@ package org.mxchange.jjobs.beans.business.branchoffice.list;
 import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
 import java.util.Comparator;
+import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Objects;
@@ -29,7 +30,8 @@ import javax.enterprise.event.Observes;
 import javax.faces.view.ViewScoped;
 import javax.inject.Inject;
 import javax.inject.Named;
-import org.mxchange.jcontactsbusiness.events.branchoffice.added.ObservableBranchOfficeAddedEvent;
+import org.mxchange.jcontactsbusiness.events.branchoffice.added.ObservableAdminBranchOfficeAddedEvent;
+import org.mxchange.jcontactsbusiness.events.branchoffice.updated.ObservableAdminBranchOfficeUpdatedEvent;
 import org.mxchange.jcontactsbusiness.exceptions.branchoffice.BranchOfficeNotFoundException;
 import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
 import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOfficeSessionBeanRemote;
@@ -47,7 +49,7 @@ public class JobsBranchOfficeListWebViewBean extends BaseJobsBean implements Job
        /**
         * Serial number
         */
-       private static final long serialVersionUID = 5_028_697_360_462L;
+       private static final long serialVersionUID = 5_028_697_360_468L;
 
        /**
         * A list of all branch offices
@@ -89,51 +91,75 @@ public class JobsBranchOfficeListWebViewBean extends BaseJobsBean implements Job
        }
 
        /**
-        * Observes events being fired when a branch office has been added.
+        * Observes events being fired when a branch office has been added by an
+        * administrator.
         * <p>
         * @param event Event being fired
+        */
+       public void afterAdminBranchOfficeAddedEvent (@Observes final ObservableAdminBranchOfficeAddedEvent event) {
+               // Validate parameter
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getAddedBranchOffice() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.addedBranchOffice is null"); //NOI18N
+               } else if (event.getAddedBranchOffice().getBranchId() == null) {
+                       // Throw it again
+                       throw new NullPointerException("event.addedBranchOffice .branchId is null"); //NOI18N
+               } else if (event.getAddedBranchOffice().getBranchId() < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException(MessageFormat.format("event.addedBranchOffice .branchId={0} is not valid", event.getAddedBranchOffice().getBranchId())); //NOI18N
+               }
+
+               // Add instance to cache
+               this.branchOfficeCache.put(event.getAddedBranchOffice().getBranchId(), event.getAddedBranchOffice());
+               this.uniqueAddBranchOffice(event.getAddedBranchOffice());
+       }
+
+       /**
+        * Observes events being fired when a branch office has been updated by an
+        * administrator.
         * <p>
-        * @throws NullPointerException If the parameter or it's carried instance is
-        * null
-        * @throws IllegalArgumentException If the branchId is zero or lower
+        * @param event Event being fired
         */
-       public void afterBranchOfficeAddedEvent (@Observes final ObservableBranchOfficeAddedEvent event) {
+       public void afterAdminBranchOfficeUpdatedEvent (@Observes final ObservableAdminBranchOfficeUpdatedEvent event) {
                // Validate parameter
                if (null == event) {
                        // Throw NPE
                        throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getBranchOffice() == null) {
+               } else if (event.getUpdatedBranchOffice() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("event.branchOffice is null"); //NOI18N
-               } else if (event.getBranchOffice().getBranchId() == null) {
+                       throw new NullPointerException("event.updatedBranchOffice is null"); //NOI18N
+               } else if (event.getUpdatedBranchOffice().getBranchId() == null) {
                        // Throw it again
-                       throw new NullPointerException("event.branchOffice.branchId is null"); //NOI18N
-               } else if (event.getBranchOffice().getBranchId() < 1) {
+                       throw new NullPointerException("event.updatedBranchOffice .branchId is null"); //NOI18N
+               } else if (event.getUpdatedBranchOffice().getBranchId() < 1) {
                        // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("event.branchOffice.branchId={0} is not valid", event.getBranchOffice().getBranchId())); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("event.updatedBranchOffice .branchId={0} is not valid", event.getUpdatedBranchOffice().getBranchId())); //NOI18N
                }
 
                // Add instance to cache
-               this.branchOfficeCache.put(event.getBranchOffice().getBranchId(), event.getBranchOffice());
-               this.getAllBranchOffices().add(event.getBranchOffice());
+               this.branchOfficeCache.put(event.getUpdatedBranchOffice().getBranchId(), event.getUpdatedBranchOffice());
+               this.uniqueAddBranchOffice(event.getUpdatedBranchOffice());
        }
 
        @Override
-       public BranchOffice findBranchOfficeById (final Long branchOfficeId) throws BranchOfficeNotFoundException {
+       public BranchOffice findBranchOfficeById (final Long branchId) throws BranchOfficeNotFoundException {
                // Validate parameter
-               if (null == branchOfficeId) {
+               if (null == branchId) {
                        // Throw NPE
-                       throw new NullPointerException("branchOfficeId is null"); //NOI18N
-               } else if (branchOfficeId < 1) {
+                       throw new NullPointerException("branchId is null"); //NOI18N
+               } else if (branchId < 1) {
                        // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("branchOfficeId={0} is invalid", branchOfficeId)); //NOI18N
-               } else if (!this.branchOfficeCache.containsKey(branchOfficeId)) {
+                       throw new IllegalArgumentException(MessageFormat.format("branchId={0} is invalid", branchId)); //NOI18N
+               } else if (!this.branchOfficeCache.containsKey(branchId)) {
                        // Not found
-                       throw new BranchOfficeNotFoundException(branchOfficeId);
+                       throw new BranchOfficeNotFoundException(branchId);
                }
 
                // Get it from cache
-               final BranchOffice branchOffice = this.branchOfficeCache.get(branchOfficeId);
+               final BranchOffice branchOffice = this.branchOfficeCache.get(branchId);
 
                // Return it
                return branchOffice;
@@ -243,6 +269,34 @@ public class JobsBranchOfficeListWebViewBean extends BaseJobsBean implements Job
                return isFound;
        }
 
+       /**
+        * Uniquely add branch office instance to allBranchOffices property
+        * <p>
+        * @param branchOffice Branch office being added
+        */
+       private void uniqueAddBranchOffice (final BranchOffice branchOffice) {
+               // Get iterator
+               final Iterator<BranchOffice> iterator = this.getAllBranchOffices().iterator();
+
+               // Iterate over all
+               while (iterator.hasNext()) {
+                       // Get current element
+                       final BranchOffice currentBranchOffice = iterator.next();
+
+                       // Does primary key match?
+                       if (Objects.equals(branchOffice.getBranchId(), currentBranchOffice.getBranchId())) {
+                               // Yes then remove this one
+                               iterator.remove();
+
+                               // Re-add maybe updated version
+                               this.getAllBranchOffices().add(branchOffice);
+
+                               // Stop iteration
+                               break;
+                       }
+               }
+       }
+
        @Override
        protected Object clone () throws CloneNotSupportedException {
                return super.clone(); //To change body of generated methods, choose Tools | Templates.
index f11accab1df7332f9f6cc0e625eacacf44dbc5a1..89945ab079549137202ec37e1a8bea7b1c0626d9 100644 (file)
@@ -48,12 +48,12 @@ public interface JobsBranchOfficeListWebViewController extends Serializable {
        /**
         * Tries to find a branch office with given id number
         * <p>
-        * @param branchOfficeId Branch office id
+        * @param branchId Branch office id
         * <p>
         * @return A branch office instance
         * <p>
         * @throws BranchOfficeNotFoundException If the branch office was not found
         */
-       BranchOffice findBranchOfficeById (final Long branchOfficeId) throws BranchOfficeNotFoundException;
+       BranchOffice findBranchOfficeById (final Long branchId) throws BranchOfficeNotFoundException;
 
 }
diff --git a/src/java/org/mxchange/jjobs/beans/business/department/action/JobsAdminBranchOfficeActionWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/business/department/action/JobsAdminBranchOfficeActionWebRequestBean.java
new file mode 100644 (file)
index 0000000..cd9a57f
--- /dev/null
@@ -0,0 +1,1132 @@
+/*
+ * 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.jjobs.beans.business.branchoffice.action;
+
+import java.text.MessageFormat;
+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.FacesException;
+import javax.faces.application.FacesMessage;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jcontactsbusiness.events.branchoffice.added.AdminBranchOfficeAddedEvent;
+import org.mxchange.jcontactsbusiness.events.branchoffice.added.ObservableAdminBranchOfficeAddedEvent;
+import org.mxchange.jcontactsbusiness.events.branchoffice.updated.AdminBranchOfficeUpdatedEvent;
+import org.mxchange.jcontactsbusiness.events.branchoffice.updated.ObservableAdminBranchOfficeUpdatedEvent;
+import org.mxchange.jcontactsbusiness.exceptions.branchoffice.BranchOfficeAlreadyAddedException;
+import org.mxchange.jcontactsbusiness.exceptions.branchoffice.BranchOfficeNotFoundException;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
+import org.mxchange.jcontactsbusiness.model.branchoffice.AdminBranchOfficeSessionBeanRemote;
+import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
+import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffices;
+import org.mxchange.jcontactsbusiness.model.branchoffice.BusinessBranchOffice;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
+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.jjobs.beans.BaseJobsBean;
+import org.mxchange.jjobs.beans.business.branchoffice.list.JobsBranchOfficeListWebViewController;
+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 branch offices
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("adminBranchOfficeActionController")
+@RequestScoped
+public class JobsAdminBranchOfficeActionWebRequestBean extends BaseJobsBean implements JobsAdminBranchOfficeActionWebRequestController {
+
+       /**
+        * Opening times of this branch office
+        */
+       private static List<OpeningTime> branchOpeningTimes;
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 5_028_697_360_471L;
+
+       /**
+        * EJB for administrative purposes
+        */
+       @EJB (lookup = "java:global/jjobs-ejb/adminBranchOffice!org.mxchange.jcontactsbusiness.model.branchoffice.AdminBranchOfficeSessionBeanRemote")
+       private AdminBranchOfficeSessionBeanRemote adminBranchOfficeBean;
+
+       /**
+        * City
+        */
+       private String branchCity;
+
+       /**
+        * Assigned company for this branch office
+        */
+       private BasicData branchCompany;
+
+       /**
+        * Contact person in branch office
+        */
+       private Employable branchContactEmployee;
+
+       /**
+        * Country
+        */
+       private Country branchCountry;
+
+       /**
+        * Email address
+        */
+       private String branchEmailAddress;
+
+       /**
+        * House number
+        */
+       private Short branchHouseNumber;
+
+       /**
+        * House number's extension (a,b,c,...)
+        */
+       private String branchHouseNumberExtension;
+
+       /**
+        * Branch office's id number
+        */
+       private Long branchId;
+
+       /**
+        * Last house number
+        */
+       private Short branchLastHouseNumber;
+
+       /**
+        * Number of branch office
+        */
+       private Long branchNumber;
+
+       /**
+        * An event being fired when a branch office has been successfully added
+        */
+       @Inject
+       @Any
+       private Event<ObservableAdminBranchOfficeAddedEvent> branchOfficeAddedEvent;
+
+       /**
+        * A list branch office controller (backing bean)
+        */
+       @Inject
+       private JobsBranchOfficeListWebViewController branchOfficeListController;
+
+       /**
+        * Owner/leader of branch office
+        */
+       private Employable branchOwnerEmployee;
+
+       /**
+        * Store
+        */
+       private Short branchStore;
+
+       /**
+        * Branch office street name
+        */
+       private String branchStreet;
+
+       /**
+        * Suite number
+        */
+       private Short branchSuiteNumber;
+
+       /**
+        * Owning user instance (which this branch office is assigned to)
+        */
+       private User branchUserOwner;
+
+       /**
+        * ZIP code
+        */
+       private Integer branchZipCode;
+
+       /**
+        * Currently worked on branch office
+        */
+       private BranchOffice currentBranchOffice;
+
+       /**
+        * Area code for fax number
+        */
+       private Integer faxAreaCode;
+
+       /**
+        * Country for fax number
+        */
+       private Country faxCountry;
+
+       /**
+        * Dial number for fax number
+        */
+       private Long faxNumber;
+
+       /**
+        * 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;
+
+       /**
+        * Event being fired when an administrator has updated a branch office
+        */
+       @Any
+       @Inject
+       private Event<ObservableAdminBranchOfficeUpdatedEvent> updatedBranchOfficeEvent;
+
+       /**
+        * Default constructor
+        */
+       public JobsAdminBranchOfficeActionWebRequestBean () {
+               // Call super constructor
+               super();
+
+               // Is the opening times list there?
+               if (null == branchOpeningTimes) {
+                       // Init list
+                       branchOpeningTimes = new ArrayList<>(1);
+               }
+       }
+
+       /**
+        * Adds branch office with all data from this backing bean. First this
+        * action method will validate if the branch office's address is already
+        * registered and if found, it will output a proper faces message.
+        */
+       public void addBranchOffice () {
+               // Get instance
+               final BranchOffice branchOffice = this.createBranchOffice();
+
+               // Is the branch office not created yet?
+               if (this.isBranchOfficeCreatedByRequiredData(branchOffice)) {
+                       // Then show proper faces message
+                       this.showFacesMessage("form-admin-add-branch-office:branchStreet", "ADMIN_BRANCH_OFFICE_ALREADY_CREATED", FacesMessage.SEVERITY_WARN); //NOI18N
+                       return;
+               }
+
+               // Delcare updated instance
+               final BranchOffice updatedOffice;
+
+               try {
+                       // Try to call EJB
+                       updatedOffice = this.adminBranchOfficeBean.addBranchOffice(branchOffice);
+               } catch (final BranchOfficeAlreadyAddedException ex) {
+                       // Output message
+                       this.showFacesMessage("form-admin-add-branch-office:branchStreet", "ADMIN_BRANCH_OFFICE_ALREADY_CREATED", FacesMessage.SEVERITY_ERROR); //NOI18N
+                       return;
+               }
+
+               // Fire event
+               this.branchOfficeAddedEvent.fire(new AdminBranchOfficeAddedEvent(updatedOffice));
+
+               // Clear this bean
+               this.clear();
+       }
+
+       /**
+        * Adds opening time to temporary list which will be sent along with the
+        * branch office 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-branch-opening-time:openingStartDay", "ADMIN_OPENING_TIME_ALREADY_CREATED", FacesMessage.SEVERITY_WARN); //NOI18N
+                       return;
+               }
+
+               // Add to temporary list
+               branchOpeningTimes.add(openingTime);
+
+               // Clear opening time fields
+               this.clearOpeningTime();
+       }
+
+       /**
+        * Copies all current branch office's properties back to this bean.
+        */
+       public void copyAllBranchOfficeProperties () {
+               // Validate current product instance
+               if (this.getCurrentBranchOffice() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("this.product is null"); //NOI18N
+               } else if (this.getCurrentBranchOffice().getBranchId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("this.product.branchId is null"); //NOI18N
+               } else if (this.getCurrentBranchOffice().getBranchId() < 1) {
+                       // Not valid
+                       throw new IllegalStateException(MessageFormat.format("this.product.branchId={0} is not valid.", this.getCurrentBranchOffice().getBranchId())); //NOI18N
+               }
+
+               // Now copy all fields
+               this.setBranchCity(this.getCurrentBranchOffice().getBranchCity());
+               this.setBranchCompany(this.getCurrentBranchOffice().getBranchCompany());
+               this.setBranchContactEmployee(this.getCurrentBranchOffice().getBranchContactEmployee());
+               this.setBranchCountry(this.getCurrentBranchOffice().getBranchCountry());
+               this.setBranchEmailAddress(this.getCurrentBranchOffice().getBranchEmailAddress());
+               this.setBranchHouseNumber(this.getCurrentBranchOffice().getBranchHouseNumber());
+               this.setBranchHouseNumberExtension(this.getCurrentBranchOffice().getBranchHouseNumberExtension());
+               this.setBranchId(this.getCurrentBranchOffice().getBranchId());
+               this.setBranchLastHouseNumber(this.getCurrentBranchOffice().getBranchLastHouseNumber());
+               this.setBranchNumber(this.getCurrentBranchOffice().getBranchNumber());
+               this.setBranchOpeningTimes(this.getCurrentBranchOffice().getBranchOpeningTimes());
+               this.setBranchOwnerEmployee(this.getCurrentBranchOffice().getBranchOwnerEmployee());
+               this.setBranchStore(this.getCurrentBranchOffice().getBranchStore());
+               this.setBranchStreet(this.getCurrentBranchOffice().getBranchStreet());
+               this.setBranchSuiteNumber(this.getCurrentBranchOffice().getBranchSuiteNumber());
+               this.setBranchUserOwner(this.getCurrentBranchOffice().getBranchUserOwner());
+               this.setBranchZipCode(this.getCurrentBranchOffice().getBranchZipCode());
+       }
+
+       /**
+        * Getter for city
+        * <p>
+        * @return City
+        */
+       public String getBranchCity () {
+               return this.branchCity;
+       }
+
+       /**
+        * Setter for city
+        * <p>
+        * @param branchCity City
+        */
+       public void setBranchCity (final String branchCity) {
+               this.branchCity = branchCity;
+       }
+
+       /**
+        * Getter for basic company data
+        * <p>
+        * @return Basic company data
+        */
+       public BasicData getBranchCompany () {
+               return this.branchCompany;
+       }
+
+       /**
+        * Setter for basic company data
+        * <p>
+        * @param branchCompany Basic company data
+        */
+       public void setBranchCompany (final BasicData branchCompany) {
+               this.branchCompany = branchCompany;
+       }
+
+       /**
+        * Getter for branch office contact person
+        * <p>
+        * @return Branch office contact person
+        */
+       public Employable getBranchContactEmployee () {
+               return this.branchContactEmployee;
+       }
+
+       /**
+        * Setter for branch office contact person
+        * <p>
+        * @param branchContactEmployee Branch office contact person
+        */
+       public void setBranchContactEmployee (final Employable branchContactEmployee) {
+               this.branchContactEmployee = branchContactEmployee;
+       }
+
+       /**
+        * Getter for country
+        * <p>
+        * @return Country
+        */
+       public Country getBranchCountry () {
+               return this.branchCountry;
+       }
+
+       /**
+        * Setter for country
+        * <p>
+        * @param branchCountry Country
+        */
+       public void setBranchCountry (final Country branchCountry) {
+               this.branchCountry = branchCountry;
+       }
+
+       /**
+        * Getter for email address
+        * <p>
+        * @return Email address
+        */
+       public String getBranchEmailAddress () {
+               return this.branchEmailAddress;
+       }
+
+       /**
+        * Getter for email address
+        * <p>
+        * @param branchEmailAddress Email address
+        */
+       public void setBranchEmailAddress (final String branchEmailAddress) {
+               this.branchEmailAddress = branchEmailAddress;
+       }
+
+       /**
+        * Getter for house number
+        * <p>
+        * @return House number
+        */
+       public Short getBranchHouseNumber () {
+               return this.branchHouseNumber;
+       }
+
+       /**
+        * Setter for house number
+        * <p>
+        * @param branchHouseNumber House number
+        */
+       public void setBranchHouseNumber (final Short branchHouseNumber) {
+               this.branchHouseNumber = branchHouseNumber;
+       }
+
+       /**
+        * Getter for house number's extension
+        * <p>
+        * @return House number's extension
+        */
+       public String getBranchHouseNumberExtension () {
+               return this.branchHouseNumberExtension;
+       }
+
+       /**
+        * Setter for house number's extension
+        * <p>
+        * @param branchHouseNumberExtension House number's extension
+        */
+       public void setBranchHouseNumberExtension (final String branchHouseNumberExtension) {
+               this.branchHouseNumberExtension = branchHouseNumberExtension;
+       }
+
+       /**
+        * Getter for branch office's id number
+        * <p>
+        * @return Branch office's id number
+        */
+       public Long getBranchId () {
+               return this.branchId;
+       }
+
+       /**
+        * Setter for branch office's id number
+        * <p>
+        * @param branchId Branch office's id number
+        */
+       public void setBranchId (final Long branchId) {
+               this.branchId = branchId;
+       }
+
+       /**
+        * Getter for last house number
+        * <p>
+        * @return Last house number
+        */
+       public Short getBranchLastHouseNumber () {
+               return this.branchLastHouseNumber;
+       }
+
+       /**
+        * Setter for last house number
+        * <p>
+        * @param branchLastHouseNumber Last house number
+        */
+       public void setBranchLastHouseNumber (final Short branchLastHouseNumber) {
+               this.branchLastHouseNumber = branchLastHouseNumber;
+       }
+
+       /**
+        * Getter for branch office number
+        * <p>
+        * @return Branch office number
+        */
+       public Long getBranchNumber () {
+               return this.branchNumber;
+       }
+
+       /**
+        * Setter for branch office number
+        * <p>
+        * @param branchNumber Branch office number
+        */
+       public void setBranchNumber (final Long branchNumber) {
+               this.branchNumber = branchNumber;
+       }
+
+       /**
+        * Getter for opening times of this branch office
+        * <p>
+        * @return Opening times
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<OpeningTime> getBranchOpeningTimes () {
+               return branchOpeningTimes;
+       }
+
+       /**
+        * Setter for opening times of this branch office
+        * <p>
+        * @param branchOpeningTimes Opening times
+        */
+       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+       public void setBranchOpeningTimes (final List<OpeningTime> branchOpeningTimes) {
+               JobsAdminBranchOfficeActionWebRequestBean.branchOpeningTimes = branchOpeningTimes;
+       }
+
+       /**
+        * Getter for branch office contact person
+        * <p>
+        * @return Branch office contact person
+        */
+       public Employable getBranchOwnerEmployee () {
+               return this.branchOwnerEmployee;
+       }
+
+       /**
+        * Setter for branch office contact person
+        * <p>
+        * @param branchOwnerEmployee Branch office contact person
+        */
+       public void setBranchOwnerEmployee (final Employable branchOwnerEmployee) {
+               this.branchOwnerEmployee = branchOwnerEmployee;
+       }
+
+       /**
+        * Getter for store
+        * <p>
+        * @return Store
+        */
+       public Short getBranchStore () {
+               return this.branchStore;
+       }
+
+       /**
+        * Setter for store
+        * <p>
+        * @param branchStore Store
+        */
+       public void setBranchStore (final Short branchStore) {
+               this.branchStore = branchStore;
+       }
+
+       /**
+        * Getter for street name
+        * <p>
+        * @return Street name
+        */
+       public String getBranchStreet () {
+               return this.branchStreet;
+       }
+
+       /**
+        * Setter for street name
+        * <p>
+        * @param branchStreet Street name
+        */
+       public void setBranchStreet (final String branchStreet) {
+               this.branchStreet = branchStreet;
+       }
+
+       /**
+        * Getter for suite number
+        * <p>
+        * @return Suite number
+        */
+       public Short getBranchSuiteNumber () {
+               return this.branchSuiteNumber;
+       }
+
+       /**
+        * Setter for suite number
+        * <p>
+        * @param branchSuiteNumber Suite number
+        */
+       public void setBranchSuiteNumber (final Short branchSuiteNumber) {
+               this.branchSuiteNumber = branchSuiteNumber;
+       }
+
+       /**
+        * Getter for owning user instance
+        * <p>
+        * @return Owning user instance
+        */
+       public User getBranchUserOwner () {
+               return this.branchUserOwner;
+       }
+
+       /**
+        * Setter for owning user instance
+        * <p>
+        * @param branchUserOwner Owning user instance
+        */
+       public void setBranchUserOwner (final User branchUserOwner) {
+               this.branchUserOwner = branchUserOwner;
+       }
+
+       /**
+        * Getter for ZIP code\
+        * <p>
+        * @return ZIP code
+        */
+       public Integer getBranchZipCode () {
+               return this.branchZipCode;
+       }
+
+       /**
+        * Setter for ZIP code\
+        * <p>
+        * @param branchZipCode ZIP code
+        */
+       public void setBranchZipCode (final Integer branchZipCode) {
+               this.branchZipCode = branchZipCode;
+       }
+
+       /**
+        * Getter for current branch office
+        * <p>
+        * @return Current branch office
+        */
+       public BranchOffice getCurrentBranchOffice () {
+               return this.currentBranchOffice;
+       }
+
+       /**
+        * Setter for current branch office
+        * <p>
+        * @param currentBranchOffice Current branch office
+        */
+       public void setCurrentBranchOffice (final BranchOffice currentBranchOffice) {
+               this.currentBranchOffice = currentBranchOffice;
+       }
+
+       /**
+        * 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 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;
+       }
+
+       /**
+        * Updates currently worked on branch office data
+        * <p>
+        * @return Redirection outcome
+        */
+       public String updateBranchOffice () {
+               // Id should be set
+               if (this.getBranchId() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("this.branchId is null"); //NOI18N
+               } else if (this.getBranchId() < 1) {
+                       // Throw ISE
+                       throw new IllegalStateException(MessageFormat.format("this.branchId={0} is not valid.", this.getBranchId())); //NOI18N
+               }
+
+               // Init instance with fresh data
+               final BranchOffice branchOffice = this.createBranchOffice();
+
+               // Does current (not updated) and just created (maybe updated) match?
+               if (Objects.equals(this.getCurrentBranchOffice(), branchOffice)) {
+                       // Yes, then output message
+                       this.showFacesMessage("form-admin-edit-branch-office:branchCompany", "ADMIN_BRANCH_OFFICE_NOT_UPDATED", FacesMessage.SEVERITY_WARN); //NOI18N
+
+                       // Skip below code
+                       return ""; //NOI18N
+               }
+
+               // Copy all fields
+               BranchOffices.copyBranchOfficeData(this.getCurrentBranchOffice(), branchOffice);
+
+               // Initialize updated instance
+               final BranchOffice updatedBranchOffice;
+
+               // Try it
+               try {
+                       // Invoke EJB
+                       updatedBranchOffice = this.adminBranchOfficeBean.updateBranchOffice(branchOffice);
+               } catch (final BranchOfficeNotFoundException ex) {
+                       // Throw as a cause
+                       throw new FacesException(ex);
+               }
+
+               // Fire event
+               this.updatedBranchOfficeEvent.fire(new AdminBranchOfficeUpdatedEvent(updatedBranchOffice));
+
+               // Redirect to list view
+               return "admin_list_branch_office"; //NOI18N
+       }
+
+       /**
+        * Clears this bean data
+        */
+       private void clear () {
+               // Clear all branch office data
+               this.setBranchCity(null);
+               this.setBranchCompany(null);
+               this.setBranchContactEmployee(null);
+               this.setBranchCountry(null);
+               this.setBranchEmailAddress(null);
+               this.setBranchHouseNumber(null);
+               this.setBranchHouseNumberExtension(null);
+               this.setBranchLastHouseNumber(null);
+               this.setBranchNumber(null);
+               this.setBranchOwnerEmployee(null);
+               this.setBranchStore(null);
+               this.setBranchStreet(null);
+               this.setBranchSuiteNumber(null);
+               this.setBranchUserOwner(null);
+               this.setBranchZipCode(null);
+
+               // Opening times list
+               this.setBranchOpeningTimes(new ArrayList<OpeningTime>(1));
+
+               // Fax and land-line number
+               this.setFaxAreaCode(null);
+               this.setFaxCountry(null);
+               this.setFaxNumber(null);
+               this.setLandLineAreaCode(null);
+               this.setLandLineCountry(null);
+               this.setLandLineNumber(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 BranchOffice 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 BranchOffice class (entity)
+        */
+       private BranchOffice createBranchOffice () {
+               // Create new branch office instance
+               final BranchOffice branchOffice = new BusinessBranchOffice(
+                                                  this.getBranchCity(),
+                                                  this.getBranchCompany(),
+                                                  this.getBranchCountry(),
+                                                  this.getBranchStreet(),
+                                                  this.getBranchZipCode(),
+                                                  this.getBranchHouseNumber()
+                                  );
+
+               // Add all other fields, too
+               branchOffice.setBranchId(this.getBranchId());
+               branchOffice.setBranchContactEmployee(this.getBranchContactEmployee());
+               branchOffice.setBranchEmailAddress(this.getBranchEmailAddress());
+               branchOffice.setBranchHouseNumberExtension(this.getBranchHouseNumberExtension());
+               branchOffice.setBranchLastHouseNumber(this.getBranchLastHouseNumber());
+               branchOffice.setBranchNumber(this.getBranchNumber());
+               branchOffice.setBranchOwnerEmployee(this.getBranchOwnerEmployee());
+               branchOffice.setBranchStore(this.getBranchStore());
+               branchOffice.setBranchSuiteNumber(this.getBranchSuiteNumber());
+               branchOffice.setBranchUserOwner(this.getBranchUserOwner());
+
+               // Init variables
+               DialableLandLineNumber landLine = null;
+               DialableFaxNumber fax = null;
+
+               // Are all required fields set?
+               if (this.getLandLineAreaCode() != null && this.getLandLineCountry() != null && 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) {
+                       // Initialize fax 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
+                       branchOffice.setBranchLandLineNumber(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
+                       branchOffice.setBranchFaxNumber(fax);
+               }
+               // Is the opening times list filled?
+               if (!this.getBranchOpeningTimes().isEmpty()) {
+                       // Yes, then set in branch office, too
+                       branchOffice.setBranchOpeningTimes(this.getBranchOpeningTimes());
+               }
+
+               // Return fully prepared instance
+               return branchOffice;
+       }
+
+       /**
+        * 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 whether the given branch office's address is already found in
+        * local cache. Please note that this method fully relies on the cache, so
+        * you must always fire proper events that add/update/delete entries in
+        * cache.
+        * <p>
+        * @param branchOffice Branch office to check it's address
+        * <p>
+        * @return Whether the address has been found
+        */
+       private boolean isBranchOfficeCreatedByRequiredData (final BranchOffice branchOffice) {
+               // Get full list from other bean
+               final List<BranchOffice> branchOffices = this.branchOfficeListController.getAllBranchOffices();
+
+               // Default is not found
+               boolean isFound = false;
+
+               // Now check each entry
+               for (final BranchOffice bo : branchOffices) {
+                       // Is same address?
+                       if (BranchOffices.isSameAddress(bo, branchOffice)) {
+                               // Found one
+                               isFound = true;
+                               break;
+                       }
+               }
+
+               // Return flag
+               return isFound;
+       }
+
+       /**
+        * 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.getBranchOpeningTimes()) {
+                       // Check it
+                       if (Objects.equals(ot, openingTime)) {
+                               // Found same match
+                               isFound = true;
+                               break;
+                       }
+               }
+
+               // Return it
+               return isFound;
+       }
+
+}
diff --git a/src/java/org/mxchange/jjobs/beans/business/department/action/JobsAdminBranchOfficeActionWebRequestController.java b/src/java/org/mxchange/jjobs/beans/business/department/action/JobsAdminBranchOfficeActionWebRequestController.java
new file mode 100644 (file)
index 0000000..c9b3896
--- /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.jjobs.beans.business.branchoffice.action;
+
+import java.io.Serializable;
+
+/**
+ * An interface for administrative branch office controller
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface JobsAdminBranchOfficeActionWebRequestController extends Serializable {
+
+}
index 05294fe0403d43ba5e8e282061a0740e02310561..3d2d155d9e83e980b90e485fb64436d469cedd61 100644 (file)
@@ -47,7 +47,7 @@ public class JobsDepartmentListWebViewBean extends BaseJobsBean implements JobsD
        /**
         * Serial number
         */
-       private static final long serialVersionUID = 5_028_697_360_462L;
+       private static final long serialVersionUID = 5_028_697_360_469L;
 
        /**
         * A list of all departments
index 79fd3c9a96f464b4fbf40d64ef618e6f17d876e7..abc53b3535fa11b2d7d19d6b4e1f86eea66536cd 100644 (file)
@@ -63,7 +63,7 @@ public class JobsAdminHeadquarterWebRequestBean extends BaseJobsBean implements
        /**
         * Serial number
         */
-       private static final long serialVersionUID = 5_028_697_360_462L;
+       private static final long serialVersionUID = 5_028_697_360_470L;
 
        /**
         * EJB for administrative purposes
index 728edaf4624168fa13617362672337ba12d19359..173c97f71106b77706ab671c192a85f9b7b5f0c3 100644 (file)
@@ -553,8 +553,16 @@ public class JobsAdminContactWebRequestBean extends BaseJobsBean implements Jobs
                // Update all data in contact
                this.updateContactData(createdContact);
 
-               // Call EJB for updating contact data
-               final Contact updatedContact = this.contactBean.updateContactData(createdContact, this.isMobileNumberUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
+               // Init updated contact instance
+               final Contact updatedContact;
+
+               try {
+                       // Call EJB for updating contact data
+                       updatedContact = this.contactBean.updateContactData(createdContact, this.isMobileNumberUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
+               } catch (final ContactNotFoundException ex) {
+                       // Throw as a cause
+                       throw new FacesException(ex);
+               }
 
                // Fire event
                this.updatedContactEvent.fire(new AdminUpdatedContactEvent(updatedContact));
index d9e62b7617bf5e450483074bc6c04aed68808a3a..031973528144dcb16ab0d19b48c71de2f3a0e6b2 100644 (file)
@@ -21,11 +21,16 @@ import java.util.Date;
 import java.util.Objects;
 import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
 import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Any;
 import javax.faces.FacesException;
 import javax.faces.application.FacesMessage;
 import javax.inject.Inject;
 import javax.inject.Named;
+import org.mxchange.jcontacts.events.contact.update.ObservableUpdatedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.UpdatedContactEvent;
+import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote;
 import org.mxchange.jcontacts.model.contact.Contacts;
@@ -93,6 +98,13 @@ public class JobsContactWebRequestBean extends BaseJobsBean implements JobsConta
         */
        private JobsContactListWebViewController contactListController;
 
+       /**
+        * Event being fired when a user has updated his contact data
+        */
+       @Any
+       @Inject
+       private Event<ObservableUpdatedContactEvent> contactUpdatedEvent;
+
        /**
         * Country instance
         */
@@ -368,8 +380,19 @@ public class JobsContactWebRequestBean extends BaseJobsBean implements JobsConta
                // Update contact's fax number
                final boolean isFaxUnlinked = Contacts.updateFaxNumber(contact, this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
 
-               // Send it to the EJB
-               this.contactBean.updateContactData(contact, isMobileUnlinked, isLandLineUnlinked, isFaxUnlinked);
+               // Init updated contact instance
+               final Contact updatedContact;
+
+               try {
+                       // Send it to the EJB
+                       updatedContact = this.contactBean.updateContactData(contact, isMobileUnlinked, isLandLineUnlinked, isFaxUnlinked);
+               } catch (final ContactNotFoundException ex) {
+                       // Throw as cause
+                       throw new FacesException(ex);
+               }
+
+               // Fire event
+               this.contactUpdatedEvent.fire(new UpdatedContactEvent(updatedContact));
 
                // All fine
                return "contact_data_saved"; //NOI18N
index 5c8b19a1e472d90bd546427a542b7f4303264f6e..c4de0434422ef5e0f5f0d7610e1f89d7130c52aa 100644 (file)
@@ -32,6 +32,7 @@ import javax.inject.Named;
 import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.deleted.ObservableAdminDeletedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableUpdatedContactEvent;
 import org.mxchange.jcontacts.events.fax.unlinked.ObservableAdminUnlinkedFaxNumberEvent;
 import org.mxchange.jcontacts.events.landline.unlinked.ObservableAdminUnlinkedLandLineNumberEvent;
 import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent;
@@ -277,6 +278,31 @@ public class JobsContactListWebViewBean extends BaseJobsBean implements JobsCont
                this.uniqueAddContact(event.getUpdatedContact());
        }
 
+       /**
+        * Event observer for updated contact data by the user
+        * <p>
+        * @param event Updated contact data event
+        */
+       public void afterUpdatedContactDataEvent (@Observes final ObservableUpdatedContactEvent event) {
+               // Event and contained entity instance should not be null
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getUpdatedContact() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.updatedContact is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
+               }
+
+               // Add contact instance only once
+               this.uniqueAddContact(event.getUpdatedContact());
+       }
+
        /**
         * Event observer when user confirmed account.
         * <p>
index 5d5a4801942322d23b135fa26e57134f4fba5a5f..a0c26bb35db3a7eb79286594feb3bd541498ec2a 100644 (file)
@@ -29,16 +29,18 @@ import javax.inject.Named;
 import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.created.ObservableCreatedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableUpdatedContactEvent;
 import org.mxchange.jcontacts.events.mobile.linked.AdminLinkedMobileNumberEvent;
 import org.mxchange.jcontacts.events.mobile.linked.ObservableAdminLinkedMobileNumberEvent;
 import org.mxchange.jcontacts.events.mobile.unlinked.AdminUnlinkedMobileNumberEvent;
 import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent;
+import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
 import org.mxchange.jcontacts.model.contact.Contact;
-import org.mxchange.jcontacts.model.phone.AdminContactsPhoneSessionBeanRemote;
+import org.mxchange.jcontacts.model.mobile.AdminContactsMobileSessionBeanRemote;
 import org.mxchange.jjobs.beans.BaseJobsBean;
 import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEvent;
-import org.mxchange.jphone.exceptions.phone.PhoneNumberAlreadyLinkedException;
-import org.mxchange.jphone.exceptions.phone.PhoneNumberNotLinkedException;
+import org.mxchange.jphone.exceptions.mobile.MobileNumberAlreadyLinkedException;
+import org.mxchange.jphone.exceptions.mobile.MobileNumberNotLinkedException;
 import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber;
 import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
@@ -59,10 +61,10 @@ public class JobsAdminContactMobileWebRequestBean extends BaseJobsBean implement
        private static final long serialVersionUID = 542_145_347_919L;
 
        /**
-        * Administrative EJB for phone number
+        * Administrative EJB for mobile number
         */
-       @EJB (lookup = "java:global/jjobs-ejb/adminContactPhone!org.mxchange.jcontacts.model.phone.AdminContactsPhoneSessionBeanRemote")
-       private AdminContactsPhoneSessionBeanRemote adminContactPhoneBean;
+       @EJB (lookup = "java:global/jjobs-ejb/adminContactMobile!org.mxchange.jcontacts.model.mobile.AdminContactsMobileSessionBeanRemote")
+       private AdminContactsMobileSessionBeanRemote adminContactMobileBean;
 
        /**
         * Event being fired when a mobile number has been linked
@@ -257,6 +259,31 @@ public class JobsAdminContactMobileWebRequestBean extends BaseJobsBean implement
                this.setMobileEntryUpdated(number.getMobileEntryUpdated());
        }
 
+       /**
+        * Event observer for updated contact data by the user
+        * <p>
+        * @param event Updated contact data event
+        */
+       public void afterUpdatedContactDataEvent (@Observes final ObservableUpdatedContactEvent event) {
+               // Event and contained entity instance should not be null
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getUpdatedContact() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.updatedContact is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
+               }
+
+               // Clear all data
+               this.clear();
+       }
+
        /**
         * Links mobile number to contact from bean helper as "main mobile number".
         * <p>
@@ -300,8 +327,8 @@ public class JobsAdminContactMobileWebRequestBean extends BaseJobsBean implement
                // Try it again
                try {
                        // Link it, too
-                       updatedContact = this.adminContactPhoneBean.linkNewMobileNumberWithContact(targetContact, number);
-               } catch (final PhoneNumberAlreadyLinkedException ex) {
+                       updatedContact = this.adminContactMobileBean.linkNewMobileNumberWithContact(targetContact, number);
+               } catch (final MobileNumberAlreadyLinkedException | ContactNotFoundException ex) {
                        // Throw again as cause
                        this.showFacesMessage("form_add_contact_mobile:mobileNumber", ex, FacesMessage.SEVERITY_ERROR); //NOI18N
                        return ""; //NOI18N
@@ -436,8 +463,8 @@ public class JobsAdminContactMobileWebRequestBean extends BaseJobsBean implement
 
                try {
                        // Unlink it and return contact without mobile instance
-                       updatedContact = this.adminContactPhoneBean.unlinkMobileDataFromContact(this.getContact(), number);
-               } catch (final PhoneNumberNotLinkedException ex) {
+                       updatedContact = this.adminContactMobileBean.unlinkMobileDataFromContact(this.getContact(), number);
+               } catch (final MobileNumberNotLinkedException | ContactNotFoundException ex) {
                        // Did not work
                        this.showFacesMessage("form_unlink_contact_mobile:mobileNumberId", ex, FacesMessage.SEVERITY_ERROR); //NOI18N
                        return ""; //NOI18N
index 25c0af4eb4724d7fe7612d8eea9c75cae2c0f04c..75df73db621b90dbd46495e655fe13b72730f9a3 100644 (file)
@@ -26,6 +26,7 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableUpdatedContactEvent;
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jjobs.beans.BaseJobsBean;
 import org.mxchange.jjobs.beans.contact.list.JobsContactListWebViewController;
@@ -168,6 +169,31 @@ public class JobsContactMobileWebRequestBean extends BaseJobsBean implements Job
                this.setMobileNumber(event.getMobileNumber());
        }
 
+       /**
+        * Event observer for updated contact data by the user
+        * <p>
+        * @param event Updated contact data event
+        */
+       public void afterUpdatedContactDataEvent (@Observes final ObservableUpdatedContactEvent event) {
+               // Event and contained entity instance should not be null
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getUpdatedContact() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.updatedContact is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
+               }
+
+               // Clear all data
+               this.clear();
+       }
+
        /**
         * Getter for all contacts having current mobile number linked
         * <p>
index 5d1f90be22a531bbde579736c01d89f73d561a8a..eb8a01fe3076a115ba061fe031dd7aeff4c4c01f 100644 (file)
@@ -29,6 +29,7 @@ import javax.inject.Named;
 import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.created.ObservableCreatedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableUpdatedContactEvent;
 import org.mxchange.jcontacts.events.fax.linked.AdminLinkedFaxNumberEvent;
 import org.mxchange.jcontacts.events.fax.linked.ObservableAdminLinkedFaxNumberEvent;
 import org.mxchange.jcontacts.events.fax.unlinked.AdminUnlinkedFaxNumberEvent;
@@ -37,6 +38,7 @@ import org.mxchange.jcontacts.events.landline.linked.AdminLinkedLandLineNumberEv
 import org.mxchange.jcontacts.events.landline.linked.ObservableAdminLinkedLandLineNumberEvent;
 import org.mxchange.jcontacts.events.landline.unlinked.AdminUnlinkedLandLineNumberEvent;
 import org.mxchange.jcontacts.events.landline.unlinked.ObservableAdminUnlinkedLandLineNumberEvent;
+import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jcontacts.model.phone.AdminContactsPhoneSessionBeanRemote;
 import org.mxchange.jcountry.model.data.Country;
@@ -345,6 +347,31 @@ public class JobsAdminContactPhoneWebRequestBean extends BaseJobsBean implements
                this.setPhoneEntryUpdated(number.getPhoneEntryUpdated());
        }
 
+       /**
+        * Event observer for updated contact data by the user
+        * <p>
+        * @param event Updated contact data event
+        */
+       public void afterUpdatedContactDataEvent (@Observes final ObservableUpdatedContactEvent event) {
+               // Event and contained entity instance should not be null
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getUpdatedContact() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.updatedContact is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
+               }
+
+               // Clear all data
+               this.clear();
+       }
+
        /**
         * Links fax number to contact from bean helper as "main fax number".
         * <p>
@@ -395,7 +422,7 @@ public class JobsAdminContactPhoneWebRequestBean extends BaseJobsBean implements
                try {
                        // Link it, too
                        updatedContact = this.adminContactPhoneBean.linkNewFaxNumberWithContact(targetContact, number);
-               } catch (final PhoneNumberAlreadyLinkedException ex) {
+               } catch (final PhoneNumberAlreadyLinkedException | ContactNotFoundException ex) {
                        // Throw again as cause
                        this.showFacesMessage("form_add_contact_fax:faxNumber", ex, FacesMessage.SEVERITY_ERROR); //NOI18N
                        return ""; //NOI18N
@@ -459,7 +486,7 @@ public class JobsAdminContactPhoneWebRequestBean extends BaseJobsBean implements
                try {
                        // Link it, too
                        updatedContact = this.adminContactPhoneBean.linkNewLandLineNumberWithContact(targetContact, number);
-               } catch (final PhoneNumberAlreadyLinkedException ex) {
+               } catch (final PhoneNumberAlreadyLinkedException | ContactNotFoundException ex) {
                        // Throw again as cause
                        this.showFacesMessage("form_add_contact_landLine:landLineNumber", ex, FacesMessage.SEVERITY_ERROR); //NOI18N
                        return ""; //NOI18N
@@ -658,7 +685,7 @@ public class JobsAdminContactPhoneWebRequestBean extends BaseJobsBean implements
                try {
                        // Unlink it and return contact without fax instance
                        updatedContact = this.adminContactPhoneBean.unlinkFaxDataFromContact(this.getContact(), number);
-               } catch (final PhoneNumberNotLinkedException ex) {
+               } catch (final PhoneNumberNotLinkedException | ContactNotFoundException ex) {
                        // Did not work
                        this.showFacesMessage("form_unlink_contact_fax:faxNumberId", ex, FacesMessage.SEVERITY_ERROR); //NOI18N
                        return ""; //NOI18N
@@ -713,7 +740,7 @@ public class JobsAdminContactPhoneWebRequestBean extends BaseJobsBean implements
                try {
                        // Unlink it and return contact without landLine instance
                        updatedContact = this.adminContactPhoneBean.unlinkLandLineDataFromContact(this.getContact(), number);
-               } catch (final PhoneNumberNotLinkedException ex) {
+               } catch (final PhoneNumberNotLinkedException | ContactNotFoundException ex) {
                        // Did not work
                        this.showFacesMessage("form_unlink_contact_landLine:landLineNumberId", ex, FacesMessage.SEVERITY_ERROR); //NOI18N
                        return ""; //NOI18N
index ed9396222d03665d0f3a787740e27e3acbaed006..cc2ace7c42b8bff494ecca885a742c0cff5b0e72 100644 (file)
@@ -26,6 +26,7 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableUpdatedContactEvent;
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jjobs.beans.BaseJobsBean;
 import org.mxchange.jjobs.beans.contact.list.JobsContactListWebViewController;
@@ -201,6 +202,31 @@ public class JobsContactPhoneWebRequestBean extends BaseJobsBean implements Jobs
                this.setLandLineNumber(event.getLandLineNumber());
        }
 
+       /**
+        * Event observer for updated contact data by the user
+        * <p>
+        * @param event Updated contact data event
+        */
+       public void afterUpdatedContactDataEvent (@Observes final ObservableUpdatedContactEvent event) {
+               // Event and contained entity instance should not be null
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getUpdatedContact() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.updatedContact is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
+               }
+
+               // Clear all data
+               this.clear();
+       }
+
        /**
         * Getter for all contacts having current fax number linked
         * <p>
index 3fe9c4932ad50b762cf56988ee96e0e524039529..6bd46bb6cae32a2b7fd4b39fad3e271c841371e7 100644 (file)
@@ -31,6 +31,7 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableUpdatedContactEvent;
 import org.mxchange.jcontacts.events.mobile.linked.ObservableAdminLinkedMobileNumberEvent;
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jjobs.beans.BaseJobsBean;
@@ -274,6 +275,34 @@ public class JobsMobileListWebViewBean extends BaseJobsBean implements JobsMobil
                this.clear();
        }
 
+       /**
+        * Observes events being fired when an user has updated contact data.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterUpdatedContactDataEvent (@Observes final ObservableUpdatedContactEvent event) {
+               // Event and contained entity instance should not be null
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getUpdatedContact() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.updatedContact is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
+               }
+
+               // Update contact's mobile, land-line and mobile number
+               this.updateContactMobileNumbers(event.getUpdatedContact());
+
+               // Clear all data
+               this.clear();
+       }
+
        @Override
        public DialableMobileNumber findMobileNumberById (final Long mobileNumberId) throws MobileEntityNotFoundException {
                // Validate paramter
index 398fbdb582a0fb9ee90ca2f32a3e2e84d71a727c..0f72401e23ca7ff23b153604afb4a9bec914f9cc 100644 (file)
@@ -31,6 +31,7 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableUpdatedContactEvent;
 import org.mxchange.jcontacts.events.fax.linked.ObservableAdminLinkedFaxNumberEvent;
 import org.mxchange.jcontacts.events.landline.linked.ObservableAdminLinkedLandLineNumberEvent;
 import org.mxchange.jcontacts.model.contact.Contact;
@@ -366,6 +367,34 @@ public class JobsPhoneListWebViewBean extends BaseJobsBean implements JobsPhoneL
                this.clear();
        }
 
+       /**
+        * Observes events being fired when an user has updated contact data.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterUpdatedContactDataEvent (@Observes final ObservableUpdatedContactEvent event) {
+               // Event and contained entity instance should not be null
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getUpdatedContact() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.updatedContact is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() == null) {
+                       // phoneId is null
+                       throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
+               }
+
+               // Update contact's mobile, land-line and fax number
+               this.updateContactPhoneNumbers(event.getUpdatedContact());
+
+               // Clear all data
+               this.clear();
+       }
+
        @Override
        public DialableFaxNumber findFaxNumberById (final Long phoneId) throws PhoneEntityNotFoundException {
                // Validate paramter
index f05fe543de31c662d2661e6a36e5c413612568b3..6aa69961365fe67180cda35a525c33bab1664788 100644 (file)
@@ -59,10 +59,10 @@ public class JobsBranchOfficeConverter implements Converter<BranchOffice> {
 
                try {
                        // Try to parse the value as long
-                       final Long branchOfficeId = Long.valueOf(submittedValue);
+                       final Long branchId = Long.valueOf(submittedValue);
 
                        // Try to get user instance from it
-                       branchOffice = BRANCH_OFFICE_LIST_CONTROLLER.findBranchOfficeById(branchOfficeId);
+                       branchOffice = BRANCH_OFFICE_LIST_CONTROLLER.findBranchOfficeById(branchId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
index 70932c5a64b60533996e802f244f1ff973e20b8a..210d89e2653949dab1c5eaf2899764ac1c5cad75 100644 (file)
@@ -158,7 +158,7 @@ USER_CREATED_TITLE=Wann der Benutzer dieser Community beigetreten ist.
 PAGE_TITLE_INDEX_USER_PROFILE=Benutzerprofil
 CONTENT_TITLE_INDEX_USER_PROFILE=\u00d6ffentliches Profil des Benutzers:
 PARAMETER_USER_ID_MISSING=Benutzernummer nicht angegeben.
-PARAMETER_USER_ID_INVALID=Der angeklickte Link ist nicht mehr g\u00fcltig: Den Benutzer mit der Id-Nummer existiert nicht (mehr).
+PARAMETER_USER_ID_INVALID=Der angeklickte Link ist nicht mehr g\u00fcltig: Der Benutzer mit der Id-Nummer existiert nicht (mehr).
 PARAMETER_USER_ID_NOT_FOUND=Benutzeraccount mit der Id-Nummer nicht gefunden.
 TABLE_HEADER_ERROR_HANDLING_USER_ID=Fehler beim Verarbeiten der Benutzernummer:
 TABLE_HEADER_SHOW_ADDRESSBOOK=Adressbuchdaten:
@@ -873,7 +873,7 @@ CONTENT_TITLE_ADMIN_LIST_BRANCH_OFFICES=Auflisten von Filialen:
 ADMIN_EMPTY_LIST_BRANCH_OFFICES=Es befinden sich keine Filialen in der Datenbank gefunden. Oder Ihre Suche ergab keine Uebereinstimmungen.
 ADMIN_ADD_BRANCH_OFFICE_TITLE=Filiale hinzuf\u00fcgen
 #@TODO Please fix German umlauts!
-ADMIN_ADD_BRANCH_OFFICE_MINIMUM_DATA=Bitte waehlen Sie mindestens das zugehoerige Unternehmen und das Land aus und geben Sie Strasse, Hausnummer, Postleitzahl und Stadt ein.
+ADMIN_BRANCH_OFFICE_MINIMUM_DATA=Bitte waehlen Sie mindestens das zugehoerige Unternehmen und das Land aus und geben Sie Strasse, Hausnummer, Postleitzahl und Stadt ein.
 ADMIN_ENTER_BRANCH_OFFICE_EMAIL_ADDRESS=Email-Addresse der Filiale:
 ADMIN_ENTER_BRANCH_OFFICE_LAND_LINE_NUMBER=Telefonnummer eingeben:
 ADMIN_ENTER_BRANCH_OFFICE_FAX_NUMBER=Faxnummer eingeben:
@@ -1221,7 +1221,7 @@ OPTIONS=Optionen
 ADMIN_BASIC_DATA_COMPANY_SHORT_NAME=Kurzer Firmenname:
 ADMIN_BASIC_DATA_COMPANY_SHORT_NAME_HEADER=Kurzer Name:
 AVAILABLE_HEADER=Verf\u00fcgbar:
-ADMIN_MANUFACTURER_HEADER=Hersteller:
+ADMIN_MANUFACTURER_HEADER=Hersteller:branchId
 ADMIN_ASSIGNED_MANUFACTURER_LABEL=Zugewiesener Hersteller:
 BARCODE=Barcode:
 ADMIN_CONTACT_DETAILS_HEADER=Kontaktdaten zu {0} {1} {2}:
@@ -1231,3 +1231,10 @@ ERROR_PARAMETER_CONFIRM_KEY_IS_NOT_SET=Fehler: Parameter "confirmationKey" ist n
 ROAD_NUMBER_HEADER=Betriebsnummer:
 ADMIN_BASIC_DATA_COMPANY_ROAD_NUMBER=Betriebsnummer:
 BASIC_DATA_COMPANY_ROAD_NUMBER_MISMATCHES_PATTERN=Die Betriebsnummer stimmt nicht mit dem regul\u00e4ren Ausruck AA BB 12345 \u00fcberein.
+ERROR_PARAMETER_BRANCH_OFFICE_ID_NOT_SET=Fehler: Parameter "branchId" ist nicht gesetzt.
+PARAMETER_BRANCH_OFFICE_ID_INVALID=Der angeklickte Link ist nicht mehr g\u00fcltig: Die Filiale mit der Id-Nummer existiert nicht (mehr).
+ADMIN_BRANCH_OFFICE_NOT_UPDATED=Sie haben keine Daten der Filiale aktualisiert.
+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:
index 8a828f4cfd9d105cf76cbcdf1e7429ac154dee66..748ed6a3bd7f55fe017595119af168e3880106a0 100644 (file)
@@ -840,7 +840,7 @@ PAGE_TITLE_ADMIN_LIST_BRANCH_OFFICES=List branch offices
 CONTENT_TITLE_ADMIN_LIST_BRANCH_OFFICES=List branch offices:
 ADMIN_EMPTY_LIST_BRANCH_OFFICES=There are no branch offices found in database. Or your search criteria doesn't match anything.
 ADMIN_ADD_BRANCH_OFFICE_TITLE=Add branch office
-ADMIN_ADD_BRANCH_OFFICE_MINIMUM_DATA=Please at least choose assigned company, country and enter at least street name, house number, ZIP code and city.
+ADMIN_BRANCH_OFFICE_MINIMUM_DATA=Please at least choose assigned company, country and enter at least street name, house number, ZIP code and city.
 ADMIN_ENTER_BRANCH_OFFICE_EMAIL_ADDRESS=Email address of branch office:
 ADMIN_ENTER_BRANCH_OFFICE_LAND_LINE_NUMBER=Enter land-line number:
 ADMIN_ENTER_BRANCH_OFFICE_FAX_NUMBER=Enter fax number:
@@ -1137,3 +1137,10 @@ ERROR_PARAMETER_CONFIRM_KEY_IS_NOT_SET=Error: Parameter "confirmKey" is required
 ROAD_NUMBER_HEADER=Road number:
 ADMIN_BASIC_DATA_COMPANY_ROAD_NUMBER=Road number:
 BASIC_DATA_COMPANY_ROAD_NUMBER_MISMATCHES_PATTERN=Company's road number does not match pattern AA BB 12345.
+ERROR_PARAMETER_BRANCH_OFFICE_ID_NOT_SET=Error: Parameter "branchId" is not set.
+PARAMETER_BRANCH_OFFICE_ID_INVALID=The clicked link is no longer valid: The branch office with provided id number does not exist.
+ADMIN_BRANCH_OFFICE_NOT_UPDATED=You have not updated any data of the branch office.
+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}):
index ba45efc4031c365f87d10c207d5811dc4962b20e..1529c0eecd9a1377be031e8ad8b914e05f1b09b4 100644 (file)
                        <to-view-id>/admin/landline/admin_landline_show.xhtml</to-view-id>
                </navigation-case>
        </navigation-rule>
+       <navigation-rule>
+               <from-view-id>/admin/branch_office/admin_branch_office_edit.xhtml</from-view-id>
+               <navigation-case>
+                       <from-outcome>admin_list_branch_office</from-outcome>
+                       <to-view-id>/admin/branch_office/admin_branch_office_list.xhtml</to-view-id>
+                       <redirect></redirect>
+               </navigation-case>
+       </navigation-rule>
        <navigation-rule>
                <from-view-id>/admin/department/admin_department_list.xhtml</from-view-id>
                <navigation-case>
index 00b6545d79c964ce40c2723a5f7d43a057bb52ae..8cc47ec8496e266936fa03cbc6bb1430a54d74a7 100644 (file)
@@ -1,7 +1,4 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<!--
-@TODO: title="#{msg.ADMIN_BRANCH_OFFICE_DATA_LEGEND_TITLE}"
--->
 <ui:composition
        xmlns="http://www.w3.org/1999/xhtml"
        xmlns:core="http://mxchange.org/jsf/core/widgets"
@@ -11,7 +8,10 @@
        xmlns:p="http://primefaces.org/ui"
        >
 
-       <p:fieldset legend="#{msg.ADMIN_BRANCH_OFFICE_DATA_LEGEND}">
+       <p:fieldset
+               legend="#{msg.ADMIN_BRANCH_OFFICE_DATA_LEGEND}"
+               title="#{msg.ADMIN_BRANCH_OFFICE_DATA_LEGEND_TITLE}"
+               >
                <p:panelGrid
                        layout="grid"
                        columns="2"
@@ -21,7 +21,7 @@
                        <p:outputLabel for="branchCompany" value="#{msg.ADMIN_ASSIGN_BASIC_DATA_BRANCH_OFFICE}" />
                        <p:selectOneMenu
                                id="branchCompany"
-                               value="#{adminBranchOfficeController.branchCompany}"
+                               value="#{adminBranchOfficeActionController.branchCompany}"
                                filter="true"
                                filterMatchMode="contains"
                                required="true"
@@ -43,7 +43,7 @@
                        <p:outputLabel for="branchContactEmployee" value="#{msg.ADMIN_ASSIGN_BRANCH_OFFICE_CONTACT_EMPLOYEE}" />
                        <p:selectOneMenu
                                id="branchContactEmployee"
-                               value="#{adminBranchOfficeController.branchContactEmployee}"
+                               value="#{adminBranchOfficeActionController.branchContactEmployee}"
                                filter="true"
                                filterMatchMode="contains"
                                >
                                        />
                        </p:selectOneMenu>
 
-                       <p:outputLabel for="branchOwner" value="#{msg.ADMIN_ASSIGN_BRANCH_OFFICE_OWNER}" />
+                       <p:outputLabel for="branchOwnerEmployee" value="#{msg.ADMIN_ASSIGN_BRANCH_OFFICE_OWNER}" />
                        <p:selectOneMenu
-                               id="branchOwner"
-                               value="#{adminBranchOfficeController.branchOwner}"
+                               id="branchOwnerEmployee"
+                               value="#{adminBranchOfficeActionController.branchOwnerEmployee}"
                                filter="true"
                                filterMatchMode="contains"
                                >
@@ -83,7 +83,7 @@
                        <p:outputLabel for="branchUserOwner" value="#{msg.ADMIN_ASSIGN_BRANCH_OFFICE_USER_OWNER}" />
                        <p:selectOneMenu
                                id="branchUserOwner"
-                               value="#{adminBranchOfficeController.branchUserOwner}"
+                               value="#{adminBranchOfficeActionController.branchUserOwner}"
                                filter="true"
                                filterMatchMode="contains"
                                >
                                id="branchEmailAddress"
                                size="40"
                                maxlength="255"
-                               value="#{adminBranchOfficeController.branchEmailAddress}"
+                               value="#{adminBranchOfficeActionController.branchEmailAddress}"
                                validatorMessage="#{msg.ENTERED_EMAIL_ADDRESS_IS_INVALID}"
                                >
                                <validator:branchOfficeEmailAddressValidator allowEmptyRequiredData="true" />
                        </p:inputText>
 
                        <p:outputLabel for="landLineCountry" value="#{msg.ADMIN_ENTER_BRANCH_OFFICE_LAND_LINE_NUMBER}" />
-                       <core:inputLandLineNumberPanelGrid targetController="#{adminBranchOfficeController}" />
+                       <core:inputLandLineNumberPanelGrid targetController="#{adminBranchOfficeActionController}" />
 
                        <p:outputLabel for="faxCountry" value="#{msg.ADMIN_ENTER_BRANCH_OFFICE_FAX_NUMBER}" />
-                       <core:inputFaxNumberPanelGrid targetController="#{adminBranchOfficeController}" />
+                       <core:inputFaxNumberPanelGrid targetController="#{adminBranchOfficeActionController}" />
 
                        <p:outputLabel for="branchNumber" value="#{msg.ADMIN_ENTER_BRANCH_OFFICE_NUMBER}" />
-                       <p:inputText id="branchNumber" size="2" maxlength="10" value="#{adminBranchOfficeController.branchNumber}" />
+                       <p:inputText
+                               id="branchNumber"
+                               size="5"
+                               maxlength="10"
+                               value="#{adminBranchOfficeActionController.branchNumber}"
+                               />
                </p:panelGrid>
        </p:fieldset>
 
-       <p:fieldset legend="#{msg.ADMIN_BRANCH_OFFICE_ADDRESS_LEGEND}">
+       <p:fieldset
+               legend="#{msg.ADMIN_BRANCH_OFFICE_ADDRESS_LEGEND}"
+               title="#{msg.ADMIN_BRANCH_OFFICE_ADDRESS_LEGEND_TITLE}"
+               >
                <p:panelGrid
                        layout="grid"
                        columns="2"
                        styleClass="ui-noborder"
                        >
                        <p:outputLabel for="branchStreet" value="#{msg.ADMIN_DATA_STREET_NAME}" />
-                       <p:inputText id="branchStreet" size="20" maxlength="255" value="#{adminBranchOfficeController.branchStreet}" required="true" requiredMessage="#{msg.ADMIN_BRANCH_OFFICE_STREET_NAME_REQUIRED}" />
+                       <p:inputText id="branchStreet" size="20" maxlength="255" value="#{adminBranchOfficeActionController.branchStreet}" required="true" requiredMessage="#{msg.ADMIN_BRANCH_OFFICE_STREET_NAME_REQUIRED}" />
 
                        <p:outputLabel for="branchHouseNumber" value="#{msg.ADMIN_DATA_HOUSE_NUMBER}" />
-                       <p:inputText id="branchHouseNumber" size="3" maxlength="5" value="#{adminBranchOfficeController.branchHouseNumber}" validatorMessage="#{msg.ENTERED_HOUSE_NUMBER_INVALID}" required="true" requiredMessage="#{msg.ADMIN_BRANCH_OFFICE_HOUSE_NUMBER_REQUIRED}">
+                       <p:inputText id="branchHouseNumber" size="3" maxlength="5" value="#{adminBranchOfficeActionController.branchHouseNumber}" validatorMessage="#{msg.ENTERED_HOUSE_NUMBER_INVALID}" required="true" requiredMessage="#{msg.ADMIN_BRANCH_OFFICE_HOUSE_NUMBER_REQUIRED}">
                                <f:validateLongRange minimum="1" maximum="500" />
                        </p:inputText>
 
                        <p:outputLabel for="branchLastHouseNumber" value="#{msg.ADMIN_DATA_LAST_HOUSE_NUMBER}" />
-                       <p:inputText id="branchLastHouseNumber" size="3" maxlength="5" value="#{adminBranchOfficeController.branchLastHouseNumber}" validatorMessage="#{msg.ENTERED_HOUSE_NUMBER_INVALID}">
+                       <p:inputText id="branchLastHouseNumber" size="3" maxlength="5" value="#{adminBranchOfficeActionController.branchLastHouseNumber}" validatorMessage="#{msg.ENTERED_HOUSE_NUMBER_INVALID}">
                                <f:validateLongRange minimum="1" maximum="500" />
                        </p:inputText>
 
                        <p:outputLabel for="branchHouseNumberExtension" value="#{msg.ADMIN_DATA_HOUSE_NUMBER_EXTENSION}" />
-                       <p:inputText id="branchHouseNumberExtension" size="1" maxlength="255" value="#{adminBranchOfficeController.branchHouseNumberExtension}" validatorMessage="#{msg.ENTERED_HOUSE_NUMBER_INVALID}" />
+                       <p:inputText id="branchHouseNumberExtension" size="1" maxlength="255" value="#{adminBranchOfficeActionController.branchHouseNumberExtension}" validatorMessage="#{msg.ENTERED_HOUSE_NUMBER_INVALID}" />
 
                        <p:outputLabel for="branchStore" value="#{msg.ADMIN_ENTER_DATA_STORE}" />
-                       <p:inputText id="branchStore" size="3" maxlength="5" value="#{adminBranchOfficeController.branchStore}" validatorMessage="#{msg.ENTERED_STORE_INVALID}">
+                       <p:inputText id="branchStore" size="3" maxlength="5" value="#{adminBranchOfficeActionController.branchStore}" validatorMessage="#{msg.ENTERED_STORE_INVALID}">
                                <f:validateLongRange minimum="-5" maximum="200" />
                        </p:inputText>
 
                        <p:outputLabel for="branchSuiteNumber" value="#{msg.ADMIN_ENTER_DATA_SUITE_NUMBER}" />
-                       <p:inputText id="branchSuiteNumber" size="3" maxlength="5" value="#{adminBranchOfficeController.branchSuiteNumber}" validatorMessage="#{msg.ENTERED_SUITE_NUMBER_INVALID}">
+                       <p:inputText id="branchSuiteNumber" size="3" maxlength="5" value="#{adminBranchOfficeActionController.branchSuiteNumber}" validatorMessage="#{msg.ENTERED_SUITE_NUMBER_INVALID}">
                                <f:validateLongRange minimum="1" maximum="500" />
                        </p:inputText>
 
                        <p:outputLabel for="branchZipCode" value="#{msg.DATA_ZIP_CODE}" />
-                       <p:inputText id="branchZipCode" size="5" maxlength="6" value="#{adminBranchOfficeController.branchZipCode}" required="true" requiredMessage="#{msg.ADMIN_BRANCH_OFFICE_ZIP_CODE_REQUIRED}">
+                       <p:inputText id="branchZipCode" size="5" maxlength="6" value="#{adminBranchOfficeActionController.branchZipCode}" required="true" requiredMessage="#{msg.ADMIN_BRANCH_OFFICE_ZIP_CODE_REQUIRED}">
                                <f:validateLongRange minimum="1" maximum="99999" />
                        </p:inputText>
 
                        <p:outputLabel for="branchCity" value="#{msg.ADMIN_DATA_CITY}" />
-                       <p:inputText id="branchCity" size="20" maxlength="255" value="#{adminBranchOfficeController.branchCity}" required="true" requiredMessage="#{msg.ADMIN_BRANCH_OFFICE_CITY_REQUIRED}" />
+                       <p:inputText id="branchCity" size="20" maxlength="255" value="#{adminBranchOfficeActionController.branchCity}" required="true" requiredMessage="#{msg.ADMIN_BRANCH_OFFICE_CITY_REQUIRED}" />
 
                        <p:outputLabel for="branchCountry" value="#{msg.ADMIN_SELECT_COUNTRY}" />
-                       <core:outputCountrySelector id="branchCountry" value="#{adminBranchOfficeController.branchCountry}" required="true" requiredMessage="#{msg.ADMIN_BRANCH_OFFICE_COUNTRY_REQUIRED}" />
+                       <core:outputCountrySelector id="branchCountry" value="#{adminBranchOfficeActionController.branchCountry}" required="true" requiredMessage="#{msg.ADMIN_BRANCH_OFFICE_COUNTRY_REQUIRED}" />
                </p:panelGrid>
        </p:fieldset>
 </ui:composition>
index 6c54ce6cc0714bfb43521c024f3291582f69ae50..4af4b8665bfb8c3f6f308e0674c600c7887ea1c2 100644 (file)
@@ -22,7 +22,7 @@
 
                        <p:selectOneMenu
                                id="openingStartDay"
-                               value="#{adminBranchOfficeController.openingStartDay}"
+                               value="#{adminBranchOfficeActionController.openingStartDay}"
                                filter="true"
                                filterMatchMode="contains"
                                required="true"
@@ -43,7 +43,7 @@
 
                        <p:selectOneMenu
                                id="openingEndDay"
-                               value="#{adminBranchOfficeController.openingEndDay}"
+                               value="#{adminBranchOfficeActionController.openingEndDay}"
                                filter="true"
                                filterMatchMode="contains"
                                required="true"
@@ -64,7 +64,7 @@
 
                        <p:calendar
                                id="openingStartTime"
-                               value="#{adminBranchOfficeController.openingStartTime}"
+                               value="#{adminBranchOfficeActionController.openingStartTime}"
                                pattern="HH:mm"
                                timeOnly="true"
                                stepMinute="5"
@@ -75,7 +75,7 @@
 
                        <p:calendar
                                id="openingEndTime"
-                               value="#{adminBranchOfficeController.openingEndTime}"
+                               value="#{adminBranchOfficeActionController.openingEndTime}"
                                pattern="HH:mm"
                                timeOnly="true"
                                stepMinute="5"
diff --git a/web/admin/branch_office/admin_branch_office_edit.xhtml b/web/admin/branch_office/admin_branch_office_edit.xhtml
new file mode 100644 (file)
index 0000000..12fdd25
--- /dev/null
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ui:composition
+       template="/WEB-INF/templates/admin/admin_base.tpl"
+       xmlns="http://www.w3.org/1999/xhtml"
+       xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
+       xmlns:h="http://xmlns.jcp.org/jsf/html"
+       xmlns:f="http://xmlns.jcp.org/jsf/core"
+       xmlns:p="http://primefaces.org/ui"
+       >
+
+       <ui:define name="metadata">
+               <f:metadata>
+                       <f:viewParam
+                               name="branchId"
+                               value="#{adminBranchOfficeActionController.currentBranchOffice}"
+                               converter="BranchOfficeConverter"
+                               required="true"
+                               requiredMessage="#{msg.ERROR_PARAMETER_BRANCH_OFFICE_ID_NOT_SET}"
+                               converterMessage="#{msg.PARAMETER_BRANCH_OFFICE_ID_INVALID}"
+                               />
+
+                       <f:viewAction
+                               action="#{adminBranchOfficeActionController.copyAllBranchOfficeProperties()}"
+                               />
+               </f:metadata>
+       </ui:define>
+
+       <ui:define name="document_admin_title">
+               <h:outputText value="#{msg.PAGE_TITLE_ADMIN_EDIT_BRANCH_OFFICE}" />
+       </ui:define>
+
+       <ui:define name="content_header">
+               <h:outputText value="#{msg.CONTENT_TITLE_ADMIN_EDIT_BRANCH_OFFICE}" />
+       </ui:define>
+
+       <ui:define name="content">
+               <h:form
+                       id="form-admin-edit-branch-office"
+                       rendered="#{not empty adminBranchOfficeActionController.currentBranchOffice}"
+                       >
+                       <h:inputHidden value="#{adminBranchOfficeActionController.branchId}" />
+
+                       <p:panelGrid
+                               columns="1"
+                               layout="grid"
+                               >
+                               <f:facet name="header">
+                                       <h:outputFormat
+                                               value="#{msg.ADMIN_EDIT_BRANCH_OFFICE_TITLE}"
+                                               title="#{beanHelper.renderBranchOffice(adminBranchOfficeActionController.currentBranchOffice, false)}"
+                                               rendered="#{empty adminBranchOfficeActionController.branchNumber}"
+                                               >
+                                               <f:param value="#{adminBranchOfficeActionController.branchId}" />
+                                       </h:outputFormat>
+
+                                       <h:outputFormat
+                                               value="#{msg.ADMIN_EDIT_BRANCH_OFFICE_NUMBER_TITLE}"
+                                               title="#{beanHelper.renderBranchOffice(adminBranchOfficeActionController.currentBranchOffice, false)}"
+                                               rendered="#{not empty adminBranchOfficeActionController.branchNumber}"
+                                               >
+                                               <f:param value="#{adminBranchOfficeActionController.branchId}" />
+                                               <f:param value="#{adminBranchOfficeActionController.branchNumber}" />
+                                       </h:outputFormat>
+                               </f:facet>
+
+                               <h:panelGroup styleClass="para" layout="block">
+                                       <h:outputText value="#{msg.ADMIN_BRANCH_OFFICE_MINIMUM_DATA}" />
+                               </h:panelGroup>
+
+                               <ui:include src="/WEB-INF/templates/admin/branch_office/admin_form_branch_office_data.tpl" />
+
+                               <f:facet name="footer">
+                                       <p:panelGrid columns="2" layout="grid">
+                                               <p:commandButton
+                                                       type="reset"
+                                                       value="#{msg.BUTTON_RESET_FORM}"
+                                                       />
+
+                                               <p:commandButton
+                                                       type="submit"
+                                                       value="#{msg.BUTTON_ADMIN_EDIT_BRANCH_OFFICE}"
+                                                       action="#{adminBranchOfficeActionController.updateBranchOffice()}"
+                                                       />
+                                       </p:panelGrid>
+                               </f:facet>
+                       </p:panelGrid>
+               </h:form>
+       </ui:define>
+</ui:composition>
index 0a55aa17e6b06a2037dab4c34b53c844726159c7..f491f4d0e4726525330fa536ac1965db345f8e64 100644 (file)
                                </f:facet>
 
                                <h:panelGroup styleClass="para" layout="block">
-                                       <h:outputText value="#{msg.ADMIN_ADD_BRANCH_OFFICE_MINIMUM_DATA}" />
+                                       <h:outputText value="#{msg.ADMIN_BRANCH_OFFICE_MINIMUM_DATA}" />
                                </h:panelGroup>
 
                                <ui:include src="/WEB-INF/templates/admin/branch_office/admin_form_branch_office_data.tpl" />
                                                <p:commandButton
                                                        type="submit"
                                                        value="#{msg.BUTTON_ADMIN_ADD_BASIC_DATA}"
-                                                       action="#{adminBranchOfficeController.addBranchOffice()}"
+                                                       action="#{adminBranchOfficeActionController.addBranchOffice()}"
                                                        update="form-list-branch-offices:branchOfficeList"
                                                        oncomplete="PF('branchOfficeList').filter()"
                                                        />
                        <p:fieldset legend="#{msg.ADMIN_BRANCH_OFFICE_OPENING_TIMES_LEGEND}">
                                <core:outputOpeningTimesDataTable
                                        id="branchOpeningTimeList"
-                                       value="#{adminBranchOfficeController.branchOpeningTimes}"
+                                       value="#{adminBranchOfficeActionController.branchOpeningTimes}"
                                        rows="10"
                                        summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_BRANCH_OFFICE_OPENING_TIMES}"
                                        emptyMessage="#{msg.ADMIN_EMPTY_LIST_BRANCH_OFFICE_OPENING_TIMES}"
                                                <p:commandButton
                                                        type="submit"
                                                        value="#{msg.BUTTON_ADMIN_ADD_BRANCH_OFFICE_OPENING_TIME}"
-                                                       action="#{adminBranchOfficeController.addOpeningTime()}"
+                                                       action="#{adminBranchOfficeActionController.addOpeningTime()}"
                                                        update="form-list-branch-opening-time:branchOpeningTimeList"
                                                        oncomplete=""
                                                        />