]> git.mxchange.org Git - jjobs-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Tue, 17 Oct 2017 21:42:44 +0000 (23:42 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 21 Jul 2019 04:56:11 +0000 (06:56 +0200)
- switched converters/validators which are converting primary keys (id numbers)
  into entities from EJB-based lookup to backing-bean-based lookup as this is
  much better performing (EJB calls are relative "expensive")
- the backing bean will then check cache which is basically a distributed Map
  (Cache interface) where the primary key is also the key for cache entries
- a SomeEntityNotFoundException is being thrown when containsKey() returns
  false which is then caught by the calling method
- fixed imports from "renaming season" ;-)
- renamed contactsCache -> contactCache as other caches are named same way
- no need for company employee, basic data, branch offices and departments

Signed-off-by: Roland Häder <roland@mxchange.org>
59 files changed:
src/java/org/mxchange/jjobs/beans/business/basicdata/JobsAdminBusinessDataWebRequestBean.java
src/java/org/mxchange/jjobs/beans/business/basicdata/JobsBusinessDataWebRequestBean.java
src/java/org/mxchange/jjobs/beans/business/basicdata/JobsBusinessDataWebRequestController.java
src/java/org/mxchange/jjobs/beans/business/branchoffice/JobsAdminBranchOfficeWebRequestBean.java
src/java/org/mxchange/jjobs/beans/business/branchoffice/JobsBranchOfficeWebRequestBean.java
src/java/org/mxchange/jjobs/beans/business/branchoffice/JobsBranchOfficeWebRequestController.java
src/java/org/mxchange/jjobs/beans/business/department/JobsAdminDepartmentWebRequestBean.java
src/java/org/mxchange/jjobs/beans/business/department/JobsDepartmentWebRequestBean.java
src/java/org/mxchange/jjobs/beans/business/department/JobsDepartmentWebRequestController.java
src/java/org/mxchange/jjobs/beans/business/employee/JobsAdminCompanyEmployeeWebRequestBean.java
src/java/org/mxchange/jjobs/beans/business/employee/JobsCompanyEmployeeWebRequestBean.java
src/java/org/mxchange/jjobs/beans/business/employee/JobsCompanyEmployeeWebSessionController.java
src/java/org/mxchange/jjobs/beans/business/opening_time/JobsOpeningTimeWebRequestBean.java
src/java/org/mxchange/jjobs/beans/business/opening_time/JobsOpeningTimeWebRequestController.java
src/java/org/mxchange/jjobs/beans/contact/JobsContactWebRequestBean.java
src/java/org/mxchange/jjobs/beans/contact/JobsContactWebRequestController.java
src/java/org/mxchange/jjobs/beans/contact/phone/JobsAdminContactPhoneWebRequestBean.java
src/java/org/mxchange/jjobs/beans/country/JobsAdminCountryWebRequestBean.java
src/java/org/mxchange/jjobs/beans/country/JobsCountryWebRequestBean.java
src/java/org/mxchange/jjobs/beans/country/JobsCountryWebRequestController.java
src/java/org/mxchange/jjobs/beans/helper/JobsWebRequestHelperBean.java
src/java/org/mxchange/jjobs/beans/localization/JobsLocalizationSessionBean.java
src/java/org/mxchange/jjobs/beans/localization/JobsLocalizationSessionController.java
src/java/org/mxchange/jjobs/beans/mobileprovider/JobsAdminMobileProviderWebRequestBean.java
src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestBean.java
src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestController.java
src/java/org/mxchange/jjobs/beans/phone/JobsPhoneWebRequestBean.java
src/java/org/mxchange/jjobs/beans/phone/JobsPhoneWebRequestController.java
src/java/org/mxchange/jjobs/beans/user/JobsUserWebRequestBean.java
src/java/org/mxchange/jjobs/beans/user/JobsUserWebRequestController.java
src/java/org/mxchange/jjobs/converter/business/basicdata/JobsBusinessContactConverter.java
src/java/org/mxchange/jjobs/converter/business/branchoffice/JobsBranchOfficeConverter.java
src/java/org/mxchange/jjobs/converter/business/department/JobsCompanyDepartmentConverter.java
src/java/org/mxchange/jjobs/converter/business/employee/JobsEmployeeConverter.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/converter/business/headquarters/JobsCompanyHeadquartersConverter.java
src/java/org/mxchange/jjobs/converter/business/opening_time/JobsCompanyOpeningTimeConverter.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/converter/contact/JobsContactConverter.java
src/java/org/mxchange/jjobs/converter/country/JobsCountryConverter.java
src/java/org/mxchange/jjobs/converter/dayofweek/FinancialsDayOfTheWeekConverter.java [deleted file]
src/java/org/mxchange/jjobs/converter/dayofweek/JobsDayOfTheWeekConverter.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/converter/fax/JobsFaxNumberConverter.java
src/java/org/mxchange/jjobs/converter/landline/JobsLandLineNumberConverter.java
src/java/org/mxchange/jjobs/converter/mobile/JobsMobileNumberConverter.java
src/java/org/mxchange/jjobs/converter/mobileprovider/JobsMobileProviderConverter.java
src/java/org/mxchange/jjobs/converter/user/JobsUserConverter.java
src/java/org/mxchange/jjobs/validator/business/basicdata/JobsCompanyNameValidator.java
src/java/org/mxchange/jjobs/validator/emailaddress/JobsEmailAddressValidator.java
src/java/org/mxchange/jjobs/validator/user/JobsUserIdValidator.java
src/java/org/mxchange/localization/bundle_de_DE.properties
src/java/org/mxchange/localization/bundle_en_US.properties
web/WEB-INF/links.jsf.taglib.xml
web/WEB-INF/templates/admin/basic_company_data/admin_form_basic_company_data.tpl
web/WEB-INF/templates/admin/branch_office/admin_form_branch_office_data.tpl
web/WEB-INF/templates/admin/department/admin_form_department_data.tpl
web/WEB-INF/templates/admin/employee/admin_form_employee_data.tpl
web/admin/basic_company_data/admin_basic_company_data_list.xhtml
web/admin/branch_office/admin_branch_office_list.xhtml
web/admin/department/admin_department_list.xhtml
web/admin/employee/admin_employee_list.xhtml

index de80c37f25f22c317d7474648916871b2413b836..542a1ede5c87b3cf753e5775cb2f9158a8a2187e 100644 (file)
@@ -25,11 +25,11 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcontactsbusiness.events.basicdata.added.AdminAddedBusinessBasicDataEvent;
 import org.mxchange.jcontactsbusiness.events.basicdata.added.ObservableAdminAddedBusinessBasicDataEvent;
-import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicCompanyDataAlreadyAddedException;
+import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicDataAlreadyAddedException;
 import org.mxchange.jcontactsbusiness.model.basicdata.AdminBasicCompanyDataSessionBeanRemote;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
-import org.mxchange.jcontactsbusiness.model.basicdata.CompanyBasicData;
-import org.mxchange.jcontactsbusiness.model.employee.Employee;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
 import org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jjobs.beans.BaseJobsBean;
@@ -74,7 +74,7 @@ public class JobsAdminBusinessDataWebRequestBean extends BaseJobsBean implements
        /**
         * An employee as contact person with this company
         */
-       private Employee companyContactEmployee;
+       private Employable companyContactEmployee;
 
        /**
         * Companies (main) email address (example: info@company.example)
@@ -84,7 +84,7 @@ public class JobsAdminBusinessDataWebRequestBean extends BaseJobsBean implements
        /**
         * Company founder
         */
-       private Employee companyFounder;
+       private Employable companyFounder;
 
        /**
         * Head quarter data for this company
@@ -165,7 +165,7 @@ public class JobsAdminBusinessDataWebRequestBean extends BaseJobsBean implements
                }
 
                // Prepare entity
-               BusinessBasicData basicData = new CompanyBasicData(this.getCompanyName());
+               BasicData basicData = new BusinessBasicData(this.getCompanyName());
 
                // Set all opther remaining data
                basicData.setCompanyComments(this.getCompanyComments());
@@ -228,11 +228,11 @@ public class JobsAdminBusinessDataWebRequestBean extends BaseJobsBean implements
                // Now try to send to EJB and get an updated version back
                try {
                        // Try it
-                       BusinessBasicData updatedBasicData = this.adminBasicCompanyDataBean.addCompanyBasicData(basicData);
+                       final BasicData updatedBasicData = this.adminBasicCompanyDataBean.addBusinessBasicData(basicData);
 
                        // Fire event
                        this.businessDataAddedEvent.fire(new AdminAddedBusinessBasicDataEvent(updatedBasicData));
-               } catch (final BasicCompanyDataAlreadyAddedException e) {
+               } catch (final BasicDataAlreadyAddedException e) {
                        // Does already exist
                        throw new FacesException(e);
                }
@@ -262,18 +262,18 @@ public class JobsAdminBusinessDataWebRequestBean extends BaseJobsBean implements
        /**
         * Getter for employee as contact person
         * <p>
-        * @return Employee as contact person
+        * @return Employable as contact person
         */
