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.jfinancials.beans.businesscontact;
19 import java.util.List;
20 import javax.annotation.PostConstruct;
21 import javax.enterprise.context.SessionScoped;
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.jcontactsbusiness.BusinessBasicData;
28 import org.mxchange.jcontactsbusiness.BusinessDataAdminSessionBeanRemote;
29 import org.mxchange.jcountry.data.Country;
30 import org.mxchange.jfinancials.beans.BaseFinancialsController;
33 * An administrative business contact bean (controller)
35 * @author Roland Häder<roland@mxchange.org>
37 @Named ("adminBusinessDataController")
39 public class FinancialsAdminBusinessContactWebSessionBean extends BaseFinancialsController implements FinancialsAdminBusinessContactWebSessionController {
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;
67 * Company legal status (example: Incorporated, GmbH)
69 private String companyLegalStatus;
74 private String companyName;
77 * Area code for fax number
79 private Integer faxAreaCode;
82 * Country for fax number
84 private Country faxCountry;
87 * Dial number for fax number
89 private Long faxNumber;
92 * Area code for land-line number
94 private Integer landLineAreaCode;
97 * Country for land-line number
99 private Country landLineCountry;
102 * Dial number for land-line number
104 private Long landLineNumber;
109 public FinancialsAdminBusinessContactWebSessionBean () {
110 // Call super constructor
115 @SuppressWarnings ("ReturnOfCollectionOrArrayField")
116 public List<BusinessBasicData> allBusinessContacts () {
117 return this.businessContacts;
121 * Getter for comments
125 public String getCompanyComments () {
126 return this.companyComments;
130 * Setter for comments
132 * @param companyComments Comments
134 public void setCompanyComments (final String companyComments) {
135 this.companyComments = companyComments;
139 * Getter for company's (main) email address
141 * @return Company's (main) email address
143 public String getCompanyEmailAddress () {
144 return this.companyEmailAddress;
148 * Setter for company's (main) email address
150 * @param companyEmailAddress Company's (main) email address
152 public void setCompanyEmailAddress (final String companyEmailAddress) {
153 this.companyEmailAddress = companyEmailAddress;
157 * Getter for company's legal status
159 * @return Company's legal status
161 public String getCompanyLegalStatus () {
162 return this.companyLegalStatus;
166 * Setter for company's legal status
168 * @param companyLegalStatus Company's legal status
170 public void setCompanyLegalStatus (final String companyLegalStatus) {
171 this.companyLegalStatus = companyLegalStatus;
175 * Getter for company name
177 * @return Company name
179 public String getCompanyName () {
180 return this.companyName;
184 * Setter for company name
186 * @param companyName Company name
188 public void setCompanyName (final String companyName) {
189 this.companyName = companyName;
193 * Getter for fax number's area code
195 * @return Fax number's area code
197 public Integer getFaxAreaCode () {
198 return this.faxAreaCode;
202 * Setter for fax number's area code
204 * @param faxAreaCode Fax number's area code
206 public void setFaxAreaCode (final Integer faxAreaCode) {
207 this.faxAreaCode = faxAreaCode;
211 * Getter for fax's country instance
213 * @return Fax' country instance
215 public Country getFaxCountry () {
216 return this.faxCountry;
220 * Setter for fax's country instance
222 * @param faxCountry Fax' country instance
224 public void setFaxCountry (final Country faxCountry) {
225 this.faxCountry = faxCountry;
229 * Getter for fax number
233 public Long getFaxNumber () {
234 return this.faxNumber;
238 * Setter for fax number
240 * @param faxNumber Fax number
242 public void setFaxNumber (final Long faxNumber) {
243 this.faxNumber = faxNumber;
247 * Getter for land-line number's area code
249 * @return Land-line number's area code
251 public Integer getLandLineAreaCode () {
252 return this.landLineAreaCode;
256 * Setter for land-line number's area code
258 * @param landLineAreaCode Land-line number's area code
260 public void setLandLineAreaCode (final Integer landLineAreaCode) {
261 this.landLineAreaCode = landLineAreaCode;
265 * Getter for land-line number's country instance
267 * @return Land-line number's country instance
269 public Country getLandLineCountry () {
270 return this.landLineCountry;
274 * Setter for land-line number's country instance
276 * @param landLineCountry Land-line number's country instance
278 public void setLandLineCountry (final Country landLineCountry) {
279 this.landLineCountry = landLineCountry;
283 * Getter for land-line number
285 * @return Land-line number
287 public Long getLandLineNumber () {
288 return this.landLineNumber;
292 * Setter for land-line number
294 * @param landLineNumber Land-line number
296 public void setLandLineNumber (final Long landLineNumber) {
297 this.landLineNumber = landLineNumber;
301 * Post-initialization of this class
304 public void init () {
307 // Get initial context
308 Context context = new InitialContext();
311 this.adminBusinessDataBean = (BusinessDataAdminSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/adminBusinessData!org.mxchange.jcontactsbusiness.BusinessDataAdminSessionBeanRemote"); //NOI18N
312 } catch (final NamingException e) {
314 throw new FaceletException(e);
317 // Init user's contact list
318 this.businessContacts = this.adminBusinessDataBean.allBusinessContacts();