2 * Copyright (C) 2016, 2017 Roland 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.businesscontact;
19 import java.util.Collections;
20 import java.util.List;
21 import javax.annotation.PostConstruct;
22 import javax.enterprise.context.SessionScoped;
23 import javax.faces.view.facelets.FaceletException;
24 import javax.inject.Inject;
25 import javax.inject.Named;
26 import javax.naming.Context;
27 import javax.naming.InitialContext;
28 import javax.naming.NamingException;
29 import org.mxchange.jcontactsbusiness.BusinessContact;
30 import org.mxchange.jcontactsbusiness.BusinessContactSessionBeanRemote;
31 import org.mxchange.jfinancials.beans.BaseFinancialsController;
32 import org.mxchange.jfinancials.beans.login.user.FinancialsUserLoginWebSessionController;
35 * A business contact bean (controller)
37 * @author Roland Häder<roland@mxchange.org>
39 @Named ("businessContactController")
41 public class AddressbookBusinessContactWebSessionBean extends BaseFinancialsController implements AddressbookBusinessContactWebSessionController {
46 private static final long serialVersionUID = 56_189_028_928_371L;
51 private BusinessContactSessionBeanRemote businessContactBean;
54 * A list of all registered companies (globally)
56 private List<BusinessContact> registeredCompanies;
62 private FinancialsUserLoginWebSessionController userLoginController;
67 public AddressbookBusinessContactWebSessionBean () {
68 // Call super constructor
73 public List<BusinessContact> allRegisteredCompanies () {
74 return Collections.unmodifiableList(this.registeredCompanies);
78 * Post-initialization of this class
84 // Get initial context
85 Context context = new InitialContext();
88 this.businessContactBean = (BusinessContactSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/businessContact!org.mxchange.jcontactsbusiness.BusinessContactSessionBeanRemote"); //NOI18N
91 this.registeredCompanies = this.businessContactBean.allBusinessContacts();
92 } catch (final NamingException e) {
94 throw new FaceletException(e);