-       public Employee getCompanyContactEmployee () {
+       public Employable getCompanyContactEmployee () {
                return this.companyContactEmployee;
        }
 
        /**
         * Setter for employee as contact person
         * <p>
-        * @param companyContactEmployee Employee as contact person
+        * @param companyContactEmployee Employable as contact person
         */
-       public void setCompanyContactEmployee (final Employee companyContactEmployee) {
+       public void setCompanyContactEmployee (final Employable companyContactEmployee) {
                this.companyContactEmployee = companyContactEmployee;
        }
 
@@ -300,7 +300,7 @@ public class JobsAdminBusinessDataWebRequestBean extends BaseJobsBean implements
         * <p>
         * @return Company founder
         */
-       public Employee getCompanyFounder () {
+       public Employable getCompanyFounder () {
                return this.companyFounder;
        }
 
@@ -309,7 +309,7 @@ public class JobsAdminBusinessDataWebRequestBean extends BaseJobsBean implements
         * <p>
         * @param companyFounder Company founder
         */
-       public void setCompanyFounder (final Employee companyFounder) {
+       public void setCompanyFounder (final Employable companyFounder) {
                this.companyFounder = companyFounder;
        }
 
index 0b09570b0664ac056c3b19d2f2008e4fc5bba84c..de5d555b86b0f823c1c79bb2ddb5448af729580b 100644 (file)
@@ -30,9 +30,10 @@ import javax.enterprise.event.Observes;
 import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcontactsbusiness.events.basicdata.added.ObservableAdminAddedBusinessBasicDataEvent;
+import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicDataNotFoundException;
 import org.mxchange.jcontactsbusiness.model.basicdata.AdminBasicCompanyDataSessionBeanRemote;
 import org.mxchange.jcontactsbusiness.model.basicdata.BasicCompanyDataSessionBeanRemote;
-import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jjobs.beans.BaseJobsBean;
 import org.mxchange.jjobs.beans.user.login.JobsUserLoginWebSessionController;
@@ -60,14 +61,14 @@ public class JobsBusinessDataWebRequestBean extends BaseJobsBean implements Jobs
        /**
         * List of all basic company data
         */
-       private List<BusinessBasicData> allCompanyBasicData;
+       private List<BasicData> allBasicData;
 
        /**
         * A list of all registered companies (globally)
         */
        @Inject
        @NamedCache (cacheName = "basicDataCache")
-       private Cache<Long, BusinessBasicData> basicDataCache;
+       private Cache<Long, BasicData> basicDataCache;
 
        /**
         * EJB for general basic business data purposes
@@ -108,7 +109,7 @@ public class JobsBusinessDataWebRequestBean extends BaseJobsBean implements Jobs
        /**
         * List of filtered basic company data
         */
-       private List<BusinessBasicData> filteredBasicCompanyData;
+       private List<BasicData> filteredBasicCompanyData;
 
        /**
         * Area code for land-line number
@@ -139,7 +140,7 @@ public class JobsBusinessDataWebRequestBean extends BaseJobsBean implements Jobs
                super();
 
                // Init list
-               this.allCompanyBasicData = new LinkedList<>();
+               this.allBasicData = new LinkedList<>();
        }
 
        /**
@@ -172,7 +173,7 @@ public class JobsBusinessDataWebRequestBean extends BaseJobsBean implements Jobs
 
                // Add it to list
                this.basicDataCache.put(event.getBasicData().getBasicDataId(), event.getBasicData());
-               this.allCompanyBasicData.add(event.getBasicData());
+               this.allBasicData.add(event.getBasicData());
        }
 
        /**
@@ -181,8 +182,29 @@ public class JobsBusinessDataWebRequestBean extends BaseJobsBean implements Jobs
         * @return A list of all business contacts
         */
        @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<BusinessBasicData> allCompanyBasicData () {
-               return this.allCompanyBasicData;
+       public List<BasicData> allBasicData () {
+               return this.allBasicData;
+       }
+
+       @Override
+       public BasicData findBasicDataById (final Long basicDataId) throws BasicDataNotFoundException {
+               // Validate parameter
+               if (null == basicDataId) {
+                       // Throw NPE
+                       throw new NullPointerException("basicDataId is null"); //NOI18N
+               } else if (basicDataId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("basicDataId=" + basicDataId + " is invalid"); //NOI18N
+               } else if (!this.basicDataCache.containsKey(basicDataId)) {
+                       // Not found
+                       throw new BasicDataNotFoundException(basicDataId);
+               }
+
+               // Get it from cache
+               final BasicData basicData = this.basicDataCache.get(basicDataId);
+
+               // Return it
+               return basicData;
        }
 
        /**
@@ -299,7 +321,7 @@ public class JobsBusinessDataWebRequestBean extends BaseJobsBean implements Jobs
         * @return Filtered basic company data
         */
        @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<BusinessBasicData> getFilteredBasicCompanyData () {
+       public List<BasicData> getFilteredBasicCompanyData () {
                return this.filteredBasicCompanyData;
        }
 
@@ -309,7 +331,7 @@ public class JobsBusinessDataWebRequestBean extends BaseJobsBean implements Jobs
         * @param filteredBasicCompanyData Filtered basic company data
         */
        @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
-       public void setFilteredBasicCompanyData (final List<BusinessBasicData> filteredBasicCompanyData) {
+       public void setFilteredBasicCompanyData (final List<BasicData> filteredBasicCompanyData) {
                this.filteredBasicCompanyData = filteredBasicCompanyData;
        }
 
@@ -375,39 +397,44 @@ public class JobsBusinessDataWebRequestBean extends BaseJobsBean implements Jobs
                // Is cache there?
                if (!this.basicDataCache.iterator().hasNext()) {
                        // Get whole list
-                       final List<BusinessBasicData> basicDatas = this.businessDataBean.allCompanyBasicData();
+                       final List<BasicData> basicDatas = this.businessDataBean.allBusinessBasicData();
 
                        // Add all
-                       for (final BusinessBasicData basicData : basicDatas) {
+                       for (final BasicData basicData : basicDatas) {
                                // Add it to cache
                                this.basicDataCache.put(basicData.getBasicDataId(), basicData);
                        }
                }
 
                // Is cache there and list is not full?
-               if ((this.allCompanyBasicData.isEmpty()) && (this.basicDataCache.iterator().hasNext())) {
+               if ((this.allBasicData.isEmpty()) && (this.basicDataCache.iterator().hasNext())) {
                        // Get iterator
-                       final Iterator<Cache.Entry<Long, BusinessBasicData>> iterator = this.basicDataCache.iterator();
+                       final Iterator<Cache.Entry<Long, BasicData>> iterator = this.basicDataCache.iterator();
 
                        // Build up list
                        while (iterator.hasNext()) {
                                // GEt next element
-                               final Cache.Entry<Long, BusinessBasicData> next = iterator.next();
+                               final Cache.Entry<Long, BasicData> next = iterator.next();
 
                                // Add to list
-                               this.allCompanyBasicData.add(next.getValue());
+                               this.allBasicData.add(next.getValue());
                        }
 
                        // Sort list
-                       this.allCompanyBasicData.sort(new Comparator<BusinessBasicData>() {
+                       this.allBasicData.sort(new Comparator<BasicData>() {
                                @Override
-                               public int compare (final BusinessBasicData o1, final BusinessBasicData o2) {
+                               public int compare (final BasicData o1, final BasicData o2) {
                                        return o1.getBasicDataId() > o2.getBasicDataId() ? 1 : o1.getBasicDataId() < o2.getBasicDataId() ? -1 : 0;
                                }
                        });
                }
        }
 
+       @Override
+       public Boolean isCompanyNameUsed (String companyName) {
+               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+       }
+
        /**
         * Clears this bean
         */
index f60e6d4d8a6ca114a4c5898959a68aa0f80971ab..89dbc778415a21ae6a29c16f184dab99e961c915 100644 (file)
@@ -17,6 +17,8 @@
 package org.mxchange.jjobs.beans.business.basicdata;
 
 import java.io.Serializable;
+import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicDataNotFoundException;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 
 /**
  * An interface for session-scoped basic data controller
@@ -25,4 +27,26 @@ import java.io.Serializable;
  */
 public interface JobsBusinessDataWebRequestController extends Serializable {
 
+       /**
+        * Retrieves a single business data entity for given id number or throws a
+        * proper exception if not found.
+        * <p>
+        * @param basicDataId Company basic data id to lookup
+        * <p>
+        * @return Business contact instance
+        * <p>
+        * @throws BasicDataNotFoundException If the id number could not be
+        * looked up and solved into an entity
+        */
+       BasicData findBasicDataById (final Long basicDataId) throws BasicDataNotFoundException;
+
+       /**
+        * Checks whether given company name already exists
+        * <p>
+        * @param companyName Company name to check
+        * <p>
+        * @return Whether the company name exists
+        */
+       Boolean isCompanyNameUsed (final String companyName);
+
 }
index be6b6734e676f9bb70fd22b184e18618c55b55d4..fa0a5261e02d0fd5d859104cd961adc03b1abeb8 100644 (file)
@@ -29,12 +29,10 @@ 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.BusinessBasicData;
 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.CompanyBranchOffice;
-import org.mxchange.jcontactsbusiness.model.employee.Employee;
+import org.mxchange.jcontactsbusiness.model.branchoffice.BusinessBranchOffice;
 import org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
 import org.mxchange.jcontactsbusiness.model.opening_time.dayofweek.DayOfTheWeek;
@@ -45,6 +43,8 @@ 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;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 
 /**
  * An administrative bean for branch offices
@@ -74,12 +74,12 @@ public class JobsAdminBranchOfficeWebRequestBean extends BaseJobsBean implements
        /**
         * Assigned company for this branch office
         */
-       private BusinessBasicData branchCompany;
+       private BasicData branchCompany;
 
        /**
         * Contact person in branch office
         */
-       private Employee branchContactEmployee;
+       private Employable branchContactEmployee;
 
        /**
         * Country
@@ -308,7 +308,7 @@ public class JobsAdminBranchOfficeWebRequestBean extends BaseJobsBean implements
         * <p>
         * @return Basic company data
         */
-       public BusinessBasicData getBranchCompany () {
+       public BasicData getBranchCompany () {
                return this.branchCompany;
        }
 
@@ -317,7 +317,7 @@ public class JobsAdminBranchOfficeWebRequestBean extends BaseJobsBean implements
         * <p>
         * @param branchCompany Basic company data
         */
-       public void setBranchCompany (final BusinessBasicData branchCompany) {
+       public void setBranchCompany (final BasicData branchCompany) {
                this.branchCompany = branchCompany;
        }
 
@@ -326,7 +326,7 @@ public class JobsAdminBranchOfficeWebRequestBean extends BaseJobsBean implements
         * <p>
         * @return Branch office contact person
         */
-       public Employee getBranchContactEmployee () {
+       public Employable getBranchContactEmployee () {
                return this.branchContactEmployee;
        }
 
@@ -335,7 +335,7 @@ public class JobsAdminBranchOfficeWebRequestBean extends BaseJobsBean implements
         * <p>
         * @param branchContactEmployee Branch office contact person
         */
-       public void setBranchContactEmployee (final Employee branchContactEmployee) {
+       public void setBranchContactEmployee (final Employable branchContactEmployee) {
                this.branchContactEmployee = branchContactEmployee;
        }
 
@@ -428,7 +428,7 @@ public class JobsAdminBranchOfficeWebRequestBean extends BaseJobsBean implements
         */
        @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
        public void setBranchOpeningTimes (final List<OpeningTime> branchOpeningTimes) {
-               FinancialsAdminBranchOfficeWebRequestBean.branchOpeningTimes = branchOpeningTimes;
+               JobsAdminBranchOfficeWebRequestBean.branchOpeningTimes = branchOpeningTimes;
        }
 
        /**
@@ -748,7 +748,7 @@ public class JobsAdminBranchOfficeWebRequestBean extends BaseJobsBean implements
         */
        private BranchOffice createBranchOffice () {
                // Create new branch office instance
-               final BranchOffice branchOffice = new CompanyBranchOffice(this.getBranchCity(), this.getBranchCompany(), this.getBranchCountry(), this.getBranchStreet(), this.getBranchZipCode(), this.getBranchHouseNumber());
+               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());
index 8b8aebd723f166e4250592715994da56f48ebb81..898b55f695f82cb1d137ced6bea55cd90f2ea6b4 100644 (file)
@@ -30,6 +30,7 @@ import javax.enterprise.event.Observes;
 import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcontactsbusiness.events.branchoffice.added.ObservableBranchOfficeAddedEvent;
+import org.mxchange.jcontactsbusiness.exceptions.branchoffice.BranchOfficeNotFoundException;
 import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
 import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOfficeSessionBeanRemote;
 import org.mxchange.jjobs.beans.BaseJobsBean;
@@ -118,6 +119,27 @@ public class JobsBranchOfficeWebRequestBean extends BaseJobsBean implements Jobs
                return this.allBranchOffices;
        }
 
+       @Override
+       public BranchOffice findBranchOfficeById (final Long branchOfficeId) throws BranchOfficeNotFoundException {
+               // Validate parameter
+               if (null == branchOfficeId) {
+                       // Throw NPE
+                       throw new NullPointerException("branchOfficeId is null"); //NOI18N
+               } else if (branchOfficeId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("branchOfficeId=" + branchOfficeId + " is invalid"); //NOI18N
+               } else if (!this.branchOfficeCache.containsKey(branchOfficeId)) {
+                       // Not found
+                       throw new BranchOfficeNotFoundException(branchOfficeId);
+               }
+
+               // Get it from cache
+               final BranchOffice branchOffice = this.branchOfficeCache.get(branchOfficeId);
+
+               // Return it
+               return branchOffice;
+       }
+
        /**
         * Getter for a list of filtered branch offices
         * <p>
index ffddeed2bdf1e2d899864af9599927c84abad612..ed37432bf9787f2e2bc71dde9fa1b05848645925 100644 (file)
@@ -18,6 +18,7 @@ package org.mxchange.jjobs.beans.business.branchoffice;
 
 import java.io.Serializable;
 import java.util.List;
+import org.mxchange.jcontactsbusiness.exceptions.branchoffice.BranchOfficeNotFoundException;
 import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
 
 /**
@@ -34,4 +35,15 @@ public interface JobsBranchOfficeWebRequestController extends Serializable {
         */
        List<BranchOffice> allBranchOffices ();
 
+       /**
+        * Tries to find a branch office with given id number
+        * <p>
+        * @param branchOfficeId 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;
+
 }
index 1df4c2b3fbafdc8bc6bab649173829abd7a14ef9..e88d4fef9c14c6d3a99798f81fc64dfb98921b8a 100644 (file)
@@ -26,16 +26,16 @@ import javax.inject.Named;
 import org.mxchange.jcontactsbusiness.events.department.added.DepartmentAddedEvent;
 import org.mxchange.jcontactsbusiness.events.department.added.ObservableDepartmentAddedEvent;
 import org.mxchange.jcontactsbusiness.exceptions.department.DepartmentAlreadyAddedException;
-import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
 import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
 import org.mxchange.jcontactsbusiness.model.department.AdminDepartmentSessionBeanRemote;
-import org.mxchange.jcontactsbusiness.model.department.CompanyDepartment;
+import org.mxchange.jcontactsbusiness.model.department.BusinessDepartment;
 import org.mxchange.jcontactsbusiness.model.department.Department;
 import org.mxchange.jcontactsbusiness.model.department.Departments;
-import org.mxchange.jcontactsbusiness.model.employee.Employee;
 import org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData;
 import org.mxchange.jjobs.beans.BaseJobsBean;
 import org.mxchange.jusercore.model.user.User;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 
 /**
  * An administrative bean for departments
@@ -72,7 +72,7 @@ public class JobsAdminDepartmentWebRequestBean extends BaseJobsBean implements J
        /**
         * Assigned company for this department
         */
-       private BusinessBasicData departmentCompany;
+       private BasicData departmentCompany;
 
        /**
         * A general department controller (backing bean)
@@ -88,7 +88,7 @@ public class JobsAdminDepartmentWebRequestBean extends BaseJobsBean implements J
        /**
         * Lead person of this department
         */
-       private Employee departmentLead;
+       private Employable departmentLead;
 
        /**
         * Department name
@@ -168,7 +168,7 @@ public class JobsAdminDepartmentWebRequestBean extends BaseJobsBean implements J
         * <p>
         * @return Basic company data
         */
-       public BusinessBasicData getDepartmentCompany () {
+       public BasicData getDepartmentCompany () {
                return this.departmentCompany;
        }
 
@@ -177,7 +177,7 @@ public class JobsAdminDepartmentWebRequestBean extends BaseJobsBean implements J
         * <p>
         * @param departmentCompany Basic company data
         */
-       public void setDepartmentCompany (final BusinessBasicData departmentCompany) {
+       public void setDepartmentCompany (final BasicData departmentCompany) {
                this.departmentCompany = departmentCompany;
        }
 
@@ -204,7 +204,7 @@ public class JobsAdminDepartmentWebRequestBean extends BaseJobsBean implements J
         * <p>
         * @return Department contact person
         */
-       public Employee getDepartmentLead () {
+       public Employable getDepartmentLead () {
                return this.departmentLead;
        }
 
@@ -213,7 +213,7 @@ public class JobsAdminDepartmentWebRequestBean extends BaseJobsBean implements J
         * <p>
         * @param departmentLead Department contact person
         */
-       public void setDepartmentLead (final Employee departmentLead) {
+       public void setDepartmentLead (final Employable departmentLead) {
                this.departmentLead = departmentLead;
        }
 
@@ -262,7 +262,7 @@ public class JobsAdminDepartmentWebRequestBean extends BaseJobsBean implements J
         */
        private Department createDepartment () {
                // Create new department instance
-               final Department department = new CompanyDepartment(this.getDepartmentCompany(), this.getDepartmentI18nKey());
+               final Department department = new BusinessDepartment(this.getDepartmentCompany(), this.getDepartmentI18nKey());
 
                // Add all optional fields
                department.setDepartmentHeadquarters(this.getDepartmentHeadquarters());
index 422f0c5dbecc8fbab9d8e58a0db30583c6451dd4..196b61421fa50e8e4b60a3da6db41116a43f4cb4 100644 (file)
@@ -30,6 +30,7 @@ import javax.enterprise.event.Observes;
 import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcontactsbusiness.events.department.added.ObservableDepartmentAddedEvent;
+import org.mxchange.jcontactsbusiness.exceptions.department.DepartmentNotFoundException;
 import org.mxchange.jcontactsbusiness.model.department.Department;
 import org.mxchange.jcontactsbusiness.model.department.DepartmentSessionBeanRemote;
 import org.mxchange.jjobs.beans.BaseJobsBean;
@@ -118,6 +119,27 @@ public class JobsDepartmentWebRequestBean extends BaseJobsBean implements JobsDe
                return this.allDepartments;
        }
 
+       @Override
+       public Department findDepartmentById (final Long departmentId) throws DepartmentNotFoundException {
+               // Validate parameter
+               if (null == departmentId) {
+                       // Throw NPE
+                       throw new NullPointerException("departmentId is null"); //NOI18N
+               } else if (departmentId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("departmentId=" + departmentId + " is invalid"); //NOI18N
+               } else if (!this.departmentCache.containsKey(departmentId)) {
+                       // Not found
+                       throw new DepartmentNotFoundException(departmentId);
+               }
+
+               // Get it from cache
+               final Department department = this.departmentCache.get(departmentId);
+
+               // Return it
+               return department;
+       }
+
        /**
         * Getter for a list of filtered departments
         * <p>
index a60fc9090078211c40ae4c61381f2d6196ae2ce3..896f28640ec5a111657fdaa2e84c4caacd93403e 100644 (file)
@@ -18,6 +18,7 @@ package org.mxchange.jjobs.beans.business.department;
 
 import java.io.Serializable;
 import java.util.List;
+import org.mxchange.jcontactsbusiness.exceptions.department.DepartmentNotFoundException;
 import org.mxchange.jcontactsbusiness.model.department.Department;
 
 /**
@@ -34,4 +35,17 @@ public interface JobsDepartmentWebRequestController extends Serializable {
         */
        List<Department> allDepartments ();
 
+       /**
+        * Retrieves a single company department entity for given id number or
+        * throws a proper exception if not found.
+        * <p>
+        * @param departmentId Company department id to lookup
+        * <p>
+        * @return Company department instance
+        * <p>
+        * @throws DepartmentNotFoundException If the id number could not be
+        * looked up and solved into an entity
+        */
+       Department findDepartmentById (final Long departmentId) throws DepartmentNotFoundException;
+
 }
index ae5744011cbfcd8dae812a3d06d347644150d18c..47c9777edfe4401e0c50f85c5e8208bcbbc56961 100644 (file)
@@ -24,17 +24,18 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jcontactsbusiness.events.employee.added.ObservableEmployeeAddedEvent;
-import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
 import org.mxchange.jcontactsbusiness.model.department.Department;
-import org.mxchange.jcontactsbusiness.model.employee.AdminCompanyEmployeeSessionBeanRemote;
+import org.mxchange.jcontactsbusiness.model.employee.AdminEmployeeSessionBeanRemote;
 import org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData;
 import org.mxchange.jjobs.beans.BaseJobsBean;
 import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
 import org.mxchange.jusercore.model.user.User;
 
 /**
- * A request-scoped bean for administrative purposes for company employees.
+ * A request-scoped bean for administrative purposes for administrative employee
+ * purposes.
  * <p>
  * @author Roland Häder<roland@mxchange.org>
  */
@@ -57,18 +58,18 @@ public class JobsAdminEmployeeWebRequestBean extends BaseJobsBean implements Job
        /**
         * EJB for administrative company employee purposes
         */
-       @EJB (lookup = "java:global/jjobs-ejb/adminEmployee!org.mxchange.jcontactsbusiness.model.employee.AdminCompanyEmployeeSessionBeanRemote")
-       private AdminCompanyEmployeeSessionBeanRemote adminEmployeeBean;
+       @EJB (lookup = "java:global/jjobs-ejb/adminEmployee!org.mxchange.jcontactsbusiness.model.employee.AdminEmployeeSessionBeanRemote")
+       private AdminEmployeeSessionBeanRemote adminEmployeeBean;
 
        /**
-        * Assigned branch office
+        * Assigned basic data instance
         */
-       private BranchOffice employeeBranchOffice;
+       private BasicData employeeBasicData;
 
        /**
-        * Assigned basic data instance
+        * Assigned branch office
         */
-       private BusinessBasicData employeeCompany;
+       private BranchOffice employeeBranchOffice;
 
        /**
         * Department where employee works (alternative to headquarters)
@@ -146,17 +147,17 @@ public class JobsAdminEmployeeWebRequestBean extends BaseJobsBean implements Job
         * <p>
         * @return Employee's assigned basic company data
         */
-       public BusinessBasicData getEmployeeCompany () {
-               return this.employeeCompany;
+       public BasicData getEmployeeCompany () {
+               return this.employeeBasicData;
        }
 
        /**
         * Setter for employee's assigned basic company data
         * <p>
-        * @param employeeCompany Employee's assigned basic company data
+        * @param employeeBasicData Employee's assigned basic company data
         */
-       public void setEmployeeCompany (final BusinessBasicData employeeCompany) {
-               this.employeeCompany = employeeCompany;
+       public void setEmployeeCompany (final BasicData employeeBasicData) {
+               this.employeeBasicData = employeeBasicData;
        }
 
        /**
index bfb58e52822ad46ddc3f906803b657d977e24598..13ee9425d43e76ebc1d10977dd0189c5d0de1835 100644 (file)
@@ -30,8 +30,9 @@ import javax.enterprise.event.Observes;
 import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcontactsbusiness.events.employee.added.ObservableEmployeeAddedEvent;
-import org.mxchange.jcontactsbusiness.model.employee.CompanyEmployeeSessionBeanRemote;
-import org.mxchange.jcontactsbusiness.model.employee.Employee;
+import org.mxchange.jcontactsbusiness.exceptions.employee.EmployeeNotFoundException;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jcontactsbusiness.model.employee.EmployeeSessionBeanRemote;
 import org.mxchange.jjobs.beans.BaseJobsBean;
 
 /**
@@ -51,25 +52,25 @@ public class JobsEmployeeWebRequestBean extends BaseJobsBean implements JobsEmpl
        /**
         * List of all employees
         */
-       private final List<Employee> allEmployees;
+       private final List<Employable> allEmployees;
 
        /**
         * EJB for general company employee purposes
         */
-       @EJB (lookup = "java:global/jjobs-ejb/employee!org.mxchange.jcontactsbusiness.model.employee.CompanyEmployeeSessionBeanRemote")
-       private CompanyEmployeeSessionBeanRemote employeeBean;
+       @EJB (lookup = "java:global/jjobs-ejb/employee!org.mxchange.jcontactsbusiness.model.employee.EmployeeSessionBeanRemote")
+       private EmployeeSessionBeanRemote employeeBean;
 
        /**
         * List of all company employees
         */
        @Inject
        @NamedCache (cacheName = "companyEmployeeCache")
-       private Cache<Long, Employee> employeeCache;
+       private Cache<Long, Employable> employeeCache;
 
        /**
         * A list of filtered employees
         */
-       private List<Employee> filteredEmployees;
+       private List<Employable> filteredEmployees;
 
        /**
         * Default constructor
@@ -114,17 +115,38 @@ public class JobsEmployeeWebRequestBean extends BaseJobsBean implements JobsEmpl
         * @return List of all company employees
         */
        @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<Employee> allCompanyEmployees () {
+       public List<Employable> allEmployees () {
                return this.allEmployees;
        }
 
+       @Override
+       public Employable findEmployeeById (final Long employeeId) throws EmployeeNotFoundException {
+               // Validate parameter
+               if (null == employeeId) {
+                       // Throw NPE
+                       throw new NullPointerException("employeeId is null"); //NOI18N
+               } else if (employeeId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("employeeId=" + employeeId + " is invalid"); //NOI18N
+               } else if (!this.employeeCache.containsKey(employeeId)) {
+                       // Not found
+                       throw new EmployeeNotFoundException(employeeId);
+               }
+
+               // Get it from cache
+               final Employable employee = this.employeeCache.get(employeeId);
+
+               // Return it
+               return employee;
+       }
+
        /**
         * Getter for filtered list of employees
         * <p>
         * @return Filtered list of employees
         */
        @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<Employee> getFilteredEmployees () { //NOI18N
+       public List<Employable> getFilteredEmployees () { //NOI18N
                return this.filteredEmployees;
        }
 
@@ -134,7 +156,7 @@ public class JobsEmployeeWebRequestBean extends BaseJobsBean implements JobsEmpl
         * @param filteredEmployees Filtered list of employees
         */
        @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
-       public void setFilteredEmployees (final List<Employee> filteredEmployees) { //NOI18N
+       public void setFilteredEmployees (final List<Employable> filteredEmployees) { //NOI18N
                this.filteredEmployees = filteredEmployees;
        }
 
@@ -146,10 +168,10 @@ public class JobsEmployeeWebRequestBean extends BaseJobsBean implements JobsEmpl
                // Is cache there?
                if (!this.employeeCache.iterator().hasNext()) {
                        // Get whole list
-                       final List<Employee> employees = this.employeeBean.allCompanyEmployees();
+                       final List<Employable> employees = this.employeeBean.allEmployees();
 
                        // Add all
-                       for (final Employee employee : employees) {
+                       for (final Employable employee : employees) {
                                // Add it to cache
                                this.employeeCache.put(employee.getEmployeeId(), employee);
                        }
@@ -158,21 +180,21 @@ public class JobsEmployeeWebRequestBean extends BaseJobsBean implements JobsEmpl
                // Is cache filled and list is empty
                if ((this.employeeCache.iterator().hasNext()) && (this.allEmployees.isEmpty())) {
                        // Get iterator
-                       final Iterator<Cache.Entry<Long, Employee>> iterator = this.employeeCache.iterator();
+                       final Iterator<Cache.Entry<Long, Employable>> iterator = this.employeeCache.iterator();
 
                        // Build up list
                        while (iterator.hasNext()) {
                                // GEt next element
-                               final Cache.Entry<Long, Employee> next = iterator.next();
+                               final Cache.Entry<Long, Employable> next = iterator.next();
 
                                // Add to list
                                this.allEmployees.add(next.getValue());
                        }
 
                        // Sort list
-                       this.allEmployees.sort(new Comparator<Employee>() {
+                       this.allEmployees.sort(new Comparator<Employable>() {
                                @Override
-                               public int compare (final Employee o1, final Employee o2) {
+                               public int compare (final Employable o1, final Employable o2) {
                                        return o1.getEmployeeId() > o2.getEmployeeId() ? 1 : o1.getEmployeeId() < o2.getEmployeeId() ? -1 : 0;
                                }
                        });
index 02ceaa8ae279c5c254155a08f45518c3adaea69c..ed21595ee4536b0cf2e4324eed8b747f1615ee45 100644 (file)
@@ -17,6 +17,8 @@
 package org.mxchange.jjobs.beans.business.employee;
 
 import java.io.Serializable;
+import org.mxchange.jcontactsbusiness.exceptions.employee.EmployeeNotFoundException;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
 
 /**
  * An interface for request-scoped general company employee beans
@@ -25,4 +27,15 @@ import java.io.Serializable;
  */
 public interface JobsEmployeeWebRequestController extends Serializable {
 
+       /**
+        * Finds a company employee by given employee id
+        * <p>
+        * @param employeeId Employable id to find company employee instance for
+        * <p>
+        * @return Company employee instance
+        * <p>
+        * @throws EmployeeNotFoundException If the company employee was not found
+        */
+       Employable findEmployeeById (final Long employeeId) throws EmployeeNotFoundException;
+
 }
index c0fae99d8241adc95cc0764a35b9d2266f7b560e..55a3cd5a98ccda914f2ac604b0d791d5e66db9d8 100644 (file)
@@ -30,6 +30,7 @@ import javax.enterprise.event.Observes;
 import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcontactsbusiness.events.opening_time.added.ObservableOpeningTimeAddedEvent;
+import org.mxchange.jcontactsbusiness.exceptions.opening_time.OpeningTimeNotFoundException;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTimeSessionBeanRemote;
 import org.mxchange.jjobs.beans.BaseJobsBean;
@@ -114,6 +115,27 @@ public class JobsOpeningTimeWebRequestBean extends BaseJobsBean implements JobsO
                return this.allOpeningTimes;
        }
 
+       @Override
+       public OpeningTime findOpeningTimeById (final Long openingId) throws OpeningTimeNotFoundException {
+               // Validate parameter
+               if (null == openingId) {
+                       // Throw NPE
+                       throw new NullPointerException("openingId is null"); //NOI18N
+               } else if (openingId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("openingId=" + openingId + " is invalid"); //NOI18N
+               } else if (!this.openingTimesCache.containsKey(openingId)) {
+                       // Not found
+                       throw new OpeningTimeNotFoundException(openingId);
+               }
+
+               // Get it from cache
+               final OpeningTime opening = this.openingTimesCache.get(openingId);
+
+               // Return it
+               return opening;
+       }
+
        /**
         * Getter for a list of filtered opening times
         * <p>
index 4cdd98cadfec5cc70bffc4b04373ebae17c20acc..f13d8209bac64b05058cec04198338a56eb3e507 100644 (file)
@@ -18,6 +18,7 @@ package org.mxchange.jjobs.beans.business.opening_time;
 
 import java.io.Serializable;
 import java.util.List;
+import org.mxchange.jcontactsbusiness.exceptions.opening_time.OpeningTimeNotFoundException;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
 
 /**
@@ -34,4 +35,17 @@ public interface JobsOpeningTimeWebRequestController extends Serializable {
         */
        List<OpeningTime> allOpeningTimes ();
 
+       /**
+        * Retrieves a single company department entity for given id number or
+        * throws a proper exception if not found.
+        * <p>
+        * @param openingId Company department id to lookup
+        * <p>
+        * @return Company department instance
+        * <p>
+        * @throws OpeningTimeNotFoundException If the id number could not be looked
+        * up and solved into an entity
+        */
+       OpeningTime findOpeningTimeById (final Long openingId) throws OpeningTimeNotFoundException;
+
 }
index 67dc7a06f637517475baf8548cfc09ab852eb423..a419047d0e5e491f7c182896192cd0ade6d723e7 100644 (file)
@@ -33,6 +33,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.exceptions.ContactNotFoundException;
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote;
 import org.mxchange.jcontacts.model.contact.ContactUtils;
@@ -101,8 +102,8 @@ public class JobsContactWebRequestBean extends BaseJobsBean implements JobsConta
         * Contact list
         */
        @Inject
-       @NamedCache (cacheName = "contactsCache")
-       private Cache<Long, Contact> contactsCache;
+       @NamedCache (cacheName = "contactCache")
+       private Cache<Long, Contact> contactCache;
 
        /**
         * Country instance
@@ -454,7 +455,7 @@ public class JobsContactWebRequestBean extends BaseJobsBean implements JobsConta
                final List<Contact> list = new LinkedList<>();
 
                // Get iterator
-               final Iterator<Cache.Entry<Long, Contact>> iterator = this.contactsCache.iterator();
+               final Iterator<Cache.Entry<Long, Contact>> iterator = this.contactCache.iterator();
 
                // Loop over all
                while (iterator.hasNext()) {
@@ -615,6 +616,27 @@ public class JobsContactWebRequestBean extends BaseJobsBean implements JobsConta
                return "contact_data_saved"; //NOI18N
        }
 
+       @Override
+       public Contact findContactById (final Long contactId) throws ContactNotFoundException {
+               // Validate parameter
+               if (null == contactId) {
+                       // Throw NPE
+                       throw new NullPointerException("contactId is null"); //NOI18N
+               } else if (contactId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("contactId=" + contactId + " is invalid"); //NOI18N
+               } else if (!this.contactCache.containsKey(contactId)) {
+                       // Not found
+                       throw new ContactNotFoundException(contactId);
+               }
+
+               // Get it from cache
+               final Contact contact = this.contactCache.get(contactId);
+
+               // Return it
+               return contact;
+       }
+
        /**
         * Getter for academic title
         * <p>
@@ -1027,14 +1049,14 @@ public class JobsContactWebRequestBean extends BaseJobsBean implements JobsConta
        @PostConstruct
        public void init () {
                // Is cache there?
-               if (!this.contactsCache.iterator().hasNext()) {
+               if (!this.contactCache.iterator().hasNext()) {
                        // Get whole list
                        final List<Contact> contacts = this.contactBean.allContacts();
 
                        // Add all
                        for (final Contact contact : contacts) {
                                // Add it to cache
-                               this.contactsCache.put(contact.getContactId(), contact);
+                               this.contactCache.put(contact.getContactId(), contact);
                                this.emailAddressCache.put(contact.getContactId(), contact.getContactEmailAddress());
                        }
                } else if (this.selectableContactsCache.iterator().hasNext()) {
@@ -1046,7 +1068,7 @@ public class JobsContactWebRequestBean extends BaseJobsBean implements JobsConta
                final List<User> allUsers = this.userController.allUsers();
 
                // Get iterator from contacts cache
-               final Iterator<Cache.Entry<Long, Contact>> iterator = this.contactsCache.iterator();
+               final Iterator<Cache.Entry<Long, Contact>> iterator = this.contactCache.iterator();
 
                // Loop through all contacts
                while (iterator.hasNext()) {
@@ -1092,6 +1114,11 @@ public class JobsContactWebRequestBean extends BaseJobsBean implements JobsConta
                return ((this.emailAddressCache instanceof List) && (this.emailAddressCache.containsKey(contact.getContactId())));
        }
 
+       @Override
+       public boolean isEmailAddressRegistered (String emailAddress) {
+               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+       }
+
        @Override
        public boolean isRequiredChangePersonalDataSet () {
                return ((this.getPersonalTitle() != null) &&
@@ -1132,7 +1159,7 @@ public class JobsContactWebRequestBean extends BaseJobsBean implements JobsConta
                final List<Contact> selectableContacts = new LinkedList<>();
 
                // Get iterator from cache
-               final Iterator<Cache.Entry<Long, Contact>> iterator = this.contactsCache.iterator();
+               final Iterator<Cache.Entry<Long, Contact>> iterator = this.contactCache.iterator();
 
                // Loop through all contacts
                while (iterator.hasNext()) {
@@ -1291,7 +1318,7 @@ public class JobsContactWebRequestBean extends BaseJobsBean implements JobsConta
                }
 
                // Remove from general list
-               if (!this.contactsCache.remove(contact.getContactId())) {
+               if (!this.contactCache.remove(contact.getContactId())) {
                        // Did not remove contact
                        throw new IllegalStateException(MessageFormat.format("contact {0} was not removed.", contact.getContactId())); //NOI18N
                }
@@ -1320,7 +1347,7 @@ public class JobsContactWebRequestBean extends BaseJobsBean implements JobsConta
                }
 
                // Get iterator from list
-               final Iterator<Cache.Entry<Long, Contact>> iterator = this.contactsCache.iterator();
+               final Iterator<Cache.Entry<Long, Contact>> iterator = this.contactCache.iterator();
 
                // "Walk" through all entries
                while (iterator.hasNext()) {
@@ -1336,7 +1363,7 @@ public class JobsContactWebRequestBean extends BaseJobsBean implements JobsConta
                }
 
                // Add contact to list
-               this.contactsCache.put(contact.getContactId(), contact);
+               this.contactCache.put(contact.getContactId(), contact);
        }
 
 }
index 5dff76a82d6d90c407dec70fec1fb7fbbcdf8dc4..f31b1f2fd6c1867229a7b0b965162c4c34128ef4 100644 (file)
@@ -18,6 +18,7 @@ package org.mxchange.jjobs.beans.contact;
 
 import java.io.Serializable;
 import java.util.List;
+import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
 import org.mxchange.jcontacts.model.contact.Contact;
 
 /**
@@ -120,4 +121,26 @@ public interface JobsContactWebRequestController extends Serializable {
         */
        String doChangePersonalContactData ();
 
+       /**
+        * Returns a contact instance which has the given id number.
+        * <p>
+        * @param contactId Contact id
+        * <p>
+        * @return Contact instance
+        * <p>
+        * @throws ContactNotFoundException If the contact was not found
+        */
+       Contact findContactById (final Long contactId) throws ContactNotFoundException;
+
+       /**
+        * Checks whether the given email address is already registered. The email
+        * address should be validated by EmailAddressValidator before calling this
+        * method.
+        * <p>
+        * @param emailAddress Email address to check
+        * <p>
+        * @return Whether the email address is already registered
+        */
+       boolean isEmailAddressRegistered (final String emailAddress);
+
 }
index 5053f438863f3a6aa5bdb7edda0b8452404394a7..70f713920b052a0f7d5d7827628135f1b75aeb3b 100644 (file)
@@ -48,8 +48,8 @@ import org.mxchange.jjobs.beans.phone.JobsAdminPhoneWebRequestController;
 import org.mxchange.jphone.events.fax.created.ObservableCreatedFaxNumberEvent;
 import org.mxchange.jphone.events.landline.created.ObservableCreatedLandLineNumberEvent;
 import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEvent;
-import org.mxchange.jphone.exceptions.PhoneNumberAlreadyLinkedException;
-import org.mxchange.jphone.exceptions.PhoneNumberNotLinkedException;
+import org.mxchange.jphone.exceptions.phone.PhoneNumberAlreadyLinkedException;
+import org.mxchange.jphone.exceptions.phone.PhoneNumberNotLinkedException;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
index e730dd54e51bf15dd00d6d32b18afe91ac288034..698e52834e8cf22bb868ca68d933dac89a9ca7bc 100644 (file)
@@ -26,12 +26,12 @@ import javax.enterprise.inject.Any;
 import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
-import org.mxchange.jcountry.events.AdminAddedCountryEvent;
-import org.mxchange.jcountry.events.ObservableAdminAddedCountryEvent;
+import org.mxchange.jcountry.events.added.AdminAddedCountryEvent;
+import org.mxchange.jcountry.events.added.ObservableAdminAddedCountryEvent;
 import org.mxchange.jcountry.exceptions.CountryAlreadyAddedException;
+import org.mxchange.jcountry.model.data.AdminCountrySessionBeanRemote;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jcountry.model.data.CountryData;
-import org.mxchange.jcountry.model.data.CountrySingletonBeanRemote;
 import org.mxchange.jjobs.beans.BaseJobsBean;
 
 /**
@@ -56,15 +56,15 @@ public class JobsAdminCountryWebRequestBean extends BaseJobsBean implements Jobs
        private Event<ObservableAdminAddedCountryEvent> addedCountryEvent;
 
        /**
-        * Abroad dial prefix
+        * Remote country EJB
         */
-       private String countryAbroadDialPrefix;
+       @EJB (lookup = "java:global/jjobs-ejb/adminCountry!org.mxchange.jcountry.model.data.AdminCountrySessionBeanRemote")
+       private AdminCountrySessionBeanRemote adminCountryBean;
 
        /**
-        * Remote country EJB
+        * Abroad dial prefix
         */
-       @EJB (lookup = "java:global/jjobs-ejb/country!org.mxchange.jcountry.model.data.CountrySingletonBeanRemote")
-       private CountrySingletonBeanRemote countryBean;
+       private String countryAbroadDialPrefix;
 
        /**
         * 2-letter country code
@@ -136,7 +136,7 @@ public class JobsAdminCountryWebRequestBean extends BaseJobsBean implements Jobs
 
                try {
                        // Send country to bean
-                       updatedCountry = this.countryBean.addCountry(country);
+                       updatedCountry = this.adminCountryBean.addCountry(country);
                } catch (final CountryAlreadyAddedException ex) {
                        // Throw again
                        throw new FaceletException(ex);
index 112a1b62538f566f245144b5d5f7bcf563222aa6..5a7acef542548ee66979c444b796b1a7082c3da9 100644 (file)
@@ -28,7 +28,8 @@ import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Observes;
 import javax.inject.Inject;
 import javax.inject.Named;
-import org.mxchange.jcountry.events.ObservableAdminAddedCountryEvent;
+import org.mxchange.jcountry.events.added.ObservableAdminAddedCountryEvent;
+import org.mxchange.jcountry.exceptions.CountryNotFoundException;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jcountry.model.data.CountrySingletonBeanRemote;
 import org.mxchange.jjobs.beans.BaseJobsBean;
@@ -116,6 +117,27 @@ public class JobsCountryWebRequestBean extends BaseJobsBean implements JobsCount
                return list;
        }
 
+       @Override
+       public Country findCountryById (final Long countryId) throws CountryNotFoundException {
+               // Validate parameter
+               if (null == countryId) {
+                       // Throw NPE
+                       throw new NullPointerException("countryId is null"); //NOI18N
+               } else if (countryId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("countryId=" + countryId + " is invalid"); //NOI18N
+               } else if (!this.countryCache.containsKey(countryId)) {
+                       // Not found
+                       throw new CountryNotFoundException(countryId);
+               }
+
+               // Get it from cache
+               final Country country = this.countryCache.get(countryId);
+
+               // Return it
+               return country;
+       }
+
        /**
         * Post-construction method
         */
index 57c88eef3d72e8eca6cca7118f6e82b7b30eda89..db908dfad1cae719017cf56c15e0e04c808bc7cf 100644 (file)
@@ -18,6 +18,7 @@ package org.mxchange.jjobs.beans.country;
 
 import java.io.Serializable;
 import java.util.List;
+import org.mxchange.jcountry.exceptions.CountryNotFoundException;
 import org.mxchange.jcountry.model.data.Country;
 
 /**
@@ -34,4 +35,16 @@ public interface JobsCountryWebRequestController extends Serializable {
         */
        List<Country> allCountries ();
 
+       /**
+        * Returns a country instance found by given primary key. If not found, a
+        * proper exception is thrown.
+        * <p>
+        * @param countryId Primary key
+        * <p>
+        * @return Country data instance
+        * <p>
+        * @throws CountryNotFoundException If the primary key was not found
+        */
+       public Country findCountryById (final Long countryId) throws CountryNotFoundException;
+
 }
index f73152a714e0262916a118010a9bbf5514eddaa9..a6ac5b7c980d41b3b2ed455e5d9265a108d6063e 100644 (file)
@@ -27,10 +27,11 @@ import org.mxchange.jcontacts.events.contact.created.ObservableCreatedContactEve
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
 import org.mxchange.jcontactsbusiness.model.department.Department;
-import org.mxchange.jcontactsbusiness.model.employee.Employee;
 import org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData;
 import org.mxchange.jjobs.beans.BaseJobsBean;
+import org.mxchange.jjobs.beans.localization.JobsLocalizationSessionController;
 import org.mxchange.jjobs.beans.user.JobsUserWebRequestController;
+import org.mxchange.jjobs.model.receipt.BillableReceipt;
 import org.mxchange.jphone.events.fax.created.CreatedFaxNumberEvent;
 import org.mxchange.jphone.events.fax.created.ObservableCreatedFaxNumberEvent;
 import org.mxchange.jphone.events.landline.created.CreatedLandLineNumberEvent;
@@ -40,9 +41,11 @@ import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEv
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
 import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
+import org.mxchange.jproduct.model.product.Product;
 import org.mxchange.jusercore.events.user.created.CreatedUserEvent;
 import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent;
 import org.mxchange.jusercore.model.user.User;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
 
 /**
  * A general helper for beans
@@ -53,11 +56,6 @@ import org.mxchange.jusercore.model.user.User;
 @RequestScoped
 public class JobsWebRequestHelperBean extends BaseJobsBean implements JobsWebRequestHelperController {
 
-       /**
-        * Call-stack instance (5 may show BeanELResolver.getValue as caller)
-        */
-       private static final short THREAD_STACK = 5;
-
        /**
         * Serial number
         */
@@ -99,6 +97,12 @@ public class JobsWebRequestHelperBean extends BaseJobsBean implements JobsWebReq
        @Inject
        private Event<ObservableCreatedLandLineNumberEvent> landLineNumberCreatedEvent;
 
+       /**
+        * Localization controller
+        */
+       @Inject
+       private JobsLocalizationSessionController localizationController;
+
        /**
         * Mobile number
         */
@@ -152,8 +156,6 @@ public class JobsWebRequestHelperBean extends BaseJobsBean implements JobsWebReq
         * @param contact Contact instance
         */
        public void setContact (final Contact contact) {
-               // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[THREAD_STACK].getClassName(), Thread.currentThread().getStackTrace()[THREAD_STACK].getMethodName());
-               // System.out.println(MessageFormat.format("{0}: Setting contact={1}, previous: {2}, caller: {3}", this.getClass().getSimpleName(), contact, this.contact, caller));
                this.contact = contact;
        }
 
@@ -524,16 +526,16 @@ public class JobsWebRequestHelperBean extends BaseJobsBean implements JobsWebReq
         * Returns the employee's number, personal title, family name and name if
         * available. If null is provided, an empty string is returned.
         * <p>
-        * @param employee Employee instance
       * <p>
+        * @param employee Employable instance
+ <p>
         * @return Contact's full name
         */
-       public String renderEmployee (final Employee employee) {
+       public String renderEmployee (final Employable employee) {
                // Default is empty string, so let's get started
                final StringBuilder sb = new StringBuilder(20);
 
                // Is employee set?
-               if (employee instanceof Employee) {
+               if (employee instanceof Employable) {
                        // Then create name
                        sb.append(employee.getEmployeeNumber());
 
@@ -565,12 +567,12 @@ public class JobsWebRequestHelperBean extends BaseJobsBean implements JobsWebReq
        }
 
        /**
-        * Returns the headquarters' address. If null is provided, an empty string
-        * is returned.
+        * Returns the headquarters address. If null is provided, an empty string is
+        * returned.
         * <p>
         * @param headquarters Headquarters instance
         * <p>
-        * @return Headquarters' address
+        * @return Headquarters address
         */
        public String renderHeadquarters (final HeadquartersData headquarters) {
                // Default is empty string, so let's get started
@@ -609,6 +611,66 @@ public class JobsWebRequestHelperBean extends BaseJobsBean implements JobsWebReq
                return sb.toString();
        }
 
+       /**
+        * Returns the product name and price. If null is provided, an empty string
+        * is returned.
+        * <p>
+        * @param product Product instance
+        * <p>
+        * @return Product name
+        */
+       public String renderProduct (final Product product) {
+               // Default is empty string, so let's get started
+               final StringBuilder sb = new StringBuilder(10);
+
+               // Is a product set?
+               if (product instanceof Product) {
+                       // Add name and price
+                       sb.append(product.getProductTitle());
+                       sb.append(" ("); //NOI18N
+                       sb.append(this.localizationController.formatCurrency(product.getProductPrice()));
+                       sb.append(")"); //NOI18N
+               }
+
+               // Return it
+               return sb.toString();
+       }
+
+       /**
+        * Returns the receipt. If null is provided, an empty string
+        * is returned.
+        * <p>
+        * @param receipt Receipt instance
+        * <p>
+        * @return Product name
+        */
+       public String renderReceipt (final BillableReceipt receipt) {
+               // Default is empty string, so let's get started
+               final StringBuilder sb = new StringBuilder(10);
+
+               // Is receipt set?
+               if (receipt instanceof BillableReceipt) {
+                       // Add relevant data
+                       sb.append(this.getMessageFromBundle("RECEIPT_ISSUED")).append(" "); //NOI18N
+                       sb.append(this.getMessageFromBundle(receipt.getReceiptPaymentType().getI18nKey()));
+
+                       // Is receipt number included?
+                       if (receipt.getReceiptNumber() !=null) {
+                               // Append it
+                               sb.append(", ").append(this.getMessageFromBundle("RECEIPT_NUMBER")).append(" "); //NOI18N
+                               sb.append(receipt.getReceiptNumber());
+                       }
+
+                       // Add company (over branch office)
+                       sb.append(" ("); //NOI18N
+                       sb.append(receipt.getReceiptBranchOffice().getBranchCompany().getCompanyName());
+                       sb.append(")"); //NOI18N
+               }
+
+               // Return it
+               return sb.toString();
+       }
+
        /**
         * Set's all given contact's phone instances: land-line, mobile and
         * faxNumber
index 0d9c2d838729162076a69ee0ba5eb4d21ed89447..132ec1cba50794d6c922bc9c335f9e40f2deb11c 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jjobs.beans.localization;
 
 import java.text.MessageFormat;
+import java.text.NumberFormat;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Locale;
@@ -48,6 +49,11 @@ import org.mxchange.juserlogincore.events.logout.ObservableUserLogoutEvent;
 @SessionScoped
 public class JobsLocalizationSessionBean extends BaseJobsBean implements JobsLocalizationSessionController {
 
+       /**
+        * Number format
+        */
+       private static NumberFormat NUMBER_FORMAT;
+
        /**
         * Serial number
         */
@@ -82,7 +88,7 @@ public class JobsLocalizationSessionBean extends BaseJobsBean implements JobsLoc
                // Call super constructor
                super();
 
-               // Init list
+               // Init locale list
                this.supportedLocales = new LinkedHashMap<>(2);
        }
 
@@ -181,6 +187,15 @@ public class JobsLocalizationSessionBean extends BaseJobsBean implements JobsLoc
 
                // Then change it
                this.changeLocale(newLocale, Boolean.TRUE);
+
+               // Change formatting
+               NUMBER_FORMAT = NumberFormat.getNumberInstance(newLocale);
+       }
+
+       @Override
+       public String formatCurrency (final Float amount) {
+               // Format amount
+               return NUMBER_FORMAT.format(amount);
        }
 
        /**
@@ -285,6 +300,9 @@ public class JobsLocalizationSessionBean extends BaseJobsBean implements JobsLoc
 
                // Change locale, may set same back in faces context, but triggers event
                this.changeLocale(requestLocale, Boolean.FALSE);
+
+               // Initial formatting, may change when user chooses other locale
+               NUMBER_FORMAT = NumberFormat.getNumberInstance(this.locale);
        }
 
        /**
index 622dbf7f36942c78c1b88ce35bd1d511526ba27c..5abf20e4581f2ab5db4962852a6b84a8fdf0e5cb 100644 (file)
@@ -25,4 +25,13 @@ import java.io.Serializable;
  */
 public interface JobsLocalizationSessionController extends Serializable {
 
+       /**
+        * Formats a float into a currency, depending on current locale
+        * <p>
+        * @param amount Amount (price) to format
+        * <p>
+        * @return Formatted string
+        */
+       String formatCurrency (final Float amount);
+
 }
index 654d32edae8c4588087c26f61d6eb5f9ba57a4da..b0b5f4062a94fbb71943454cf42f9a8e41a9e4e9 100644 (file)
@@ -30,7 +30,7 @@ import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jjobs.beans.BaseJobsBean;
 import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent;
 import org.mxchange.jphone.events.mobileprovider.added.AdminMobileProviderAddedEvent;
-import org.mxchange.jphone.exceptions.MobileProviderAlreadyAddedException;
+import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderAlreadyAddedException;
 import org.mxchange.jphone.model.phonenumbers.mobileprovider.AdminMobileProviderSessionBeanRemote;
 import org.mxchange.jphone.model.phonenumbers.mobileprovider.CellphoneProvider;
 import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
index 5975a5accfcc5911529b950931828bfd89e2c668..ee4630163fce54ef80978e8bb1303fb9c61d017c 100644 (file)
@@ -31,6 +31,7 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jjobs.beans.BaseJobsBean;
 import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent;
+import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderNotFoundException;
 import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
 import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote;
 
@@ -116,6 +117,27 @@ public class JobsMobileProviderWebRequestBean extends BaseJobsBean implements Jo
                return this.allMobileProviders;
        }
 
+       @Override
+       public MobileProvider findMobileProviderById (final Long mobileProviderId) throws MobileProviderNotFoundException {
+               // Validate parameter
+               if (null == mobileProviderId) {
+                       // Throw NPE
+                       throw new NullPointerException("mobileProviderId is null"); //NOI18N
+               } else if (mobileProviderId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("mobileProviderId=" + mobileProviderId + " is invalid."); //NOI18N
+               } else if (!this.mobileProviderCache.containsKey(mobileProviderId)) {
+                       // Not found
+                       throw new MobileProviderNotFoundException(mobileProviderId);
+               }
+
+               // Get it from cache
+               final MobileProvider mobileProvider = this.mobileProviderCache.get(mobileProviderId);
+
+               // Return it
+               return mobileProvider;
+       }
+
        /**
         * Getter for filtered mobile provider list
         * <p>
index 4d8a37385185a1b61109ef2596bd19766f2fa76f..0b5ff1eb9679be68808551ce51096d515f8de8fb 100644 (file)
@@ -18,6 +18,7 @@ package org.mxchange.jjobs.beans.mobileprovider;
 
 import java.io.Serializable;
 import java.util.List;
+import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderNotFoundException;
 import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
 
 /**
@@ -27,6 +28,19 @@ import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
  */
 public interface JobsMobileProviderWebRequestController extends Serializable {
 
+       /**
+        * Returns a mobile provider instance by given primary key. If not found, a
+        * proper exception is thrown.
+        * <p>
+        * @param mobileProviderId Primary key
+        * <p>
+        * @return Mobile provider instance
+        * <p>
+        * @throws MobileProviderNotFoundException If the primary key could not be
+        * found
+        */
+       MobileProvider findMobileProviderById (final Long mobileProviderId) throws MobileProviderNotFoundException;
+
        /**
         * Returns a list of all mobile providers
         * <p>
index 14039ba92f89ffcd54c07229eb87dfd8fe8cad17..dcb2ed6c5c28346b807efae75b549ad6e3010bf4 100644 (file)
@@ -42,6 +42,7 @@ import org.mxchange.jphone.events.landline.deleted.AdminDeletedLandLineNumberEve
 import org.mxchange.jphone.events.landline.updated.AdminUpdatedLandLineNumberEvent;
 import org.mxchange.jphone.events.mobile.deleted.AdminDeletedMobileNumberEvent;
 import org.mxchange.jphone.events.mobile.updated.AdminUpdatedMobileNumberEvent;
+import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
 import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
@@ -254,25 +255,25 @@ public class JobsPhoneWebRequestBean extends BaseJobsBean implements JobsPhoneWe
                        throw new NullPointerException("event is null"); //NOI18N
                } else if (event.getContact() == null) {
                        // Throw again ...
-                       throw new NullPointerException("event.contact is null");
+                       throw new NullPointerException("event.contact is null"); //NOI18N
                } else if (event.getContact().getContactId() == null) {
                        // Throw again ...
-                       throw new NullPointerException("event.contact.contactId is null");
+                       throw new NullPointerException("event.contact.contactId is null"); //NOI18N
                } else if (event.getContact().getContactId() < 1) {
                        // Throw again ...
-                       throw new NullPointerException("event.contact.contactId=" + event.getContact().getContactId() + " is invalid");
+                       throw new NullPointerException("event.contact.contactId=" + event.getContact().getContactId() + " is invalid"); //NOI18N
                } else if (event.getContact().getContactFaxNumber() == null) {
                        // Throw again ...
-                       throw new NullPointerException("event.contact.contactFaxNumber is null");
+                       throw new NullPointerException("event.contact.contactFaxNumber is null"); //NOI18N
                } else if (event.getContact().getContactFaxNumber().getPhoneId() == null) {
                        // Throw again ...
-                       throw new NullPointerException("event.contact.contactFaxNumber.phoneId is null");
+                       throw new NullPointerException("event.contact.contactFaxNumber.phoneId is null"); //NOI18N
                } else if (event.getContact().getContactFaxNumber().getPhoneId() < 1) {
                        // Throw again ...
-                       throw new NullPointerException("event.contact.contactFaxNumber.phoneId=" + event.getContact().getContactFaxNumber().getPhoneId() + " is invalid");
+                       throw new NullPointerException("event.contact.contactFaxNumber.phoneId=" + event.getContact().getContactFaxNumber().getPhoneId() + " is invalid"); //NOI18N
                } else if (event.getLinkedFaxNumber() == null) {
                        // Throw again ...
-                       throw new NullPointerException("event.linkedFaxNumer is null");
+                       throw new NullPointerException("event.linkedFaxNumer is null"); //NOI18N
                }
 
                // Is the id number in linked number not set?
@@ -295,25 +296,25 @@ public class JobsPhoneWebRequestBean extends BaseJobsBean implements JobsPhoneWe
                        throw new NullPointerException("event is null"); //NOI18N
                } else if (event.getContact() == null) {
                        // Throw again ...
-                       throw new NullPointerException("event.contact is null");
+                       throw new NullPointerException("event.contact is null"); //NOI18N
                } else if (event.getContact().getContactId() == null) {
                        // Throw again ...
-                       throw new NullPointerException("event.contact.contactId is null");
+                       throw new NullPointerException("event.contact.contactId is null"); //NOI18N
                } else if (event.getContact().getContactId() < 1) {
                        // Throw again ...
-                       throw new NullPointerException("event.contact.contactId=" + event.getContact().getContactId() + " is invalid");
+                       throw new NullPointerException("event.contact.contactId=" + event.getContact().getContactId() + " is invalid"); //NOI18N
                } else if (event.getContact().getContactLandLineNumber() == null) {
                        // Throw again ...
-                       throw new NullPointerException("event.contact.contactLandLineNumber is null");
+                       throw new NullPointerException("event.contact.contactLandLineNumber is null"); //NOI18N
                } else if (event.getContact().getContactLandLineNumber().getPhoneId() == null) {
                        // Throw again ...
-                       throw new NullPointerException("event.contact.contactLandLineNumber.phoneId is null");
+                       throw new NullPointerException("event.contact.contactLandLineNumber.phoneId is null"); //NOI18N
                } else if (event.getContact().getContactLandLineNumber().getPhoneId() < 1) {
                        // Throw again ...
-                       throw new NullPointerException("event.contact.contactLandLineNumber.phoneId=" + event.getContact().getContactLandLineNumber().getPhoneId() + " is invalid");
+                       throw new NullPointerException("event.contact.contactLandLineNumber.phoneId=" + event.getContact().getContactLandLineNumber().getPhoneId() + " is invalid"); //NOI18N
                } else if (event.getLinkedLandLineNumber() == null) {
                        // Throw again ...
-                       throw new NullPointerException("event.linkedLandLineNumer is null");
+                       throw new NullPointerException("event.linkedLandLineNumer is null"); //NOI18N
                }
 
                // Is the id number in linked number not set?
@@ -336,25 +337,25 @@ public class JobsPhoneWebRequestBean extends BaseJobsBean implements JobsPhoneWe
                        throw new NullPointerException("event is null"); //NOI18N
                } else if (event.getContact() == null) {
                        // Throw again ...
-                       throw new NullPointerException("event.contact is null");
+                       throw new NullPointerException("event.contact is null"); //NOI18N
                } else if (event.getContact().getContactId() == null) {
                        // Throw again ...
-                       throw new NullPointerException("event.contact.contactId is null");
+                       throw new NullPointerException("event.contact.contactId is null"); //NOI18N
                } else if (event.getContact().getContactId() < 1) {
                        // Throw again ...
-                       throw new NullPointerException("event.contact.contactId=" + event.getContact().getContactId() + " is invalid");
+                       throw new NullPointerException("event.contact.contactId=" + event.getContact().getContactId() + " is invalid"); //NOI18N
                } else if (event.getContact().getContactMobileNumber() == null) {
                        // Throw again ...
-                       throw new NullPointerException("event.contact.contactMobileNumber is null");
+                       throw new NullPointerException("event.contact.contactMobileNumber is null"); //NOI18N
                } else if (event.getContact().getContactMobileNumber().getPhoneId() == null) {
                        // Throw again ...
-                       throw new NullPointerException("event.contact.contactMobileNumber.phoneId is null");
+                       throw new NullPointerException("event.contact.contactMobileNumber.phoneId is null"); //NOI18N
                } else if (event.getContact().getContactMobileNumber().getPhoneId() < 1) {
                        // Throw again ...
-                       throw new NullPointerException("event.contact.contactMobileNumber.phoneId=" + event.getContact().getContactMobileNumber().getPhoneId() + " is invalid");
+                       throw new NullPointerException("event.contact.contactMobileNumber.phoneId=" + event.getContact().getContactMobileNumber().getPhoneId() + " is invalid"); //NOI18N
                } else if (event.getLinkedMobileNumber() == null) {
                        // Throw again ...
-                       throw new NullPointerException("event.linkedMobileNumer is null");
+                       throw new NullPointerException("event.linkedMobileNumer is null"); //NOI18N
                }
 
                // Is the id number in linked number not set?
@@ -546,6 +547,69 @@ public class JobsPhoneWebRequestBean extends BaseJobsBean implements JobsPhoneWe
                return list;
        }
 
+       @Override
+       public DialableFaxNumber findFaxNumberById (final Long faxNumberId) throws PhoneEntityNotFoundException {
+               // Validate paramter
+               if (null == faxNumberId) {
+                       // Throw NPE
+                       throw new NullPointerException("faxNumberId is null"); //NOI18N
+               } else if (faxNumberId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("faxNumberId=" + faxNumberId + " is invalid."); //NOI18N
+               } else if (!this.faxNumberCache.containsKey(faxNumberId)) {
+                       // Not found
+                       throw new PhoneEntityNotFoundException(faxNumberId);
+               }
+
+               // Get it from cache
+               final DialableFaxNumber faxNumber = this.faxNumberCache.get(faxNumberId);
+
+               // Return it
+               return faxNumber;
+       }
+
+       @Override
+       public DialableLandLineNumber findLandLineNumberById (final Long landLineNumberId) throws PhoneEntityNotFoundException {
+               // Validate paramter
+               if (null == landLineNumberId) {
+                       // Throw NPE
+                       throw new NullPointerException("landLineNumberId is null"); //NOI18N
+               } else if (landLineNumberId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("landLineNumberId=" + landLineNumberId + " is invalid."); //NOI18N
+               } else if (!this.landLineNumberCache.containsKey(landLineNumberId)) {
+                       // Not found
+                       throw new PhoneEntityNotFoundException(landLineNumberId);
+               }
+
+               // Get it from cache
+               final DialableLandLineNumber landLineNumber = this.landLineNumberCache.get(landLineNumberId);
+
+               // Return it
+               return landLineNumber;
+       }
+
+       @Override
+       public DialableMobileNumber findMobileNumberById (final Long mobileNumberId) throws PhoneEntityNotFoundException {
+               // Validate paramter
+               if (null == mobileNumberId) {
+                       // Throw NPE
+                       throw new NullPointerException("mobileNumberId is null"); //NOI18N
+               } else if (mobileNumberId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("mobileNumberId=" + mobileNumberId + " is invalid."); //NOI18N
+               } else if (!this.mobileNumberCache.containsKey(mobileNumberId)) {
+                       // Not found
+                       throw new PhoneEntityNotFoundException(mobileNumberId);
+               }
+
+               // Get it from cache
+               final DialableMobileNumber mobileNumber = this.mobileNumberCache.get(mobileNumberId);
+
+               // Return it
+               return mobileNumber;
+       }
+
        /**
         * Post-construction method
         */
@@ -605,13 +669,13 @@ public class JobsPhoneWebRequestBean extends BaseJobsBean implements JobsPhoneWe
                // Make sure the parameter is valid
                if (null == faxNumber) {
                        // Throw NPE
-                       throw new NullPointerException("faxNumber is null");
+                       throw new NullPointerException("faxNumber is null"); //NOI18N
                } else if (faxNumber.getPhoneId() == null) {
                        // Throw again ...
-                       throw new NullPointerException("faxNumber.phoneId is null");
+                       throw new NullPointerException("faxNumber.phoneId is null"); //NOI18N
                } else if (faxNumber.getPhoneId() < 1) {
                        // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneId={0} is not valid.", faxNumber.getPhoneId()));
+                       throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneId={0} is not valid.", faxNumber.getPhoneId())); //NOI18N
                }
 
                // First remove it
@@ -641,13 +705,13 @@ public class JobsPhoneWebRequestBean extends BaseJobsBean implements JobsPhoneWe
                // Make sure the parameter is valid
                if (null == landLineNumber) {
                        // Throw NPE
-                       throw new NullPointerException("landLineNumber is null");
+                       throw new NullPointerException("landLineNumber is null"); //NOI18N
                } else if (landLineNumber.getPhoneId() == null) {
                        // Throw again ...
-                       throw new NullPointerException("landLineNumber.phoneId is null");
+                       throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N
                } else if (landLineNumber.getPhoneId() < 1) {
                        // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneId={0} is not valid.", landLineNumber.getPhoneId()));
+                       throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneId={0} is not valid.", landLineNumber.getPhoneId())); //NOI18N
                }
 
                // First remove it
@@ -677,13 +741,13 @@ public class JobsPhoneWebRequestBean extends BaseJobsBean implements JobsPhoneWe
                // Make sure the parameter is valid
                if (null == mobileNumber) {
                        // Throw NPE
-                       throw new NullPointerException("mobileNumber is null");
+                       throw new NullPointerException("mobileNumber is null"); //NOI18N
                } else if (mobileNumber.getPhoneId() == null) {
                        // Throw again ...
-                       throw new NullPointerException("mobileNumber.phoneId is null");
+                       throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N
                } else if (mobileNumber.getPhoneId() < 1) {
                        // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid.", mobileNumber.getPhoneId()));
+                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid.", mobileNumber.getPhoneId())); //NOI18N
                }
 
                // First remove it by object
@@ -712,10 +776,10 @@ public class JobsPhoneWebRequestBean extends BaseJobsBean implements JobsPhoneWe
                // Parameter must be valid
                if (null == contact) {
                        // Throw NPE
-                       throw new NullPointerException("contact is null");
+                       throw new NullPointerException("contact is null"); //NOI18N
                } else if (contact.getContactId() == null) {
                        // Throw again
-                       throw new NullPointerException("contact.contactId is null");
+                       throw new NullPointerException("contact.contactId is null"); //NOI18N
                } else if (contact.getContactId() < 1) {
                        // Id number is not valid
                }
index f39942574e0a8eace52346de1fa64bf1f2aa374b..acca9a3a924e0b4d0027b51fc89738651fc7b817 100644 (file)
@@ -18,6 +18,7 @@ package org.mxchange.jjobs.beans.phone;
 
 import java.io.Serializable;
 import java.util.List;
+import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
 import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
@@ -60,4 +61,37 @@ public interface JobsPhoneWebRequestController extends Serializable {
         */
        List<DialableLandLineNumber> allLandLineNumbers ();
 
+       /**
+        * Finds a fax entry by given id number
+        * <p>
+        * @param faxNumberId Fax entry id number
+        * <p>
+        * @return A valid fax instance
+        * <p>
+        * @throws PhoneEntityNotFoundException If the entity was not found
+        */
+       DialableFaxNumber findFaxNumberById (final Long faxNumberId) throws PhoneEntityNotFoundException;
+
+       /**
+        * Finds a land-line entry by given id number
+        * <p>
+        * @param landLineNumberId Land-line entry id number
+        * <p>
+        * @return A valid land-line instance
+        * <p>
+        * @throws PhoneEntityNotFoundException If the entity was not found
+        */
+       DialableLandLineNumber findLandLineNumberById (final Long landLineNumberId) throws PhoneEntityNotFoundException;
+
+       /**
+        * Finds a mobile entry by given id number
+        * <p>
+        * @param mobileNumberId Mobile entry id number
+        * <p>
+        * @return A valid mobile instance
+        * <p>
+        * @throws PhoneEntityNotFoundException If the entity was not found
+        */
+       DialableMobileNumber findMobileNumberById (Long mobileNumberId) throws PhoneEntityNotFoundException;
+
 }
index 2a3ee65e4967b98d31cc76f0711f446200089a0d..d587679622864085b22144da0252e20261e1f6e4 100644 (file)
@@ -383,10 +383,10 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
                // Is the parameter valid?
                if (null == event) {
                        // Throw NPE
-                       throw new NullPointerException("event is null");
+                       throw new NullPointerException("event is null"); //NOI18N
                } else if (event.getLocale() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("event.locale is null");
+                       throw new NullPointerException("event.locale is null"); //NOI18N
                }
 
                // Set it here
@@ -575,7 +575,7 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
                // Is it valid?
                if (null == event) {
                        // Throw NPE
-                       throw new NullPointerException("event is null");
+                       throw new NullPointerException("event is null"); //NOI18N
                }
 
                // Clear it
@@ -591,7 +591,7 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
                // Is it valid?
                if (null == event) {
                        // Throw NPE
-                       throw new NullPointerException("event is null");
+                       throw new NullPointerException("event is null"); //NOI18N
                }
 
                // Clear it
@@ -706,6 +706,27 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
                return "user_contact_data_saved"; //NOI18N
        }
 
+       @Override
+       public User findUserById (final Long userId) throws UserNotFoundException {
+               // Validate parameter
+               if (null == userId) {
+                       // Throw NPE
+                       throw new NullPointerException("userId is null"); //NOI18N
+               } else if (userId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("userId=" + userId + " is invalid."); //NOI18N
+               } else if (!this.userCache.containsKey(userId)) {
+                       // Not found
+                       throw new UserNotFoundException(userId);
+               }
+
+               // Get it from cache
+               final User user = this.userCache.get(userId);
+
+               // Return it
+               return user;
+       }
+
        /**
         * Getter for filtered users list
         * <p>
@@ -820,6 +841,24 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR
                                ((this.getUserPasswordRepeat() == null) || (this.getUserPasswordRepeat().isEmpty())));
        }
 
+       @Override
+       public boolean ifUserIdExists (final Long userId) {
+               // Validate parameter
+               if (null == userId) {
+                       // Throw NPE
+                       throw new NullPointerException("userId is null"); //NOI18N
+               } else if (userId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("userId=" + userId + " is invalid."); //NOI18N
+               }
+
+               // Check if key is there
+               boolean isFound = this.userCache.containsKey(userId);
+
+               // Return flag
+               return isFound;
+       }
+
        /**
         * Post-initialization of this class
         */
index 27241ddff8cee28bba3c8cac130201c7f447285e..dc1b1f461039ce76876ea8b308e95308b51aa122 100644 (file)
@@ -38,6 +38,27 @@ public interface JobsUserWebRequestController extends Serializable {
        @Deprecated
        public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
 
+       /**
+        * Returns a user instance by given primary key. If not found, a proper
+        * exception is thrown.
+        * <p>
+        * @param userId User id
+        * <p>
+        * @return User instance
+        * <p>
+        * @throws UserNotFoundException If the user is not found
+        */
+       User findUserById (final Long userId) throws UserNotFoundException;
+
+       /**
+        * Checks if given user id exists
+        * <p>
+        * @param userId User id to check
+        * <p>
+        * @return Whether the user id exists
+        */
+       boolean ifUserIdExists (final Long userId);
+
        /**
         * Getter for clear-text user password
         * <p>
@@ -72,9 +93,9 @@ public interface JobsUserWebRequestController extends Serializable {
        boolean isContactFound (final Contact contact);
 
        /**
-        * Checks whether given user instance's name is used
+        * Checks whether given user instance name is used
         * <p>
-        * @param user User instance's name to check
+        * @param user User instance name to check
         * <p>
         * @return Whether it is already used
         */
index 6de37453bb0dcb1972b1263badb702b517265e90..d036ec0fba419bdd52f5fffad129c88ae597c066 100644 (file)
@@ -26,36 +26,36 @@ import javax.faces.validator.ValidatorException;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicCompanyDataNotFoundException;
-import org.mxchange.jcontactsbusiness.model.basicdata.BasicCompanyDataSessionBeanRemote;
-import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
+import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicDataNotFoundException;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
+import org.mxchange.jjobs.beans.business.basicdata.JobsBusinessDataWebRequestController;
 
 /**
  * Converter for basic company data id <-> valid basic company data instance
  * <p>
  * @author Roland Häder<roland@mxchange.org>
  */
-@FacesConverter ("BusinessContactConverter")
-public class JobsBusinessContactConverter implements Converter<BusinessBasicData> {
+@FacesConverter ("BasicCompanyDataConverter")
+public class JobsBasicCompanyDataConverter implements Converter<BasicData> {
 
        /**
-        * Basic company data EJB
+        * Basic company data backing bean
         */
-       private static BasicCompanyDataSessionBeanRemote BASIC_DATA_BEAN;
+       private static JobsBusinessDataWebRequestController BASIC_DATA_CONTROLLER;
 
        @Override
-       public BusinessBasicData getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+       public BasicData getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
-               if (BASIC_DATA_BEAN == null) {
+               if (BASIC_DATA_CONTROLLER == null) {
                        try {
                                // Not yet, attempt lookup
                                final Context initial = new InitialContext();
 
                                // Lookup EJB
-                               BASIC_DATA_BEAN = (BasicCompanyDataSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/basicCompanyData!org.mxchange.jcontactsbusiness.model.basicdata.BasicCompanyDataSessionBeanRemote"); //NOI18N
+                               BASIC_DATA_CONTROLLER = (JobsBusinessDataWebRequestController) initial.lookup("java:module/basicCompanyDataController!org.mxchange.jjobs.beans.business.basicdata.JobsBusinessDataWebRequestController"); //NOI18N
                        } catch (final NamingException ex) {
                                // Throw it again
-                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex); //NOI18N
+                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex); //NOI18N
                        }
                }
 
@@ -69,18 +69,18 @@ public class JobsBusinessContactConverter implements Converter<BusinessBasicData
                }
 
                // Init instance
-               BusinessBasicData basicData = null;
+               BasicData basicData = null;
 
                try {
                        // Try to parse the value as long
                        final Long basicDataId = Long.valueOf(submittedValue);
 
                        // Try to get user instance from it
-                       basicData = BASIC_DATA_BEAN.findBasicDataById(basicDataId);
+                       basicData = BASIC_DATA_CONTROLLER.findBasicDataById(basicDataId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
-               } catch (final BasicCompanyDataNotFoundException ex) {
+               } catch (final BasicDataNotFoundException ex) {
                        // Debug message
                        // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N
                }
@@ -90,7 +90,7 @@ public class JobsBusinessContactConverter implements Converter<BusinessBasicData
        }
 
        @Override
-       public String getAsString (final FacesContext context, final UIComponent component, final BusinessBasicData value) {
+       public String getAsString (final FacesContext context, final UIComponent component, final BasicData value) {
                // Is the object null?
                if ((null == value) || (String.valueOf(value).isEmpty())) {
                        // Is null
index 83ec69e6f72909bd810b70c346415f688f338afd..461c4f272e6915a3cd5fb46efb60cfb2f38eac00 100644 (file)
@@ -28,7 +28,7 @@ import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.jcontactsbusiness.exceptions.branchoffice.BranchOfficeNotFoundException;
 import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
-import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOfficeSessionBeanRemote;
+import org.mxchange.jjobs.beans.business.branchoffice.JobsBranchOfficeWebRequestController;
 
 /**
  * Converter for branch office id <-> valid basic company data instance
@@ -41,21 +41,21 @@ public class JobsBranchOfficeConverter implements Converter<BranchOffice> {
        /**
         * Branch office EJB
         */
-       private static BranchOfficeSessionBeanRemote BRANCH_OFFICE_BEAN;
+       private static JobsBranchOfficeWebRequestController BRANCH_OFFICE_CONTROLLER;
 
        @Override
        public BranchOffice getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
-               if (BRANCH_OFFICE_BEAN == null) {
+               if (BRANCH_OFFICE_CONTROLLER == null) {
                        try {
                                // Not yet, attempt lookup
                                final Context initial = new InitialContext();
 
                                // Lookup EJB
-                               BRANCH_OFFICE_BEAN = (BranchOfficeSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/branchOffice!org.mxchange.jcontactsbusiness.model.branchoffice.BranchOfficeSessionBeanRemote");
+                               BRANCH_OFFICE_CONTROLLER = (JobsBranchOfficeWebRequestController) initial.lookup("java:module/branchOfficeController!org.mxchange.jjobs.beans.business.branchoffice.JobsBranchOfficeWebRequestController");
                        } catch (final NamingException ex) {
                                // Throw it again
-                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
                        }
                }
 
@@ -76,7 +76,7 @@ public class JobsBranchOfficeConverter implements Converter<BranchOffice> {
                        final Long branchOfficeId = Long.valueOf(submittedValue);
 
                        // Try to get user instance from it
-                       branchOffice = BRANCH_OFFICE_BEAN.findBranchOfficeById(branchOfficeId);
+                       branchOffice = BRANCH_OFFICE_CONTROLLER.findBranchOfficeById(branchOfficeId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
index 373e4967359ce8219a83d285c26849d552de74ef..37f453d9441d14e5cc14c98916396bb0cb93cad3 100644 (file)
@@ -28,34 +28,34 @@ import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.jcontactsbusiness.exceptions.department.DepartmentNotFoundException;
 import org.mxchange.jcontactsbusiness.model.department.Department;
-import org.mxchange.jcontactsbusiness.model.department.DepartmentSessionBeanRemote;
+import org.mxchange.jjobs.beans.business.department.JobsDepartmentWebRequestController;
 
 /**
  * Converter for company department id <-> instance
  * <p>
  * @author Roland Häder<roland@mxchange.org>
  */
-@FacesConverter ("CompanyDepartmentConverter")
-public class JobsCompanyDepartmentConverter implements Converter<Department> {
+@FacesConverter ("DepartmentConverter")
+public class JobsDepartmentConverter implements Converter<Department> {
 
        /**
         * Company department EJB
         */
-       private static DepartmentSessionBeanRemote DEPARTMENT_BEAN;
+       private static JobsDepartmentWebRequestController DEPARTMENT_CONTROLLER;
 
        @Override
        public Department getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
-               if (DEPARTMENT_BEAN == null) {
+               if (DEPARTMENT_CONTROLLER == null) {
                        try {
                                // Not yet, attempt lookup
                                final Context initial = new InitialContext();
 
                                // Lookup EJB
-                               DEPARTMENT_BEAN = (DepartmentSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/companyDepartment!org.mxchange.jcontactsbusiness.model.department.CompanyDepartmentSessionBeanRemote"); //NOI18N
+                               DEPARTMENT_CONTROLLER = (JobsDepartmentWebRequestController) initial.lookup("java:module/departmentController!org.mxchange.jjobs.beans.business.department.JobsDepartmentWebRequestController"); //NOI18N
                        } catch (final NamingException ex) {
                                // Throw it again
-                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex); //NOI18N
+                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex); //NOI18N
                        }
                }
 
@@ -76,7 +76,7 @@ public class JobsCompanyDepartmentConverter implements Converter<Department> {
                        final Long departmentId = Long.valueOf(submittedValue);
 
                        // Try to get user instance from it
-                       companyDepartment = DEPARTMENT_BEAN.findDepartmentById(departmentId);
+                       companyDepartment = DEPARTMENT_CONTROLLER.findDepartmentById(departmentId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
diff --git a/src/java/org/mxchange/jjobs/converter/business/employee/JobsEmployeeConverter.java b/src/java/org/mxchange/jjobs/converter/business/employee/JobsEmployeeConverter.java
new file mode 100644 (file)
index 0000000..16d239f
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * 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.converter.business.employee;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.convert.FacesConverter;
+import javax.faces.validator.ValidatorException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcontactsbusiness.exceptions.employee.EmployeeNotFoundException;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jjobs.beans.business.employee.JobsEmployeeWebRequestController;
+
+/**
+ * Converter for converting company employee to and from id number
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@FacesConverter ("EmployeeConverter")
+public class JobsEmployeeConverter implements Converter<Employable> {
+
+       /**
+        * Employable EJB
+        */
+       private static JobsEmployeeWebRequestController EMPLOYEE_CONTROLLER;
+
+       @Override
+       public Employable getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+               // Is the instance there?
+               if (EMPLOYEE_CONTROLLER == null) {
+                       try {
+                               // Not yet, attempt lookup
+                               final Context initial = new InitialContext();
+
+                               // Lookup EJB
+                               EMPLOYEE_CONTROLLER = (JobsEmployeeWebRequestController) initial.lookup("java:module/!.JobsEmployeeWebRequestController"); //NOI18N
+                       } catch (final NamingException ex) {
+                               // Throw it again
+                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex); //NOI18N
+                       }
+               }
+
+               // Is the value null or empty?
+               if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
+                       // Warning message
+                       // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N
+
+                       // Return null
+                       return null;
+               }
+
+               // Init instance
+               Employable companyEmployee = null;
+
+               try {
+                       // Try to parse the value as long
+                       final Long employeeId = Long.valueOf(submittedValue);
+
+                       // Try to get user instance from it
+                       companyEmployee = EMPLOYEE_CONTROLLER.findEmployeeById(employeeId);
+               } catch (final NumberFormatException ex) {
+                       // Throw again
+                       throw new ConverterException(ex);
+               } catch (final EmployeeNotFoundException ex) {
+                       // Debug message
+                       // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N
+               }
+
+               // Return it
+               return companyEmployee;
+       }
+
+       @Override
+       public String getAsString (final FacesContext context, final UIComponent component, final Employable value) {
+               // Is the object null?
+               if ((null == value) || (String.valueOf(value).isEmpty())) {
+                       // Is null
+                       return ""; //NOI18N
+               }
+
+               // Return id number
+               return String.valueOf(value.getEmployeeId());
+       }
+
+}
index cd521dc5184c342e10569d6d73c4d71520c1e77f..64ebf4df59faac8112fb9872f40c8f620540865a 100644 (file)
@@ -39,23 +39,24 @@ import org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData;
 public class JobsCompanyHeadquartersConverter implements Converter<HeadquartersData> {
 
        /**
-        * CompanyEmployee EJB
+        * Headquarters backing bean
+        * @TODO Undone
         */
-       private static CompanyHeadquartersSessionBeanRemote COMPANY_HEADQUARTERS_BEAN;
+       private static CompanyHeadquartersSessionBeanRemote HEADQUARTERS_CONTROLLER;
 
        @Override
        public HeadquartersData getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
-               if (COMPANY_HEADQUARTERS_BEAN == null) {
+               if (HEADQUARTERS_CONTROLLER == null) {
                        try {
                                // Not yet, attempt lookup
                                final Context initial = new InitialContext();
 
                                // Lookup EJB
-                               COMPANY_HEADQUARTERS_BEAN = (CompanyHeadquartersSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/headquarters!org.mxchange.jcontactsbusiness.model.headquarters.CompanyHeadquartersSessionBeanRemote"); //NOI18N
+                               HEADQUARTERS_CONTROLLER = (CompanyHeadquartersSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/headquarters!org.mxchange.jcontactsbusiness.model.headquarters.CompanyHeadquartersSessionBeanRemote"); //NOI18N
                        } catch (final NamingException ex) {
                                // Throw it again
-                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex); //NOI18N
+                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex); //NOI18N
                        }
                }
 
@@ -76,7 +77,7 @@ public class JobsCompanyHeadquartersConverter implements Converter<HeadquartersD
                        final Long headquartersId = Long.valueOf(submittedValue);
 
                        // Try to get user instance from it
-                       companyHeadquarters = COMPANY_HEADQUARTERS_BEAN.findCompanyHeadquartersById(headquartersId);
+                       companyHeadquarters = HEADQUARTERS_CONTROLLER.findCompanyHeadquartersById(headquartersId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
diff --git a/src/java/org/mxchange/jjobs/converter/business/opening_time/JobsCompanyOpeningTimeConverter.java b/src/java/org/mxchange/jjobs/converter/business/opening_time/JobsCompanyOpeningTimeConverter.java
new file mode 100644 (file)
index 0000000..52fac4e
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * 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.converter.business.opening_time;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.convert.FacesConverter;
+import javax.faces.validator.ValidatorException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcontactsbusiness.exceptions.opening_time.OpeningTimeNotFoundException;
+import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
+import org.mxchange.jjobs.beans.business.opening_time.JobsOpeningTimeWebRequestController;
+
+/**
+ * Converter for opening time id <-> instance
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@FacesConverter ("OpeningTimeConverter")
+public class JobsCompanyOpeningTimeConverter implements Converter<OpeningTime> {
+
+       /**
+        * Opening time backing bean
+        */
+       private static JobsOpeningTimeWebRequestController DEPARTMENT_CONTROLLER;
+
+       @Override
+       public OpeningTime getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+               // Is the instance there?
+               if (DEPARTMENT_CONTROLLER == null) {
+                       try {
+                               // Not yet, attempt lookup
+                               final Context initial = new InitialContext();
+
+                               // Lookup EJB
+                               DEPARTMENT_CONTROLLER = (JobsOpeningTimeWebRequestController) initial.lookup("java:module/openingTimeController!org.mxchange.jjobs.beans.business.opening_time.JobsOpeningTimeWebRequestController"); //NOI18N
+                       } catch (final NamingException ex) {
+                               // Throw it again
+                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex); //NOI18N
+                       }
+               }
+
+               // Is the value null or empty?
+               if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
+                       // Warning message
+                       // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N
+
+                       // Return null
+                       return null;
+               }
+
+               // Init instance
+               OpeningTime openingTime = null;
+
+               try {
+                       // Try to parse the value as long
+                       final Long openingId = Long.valueOf(submittedValue);
+
+                       // Try to get user instance from it
+                       openingTime = DEPARTMENT_CONTROLLER.findOpeningTimeById(openingId);
+               } catch (final NumberFormatException ex) {
+                       // Throw again
+                       throw new ConverterException(ex);
+               } catch (final OpeningTimeNotFoundException ex) {
+                       // Debug message
+                       // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N
+               }
+
+               // Return it
+               return openingTime;
+       }
+
+       @Override
+       public String getAsString (final FacesContext context, final UIComponent component, final OpeningTime value) {
+               // Is the object null?
+               if ((null == value) || (String.valueOf(value).isEmpty())) {
+                       // Is null
+                       return ""; //NOI18N
+               }
+
+               // Return id number
+               return String.valueOf(value.getOpeningId());
+       }
+
+}
index 6ea92519d1ff0ce17853d3b83867f711dc4ad696..afc327e8d0551a390793dfed4c3fea1f01692c31 100644 (file)
@@ -28,7 +28,7 @@ import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
 import org.mxchange.jcontacts.model.contact.Contact;
-import org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote;
+import org.mxchange.jjobs.beans.contact.JobsContactWebRequestController;
 
 /**
  * Converter for contact id <-> valid contact instance
@@ -41,21 +41,21 @@ public class JobsContactConverter implements Converter<Contact> {
        /**
         * User EJB
         */
-       private static ContactSessionBeanRemote CONTACT_BEAN;
+       private static JobsContactWebRequestController CONTACT_CONTROLLER;
 
        @Override
        public Contact getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
-               if (CONTACT_BEAN == null) {
+               if (CONTACT_CONTROLLER == null) {
                        try {
                                // Not yet, attempt lookup
                                final Context initial = new InitialContext();
 
                                // Lookup EJB
-                               CONTACT_BEAN = (ContactSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/contact!org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote");
+                               CONTACT_CONTROLLER = (JobsContactWebRequestController) initial.lookup("java:module/contactController!org.mxchange.jjobs.beans.contact.JobsContactWebRequestController");
                        } catch (final NamingException ex) {
                                // Throw it again
-                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
                        }
                }
 
@@ -76,7 +76,7 @@ public class JobsContactConverter implements Converter<Contact> {
                        final Long contactId = Long.valueOf(submittedValue);
 
                        // Try to get user instance from it
-                       contact = CONTACT_BEAN.findContactById(contactId);
+                       contact = CONTACT_CONTROLLER.findContactById(contactId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
index 7c28c5cc21221b4dad734f054ebb2c2ee6fcf298..7ffea183d3dad50c9f1e0af458a0648dfb2c56ed 100644 (file)
@@ -16,8 +16,6 @@
  */
 package org.mxchange.jjobs.converter.country;
 
-import java.util.List;
-import java.util.Objects;
 import javax.faces.application.FacesMessage;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
@@ -28,8 +26,9 @@ import javax.faces.validator.ValidatorException;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
+import org.mxchange.jcountry.exceptions.CountryNotFoundException;
 import org.mxchange.jcountry.model.data.Country;
-import org.mxchange.jcountry.model.data.CountrySingletonBeanRemote;
+import org.mxchange.jjobs.beans.country.JobsCountryWebRequestController;
 
 /**
  * Converter for country instance
@@ -40,23 +39,23 @@ import org.mxchange.jcountry.model.data.CountrySingletonBeanRemote;
 public class JobsCountryConverter implements Converter<Country> {
 
        /**
-        * Country bean
+        * Country backing bean
         */
-       private static CountrySingletonBeanRemote COUNTRY_BEAN;
+       private static JobsCountryWebRequestController COUNTRY_CONTROLLER;
 
        @Override
        public Country getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
-               if (COUNTRY_BEAN == null) {
+               if (COUNTRY_CONTROLLER == null) {
                        try {
                                // Not yet, attempt lookup
                                final Context initial = new InitialContext();
 
                                // Lookup EJB
-                               COUNTRY_BEAN = (CountrySingletonBeanRemote) initial.lookup("java:global/jjobs-ejb/country!org.mxchange.jcountry.model.data.CountrySingletonBeanRemote");
+                               COUNTRY_CONTROLLER = (JobsCountryWebRequestController) initial.lookup("java:module/countryController!org.mxchange.jjobs.beans.country.JobsCountryWebRequestController");
                        } catch (final NamingException ex) {
                                // Throw it again
-                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
                        }
                }
 
@@ -69,9 +68,6 @@ public class JobsCountryConverter implements Converter<Country> {
                        return null;
                }
 
-               // Get full list
-               final List<Country> countryList = COUNTRY_BEAN.allCountries();
-
                // Init value
                Country country = null;
 
@@ -80,21 +76,13 @@ public class JobsCountryConverter implements Converter<Country> {
                        // Convert it to long
                        final Long countryId = Long.parseLong(submittedValue);
 
-                       // Category id should not be below 1
-                       assert (countryId > 0) : "countryId is smaller than one: " + countryId; //NOI18N
-
                        // Try to find it
-                       for (final Country cntry : countryList) {
-                               // Is the id the same? (null-safe)
-                               if (Objects.equals(cntry.getCountryId(), countryId)) {
-                                       // Found it
-                                       country = cntry;
-                                       break;
-                               }
-                       }
+                       country = COUNTRY_CONTROLLER.findCountryById(countryId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
+               } catch (final CountryNotFoundException ex) {
+                       // Not handled
                }
 
                // Return it
diff --git a/src/java/org/mxchange/jjobs/converter/dayofweek/FinancialsDayOfTheWeekConverter.java b/src/java/org/mxchange/jjobs/converter/dayofweek/FinancialsDayOfTheWeekConverter.java
deleted file mode 100644 (file)
index 7a85b10..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2017 Roland Häder
- *
- * 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.converter.dayofweek;
-
-import javax.faces.convert.EnumConverter;
-import javax.faces.convert.FacesConverter;
-import org.mxchange.jcontactsbusiness.model.opening_time.dayofweek.DayOfTheWeek;
-
-/**
- * A converter for day of the week enumeration
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@FacesConverter("DayOfTheWeekConverter")
-public class JobsDayOfTheWeekConverter extends EnumConverter {
-
-       /**
-        * Default constructor which calls the super constructor with the proper
-        * enumeration as class type.
-        */
-       public JobsDayOfTheWeekConverter () {
-               super(DayOfTheWeek.class);
-       }
-
-}
diff --git a/src/java/org/mxchange/jjobs/converter/dayofweek/JobsDayOfTheWeekConverter.java b/src/java/org/mxchange/jjobs/converter/dayofweek/JobsDayOfTheWeekConverter.java
new file mode 100644 (file)
index 0000000..7a85b10
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2017 Roland Häder
+ *
+ * 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.converter.dayofweek;
+
+import javax.faces.convert.EnumConverter;
+import javax.faces.convert.FacesConverter;
+import org.mxchange.jcontactsbusiness.model.opening_time.dayofweek.DayOfTheWeek;
+
+/**
+ * A converter for day of the week enumeration
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@FacesConverter("DayOfTheWeekConverter")
+public class JobsDayOfTheWeekConverter extends EnumConverter {
+
+       /**
+        * Default constructor which calls the super constructor with the proper
+        * enumeration as class type.
+        */
+       public JobsDayOfTheWeekConverter () {
+               super(DayOfTheWeek.class);
+       }
+
+}
index fdf6542ba4800cc3a9dba8d0b55f2ea2ab99a1e6..f309b577b3d0132ec70cfd58d48c2bba1ced92e8 100644 (file)
@@ -26,9 +26,9 @@ import javax.faces.validator.ValidatorException;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException;
+import org.mxchange.jjobs.beans.phone.JobsPhoneWebRequestController;
+import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.model.phonenumbers.phone.PhoneSessionBeanRemote;
 
 /**
  * Converter for fax id <-> valid fax number instance
@@ -41,21 +41,21 @@ public class JobsFaxNumberConverter implements Converter<DialableFaxNumber> {
        /**
         * Phone EJB
         */
-       private static PhoneSessionBeanRemote PHONE_BEAN;
+       private static JobsPhoneWebRequestController PHONE_CONTROLLER;
 
        @Override
        public DialableFaxNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
-               if (PHONE_BEAN == null) {
+               if (PHONE_CONTROLLER == null) {
                        try {
                                // Not yet, attempt lookup
                                final Context initial = new InitialContext();
 
                                // Lookup EJB
-                               PHONE_BEAN = (PhoneSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/phone!org.mxchange.jphone.model.phonenumbers.phone.PhoneSessionBeanRemote");
+                               PHONE_CONTROLLER = (JobsPhoneWebRequestController) initial.lookup("java:module/phoneController!org.mxchange.jphone.model.phonenumbers.phone.JobsPhoneWebRequestController");
                        } catch (final NamingException ex) {
                                // Throw it again
-                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
                        }
                }
 
@@ -81,7 +81,7 @@ public class JobsFaxNumberConverter implements Converter<DialableFaxNumber> {
                        // Log message
                        // @TODO Not possible here: this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject: faxNumberId={1}", this.getClass().getSimpleName(), faxNumberId)); //NOI18N
                        // Try to get mobile instance from it
-                       faxNumber = PHONE_BEAN.findFaxNumberById(faxNumberId);
+                       faxNumber = PHONE_CONTROLLER.findFaxNumberById(faxNumberId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
index fe72af86a4caffdee251832ae3f61cca59ced1d3..01bd9a21812b14ebb5995ebbf8fccd6d530f3d12 100644 (file)
@@ -26,9 +26,9 @@ import javax.faces.validator.ValidatorException;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException;
+import org.mxchange.jjobs.beans.phone.JobsPhoneWebRequestController;
+import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jphone.model.phonenumbers.phone.PhoneSessionBeanRemote;
 
 /**
  * Converter for land-line id <-> valid land-line number instance
@@ -41,21 +41,21 @@ public class JobsLandLineNumberConverter implements Converter<DialableLandLineNu
        /**
         * Phone EJB
         */
-       private static PhoneSessionBeanRemote PHONE_BEAN;
+       private static JobsPhoneWebRequestController PHONE_CONTROLLER;
 
        @Override
        public DialableLandLineNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
-               if (PHONE_BEAN == null) {
+               if (PHONE_CONTROLLER == null) {
                        try {
                                // Not yet, attempt lookup
                                final Context initial = new InitialContext();
 
                                // Lookup EJB
-                               PHONE_BEAN = (PhoneSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/phone!org.mxchange.jphone.model.phonenumbers.phone.PhoneSessionBeanRemote");
+                               PHONE_CONTROLLER = (JobsPhoneWebRequestController) initial.lookup("java:module/phoneController!org.mxchange.jphone.model.phonenumbers.phone.JobsPhoneWebRequestController");
                        } catch (final NamingException ex) {
                                // Throw it again
-                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
                        }
                }
 
@@ -76,7 +76,7 @@ public class JobsLandLineNumberConverter implements Converter<DialableLandLineNu
                        final Long landLineNumberId = Long.valueOf(submittedValue);
 
                        // Try to get mobile instance from it
-                       landLineNumber = PHONE_BEAN.findLandLineNumberById(landLineNumberId);
+                       landLineNumber = PHONE_CONTROLLER.findLandLineNumberById(landLineNumberId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
index 47ba8d280bd718f0b4d27686827df3bab9d23360..54f6cba19ec271494757463b632866f9ea80afcb 100644 (file)
@@ -26,9 +26,9 @@ import javax.faces.validator.ValidatorException;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException;
+import org.mxchange.jjobs.beans.phone.JobsPhoneWebRequestController;
+import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
 import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
-import org.mxchange.jphone.model.phonenumbers.phone.PhoneSessionBeanRemote;
 
 /**
  * Converter for mobile id <-> valid mobile instance
@@ -41,21 +41,21 @@ public class JobsMobileNumberConverter implements Converter<DialableMobileNumber
        /**
         * Phone EJB
         */
-       private static PhoneSessionBeanRemote PHONE_BEAN;
+       private static JobsPhoneWebRequestController PHONE_CONTROLLER;
 
        @Override
        public DialableMobileNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
-               if (PHONE_BEAN == null) {
+               if (PHONE_CONTROLLER == null) {
                        try {
                                // Not yet, attempt lookup
                                final Context initial = new InitialContext();
 
                                // Lookup EJB
-                               PHONE_BEAN = (PhoneSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/phone!org.mxchange.jphone.model.phonenumbers.phone.PhoneSessionBeanRemote");
+                               PHONE_CONTROLLER = (JobsPhoneWebRequestController) initial.lookup("java:module/phoneController!org.mxchange.jjobs.beans.phone.JobsPhoneWebRequestController");
                        } catch (final NamingException ex) {
                                // Throw it again
-                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
                        }
                }
 
@@ -76,7 +76,7 @@ public class JobsMobileNumberConverter implements Converter<DialableMobileNumber
                        final Long mobileNumberId = Long.valueOf(submittedValue);
 
                        // Try to get mobile instance from it
-                       mobileNumber = PHONE_BEAN.findMobileNumberById(mobileNumberId);
+                       mobileNumber = PHONE_CONTROLLER.findMobileNumberById(mobileNumberId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
index 5133a21ebbbadd99d7820f37061d15e6232164af..484877ad06ae4de4b364b88a36c67e55b4f8c826 100644 (file)
@@ -16,8 +16,6 @@
  */
 package org.mxchange.jjobs.converter.mobileprovider;
 
-import java.util.List;
-import java.util.Objects;
 import javax.faces.application.FacesMessage;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
@@ -27,8 +25,9 @@ import javax.faces.convert.FacesConverter;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
+import org.mxchange.jjobs.beans.mobileprovider.JobsMobileProviderWebRequestController;
+import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderNotFoundException;
 import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
-import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote;
 
 /**
  * Converter for SMS provider
@@ -39,23 +38,23 @@ import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProviderSingl
 public class JobsMobileProviderConverter implements Converter<MobileProvider> {
 
        /**
-        * Mobile provider bean
+        * Mobile provider backing bean
         */
-       private static MobileProviderSingletonBeanRemote MOBILE_PROVIDER_BEAN;
+       private static JobsMobileProviderWebRequestController MOBILE_PROVIDER_CONTROLLER;
 
        @Override
        public MobileProvider getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
-               if (MOBILE_PROVIDER_BEAN == null) {
+               if (MOBILE_PROVIDER_CONTROLLER == null) {
                        try {
                                // Not yet, attempt lookup
                                final Context initial = new InitialContext();
 
                                // Lookup EJB
-                               MOBILE_PROVIDER_BEAN = (MobileProviderSingletonBeanRemote) initial.lookup("java:global/jjobs-ejb/mobileProvider!org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote");
+                               MOBILE_PROVIDER_CONTROLLER = (JobsMobileProviderWebRequestController) initial.lookup("java:module/mobileProviderController!org.mxchange.jjobs.beans.mobileprovider.JobsMobileProviderWebRequestController");
                        } catch (final NamingException ex) {
                                // Throw it again
-                               throw new ConverterException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+                               throw new ConverterException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
                        }
                }
 
@@ -68,36 +67,26 @@ public class JobsMobileProviderConverter implements Converter<MobileProvider> {
                        return null;
                }
 
-               // Get full list
-               final List<MobileProvider> providerList = MOBILE_PROVIDER_BEAN.allMobileProviders();
-
                // Init value
-               MobileProvider provider = null;
+               MobileProvider mobileProvider = null;
 
                // Try this better
                try {
                        // Convert it to long
                        final Long providerId = Long.parseLong(submittedValue);
 
-                       // Category id should not be below 1
-                       assert (providerId > 0) : "providerId is smaller than one: " + providerId; //NOI18N
-
-                       // Try to find it
-                       for (final MobileProvider prov : providerList) {
-                               // Is the id the same? (null-safe)
-                               if (Objects.equals(prov.getProviderId(), providerId)) {
-                                       // Found it
-                                       provider = prov;
-                                       break;
-                               }
-                       }
+                       // Lookup of mobile provider
+                       mobileProvider = MOBILE_PROVIDER_CONTROLLER.findMobileProviderById(providerId);
                } catch (final NumberFormatException ex) {
+                       // Throw again
+                       throw new ConverterException(ex);
+               } catch (final MobileProviderNotFoundException ex) {
                        // Log exception (maybe to much?)
                        // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logException(ex);
                }
 
                // Return it
-               return provider;
+               return mobileProvider;
        }
 
        @Override
index 1cec07f3ee65e05bd3ad7d20ac290ca84a246fa8..71d7e7dfd305a1cf35286afedf131bb5c310ef48 100644 (file)
@@ -25,9 +25,9 @@ import javax.faces.convert.FacesConverter;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
+import org.mxchange.jjobs.beans.user.JobsUserWebRequestController;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
 import org.mxchange.jusercore.model.user.User;
-import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
 
 /**
  * Converter for user id <-> valid user instance
@@ -38,23 +38,23 @@ import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
 public class JobsUserConverter implements Converter<User> {
 
        /**
-        * User EJB
+        * User backing bean
         */
-       private static UserSessionBeanRemote USER_BEAN;
+       private static JobsUserWebRequestController USER_CONTROLLER;
 
        @Override
        public User getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
                // Is the instance there?
-               if (USER_BEAN == null) {
+               if (USER_CONTROLLER == null) {
                        try {
                                // Not yet, attempt lookup
                                final Context initial = new InitialContext();
 
                                // Lookup EJB
-                               USER_BEAN = (UserSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote");
+                               USER_CONTROLLER = (JobsUserWebRequestController) initial.lookup("java:module/userController!org.mxchange.jjobs.beans.user.JobsUserWebRequestController");
                        } catch (final NamingException ex) {
                                // Throw it again
-                               throw new ConverterException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+                               throw new ConverterException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
                        }
                }
 
@@ -75,7 +75,7 @@ public class JobsUserConverter implements Converter<User> {
                        final Long userId = Long.valueOf(submittedValue);
 
                        // Try to get user instance from it
-                       user = USER_BEAN.findUserById(userId);
+                       user = USER_CONTROLLER.findUserById(userId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
index f92341b81f2a2ce8754ede9955ce81d7ea374ea9..33ab6438ea311367bab5bdfbe9ba12576bfac023 100644 (file)
@@ -25,8 +25,8 @@ import javax.faces.validator.ValidatorException;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import org.mxchange.jcontactsbusiness.model.basicdata.BasicCompanyDataSessionBeanRemote;
 import org.mxchange.jcoreee.validator.string.BaseStringValidator;
+import org.mxchange.jjobs.beans.business.basicdata.JobsBusinessDataWebRequestController;
 
 /**
  * A validator for company names
@@ -37,9 +37,9 @@ import org.mxchange.jcoreee.validator.string.BaseStringValidator;
 public class JobsCompanyNameValidator extends BaseStringValidator {
 
        /**
-        * Business contact EJB
+        * Business basic data backing bean
         */
-       private static BasicCompanyDataSessionBeanRemote BASIC_DATA_BEAN;
+       private static JobsBusinessDataWebRequestController BASIC_DATA_CONTROLLER;
 
        /**
         * Serial number
@@ -49,16 +49,16 @@ public class JobsCompanyNameValidator extends BaseStringValidator {
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
                // Is the instance there?
-               if (BASIC_DATA_BEAN == null) {
+               if (BASIC_DATA_CONTROLLER == null) {
                        try {
                                // Not yet, attempt lookup
                                final Context initial = new InitialContext();
 
                                // Lookup EJB
-                               BASIC_DATA_BEAN = (BasicCompanyDataSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/basicCompanyData!org.mxchange.jcontactsbusiness.model.basicdata.BasicCompanyDataSessionBeanRemote");
+                               BASIC_DATA_CONTROLLER = (JobsBusinessDataWebRequestController) initial.lookup("java:module/basicCompanyDataController!org.mxchange.jjobs.beans.business.basicdata.JobsBusinessDataWebRequestController"); //NOI18N
                        } catch (final NamingException ex) {
                                // Throw it again
-                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
                        }
                }
 
@@ -90,7 +90,7 @@ public class JobsCompanyNameValidator extends BaseStringValidator {
                }
 
                // Check if name is already used
-               final Boolean nameExists = BASIC_DATA_BEAN.isCompanyNameUsed(companyName);
+               final Boolean nameExists = BASIC_DATA_CONTROLLER.isCompanyNameUsed(companyName);
 
                // Is the user id valid?
                if ((!nameExists) && (checkExisting)) {
index 695cb34b92bcc98eac787686d9b3f5410bfb4226..eaa01be9d6d82d121a84dd60b3394b234d989b14 100644 (file)
@@ -26,8 +26,8 @@ import javax.faces.validator.ValidatorException;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote;
 import org.mxchange.jcoreee.validator.string.BaseStringValidator;
+import org.mxchange.jjobs.beans.contact.JobsContactWebRequestController;
 
 /**
  * A validator for email address validation
@@ -38,9 +38,9 @@ import org.mxchange.jcoreee.validator.string.BaseStringValidator;
 public class JobsEmailAddressValidator extends BaseStringValidator {
 
        /**
-        * Contact session-scoped bean
+        * Contact backing bean
         */
-       private static ContactSessionBeanRemote CONTACT_BEAN;
+       private static JobsContactWebRequestController CONTACT_CONTROLLER;
 
        /**
         * Email pattern
@@ -60,16 +60,16 @@ public class JobsEmailAddressValidator extends BaseStringValidator {
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
                // Is the instance there?
-               if (CONTACT_BEAN == null) {
+               if (CONTACT_CONTROLLER == null) {
                        try {
                                // Not yet, attempt lookup
                                final Context initial = new InitialContext();
 
                                // Lookup EJB
-                               CONTACT_BEAN = (ContactSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/contact!org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote");
+                               CONTACT_CONTROLLER = (JobsContactWebRequestController) initial.lookup("java:module/contactController!org.mxchange.jjobs.beans.contact.JobsContactWebRequestController");
                        } catch (final NamingException ex) {
                                // Throw it again
-                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
                        }
                }
 
@@ -127,7 +127,7 @@ public class JobsEmailAddressValidator extends BaseStringValidator {
                final String clientId = component.getClientId();
 
                // Is it registered?
-               final Boolean isRegistered = CONTACT_BEAN.isEmailAddressRegistered(emailAddress);
+               final Boolean isRegistered = CONTACT_CONTROLLER.isEmailAddressRegistered(emailAddress);
 
                // Is the email address already registered?
                if ((!clientId.endsWith("resendEmailAddress")) && (isRegistered)) { //NOI18N
index 0ea17f736eb73e6f7b4a0947ab885bf7f8d260a5..f617efd3889527f3f5ac6cd3302349eaf1013388 100644 (file)
@@ -26,7 +26,7 @@ import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.jcoreee.validator.number.BaseNumberValidator;
-import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
+import org.mxchange.jjobs.beans.user.JobsUserWebRequestController;
 
 /**
  * A validator for user ids
@@ -37,9 +37,9 @@ import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
 public class JobsUserIdValidator extends BaseNumberValidator {
 
        /**
-        * Remote bean
+        * User backing bean
         */
-       private static UserSessionBeanRemote USER_BEAN;
+       private static JobsUserWebRequestController USER_CONTROLLER;
 
        /**
         * Serial number
@@ -49,16 +49,16 @@ public class JobsUserIdValidator extends BaseNumberValidator {
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
                // Is the instance there?
-               if (USER_BEAN == null) {
+               if (USER_CONTROLLER == null) {
                        try {
                                // Not yet, attempt lookup
                                final Context initial = new InitialContext();
 
                                // Lookup EJB
-                               USER_BEAN = (UserSessionBeanRemote) initial.lookup("java:global/jjobs-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote");
+                               USER_CONTROLLER = (JobsUserWebRequestController) initial.lookup("java:module/userController!org.mxchange.jjobs.beans.user.JobsUserWebRequestController");
                        } catch (final NamingException ex) {
                                // Throw it again
-                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup EJB", ex.getMessage()), ex);
+                               throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Cannot lookup backing bean", ex.getMessage()), ex);
                        }
                }
 
@@ -72,7 +72,7 @@ public class JobsUserIdValidator extends BaseNumberValidator {
                final Long userId = (Long) value;
 
                // Define variable
-               final Boolean ifUserExists = USER_BEAN.ifUserIdExists(userId);
+               final Boolean ifUserExists = USER_CONTROLLER.ifUserIdExists(userId);
 
                // Is the user id valid?
                if (!ifUserExists) {
index 6e639df31d89e29e628149e65303975470a77201..789a4906043a7872c059c063515b73aefe7018d6 100644 (file)
@@ -869,7 +869,7 @@ ADMIN_ASSIGN_BRANCH_OFFICE_CONTACT_EMPLOYEE=Kontaktperson der Filiale zuweisen:
 ADMIN_BRANCH_OFFICE_DATA_LEGEND=Grunddaten der Filiale:
 #@TODO Please fix German umlauts!
 ADMIN_BRANCH_OFFICE_DATA_LEGEND_TITLE=Geben Sie hier die Grunddaten der Filiale ein.
-ADMIN_ASSIGN_BRANCH_OFFICE_COMPANY=Filiale dem Unternehmen zuweisen:
+ADMIN_ASSIGN_BRANCH_OFFICE=Filiale dem Unternehmen zuweisen:
 PAGE_TITLE_ADMIN_LIST_BRANCH_OFFICES=Filialen auflisten
 CONTENT_TITLE_ADMIN_LIST_BRANCH_OFFICES=Auflisten von Filialen:
 #@TODO Please fix German umlauts!
@@ -882,7 +882,7 @@ ADMIN_ENTER_BRANCH_OFFICE_EMAIL_ADDRESS=Email-Addresse der Filiale:
 ADMIN_ENTER_BRANCH_OFFICE_PHONE_NUMBER=Telefonnummer eingeben:
 ADMIN_ENTER_BRANCH_OFFICE_FAX_NUMBER=Faxnummer eingeben:
 #@TODO Please fix German umlauts!
-ADMIN_BRANCH_OFFICE_COMPANY_REQUIRED=Bitte waehlen das zur Filiale gehoerende Unternehmen aus.
+ADMIN_BRANCH_OFFICE_REQUIRED=Bitte waehlen das zur Filiale gehoerende Unternehmen aus.
 ADMIN_BRANCH_OFFICE_STREET_NAME_REQUIRED=Bitte geben Sie die Strasse der Filiale ein.
 ADMIN_BRANCH_OFFICE_HOUSE_NUMBER_REQUIRED=Bitte geben Sie die Hausnummer der Filiale ein.
 #@TODO Please fix German umlauts!
index f654cbad2bc7a6b062334e0597e2ea1f77f18133..0787087b248db97d81fbcc90c6482c6230b97d0a 100644 (file)
@@ -838,7 +838,7 @@ ADMIN_ASSIGN_BRANCH_OFFICE_USER_OWNER=Assign user to branch office:
 ADMIN_ASSIGN_BRANCH_OFFICE_CONTACT_EMPLOYEE=Assign contact person to branch office:
 ADMIN_BRANCH_OFFICE_DATA_LEGEND=Branch office basic data:
 ADMIN_BRANCH_OFFICE_DATA_LEGEND_TITLE=Enter branch office basic data here.
-ADMIN_ASSIGN_BRANCH_OFFICE_COMPANY=Assign branch office to company:
+ADMIN_ASSIGN_BRANCH_OFFICE=Assign branch office to company:
 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.
@@ -848,7 +848,7 @@ ADMIN_ADD_BRANCH_OFFICE_MINIMUM_DATA=Please at least choose assigned company, co
 ADMIN_ENTER_BRANCH_OFFICE_EMAIL_ADDRESS=Email address of branch office:
 ADMIN_ENTER_BRANCH_OFFICE_PHONE_NUMBER=Enter land-line number:
 ADMIN_ENTER_BRANCH_OFFICE_FAX_NUMBER=Enter fax number:
-ADMIN_BRANCH_OFFICE_COMPANY_REQUIRED=Please choose a company that sohuld be assigned with the branch office.
+ADMIN_BRANCH_OFFICE_REQUIRED=Please choose a company that sohuld be assigned with the branch office.
 ADMIN_BRANCH_OFFICE_STREET_NAME_REQUIRED=Please enter street name of branch office.
 ADMIN_BRANCH_OFFICE_HOUSE_NUMBER_REQUIRED=Please enter house number of branch office.
 ENTERED_STORE_INVALID=The entered store is not valid.
index d07704b7ce9899254467cce4a2690f79f46f69d9..06af978746b7523ebc2341b6ceab3d4919b512f3 100644 (file)
@@ -217,7 +217,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
                </attribute>
        </tag>
        <tag>
-               <tag-name>outputCompanyEmployeeAdminMiniLinks</tag-name>
+               <tag-name>outputEmployeeAdminMiniLinks</tag-name>
                <description>This tag renders administrative "mini-links" for given employee instance.</description>
                <source>resources/tags/admin/links/mini/employee/admin_employee_links.tpl</source>
                <attribute>
index 9ec478ea01e4e6defbec07eb685453721fee93c4..b7ffdec1e037900e6cf87e24f96def8f0ac4bf90 100644 (file)
@@ -56,9 +56,9 @@
                                        filter="true"
                                        filterMatchMode="contains"
                                        >
-                                       <f:converter converterId="CompanyEmployeeConverter" />
+                                       <f:converter converterId="EmployeeConverter" />
                                        <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
-                                       <f:selectItems value="#{employeeController.allCompanyEmployees()}" var="companyHeadQuarters" itemValue="#{companyEmployee}" itemLabel="#{companyEmployee.foo}" />
+                                       <f:selectItems value="#{employeeController.allEmployees()}" var="companyHeadQuarters" itemValue="#{companyEmployee}" itemLabel="#{companyEmployee.foo}" />
                                </p:selectOneMenu>
 
                                <p:outputLabel for="companyFounder" value="#{msg.ADMIN_SELECT_BASIC_COMPANY_DATA_COMPANY_FOUNDER}" />
@@ -68,9 +68,9 @@
                                        filter="true"
                                        filterMatchMode="contains"
                                        >
-                                       <f:converter converterId="CompanyEmployeeConverter" />
+                                       <f:converter converterId="EmployeeConverter" />
                                        <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
-                                       <f:selectItems value="#{employeeController.allCompanyEmployees()}" var="companyHeadQuarters" itemValue="#{companyEmployee}" itemLabel="#{companyEmployee.foo}" />
+                                       <f:selectItems value="#{employeeController.allEmployees()}" var="companyHeadQuarters" itemValue="#{companyEmployee}" itemLabel="#{companyEmployee.foo}" />
                                </p:selectOneMenu>
 
                                <p:outputLabel for="companyHeadQuarters" value="#{msg.ADMIN_SELECT_BASIC_COMPANY_DATA_COMPANY_HEADQUARTERS}" />
index 7e2c72b777ce5b0c9dc721bd0a9049335a4d8bd9..dcaefd44bbe0b5f97762f1e5a33c1c897bf14585 100644 (file)
        -->
        <p:fieldset legend="#{msg.ADMIN_BRANCH_OFFICE_DATA_LEGEND}">
                <p:panelGrid layout="grid" columns="2" columnClasses="ui-grid-col-4, ui-grid-col-8" styleClass="table table-full ui-noborder">
-                       <p:outputLabel for="branchCompany" value="#{msg.ADMIN_ASSIGN_BRANCH_OFFICE_COMPANY}" />
+                       <p:outputLabel for="branchCompany" value="#{msg.ADMIN_ASSIGN_BRANCH_OFFICE}" />
                        <p:selectOneMenu
                                id="branchCompany"
                                value="#{adminBranchOfficeController.branchCompany}"
                                filter="true"
                                filterMatchMode="contains"
                                required="true"
-                               requiredMessage="#{msg.ADMIN_BRANCH_OFFICE_COMPANY_REQUIRED}"
+                               requiredMessage="#{msg.ADMIN_BRANCH_OFFICE_REQUIRED}"
                                >
                                <f:converter converterId="BasicCompanyDataConverter" />
                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" />
-                               <f:selectItems value="#{basicCompanyDataController.allCompanyBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
+                               <f:selectItems value="#{basicCompanyDataController.allBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
                        </p:selectOneMenu>
 
                        <p:outputLabel for="branchContactEmployee" value="#{msg.ADMIN_ASSIGN_BRANCH_OFFICE_CONTACT_EMPLOYEE}" />
@@ -33,9 +33,9 @@
                                filter="true"
                                filterMatchMode="contains"
                                >
-                               <f:converter converterId="CompanyEmployeeConverter" />
+                               <f:converter converterId="EmployeeConverter" />
                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
-                               <f:selectItems value="#{employeeController.allCompanyEmployees()}" var="companyHeadQuarters" itemValue="#{companyEmployee}" itemLabel="#{companyEmployee.foo}" />
+                               <f:selectItems value="#{employeeController.allEmployees()}" var="companyHeadQuarters" itemValue="#{companyEmployee}" itemLabel="#{companyEmployee.foo}" />
                        </p:selectOneMenu>
 
                        <p:outputLabel for="branchUserOwner" value="#{msg.ADMIN_ASSIGN_BRANCH_OFFICE_USER_OWNER}" />
index e10b19579798d23fdc8e5c71792c40311de31663..cb76dbc674e816b66845ab56f021119681af19bc 100644 (file)
@@ -26,7 +26,7 @@
                                >
                                <f:converter converterId="BasicCompanyDataConverter" />
                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" />
-                               <f:selectItems value="#{basicCompanyDataController.allCompanyBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
+                               <f:selectItems value="#{basicCompanyDataController.allBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
                        </p:selectOneMenu>
 
                        <p:outputLabel for="departmentBranchOffice" value="#{msg.ADMIN_ASSIGN_DEPARTMENT_BRANCH_OFFICE}" />
@@ -48,7 +48,7 @@
                                filter="true"
                                filterMatchMode="contains"
                                >
-                               <f:converter converterId="CompanyEmployeeConverter" />
+                               <f:converter converterId="EmployeeConverter" />
                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
                                <f:selectItems value="#{headquartersController.allHeadquarters()}" var="headquarters" itemValue="#{headquarters}" itemLabel="#{beanHelper.renderHeadquarters(headquarters)}" />
                        </p:selectOneMenu>
@@ -60,9 +60,9 @@
                                filter="true"
                                filterMatchMode="contains"
                                >
-                               <f:converter converterId="CompanyEmployeeConverter" />
+                               <f:converter converterId="EmployeeConverter" />
                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
-                               <f:selectItems value="#{employeeController.allCompanyEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
+                               <f:selectItems value="#{employeeController.allEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
                        </p:selectOneMenu>
 
                        <p:outputLabel for="departmentUserOwner" value="#{msg.ADMIN_ASSIGN_DEPARTMENT_USER_OWNER}" />
index 8a2bf9179437cc5a9093de9fd9282bd219cbf2f0..5c0747a10834d2157cb00bb799257fbfd60478f7 100644 (file)
@@ -23,7 +23,7 @@
                                >
                                <f:converter converterId="BasicCompanyDataConverter" />
                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" />
-                               <f:selectItems value="#{basicCompanyDataController.allCompanyBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
+                               <f:selectItems value="#{basicCompanyDataController.allBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
                        </p:selectOneMenu>
 
                        <p:outputLabel for="employeeBranchOffice" value="#{msg.ADMIN_ASSIGN_EMPLOYEE_BRANCH_OFFICE}" />
@@ -88,7 +88,7 @@
                                filter="true"
                                filterMatchMode="contains"
                                >
-                               <f:converter converterId="CompanyDepartmentConverter" />
+                               <f:converter converterId="DepartmentConverter" />
                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
                                <f:selectItems value="#{departmentController.allDepartments()}" var="department" itemValue="#{department}" itemLabel="#{beanHelper.renderDepartment(department)}" />
                        </p:selectOneMenu>
index 0fb9c237adec7cfcce141c31d798de76661828e1..ac3f5c4fa9d80a7527bc11f824fa61d48961a060 100644 (file)
@@ -21,7 +21,7 @@
                        <p:dataTable
                                id="table-list-basic-company-data"
                                var="basicData"
-                               value="#{basicCompanyDataController.allCompanyBasicData()}"
+                               value="#{basicCompanyDataController.allBasicData()}"
                                tableStyleClass="table table-full"
                                paginator="true"
                                paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
@@ -96,9 +96,9 @@
                                                        updateLabel="true"
                                                        title="#{msg.FILTER_BY_MULTIPLE_EMPLOYEES_TITLE}"
                                                        >
-                                                       <f:converter converterId="CompanyEmployeeConverter" />
+                                                       <f:converter converterId="EmployeeConverter" />
                                                        <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
-                                                       <f:selectItems value="#{employeeController.allCompanyEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
+                                                       <f:selectItems value="#{employeeController.allEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
                                                </p:selectCheckboxMenu>
                                        </f:facet>
 
                                                        updateLabel="true"
                                                        title="#{msg.FILTER_BY_MULTIPLE_EMPLOYEES_TITLE}"
                                                        >
-                                                       <f:converter converterId="CompanyEmployeeConverter" />
+                                                       <f:converter converterId="EmployeeConverter" />
                                                        <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
-                                                       <f:selectItems value="#{employeeController.allCompanyEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
+                                                       <f:selectItems value="#{employeeController.allEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
                                                </p:selectCheckboxMenu>
                                        </f:facet>
 
index ff66511940c13c3c9b7383622c094df8d33a771c..670fb3d0176cbbbc5a56798ac00b387825f68cb6 100644 (file)
@@ -89,7 +89,7 @@
                                                        title="#{msg.FILTER_BY_MULTIPLE_COMPANIES_TITLE}"
                                                        >
                                                        <f:converter converterId="BasicCompanyDataConverter" />
-                                                       <f:selectItems value="#{basicCompanyDataController.allCompanyBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
+                                                       <f:selectItems value="#{basicCompanyDataController.allBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
                                                </p:selectCheckboxMenu>
                                        </f:facet>
 
                                                        updateLabel="true"
                                                        title="#{msg.FILTER_BY_MULTIPLE_EMPLOYEES_TITLE}"
                                                        >
-                                                       <f:converter converterId="CompanyEmployeeConverter" />
+                                                       <f:converter converterId="EmployeeConverter" />
                                                        <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
-                                                       <f:selectItems value="#{employeeController.allCompanyEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
+                                                       <f:selectItems value="#{employeeController.allEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
                                                </p:selectCheckboxMenu>
                                        </f:facet>
 
index 992a6acc15576c1dd53a9bd810b2011433c02c52..2b5bcc87bf957a3164b9c457936b9b820d7a3745 100644 (file)
@@ -68,7 +68,7 @@
                                                        title="#{msg.FILTER_BY_MULTIPLE_COMPANIES_TITLE}"
                                                        >
                                                        <f:converter converterId="BasicCompanyDataConverter" />
-                                                       <f:selectItems value="#{basicCompanyDataController.allCompanyBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
+                                                       <f:selectItems value="#{basicCompanyDataController.allBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
                                                </p:selectCheckboxMenu>
                                        </f:facet>
 
                                                        updateLabel="true"
                                                        title="#{msg.FILTER_BY_MULTIPLE_EMPLOYEES_TITLE}"
                                                        >
-                                                       <f:converter converterId="CompanyEmployeeConverter" />
+                                                       <f:converter converterId="EmployeeConverter" />
                                                        <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
-                                                       <f:selectItems value="#{employeeController.allCompanyEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
+                                                       <f:selectItems value="#{employeeController.allEmployees()}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" />
                                                </p:selectCheckboxMenu>
                                        </f:facet>
 
index 3ac1c7844a75859a98adf4c9393bec6d0a99c02e..3f84f68422387e149f577d1e80f23688376a1976 100644 (file)
@@ -21,7 +21,7 @@
                        <p:dataTable
                                id="table-list-company-employees"
                                var="employee"
-                               value="#{employeeController.allCompanyEmployees()}"
+                               value="#{employeeController.allEmployees()}"
                                tableStyleClass="table table-full"
                                paginator="true"
                                paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                                        title="#{msg.FILTER_BY_MULTIPLE_COMPANIES_TITLE}"
                                                        >
                                                        <f:converter converterId="BasicCompanyDataConverter" />
-                                                       <f:selectItems value="#{basicCompanyDataController.allCompanyBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
+                                                       <f:selectItems value="#{basicCompanyDataController.allBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
                                                </p:selectCheckboxMenu>
                                        </f:facet>
 
                                </p:column>
 
                                <p:column headerText="#{msg.ADMIN_ACTION_LINKS}" sortable="false" filterable="false">
-                                       <links:outputCompanyEmployeeAdminMiniLinks employee="#{employee}" />
+                                       <links:outputEmployeeAdminMiniLinks employee="#{employee}" />
                                </p:column>
                        </p:dataTable>
                </h:form>
                                                        styleClass="submit"
                                                        type="submit"
                                                        value="#{msg.BUTTON_ADMIN_ADD_EMPLOYEE}"
-                                                       action="#{adminEmployeeController.addCompanyEmployee()}"
+                                                       action="#{adminEmployeeController.addEmployee()}"
                                                        update=":master:form-list-company-employees:table-list-company-employees"
                                                        />
                                        </p:panelGrid>