]> git.mxchange.org Git - jjobs-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Thu, 2 Apr 2020 13:38:24 +0000 (15:38 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 2 Apr 2020 16:47:51 +0000 (18:47 +0200)
- rewrote admin-departments-list view to have working filters and sorting
  (wasn't done correctly)
- also included a "global" search (all columns)
- moved isDepartmentAlreadyAdded() to departmentListController to avoid getter
  for allDepartments being exposed in interface

Signed-off-by: Roland Häder <roland@mxchange.org>
12 files changed:
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/department/list/JobsDepartmentListWebViewBean.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/business/department/list/JobsDepartmentListWebViewController.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/converter/business/department/JobsDepartmentConverter.java
src/java/org/mxchange/localization/generic_de_DE.properties
src/java/org/mxchange/localization/generic_en_US.properties
web/WEB-INF/resources/tags/country/form_data/form_country_selector.tpl
web/admin/branch_office/admin_branch_office_list.xhtml
web/admin/department/admin_department_list.xhtml
web/admin/mobile_provider/admin_mobile_provider_list.xhtml

index 796999532f2659b6817b3fd4c278d78797c8bce8..0db3e12e3b4b2fa3233a3598300c5855466f0f7d 100644 (file)
@@ -16,7 +16,6 @@
  */
 package org.mxchange.jjobs.beans.business.department;
 
-import java.util.List;
 import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Event;
@@ -31,10 +30,10 @@ import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
 import org.mxchange.jcontactsbusiness.model.department.AdminDepartmentSessionBeanRemote;
 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.Employable;
 import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
 import org.mxchange.jjobs.beans.BaseJobsBean;
+import org.mxchange.jjobs.beans.business.department.list.JobsDepartmentListWebViewController;
 import org.mxchange.jusercore.model.user.User;
 
 /**
@@ -74,12 +73,6 @@ public class JobsAdminDepartmentWebRequestBean extends BaseJobsBean implements J
         */
        private BasicData departmentCompany;
 
-       /**
-        * A general department controller (backing bean)
-        */
-       @Inject
-       private JobsDepartmentWebRequestController departmentController;
-
        /**
         * Assigned headquarter (if apply-able)
         */
@@ -95,6 +88,12 @@ public class JobsAdminDepartmentWebRequestBean extends BaseJobsBean implements J
         */
        private Employable departmentLead;
 
+       /**
+        * A general department controller (backing bean)
+        */
+       @Inject
+       private JobsDepartmentListWebViewController departmentListController;
+
        /**
         * Owning user instance (which this department is assigned to)
         */
@@ -118,7 +117,7 @@ public class JobsAdminDepartmentWebRequestBean extends BaseJobsBean implements J
                final Department department = this.createDepartment();
 
                // Is the department not created yet?
-               if (this.isDepartmentCreatedByRequiredData(department)) {
+               if (this.departmentListController.isDepartmentAlreadyAdded(department)) {
                        // Then show proper faces message
                        this.showFacesMessage("form-admin-add-department:branchStreet", "ADMIN_DEPARTMENT_ALREADY_CREATED"); //NOI18N
                        return;
@@ -269,34 +268,4 @@ public class JobsAdminDepartmentWebRequestBean extends BaseJobsBean implements J
                return department;
        }
 
-       /**
-        * Checks whether the given department is already found in local cache.
-        * Please note that this method fully relies on the cache, so you must
-        * always fire proper events that add/update/delete entries in cache.
-        * <p>
-        * @param department Department to check it's address
-        * <p>
-        * @return Whether the address has been found
-        */
-       private boolean isDepartmentCreatedByRequiredData (final Department department) {
-               // Get full list from other bean
-               final List<Department> departments = this.departmentController.allDepartments();
-
-               // Default is not found
-               boolean isFound = false;
-
-               // Now check each entry
-               for (final Department dep : departments) {
-                       // Is same address?
-                       if (Departments.isSameDepartment(dep, department)) {
-                               // Found one
-                               isFound = true;
-                               break;
-                       }
-               }
-
-               // Return flag
-               return isFound;
-       }
-
 }
index 84a8283cf3251ea553a810c51f2327c0d93e58a7..5c0ab158f11b009f3a446e983762a23f8acfe965 100644 (file)
  */
 package org.mxchange.jjobs.beans.business.department;
 
-import fish.payara.cdi.jsr107.impl.NamedCache;
-import java.text.MessageFormat;
-import java.util.Comparator;
-import java.util.LinkedList;
-import java.util.List;
-import javax.annotation.PostConstruct;
-import javax.cache.Cache;
 import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
-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;
 
@@ -48,150 +36,18 @@ public class JobsDepartmentWebRequestBean extends BaseJobsBean implements JobsDe
         */
        private static final long serialVersionUID = 5_028_697_360_461L;
 
-       /**
-        * A list of all departments
-        */
-       private final List<Department> allDepartments;
-
        /**
         * EJB for administrative purposes
         */
        @EJB (lookup = "java:global/jjobs-ejb/department!org.mxchange.jcontactsbusiness.model.department.DepartmentSessionBeanRemote")
        private DepartmentSessionBeanRemote departmentBean;
 
-       /**
-        * A list of all departments (globally)
-        */
-       @Inject
-       @NamedCache (cacheName = "departmentCache")
-       private Cache<Long, Department> departmentCache;
-
-       /**
-        * A list of filtered departments
-        */
-       private List<Department> filteredDepartments;
-
        /**
         * Default constructor
         */
        public JobsDepartmentWebRequestBean () {
                // Call super constructor
                super();
-
-               // Init list
-               this.allDepartments = new LinkedList<>();
-       }
-
-       /**
-        * Observes events being fired when a department has been added.
-        * <p>
-        * @param event Event being fired
-        * <p>
-        * @throws NullPointerException If the parameter or it's carried instance is
-        * null
-        * @throws IllegalArgumentException If the branchId is zero or lower
-        */
-       public void afterDepartmentAddedEvent (@Observes final ObservableDepartmentAddedEvent event) {
-               // Validate parameter
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getDepartment() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.department is null"); //NOI18N
-               } else if (event.getDepartment().getDepartmentId() == null) {
-                       // Throw it again
-                       throw new NullPointerException("event.department.branchId is null"); //NOI18N
-               } else if (event.getDepartment().getDepartmentId() < 1) {
-                       // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("event.department.branchId={0} is not valid", event.getDepartment().getDepartmentId())); //NOI18N
-               }
-
-               // Add instance to cache
-               this.departmentCache.put(event.getDepartment().getDepartmentId(), event.getDepartment());
-               this.allDepartments.add(event.getDepartment());
-       }
-
-       @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<Department> allDepartments () {
-               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>
-        * @return Filtered departments
-        */
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<Department> getFilteredDepartments () {
-               return this.filteredDepartments;
-       }
-
-       /**
-        * Setter for a list of filtered departments
-        * <p>
-        * @param filteredDepartments Filtered departments
-        */
-       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
-       public void setFilteredDepartments (final List<Department> filteredDepartments) {
-               this.filteredDepartments = filteredDepartments;
-       }
-
-       /**
-        * Initializer method
-        */
-       @PostConstruct
-       public void initializeList () {
-               // Is cache there?
-               if (!this.departmentCache.iterator().hasNext()) {
-                       // Get whole list from EJB
-                       final List<Department> departments = this.departmentBean.allDepartments();
-
-                       // Add all
-                       for (final Department department : departments) {
-                               // Add it to cache
-                               this.departmentCache.put(department.getDepartmentId(), department);
-                       }
-               }
-
-               // Is the list empty, but filled cache?
-               if (this.allDepartments.isEmpty() && this.departmentCache.iterator().hasNext()) {
-                       // Build up list
-                       for (final Cache.Entry<Long, Department> currentEntry : this.departmentCache) {
-                               // Add to list
-                               this.allDepartments.add(currentEntry.getValue());
-                       }
-
-                       // Sort list
-                       this.allDepartments.sort(new Comparator<Department>() {
-                               @Override
-                               public int compare (final Department department1, final Department department2) {
-                                       return department1.getDepartmentId() > department2.getDepartmentId() ? 1 : department1.getDepartmentId() < department2.getDepartmentId() ? -1 : 0;
-                               }
-                       });
-               }
        }
 
 }
index 72d19d229c6064df49453934fe23454cc596c4ad..26adee68ccd6a9b7ae6332727db52cc3447eaf90 100644 (file)
@@ -17,9 +17,6 @@
 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;
 
 /**
  * An interface for general department controller
@@ -28,24 +25,4 @@ import org.mxchange.jcontactsbusiness.model.department.Department;
  */
 public interface JobsDepartmentWebRequestController extends Serializable {
 
-       /**
-        * Returns a list of all departments
-        * <p>
-        * @return A list of all departments
-        */
-       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;
-
 }
diff --git a/src/java/org/mxchange/jjobs/beans/business/department/list/JobsDepartmentListWebViewBean.java b/src/java/org/mxchange/jjobs/beans/business/department/list/JobsDepartmentListWebViewBean.java
new file mode 100644 (file)
index 0000000..dec8346
--- /dev/null
@@ -0,0 +1,244 @@
+/*
+ * Copyright (C) 2017 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.business.department.list;
+
+import fish.payara.cdi.jsr107.impl.NamedCache;
+import java.text.MessageFormat;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.cache.Cache;
+import javax.ejb.EJB;
+import javax.enterprise.event.Observes;
+import javax.faces.view.ViewScoped;
+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.jcontactsbusiness.model.department.Departments;
+import org.mxchange.jjobs.beans.BaseJobsBean;
+
+/**
+ * A list bean for departments
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("departmentListController")
+@ViewScoped
+public class JobsDepartmentListWebViewBean extends BaseJobsBean implements JobsDepartmentListWebViewController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 5_028_697_360_462L;
+
+       /**
+        * A list of all departments
+        */
+       private final List<Department> allDepartments;
+
+       /**
+        * EJB for administrative purposes
+        */
+       @EJB (lookup = "java:global/jjobs-ejb/department!org.mxchange.jcontactsbusiness.model.department.DepartmentSessionBeanRemote")
+       private DepartmentSessionBeanRemote departmentBean;
+
+       /**
+        * A list of all departments (globally)
+        */
+       @Inject
+       @NamedCache (cacheName = "departmentCache")
+       private transient Cache<Long, Department> departmentCache;
+
+       /**
+        * A list of filtered departments
+        */
+       private List<Department> filteredDepartments;
+
+       /**
+        * Currently selected department
+        */
+       private Department selectedDepartment;
+
+       /**
+        * Default constructor
+        */
+       public JobsDepartmentListWebViewBean () {
+               // Call super constructor
+               super();
+
+               // Init list
+               this.allDepartments = new LinkedList<>();
+       }
+
+       /**
+        * Observes events being fired when a department has been added.
+        * <p>
+        * @param event Event being fired
+        * <p>
+        * @throws NullPointerException If the parameter or it's carried instance is
+        * null
+        * @throws IllegalArgumentException If the branchId is zero or lower
+        */
+       public void afterDepartmentAddedEvent (@Observes final ObservableDepartmentAddedEvent event) {
+               // Validate parameter
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getDepartment() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.department is null"); //NOI18N
+               } else if (event.getDepartment().getDepartmentId() == null) {
+                       // Throw it again
+                       throw new NullPointerException("event.department.branchId is null"); //NOI18N
+               } else if (event.getDepartment().getDepartmentId() < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException(MessageFormat.format("event.department.branchId={0} is not valid", event.getDepartment().getDepartmentId())); //NOI18N
+               }
+
+               // Add instance to cache
+               this.departmentCache.put(event.getDepartment().getDepartmentId(), event.getDepartment());
+               this.getAllDepartments().add(event.getDepartment());
+       }
+
+       @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;
+       }
+
+       /**
+        * Returns a list of all departments
+        * <p>
+        * @return A list of all departments
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<Department> getAllDepartments () {
+               return this.allDepartments;
+       }
+
+       /**
+        * Getter for a list of filtered departments
+        * <p>
+        * @return Filtered departments
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<Department> getFilteredDepartments () {
+               return this.filteredDepartments;
+       }
+
+       /**
+        * Setter for a list of filtered departments
+        * <p>
+        * @param filteredDepartments Filtered departments
+        */
+       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+       public void setFilteredDepartments (final List<Department> filteredDepartments) {
+               this.filteredDepartments = filteredDepartments;
+       }
+
+       /**
+        * Getter for selected department
+        * <p>
+        * @return Selected department
+        */
+       public Department getSelectedDepartment () {
+               return this.selectedDepartment;
+       }
+
+       /**
+        * Setter for selected department
+        * <p>
+        * @param selectedDepartment Selected department
+        */
+       public void setSelectedDepartment (final Department selectedDepartment) {
+               this.selectedDepartment = selectedDepartment;
+       }
+
+       /**
+        * Initializer method
+        */
+       @PostConstruct
+       public void initializeList () {
+               // Is cache there?
+               if (!this.departmentCache.iterator().hasNext()) {
+                       // Get whole list from EJB
+                       final List<Department> departments = this.departmentBean.allDepartments();
+
+                       // Add all
+                       for (final Department department : departments) {
+                               // Add it to cache
+                               this.departmentCache.put(department.getDepartmentId(), department);
+                       }
+               }
+
+               // Is the list empty, but filled cache?
+               if (this.getAllDepartments().isEmpty() && this.departmentCache.iterator().hasNext()) {
+                       // Build up list
+                       for (final Cache.Entry<Long, Department> currentEntry : this.departmentCache) {
+                               // Add to list
+                               this.getAllDepartments().add(currentEntry.getValue());
+                       }
+
+                       // Sort list
+                       this.getAllDepartments().sort(new Comparator<Department>() {
+                               @Override
+                               public int compare (final Department department1, final Department department2) {
+                                       return department1.getDepartmentId() > department2.getDepartmentId() ? 1 : department1.getDepartmentId() < department2.getDepartmentId() ? -1 : 0;
+                               }
+                       });
+               }
+       }
+
+       @Override
+       public boolean isDepartmentAlreadyAdded (final Department department) {
+               // Default is not found
+               boolean isFound = false;
+
+               // Now check each entry
+               for (final Department currentDepartment : this.getAllDepartments()) {
+                       // Is same address?
+                       if (Departments.isSameDepartment(currentDepartment, department)) {
+                               // Found one
+                               isFound = true;
+                               break;
+                       }
+               }
+
+               // Return flag
+               return isFound;
+       }
+
+}
diff --git a/src/java/org/mxchange/jjobs/beans/business/department/list/JobsDepartmentListWebViewController.java b/src/java/org/mxchange/jjobs/beans/business/department/list/JobsDepartmentListWebViewController.java
new file mode 100644 (file)
index 0000000..553e8ff
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2017 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.business.department.list;
+
+import java.io.Serializable;
+import org.mxchange.jcontactsbusiness.exceptions.department.DepartmentNotFoundException;
+import org.mxchange.jcontactsbusiness.model.department.Department;
+
+/**
+ * An interface for general department controller
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface JobsDepartmentListWebViewController extends Serializable {
+
+       /**
+        * 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;
+
+       /**
+        * Checks whether the given department is already found in local cache.
+        * Please note that this method fully relies on the cache, so you must
+        * always fire proper events that add/update/delete entries in cache.
+        * <p>
+        * @param department Department to check it's address
+        * <p>
+        * @return Whether the address has been found
+        */
+       boolean isDepartmentAlreadyAdded (final Department department);
+
+}
index aa5f3e00a38210f6e86df0f524ba2444059729c0..3f2a1f47640b1c39cc73127ca89ad901127f4ca7 100644 (file)
@@ -24,8 +24,8 @@ import javax.faces.convert.ConverterException;
 import javax.faces.convert.FacesConverter;
 import org.mxchange.jcontactsbusiness.exceptions.department.DepartmentNotFoundException;
 import org.mxchange.jcontactsbusiness.model.department.Department;
