]> git.mxchange.org Git - addressbook-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Sat, 19 Aug 2017 18:53:28 +0000 (20:53 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 19 Aug 2017 20:13:54 +0000 (22:13 +0200)
- added administrative and general backing bean for company employees + added
  JNDI lookup, still at wrong place
- Employees have an instance back to business basic data which makes it
  impossible for creation (no fancy AJAX stuff now) of business basic data
  with founder and/or contact person
- separated package of businessdata to business/basicdata so above
  business/company_employee package is nicely possible

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/addressbook/beans/business/employee/AddressbookAdminCompanyEmployeeWebRequestBean.java [new file with mode: 0644]
src/java/org/mxchange/addressbook/beans/business/employee/AddressbookAdminCompanyEmployeeWebRequestController.java [new file with mode: 0644]
src/java/org/mxchange/addressbook/beans/business/employee/AddressbookCompanyEmployeeWebRequestBean.java [new file with mode: 0644]
src/java/org/mxchange/addressbook/beans/business/employee/AddressbookCompanyEmployeeWebSessionController.java [new file with mode: 0644]
src/java/org/mxchange/addressbook/beans/businessdata/AddressbookAdminBusinessDataWebRequestBean.java
src/java/org/mxchange/addressbook/beans/businessdata/AddressbookBusinessDataWebSessionBean.java
src/java/org/mxchange/addressbook/converter/company_employee/AddressbookCompanyEmployeeConverter.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/converter/company_employee/FinancialsCompanyEmployeeConverter.java [deleted file]
web/WEB-INF/templates/admin/business_basic_data/admin_form_business_basic_data.tpl

diff --git a/src/java/org/mxchange/addressbook/beans/business/employee/AddressbookAdminCompanyEmployeeWebRequestBean.java b/src/java/org/mxchange/addressbook/beans/business/employee/AddressbookAdminCompanyEmployeeWebRequestBean.java
new file mode 100644 (file)
index 0000000..87f5272
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2017 RRoland 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.addressbook.beans.business.employee;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.RequestScoped;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Named;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.addressbook.beans.BaseAddressbookController;
+import org.mxchange.jcontactsbusiness.employee.AdminCompanyEmployeeSessionBeanRemote;
+
+/**
+ * A request-scoped bean for administrative purposes for company employees.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("adminCompanyEmployeeController")
+@RequestScoped
+public class AddressbookAdminCompanyEmployeeWebRequestBean extends BaseAddressbookController implements AddressbookAdminCompanyEmployeeWebRequestController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 12_886_968_547_360L;
+
+       /**
+        * EJB for administrative company employee purposes
+        */
+       private AdminCompanyEmployeeSessionBeanRemote adminCompanyEmployeeBean;
+
+       /**
+        * Default constructor
+        */
+       public AddressbookAdminCompanyEmployeeWebRequestBean () {
+               // Call super constructor
+               super();
+       }
+
+       /**
+        * Initialization method
+        */
+       @PostConstruct
+       public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.adminCompanyEmployeeBean = (AdminCompanyEmployeeSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/adminCompanyEmployee!org.mxchange.jcontactsbusiness.employee.AdminCompanyEmployeeSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
+       }
+
+}
diff --git a/src/java/org/mxchange/addressbook/beans/business/employee/AddressbookAdminCompanyEmployeeWebRequestController.java b/src/java/org/mxchange/addressbook/beans/business/employee/AddressbookAdminCompanyEmployeeWebRequestController.java
new file mode 100644 (file)
index 0000000..86b47c6
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * 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.addressbook.beans.business.employee;
+
+import java.io.Serializable;
+
+/**
+ * An interface for request-scoped administrative company employee beans
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface AddressbookAdminCompanyEmployeeWebRequestController extends Serializable {
+
+}
diff --git a/src/java/org/mxchange/addressbook/beans/business/employee/AddressbookCompanyEmployeeWebRequestBean.java b/src/java/org/mxchange/addressbook/beans/business/employee/AddressbookCompanyEmployeeWebRequestBean.java
new file mode 100644 (file)
index 0000000..24ae8e8
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2017 RRoland 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.addressbook.beans.business.employee;
+
+import java.util.LinkedList;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.SessionScoped;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Named;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.addressbook.beans.BaseAddressbookController;
+import org.mxchange.jcontactsbusiness.employee.CompanyEmployeeSessionBeanRemote;
+import org.mxchange.jcontactsbusiness.employee.Employee;
+
+/**
+ * A request-scoped bean for general purposes for company employees.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("companyEmployeeController")
+@SessionScoped
+public class AddressbookCompanyEmployeeWebRequestBean extends BaseAddressbookController implements AddressbookCompanyEmployeeWebSessionController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 12_886_968_547_361L;
+
+       /**
+        * EJB for general company employee purposes
+        */
+       private CompanyEmployeeSessionBeanRemote companyEmployeeBean;
+
+       /**
+        * List of all company employees
+        */
+       private final List<Employee> companyEmployees;
+
+       /**
+        * Default constructor
+        */
+       public AddressbookCompanyEmployeeWebRequestBean () {
+               // Call super constructor
+               super();
+
+               // Init list instance
+               this.companyEmployees = new LinkedList<>();
+       }
+
+       /**
+        * Returns a list of all company employees
+        * <p>
+        * @return List of all company employees
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<Employee> allCompanyEmployees () {
+               return this.companyEmployees;
+       }
+
+       /**
+        * Initialization method
+        */
+       @PostConstruct
+       public void init () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup
+                       this.companyEmployeeBean = (CompanyEmployeeSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/adminCompanyEmployee!org.mxchange.jcontactsbusiness.employee.CompanyEmployeeSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw again
+                       throw new FaceletException(e);
+               }
+
+               // Get all entries from remote bean
+               List<Employee> employees = this.companyEmployeeBean.allCompanyEmployees();
+
+               // Copy it to main list
+               this.companyEmployees.addAll(employees);
+       }
+
+}
diff --git a/src/java/org/mxchange/addressbook/beans/business/employee/AddressbookCompanyEmployeeWebSessionController.java b/src/java/org/mxchange/addressbook/beans/business/employee/AddressbookCompanyEmployeeWebSessionController.java
new file mode 100644 (file)
index 0000000..2560666
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * 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.addressbook.beans.business.employee;
+
+import java.io.Serializable;
+
+/**
+ * An interface for request-scoped general company employee beans
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface AddressbookCompanyEmployeeWebSessionController extends Serializable {
+
+}
index 2b6d543d722b358f683904bd2092e3ee378407d6..b82851d9a9e11aefb669c1f691d83d45bee83a5c 100644 (file)
@@ -16,7 +16,6 @@
  */
 package org.mxchange.addressbook.beans.businessdata;
 
