2 * Copyright (C) 2017 RRoland Häder
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License as
6 * published by the Free Software Foundation, either version 3 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Affero General Public License for more details.
14 * You should have received a copy of the GNU Affero General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.addressbook.beans.business.employee;
19 import java.util.LinkedList;
20 import java.util.List;
21 import javax.annotation.PostConstruct;
23 import javax.enterprise.context.SessionScoped;
24 import javax.inject.Named;
25 import org.mxchange.addressbook.beans.BaseAddressbookController;
26 import org.mxchange.jcontactsbusiness.model.employee.CompanyEmployeeSessionBeanRemote;
27 import org.mxchange.jcontactsbusiness.model.employee.Employee;
30 * A request-scoped bean for general purposes for company employees.
32 * @author Roland Häder<roland@mxchange.org>
34 @Named ("companyEmployeeController")
36 public class AddressbookCompanyEmployeeWebRequestBean extends BaseAddressbookController implements AddressbookCompanyEmployeeWebSessionController {
41 private static final long serialVersionUID = 12_886_968_547_361L;
44 * EJB for general company employee purposes
46 @EJB (lookup = "java:global/addressbook-ejb/companyEmployee!org.mxchange.jcontactsbusiness.employee.CompanyEmployeeSessionBeanRemote")
47 private CompanyEmployeeSessionBeanRemote companyEmployeeBean;
50 * List of all company employees
52 private final List<Employee> companyEmployees;
57 public AddressbookCompanyEmployeeWebRequestBean () {
58 // Call super constructor
62 this.companyEmployees = new LinkedList<>();
66 * Returns a list of all company employees
68 * @return List of all company employees
70 @SuppressWarnings ("ReturnOfCollectionOrArrayField")
71 public List<Employee> allCompanyEmployees () {
72 return this.companyEmployees;
76 * Initialization method
80 // Get all entries from remote bean
81 List<Employee> employees = this.companyEmployeeBean.allCompanyEmployees();
83 // Copy it to main list
84 this.companyEmployees.addAll(employees);