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.RequestScoped;
22 import javax.faces.view.facelets.FaceletException;
23 import javax.inject.Inject;
24 import javax.inject.Named;
25 import javax.naming.Context;
26 import javax.naming.InitialContext;
27 import javax.naming.NamingException;
28 import org.mxchange.jcontactsbusiness.BusinessBasicData;
29 import org.mxchange.jcontactsbusiness.BusinessDataAdminSessionBeanRemote;
30 import org.mxchange.jcontactsbusiness.BusinessDataSessionBeanRemote;
31 import org.mxchange.jcountry.data.Country;
32 import org.mxchange.jfinancials.beans.BaseFinancialsController;
33 import org.mxchange.jfinancials.beans.user.login.FinancialsUserLoginWebSessionController;
36 * A business contact bean (controller)
38 * @author Roland Häder<roland@mxchange.org>
40 @Named ("businessDataController")
42 public class FinancialsBusinessContactWebSessionBean extends BaseFinancialsController implements FinancialsBusinessContactWebSessionController {
47 private static final long serialVersionUID = 56_189_028_928_371L;
52 private BusinessDataAdminSessionBeanRemote adminBusinessDataBean;
55 * A list of all registered companies (globally)
57 private List<BusinessBasicData> businessContacts;
62 private BusinessDataSessionBeanRemote businessDataBean;
65 * Comments for this company
67 private String companyComments;
70 * Companies (main) email address (example: info@company.example)
72 private String companyEmailAddress;
75 * Company legal status (example: Incorporated, GmbH)
77 private String companyLegalStatus;
82 private String companyName;
85 * Area code for fax number
87 private Integer faxAreaCode;
90 * Country for fax number
92 private Country faxCountry;
95 * Dial number for fax number
97 private Long faxNumber;
100 * Area code for land-line number
102 private Integer landLineAreaCode;
105 * Country for land-line number
107 private Country landLineCountry;
110 * Dial number for land-line number
112 private Long landLineNumber;
118 private FinancialsUserLoginWebSessionController userLoginController;
123 public FinancialsBusinessContactWebSessionBean () {
124 // Call super constructor
129 @SuppressWarnings ("ReturnOfCollectionOrArrayField")
130 public List<BusinessBasicData> allBusinessContacts () {
131 return this.businessContacts;
135 * Getter for comments
139 public String getCompanyComments () {
140 return this.companyComments;
144 * Setter for comments
146 * @param companyComments Comments
148 public void setCompanyComments (final String companyComments) {
149 this.companyComments = companyComments;
153 * Getter for company's (main) email address
155 * @return Company's (main) email address
157 public String getCompanyEmailAddress () {
158 return this.companyEmailAddress;
162 * Setter for company's (main) email address
164 * @param companyEmailAddress Company's (main) email address
166 public void setCompanyEmailAddress (final String companyEmailAddress) {
167 this.companyEmailAddress = companyEmailAddress;
171 * Getter for company's legal status
173 * @return Company's legal status
175 public String getCompanyLegalStatus () {
176 return this.companyLegalStatus;
180 * Setter for company's legal status
182 * @param companyLegalStatus Company's legal status
184 public void setCompanyLegalStatus (final String companyLegalStatus) {
185 this.companyLegalStatus = companyLegalStatus;
189 * Getter for company name
191 * @return Company name
193 public String getCompanyName () {
194 return this.companyName;
198 * Setter for company name
200 * @param companyName Company name
202 public void setCompanyName (final String companyName) {
203 this.companyName = companyName;
207 * Getter for fax number's area code
209 * @return Fax number's area code
211 public Integer getFaxAreaCode () {
212 return this.faxAreaCode;
216 * Setter for fax number's area code
218 * @param faxAreaCode Fax number's area code
220 public void setFaxAreaCode (final Integer faxAreaCode) {
221 this.faxAreaCode = faxAreaCode;
225 * Getter for fax's country instance
227 * @return Fax' country instance
229 public Country getFaxCountry () {
230 return this.faxCountry;
234 * Setter for fax's country instance
236 * @param faxCountry Fax' country instance
238 public void setFaxCountry (final Country faxCountry) {
239 this.faxCountry = faxCountry;
243 * Getter for fax number
247 public Long getFaxNumber () {
248 return this.faxNumber;
252 * Setter for fax number
254 * @param faxNumber Fax number
256 public void setFaxNumber (final Long faxNumber) {
257 this.faxNumber = faxNumber;
261 * Getter for land-line number's area code
263 * @return Land-line number's area code
265 public Integer getLandLineAreaCode () {
266 return this.landLineAreaCode;
270 * Setter for land-line number's area code
272 * @param landLineAreaCode Land-line number's area code
274 public void setLandLineAreaCode (final Integer landLineAreaCode) {
275 this.landLineAreaCode = landLineAreaCode;
279 * Getter for land-line number's country instance
281 * @return Land-line number's country instance
283 public Country getLandLineCountry () {
284 return this.landLineCountry;
288 * Setter for land-line number's country instance
290 * @param landLineCountry Land-line number's country instance
292 public void setLandLineCountry (final Country landLineCountry) {
293 this.landLineCountry = landLineCountry;
297 * Getter for land-line number
299 * @return Land-line number
301 public Long getLandLineNumber () {
302 return this.landLineNumber;
306 * Setter for land-line number
308 * @param landLineNumber Land-line number
310 public void setLandLineNumber (final Long landLineNumber) {
311 this.landLineNumber = landLineNumber;
315 * Post-initialization of this class
318 public void init () {
321 // Get initial context
322 Context context = new InitialContext();
325 this.businessDataBean = (BusinessDataSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/businessContact!org.mxchange.jcontactsbusiness.BusinessContactSessionBeanRemote"); //NOI18N
328 this.adminBusinessDataBean = (BusinessDataAdminSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/adminBusinessData!org.mxchange.jcontactsbusiness.BusinessDataAdminSessionBeanRemote"); //NOI18N
329 } catch (final NamingException e) {
331 throw new FaceletException(e);
334 // Init user's contact list
335 this.businessContacts = this.adminBusinessDataBean.allBusinessContacts();