-import java.util.List;
 import javax.annotation.PostConstruct;
 import javax.enterprise.context.RequestScoped;
 import javax.faces.view.facelets.FaceletException;
@@ -25,9 +24,11 @@ import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
-import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
-import org.mxchange.jcountry.data.Country;
 import org.mxchange.jcontactsbusiness.basicdata.AdminBusinessDataSessionBeanRemote;
+import org.mxchange.jcontactsbusiness.employee.Employee;
+import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jusercore.model.user.User;
 
 /**
  * An administrative business contact bean (controller)
@@ -49,25 +50,45 @@ public class AddressbookAdminBusinessDataWebRequestBean extends BaseAddressbookC
        private AdminBusinessDataSessionBeanRemote adminBusinessDataBean;
 
        /**
-        * A list of all registered companies (globally)
+        * Comments for this company
         */
-       private List<BusinessBasicData> businessContacts;
+       private String companyComments;
 
        /**
-        * Comments for this company
+        * An employee as contact person with this company
         */
-       private String companyComments;
+       private Employee companyContactEmployee;
 
        /**
         * Companies (main) email address (example: info@company.example)
         */
        private String companyEmailAddress;
 
+       /**
+        * Head quarter data for this company
+        */
+       private HeadQuartersData companyHeadQuarters;
+
        /**
         * Company name
         */
        private String companyName;
 
+       /**
+        * Tax number
+        */
+       private String companyTaxNumber;
+
+       /**
+        * Web site URL
+        */
+       private String companyWebsiteUrl;
+
+       /**
+        * Owning user instance (which this company is assigned to)
+        */
+       private User contactCompanyUserOwner;
+
        /**
         * Area code for fax number
         */
@@ -106,12 +127,6 @@ public class AddressbookAdminBusinessDataWebRequestBean extends BaseAddressbookC
                super();
        }
 