-import org.mxchange.jjobs.beans.business.department.JobsDepartmentWebRequestBean;
-import org.mxchange.jjobs.beans.business.department.JobsDepartmentWebRequestController;
+import org.mxchange.jjobs.beans.business.department.list.JobsDepartmentListWebViewBean;
+import org.mxchange.jjobs.beans.business.department.list.JobsDepartmentListWebViewController;
 
 /**
  * Converter for company department id <-> instance
@@ -38,16 +38,10 @@ public class JobsDepartmentConverter implements Converter<Department> {
        /**
         * Company department EJB
         */
-       private static JobsDepartmentWebRequestController DEPARTMENT_CONTROLLER;
+       private static JobsDepartmentListWebViewController DEPARTMENT_LIST_CONTROLLER;
 
        @Override
        public Department getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
-               // Is the instance there?
-               if (null == DEPARTMENT_CONTROLLER) {
-                       // Get bean from CDI directly
-                       DEPARTMENT_CONTROLLER = CDI.current().select(JobsDepartmentWebRequestBean.class).get();
-               }
-
                // Is the value null or empty?
                if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
                        // Warning message
@@ -64,8 +58,14 @@ public class JobsDepartmentConverter implements Converter<Department> {
                        // Try to parse the value as long
                        final Long departmentId = Long.valueOf(submittedValue);
 
+                       // Is the instance there?
+                       if (null == DEPARTMENT_LIST_CONTROLLER) {
+                               // Get bean from CDI directly
+                               DEPARTMENT_LIST_CONTROLLER = CDI.current().select(JobsDepartmentListWebViewBean.class).get();
+                       }
+
                        // Try to get user instance from it
-                       companyDepartment = DEPARTMENT_CONTROLLER.findDepartmentById(departmentId);
+                       companyDepartment = DEPARTMENT_LIST_CONTROLLER.findDepartmentById(departmentId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
index fac4739f2a91d2563c24602c6101fc3b27a9a654..cffa4945b06b977fd7cd36868e62b29898ce8062 100644 (file)
@@ -1228,3 +1228,4 @@ ADMIN_MANUFACTURER_HEADER=Hersteller:
 ADMIN_ASSIGNED_MANUFACTURER_LABEL=Zugewiesener Hersteller:
 BARCODE=Barcode:
 ADMIN_CONTACT_DETAILS_HEADER=Kontaktdaten zu {0} {1} {2}:
+ADMIN_DEPARTMENT_DETAILS_HEADER=Daten der Abteilung {0} (Id {1}):
index d9a515151d83a1b9b37d430628f5cc2737b4edb3..2af80878dc33a913be85f7eeb24f369d0eabc0ed 100644 (file)
@@ -1135,3 +1135,4 @@ ADMIN_MANUFACTURER_HEADER=Manufacturer:
 ADMIN_ASSIGNED_MANUFACTURER_LABEL=Assigned manufacturer:
 BARCODE=Barcode:
 ADMIN_CONTACT_DETAILS_HEADER=Contact data of {0} {1} {2}:
+ADMIN_DEPARTMENT_DETAILS_HEADER=Data of department {0} (Id {1}):
index b3369930ebdb16ee5868f43cce26787b8bf2d69d..0c154ca3c709da8df4d228a90aec72190a3c0982 100644 (file)
@@ -21,7 +21,7 @@
                <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" rendered="#{empty allowNull or allowNull}" />
 
                <f:selectItems
-                       value="#{countryController.allCountries()}"
+                       value="#{countryListController.allCountries}"
                        var="country"
                        itemValue="#{country}"
                        itemLabel="#{country.countryCode} (#{msg[country.countryI18nKey]})"
index f0532eae4bc5ba38df84d1465337c06981029cf5..5abdb2b272b59f5760eebebbe47ed18e19de7a17 100644 (file)
@@ -76,7 +76,7 @@
 
                                <p:ajax
                                        event="rowSelect"
-                                       update=":master:form-list-branch-offices:branchOffice-details"
+                                       update=":master:form-list-branch-offices:branch-office-details"
                                        oncomplete="PF('branchOfficeDialog').show()"
                                        />
 
                                responsive="true"
                                closeOnEscape="true"
                                >
-                               <p:outputPanel id="branchOffice-details">
+                               <p:outputPanel id="branch-office-details">
                                        <p:tabView>
                                                <p:tab title="#{msg.ADMIN_BRANCH_OFFICE_DATA_TAB_TITLE}">
                                                        <p:panelGrid columns="2" rendered="#{not empty branchOfficeListController.selectedBranchOffice}">
index a52836bcf73060ca9852019417bf30135d92eb70..4f72454935a31c7d71dd264be5a698e8d717e72a 100644 (file)
        </ui:define>
 
        <ui:define name="content">
-               <h:form id="form-list-department">
+               <h:form id="form-list-departments">
                        <p:dataTable
                                id="departmentList"
                                var="department"
-                               value="#{departmentController.allDepartments()}"
+                               value="#{departmentListController.allDepartments}"
                                paginator="true"
                                paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
-                               filteredValue="#{departmentController.filteredDepartments}"
+                               filteredValue="#{departmentListController.filteredDepartments}"
                                rows="10"
+                               rowKey="#{department.departmentId}"
                                reflow="true"
                                resizableColumns="true"
                                rowsPerPageTemplate="5,10,20,50,100"
                                summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_DEPARTMENTS}"
                                emptyMessage="#{msg.ADMIN_EMPTY_LIST_DEPARTMENTS}"
                                widgetVar="departmentList"
+                               selectionMode="single"
+                               selection="#{departmentListController.selectedDepartment}"
+                               skipChildren="true"
                                >
 
                                <f:facet name="header">
-                                       <p:panelGrid columns="2" columnClasses="ui-grid-col-10,ui-grid-col-2" layout="grid" styleClass="ui-noborder ui-transparent-widget">
-                                               <h:outputText value="#{msg.ADMIN_LIST_DEPARTMENTS_HEADER}" />
+                                       <p:panelGrid
+                                               columns="3"
+                                               layout="grid"
+                                               columnClasses="ui-grid-col-4,ui-grid-col-6,ui-grid-col-2"
+                                               >
+                                               <p:spacer />
+
+                                               <p:panelGrid
+                                                       columns="2"
+                                                       columnClasses="ui-grid-4,ui-grid-8"
+                                                       layout="grid"
+                                                       styleClass="ui-noborder"
+                                                       >
+                                                       <p:outputLabel for="globalFilter" value="#{msg.SEARCH_ALL_FIELDS}" style="float: right" />
+                                                       <p:inputText id="globalFilter" onkeyup="PF('departmentList').filter()" placeholder="#{msg.ENTER_KEYWORD}"/>
+                                               </p:panelGrid>
+
+                                               <p:outputPanel>
+                                                       <p:spacer height="4" />
 
-                                               <h:panelGroup>
                                                        <p:commandButton
                                                                id="toggler"
                                                                type="button"
                                                                />
 
                                                        <p:columnToggler datasource="departmentList" trigger="toggler" />
-                                               </h:panelGroup>
+                                               </p:outputPanel>
                                        </p:panelGrid>
                                </f:facet>
 
+                               <p:ajax
+                                       event="rowSelect"
+                                       update=":master:form-list-departments:department-details"
+                                       oncomplete="PF('departmentDialog').show()"
+                                       />
+
                                <p:column
                                        headerText="#{msg.ID_HEADER}"
                                        sortBy="#{department.departmentId}"
                                        <links:outputDepartmentAdminDropdownMenu department="#{department}" />
                                </p:column>
                        </p:dataTable>
+
+                       <p:dialog
+                               dynamic="true"
+                               modal="true"
+                               resizable="false"
+                               header="#{msg.ADMIN_SINGLE_DEPARTMENT_DETAILS_HEADER}"
+                               hideEffect="fade"
+                               showEffect="fade"
+                               widgetVar="departmentDialog"
+                               position="top"
+                               responsive="true"
+                               closeOnEscape="true"
+                               >
+                               <p:outputPanel id="department-details">
+                                       <p:panelGrid columns="2" rendered="#{not empty departmentListController.selectedDepartment}">
+                                               <f:facet name="header">
+                                                       <h:outputFormat value="#{msg.ADMIN_DEPARTMENT_DETAILS_HEADER}">
+                                                               <f:param value="#{msg[departmentListController.selectedDepartment.departmentI18nKey]}" />
+                                                               <f:param value="#{departmentListController.selectedDepartment.departmentId}" />
+                                                       </h:outputFormat>
+                                               </f:facet>
+
+                                               <p:outputLabel value="#{msg.ID_HEADER}" title="#{msg.DEPARTMENT_ID_NUMBER_TITLE}" />
+                                               <h:outputText value="#{departmentListController.selectedDepartment.departmentId}" />
+                                       </p:panelGrid>
+                               </p:outputPanel>
+                       </p:dialog>
                </h:form>
 
                <h:form>
                                                        type="submit"
                                                        value="#{msg.BUTTON_ADMIN_ADD_DEPARTMENT_DATA}"
                                                        action="#{adminDepartmentController.addDepartment()}"
-                                                       update=":master:form-list-department:departmentList"
+                                                       update=":master:form-list-departments:departmentList"
                                                        />
                                        </p:panelGrid>
                                </f:facet>
index 444cbce9f5d9280144ee80c35b48e96c25640202..f56d61dc68132dd5456e36a095cdcf0b1c8080ee 100644 (file)
                                                        >
                                                        <f:converter converterId="CountryConverter" />
                                                        <f:selectItems
-                                                               value="#{countryController.allCountries()}"
+                                                               value="#{countryListController.allCountries}"
                                                                var="country"
                                                                itemValue="#{country}"
                                                                itemLabel="#{msg[country.countryI18nKey]}"