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.businessdata;
19 import java.util.List;
20 import javax.annotation.PostConstruct;
21 import javax.enterprise.context.RequestScoped;
22 import javax.faces.view.facelets.FaceletException;
23 import javax.inject.Named;
24 import javax.naming.Context;
25 import javax.naming.InitialContext;
26 import javax.naming.NamingException;
27 import org.mxchange.addressbook.beans.BaseAddressbookController;
28 import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData;
29 import org.mxchange.jcontactsbusiness.basicdata.BusinessDataAdminSessionBeanRemote;
30 import org.mxchange.jcountry.data.Country;
33 * An administrative business contact bean (controller)
35 * @author Roland Häder<roland@mxchange.org>
37 @Named ("adminBusinessDataController")
39 public class AddressbookAdminBusinessDataWebRequestBean extends BaseAddressbookController implements AddressbookAdminBusinessDataWebRequestController {
44 private static final long serialVersionUID = 56_189_028_928_374L;
49 private BusinessDataAdminSessionBeanRemote adminBusinessDataBean;
52 * A list of all registered companies (globally)
54 private List<BusinessBasicData> businessContacts;
57 * Comments for this company
59 private String companyComments;
62 * Companies (main) email address (example: info@company.example)
64 private String companyEmailAddress;
69 private String companyName;
72 * Area code for fax number
74 private Integer faxAreaCode;
77 * Country for fax number
79 private Country faxCountry;
82 * Dial number for fax number
84 private Long faxNumber;
87 * Area code for land-line number
89 private Integer landLineAreaCode;
92 * Country for land-line number
94 private Country landLineCountry;
97 * Dial number for land-line number
99 private Long landLineNumber;
104 public AddressbookAdminBusinessDataWebRequestBean () {
105 // Call super constructor
110 @SuppressWarnings ("ReturnOfCollectionOrArrayField")
111 public List<BusinessBasicData> allBusinessContacts () {
112 return this.businessContacts;
116 * Getter for comments
120 public String getCompanyComments () {
121 return this.companyComments;
125 * Setter for comments
127 * @param companyComments Comments
129 public void setCompanyComments (final String companyComments) {
130 this.companyComments = companyComments;
134 * Getter for company's (main) email address
136 * @return Company's (main) email address
138 public String getCompanyEmailAddress () {
139 return this.companyEmailAddress;
143 * Setter for company's (main) email address
145 * @param companyEmailAddress Company's (main) email address
147 public void setCompanyEmailAddress (final String companyEmailAddress) {
148 this.companyEmailAddress = companyEmailAddress;
152 * Getter for company name
154 * @return Company name
156 public String getCompanyName () {
157 return this.companyName;
161 * Setter for company name
163 * @param companyName Company name
165 public void setCompanyName (final String companyName) {
166 this.companyName = companyName;
170 * Getter for fax number's area code
172 * @return Fax number's area code
174 public Integer getFaxAreaCode () {
175 return this.faxAreaCode;
179 * Setter for fax number's area code
181 * @param faxAreaCode Fax number's area code
183 public void setFaxAreaCode (final Integer faxAreaCode) {
184 this.faxAreaCode = faxAreaCode;
188 * Getter for fax's country instance
190 * @return Fax' country instance
192 public Country getFaxCountry () {
193 return this.faxCountry;
197 * Setter for fax's country instance
199 * @param faxCountry Fax' country instance
201 public void setFaxCountry (final Country faxCountry) {
202 this.faxCountry = faxCountry;
206 * Getter for fax number
210 public Long getFaxNumber () {
211 return this.faxNumber;
215 * Setter for fax number
217 * @param faxNumber Fax number
219 public void setFaxNumber (final Long faxNumber) {
220 this.faxNumber = faxNumber;
224 * Getter for land-line number's area code
226 * @return Land-line number's area code
228 public Integer getLandLineAreaCode () {
229 return this.landLineAreaCode;
233 * Setter for land-line number's area code
235 * @param landLineAreaCode Land-line number's area code
237 public void setLandLineAreaCode (final Integer landLineAreaCode) {
238 this.landLineAreaCode = landLineAreaCode;
242 * Getter for land-line number's country instance
244 * @return Land-line number's country instance
246 public Country getLandLineCountry () {
247 return this.landLineCountry;
251 * Setter for land-line number's country instance
253 * @param landLineCountry Land-line number's country instance
255 public void setLandLineCountry (final Country landLineCountry) {
256 this.landLineCountry = landLineCountry;
260 * Getter for land-line number
262 * @return Land-line number
264 public Long getLandLineNumber () {
265 return this.landLineNumber;
269 * Setter for land-line number
271 * @param landLineNumber Land-line number
273 public void setLandLineNumber (final Long landLineNumber) {
274 this.landLineNumber = landLineNumber;
278 * Post-initialization of this class
281 public void init () {
284 // Get initial context
285 Context context = new InitialContext();
288 this.adminBusinessDataBean = (BusinessDataAdminSessionBeanRemote) context.lookup("java:global/addressbook-ejb/adminBusinessData!org.mxchange.jcontactsbusiness.basicdata.BusinessDataAdminSessionBeanRemote"); //NOI18N
289 } catch (final NamingException e) {
291 throw new FaceletException(e);
294 // Init user's contact list
295 this.businessContacts = this.adminBusinessDataBean.allBusinessContacts();