-       @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<BusinessBasicData> allBusinessContacts () {
-               return this.businessContacts;
-       }
-
        /**
         * Getter for comments
         * <p>
@@ -130,6 +145,24 @@ public class AddressbookAdminBusinessDataWebRequestBean extends BaseAddressbookC
                this.companyComments = companyComments;
        }
 
+       /**
+        * Getter for employee as contact person
+        * <p>
+        * @return Employee as contact person
+        */
+       public Employee getCompanyContactEmployee () {
+               return this.companyContactEmployee;
+       }
+
+       /**
+        * Setter for employee as contact person
+        * <p>
+        * @param companyContactEmployee Employee as contact person
+        */
+       public void setCompanyContactEmployee (final Employee companyContactEmployee) {
+               this.companyContactEmployee = companyContactEmployee;
+       }
+
        /**
         * Getter for company's (main) email address
         * <p>
@@ -148,6 +181,24 @@ public class AddressbookAdminBusinessDataWebRequestBean extends BaseAddressbookC
                this.companyEmailAddress = companyEmailAddress;
        }
 
+       /**
+        * Getter for headquarters data
+        * <p>
+        * @return Headquarters data
+        */
+       public HeadQuartersData getCompanyHeadQuarters () {
+               return this.companyHeadQuarters;
+       }
+
+       /**
+        * Setter for headquarters data
+        * <p>
+        * @param companyHeadQuarters Headquarters data
+        */
+       public void setCompanyHeadQuarters (final HeadQuartersData companyHeadQuarters) {
+               this.companyHeadQuarters = companyHeadQuarters;
+       }
+
        /**
         * Getter for company name
         * <p>
@@ -166,6 +217,60 @@ public class AddressbookAdminBusinessDataWebRequestBean extends BaseAddressbookC
                this.companyName = companyName;
        }
 
+       /**
+        * Getter for company tax number
+        * <p>
+        * @return Company tax number
+        */
+       public String getCompanyTaxNumber () {
+               return this.companyTaxNumber;
+       }
+
+       /**
+        * Setter for company tax number
+        * <p>
+        * @param companyTaxNumber Company tax number
+        */
+       public void setCompanyTaxNumber (final String companyTaxNumber) {
+               this.companyTaxNumber = companyTaxNumber;
+       }
+
+       /**
+        * Getter for company web site URL
+        * <p>
+        * @return Company web site URL
+        */
+       public String getCompanyWebsiteUrl () {
+               return this.companyWebsiteUrl;
+       }
+
+       /**
+        * Getter for company web site URL
+        * <p>
+        * @param companyWebsiteUrl Company web site URL
+        */
+       public void setCompanyWebsiteUrl (final String companyWebsiteUrl) {
+               this.companyWebsiteUrl = companyWebsiteUrl;
+       }
+
+       /**
+        * Getter for owning user instance
+        * <p>
+        * @return Owning user instance
+        */
+       public User getContactCompanyUserOwner () {
+               return this.contactCompanyUserOwner;
+       }
+
+       /**
+        * Setter for owning user instance
+        * <p>
+        * @param contactCompanyUserOwner Owning user instance
+        */
+       public void setContactCompanyUserOwner (final User contactCompanyUserOwner) {
+               this.contactCompanyUserOwner = contactCompanyUserOwner;
+       }
+
        /**
         * Getter for fax number's area code
         * <p>
@@ -290,9 +395,6 @@ public class AddressbookAdminBusinessDataWebRequestBean extends BaseAddressbookC
                        // Throw again
                        throw new FaceletException(e);
                }
-
-               // Init user's contact list
-               this.businessContacts = this.adminBusinessDataBean.allBusinessContacts();
        }
 
 }
index 6b315ea06aa3597fc36c5f111ea56adb2b895651..82b98e2f36cb68151b26b52a082a139ec6ca679d 100644 (file)
  */
 package org.mxchange.addressbook.beans.businessdata;
 
+import java.util.List;
 import javax.annotation.PostConstruct;
 import javax.enterprise.context.SessionScoped;
 import javax.faces.view.facelets.FaceletException;
+import javax.inject.Inject;
 import javax.inject.Named;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import org.mxchange.addressbook.beans.BaseAddressbookController;
+import org.mxchange.jcontactsbusiness.basicdata.AdminBusinessDataSessionBeanRemote;
+import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
 import org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote;
-import org.mxchange.jcontactsbusiness.employee.Employee;
 import org.mxchange.jcountry.data.Country;
 
 /**
@@ -45,17 +48,22 @@ public class AddressbookBusinessDataWebSessionBean extends BaseAddressbookContro
        /**
         * Remote contact bean
         */
-       private BusinessDataSessionBeanRemote businessDataBean;
+       private AdminBusinessDataSessionBeanRemote adminBusinessDataBean;
 
        /**
-        * Comments for this company
+        * A list of all registered companies (globally)
         */
-       private String companyComments;
+       private List<BusinessBasicData> businessContacts;
+
+       /**
+        * Remote contact bean
+        */
+       private BusinessDataSessionBeanRemote businessDataBean;
 
        /**
-        * An employee as contact person with this company
+        * Comments for this company
         */
-       private Employee companyContactEmployee;
+       private String companyComments;
 
        /**
         * Companies (main) email address (example: info@company.example)
@@ -97,6 +105,12 @@ public class AddressbookBusinessDataWebSessionBean extends BaseAddressbookContro
         */
        private Long landLineNumber;
 
+       /**
+        * User instance
+        */
+       @Inject
+       private AddressbookUserLoginWebSessionController userLoginController;
+
        /**
         * Constructor
         */
@@ -105,6 +119,12 @@ public class AddressbookBusinessDataWebSessionBean extends BaseAddressbookContro
                super();
        }
 
+       @Override
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<BusinessBasicData> allBusinessContacts () {
+               return this.businessContacts;
+       }
+
        /**
         * Getter for comments
         * <p>
@@ -123,24 +143,6 @@ public class AddressbookBusinessDataWebSessionBean extends BaseAddressbookContro
                this.companyComments = companyComments;
        }
 
-       /**
-        * Getter for employee as contact person
-        * <p>
-        * @return Employee as contact person
-        */
-       public Employee getCompanyContactEmployee () {
-               return this.companyContactEmployee;
-       }
-
-       /**
-        * Setter for employee as contact person
-        * <p>
-        * @param companyContactEmployee Employee as contact person
-        */
-       public void setCompanyContactEmployee (final Employee companyContactEmployee) {
-               this.companyContactEmployee = companyContactEmployee;
-       }
-
        /**
         * Getter for company's (main) email address
         * <p>
@@ -297,10 +299,16 @@ public class AddressbookBusinessDataWebSessionBean extends BaseAddressbookContro
 
                        // Try to lookup
                        this.businessDataBean = (BusinessDataSessionBeanRemote) context.lookup("java:global/addressbook-ejb/businessData!org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote"); //NOI18N
+
+                       // Try to lookup
+                       this.adminBusinessDataBean = (AdminBusinessDataSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/adminBusinessData!org.mxchange.jcontactsbusiness.basicdata.BusinessDataAdminSessionBeanRemote"); //NOI18N
                } catch (final NamingException e) {
                        // Throw again
                        throw new FaceletException(e);
                }
+
+               // Init user's contact list
+               this.businessContacts = this.adminBusinessDataBean.allBusinessContacts();
        }
 
 }
diff --git a/src/java/org/mxchange/addressbook/converter/company_employee/AddressbookCompanyEmployeeConverter.java b/src/java/org/mxchange/addressbook/converter/company_employee/AddressbookCompanyEmployeeConverter.java
new file mode 100644 (file)
index 0000000..7213230
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * 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.addressbook.converter.company_employee;
+
+import java.text.MessageFormat;
+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.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcontactsbusiness.employee.CompanyEmployeeSessionBeanRemote;
+import org.mxchange.jcontactsbusiness.employee.Employee;
+import org.mxchange.jcontactsbusiness.exceptions.employee.CompanyEmployeeNotFoundException;
+
+/**
+ * Converter for converting company employee to and from id number
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@FacesConverter (value = "CompanyEmployeeConverter")
+public class AddressbookCompanyEmployeeConverter implements Converter {
+
+       /**
+        * CompanyEmployee EJB
+        */
+       private static CompanyEmployeeSessionBeanRemote COMPANY_EMPLOYEE_BEAN;
+
+       /**
+        * Default constructor
+        */
+       public AddressbookCompanyEmployeeConverter () {
+       }
+
+       @Override
+       public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+               // 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;
+               }
+
+               // Is the bean there?
+               // @TODO Requires this synchronization or is it (sync) confusing the container?
+               if (null == AddressbookCompanyEmployeeConverter.COMPANY_EMPLOYEE_BEAN) {
+                       // Try to get it
+                       try {
+                               // Get initial context
+                               Context initialContext = new InitialContext();
+
+                               // ... and user controller
+                               AddressbookCompanyEmployeeConverter.COMPANY_EMPLOYEE_BEAN = (CompanyEmployeeSessionBeanRemote) initialContext.lookup("java:global/jfinancials-ejb/companyEmployee!org.mxchange.jcontactsbusiness.company_employee.CompanyEmployeeSessionBeanRemote"); //NOI18N
+                       } catch (final NamingException ex) {
+                               // Continue to throw it
+                               throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
+                       }
+               }
+
+               // Init instance
+               Employee companyEmployee = null;
+
+               try {
+                       // Try to parse the value as long
+                       Long employeeId = Long.valueOf(submittedValue);
+
+                       // Try to get user instance from it
+                       companyEmployee = AddressbookCompanyEmployeeConverter.COMPANY_EMPLOYEE_BEAN.findCompanyEmployeeById(employeeId);
+               } catch (final NumberFormatException ex) {
+                       // Throw again
+                       throw new ConverterException(ex);
+               } catch (final CompanyEmployeeNotFoundException 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 Object value) {
+               // Is the object null?
+               if ((null == value) || (String.valueOf(value).isEmpty())) {
+                       // Is null
+                       return ""; //NOI18N
+               } else if (!(value instanceof Employee)) {
+                       // Not same interface
+                       throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement Employee.", value.getClass().getSimpleName())); //NOI18N
+               }
+
+               // Return id number
+               return String.valueOf(((Employee) value).getEmployeeId());
+       }
+
+}
diff --git a/src/java/org/mxchange/jfinancials/converter/company_employee/FinancialsCompanyEmployeeConverter.java b/src/java/org/mxchange/jfinancials/converter/company_employee/FinancialsCompanyEmployeeConverter.java
deleted file mode 100644 (file)
index 645fc22..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.jfinancials.converter.company_employee;
-
-import java.text.MessageFormat;
-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.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jcontactsbusiness.employee.CompanyEmployeeSessionBeanRemote;
-import org.mxchange.jcontactsbusiness.employee.Employee;
-import org.mxchange.jcontactsbusiness.exceptions.employee.CompanyEmployeeNotFoundException;
-
-/**
- * Converter for converting company employee to and from id number
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@FacesConverter (value = "CompanyEmployeeConverter")
-public class FinancialsCompanyEmployeeConverter implements Converter {
-
-       /**
-        * CompanyEmployee EJB
-        */
-       private static CompanyEmployeeSessionBeanRemote COMPANY_EMPLOYEE_BEAN;
-
-       /**
-        * Default constructor
-        */
-       public FinancialsCompanyEmployeeConverter () {
-       }
-
-       @Override
-       public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
-               // 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;
-               }
-
-               // Is the bean there?
-               // @TODO Requires this synchronization or is it (sync) confusing the container?
-               if (null == FinancialsCompanyEmployeeConverter.COMPANY_EMPLOYEE_BEAN) {
-                       // Try to get it
-                       try {
-                               // Get initial context
-                               Context initialContext = new InitialContext();
-
-                               // ... and user controller
-                               FinancialsCompanyEmployeeConverter.COMPANY_EMPLOYEE_BEAN = (CompanyEmployeeSessionBeanRemote) initialContext.lookup("java:global/jfinancials-ejb/companyEmployee!org.mxchange.jcontactsbusiness.company_employee.CompanyEmployeeSessionBeanRemote"); //NOI18N
-                       } catch (final NamingException ex) {
-                               // Continue to throw it
-                               throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
-                       }
-               }
-
-               // Init instance
-               Employee companyEmployee = null;
-
-               try {
-                       // Try to parse the value as long
-                       Long employeeId = Long.valueOf(submittedValue);
-
-                       // Try to get user instance from it
-                       companyEmployee = FinancialsCompanyEmployeeConverter.COMPANY_EMPLOYEE_BEAN.findCompanyEmployeeById(employeeId);
-               } catch (final NumberFormatException ex) {
-                       // Throw again
-                       throw new ConverterException(ex);
-               } catch (final CompanyEmployeeNotFoundException 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 Object value) {
-               // Is the object null?
-               if ((null == value) || (String.valueOf(value).isEmpty())) {
-                       // Is null
-                       return ""; //NOI18N
-               } else if (!(value instanceof Employee)) {
-                       // Not same interface
-                       throw new IllegalArgumentException(MessageFormat.format("value[]={0} does not implement Employee.", value.getClass().getSimpleName())); //NOI18N
-               }
-
-               // Return id number
-               return String.valueOf(((Employee) value).getEmployeeId());
-       }
-
-}
index 0daf0e550ce49ba47dceaf95a8ce145cef59b3e8..23ea3bbd5a25ad6295a9197dce9418f42e631747 100644 (file)
                                <h:message for="companyEmailAddress" errorClass="errors" warnClass="warnings" fatalClass="errors" />
                        </h:panelGroup>
 
-                       <h:panelGroup styleClass="table_row" layout="block">
-                               <div class="table_left_medium">
-                                       <h:outputLabel for="companyContactEmployee" value="#{msg.ADMIN_SELECT_BUSINESS_DATA_COMPANY_CONTACT_EMPLOYEE}" />
-                               </div>
-
-                               <div class="table_right_medium">
-                                       <h:selectOneMenu styleClass="select" id="companyContactEmployee" value="#{adminBusinessDataController.companyContactEmployee}">
-                                               <f:converter converterId="CompanyEmployeeConverter" />
-                                               <f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
-                                               <f:selectItems value="#{adminCompanyEmployeeController.allCompanyEmployees()}" var="companyEmployee" itemValue="#{companyEmployee}" itemLabel="#{companyEmployee.foo})" />
-                                       </h:selectOneMenu>
-                               </div>
-
-                               <div class="clear"></div>
-                       </h:panelGroup>
-
-                       <h:panelGroup styleClass="error_container" layout="block">
-                               <h:message for="companyContactEmployee" errorClass="errors" warnClass="warnings" fatalClass="errors" />
-                       </h:panelGroup>
-
-                       <h:panelGroup styleClass="table_row" layout="block">
-                               <div class="table_left_medium">
-                                       <h:outputLabel for="companyFounder" value="#{msg.ADMIN_SELECT_BUSINESS_DATA_COMPANY_FOUNDER}" />
-                               </div>
-
-                               <div class="table_right_medium">
-                                       <h:selectOneMenu styleClass="select" id="companyFounder" value="#{adminBusinessDataController.companyFounder}">
-                                               <f:converter converterId="CompanyEmployeeConverter" />
-                                               <f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
-                                               <f:selectItems value="#{adminCompanyEmployeeController.allCompanyEmployees()}" var="companyEmployee" itemValue="#{companyEmployee}" itemLabel="#{companyEmployee.foo})" />
-                                       </h:selectOneMenu>
-                               </div>
-
-                               <div class="clear"></div>
-                       </h:panelGroup>
-
-                       <h:panelGroup styleClass="error_container" layout="block">
-                               <h:message for="companyFounder" errorClass="errors" warnClass="warnings" fatalClass="errors" />
-                       </h:panelGroup>
-
                        <h:panelGroup styleClass="table_row" layout="block">
                                <div class="table_left_medium">
                                        <h:outputLabel for="companyLogo" value="#{msg.ADMIN_SELECT_BUSINESS_DATA_COMPANY_FOUNDER}" />
                                        <h:selectOneMenu styleClass="select" id="contactCompanyUserOwner" value="#{adminBusinessDataController.contactCompanyUserOwner}">
                                                <f:converter converterId="UserConverter" />
                                                <f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
-                                               <f:selectItems value="#{userController.allUsers()}" var="companyUserOwner" itemValue="#{companyUserOwner}" itemLabel="#{companyUserOwner.foo})" />
+                                               <f:selectItems value="#{userController.allUsers()}" var="companyUserOwner" itemValue="#{companyUserOwner}" itemLabel="#{companyUserOwner.userContact.contactFirstName} #{companyUserOwner.userContact.contactFamilyName} (#{companyUserOwner.userName})" />
                                        </h:selectOneMenu>
                                </div>
 
                                        <h:selectOneMenu styleClass="select" id="companyHeadQuarters" value="#{adminBusinessDataController.companyHeadQuarters}">
                                                <f:converter converterId="CompanyEmployeeConverter" />
                                                <f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
-                                               <f:selectItems value="#{adminCompanyHeadquartersController.allCompanyHeadquarters()}" var="companyHeadQuarters" itemValue="#{companyHeadQuarters}" itemLabel="#{companyHeadQuarters.foo})" />
+                                               <f:selectItems value="#{companyHeadquartersController.allCompanyHeadquarters()}" var="companyHeadQuarters" itemValue="#{companyHeadQuarters}" itemLabel="#{companyHeadQuarters.foo}" />
                                        </h:selectOneMenu>
                                </div>