]> git.mxchange.org Git - pizzaservice-war.git/blob
c61c5e0746ec959f5a0d6b90309705161507614b
[pizzaservice-war.git] /
1 /*
2  * Copyright (C) 2016, 2017 Roland Häder
3  *
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.
8  *
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.
13  *
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/>.
16  */
17 package org.mxchange.pizzaapplication.beans.businesscontact;
18
19 import javax.annotation.PostConstruct;
20 import javax.enterprise.context.SessionScoped;
21 import javax.faces.view.facelets.FaceletException;
22 import javax.inject.Inject;
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.BusinessDataSessionBeanRemote;
28 import org.mxchange.jcountry.data.Country;
29 import org.mxchange.pizzaapplication.beans.BasePizzaController;
30 import org.mxchange.pizzaapplication.beans.user.login.PizzaUserLoginWebSessionController;
31
32 /**
33  * A business contact bean (controller)
34  * <p>
35  * @author Roland Häder<roland@mxchange.org>
36  */
37 @Named ("businessDataController")
38 @SessionScoped
39 public class PizzaBusinessContactWebSessionBean extends BasePizzaController implements PizzaBusinessContactWebSessionController {
40
41         /**
42          * Serial number
43          */
44         private static final long serialVersionUID = 56_189_028_928_371L;
45
46         /**
47          * Remote contact bean
48          */
49         private BusinessDataSessionBeanRemote businessDataBean;
50
51         /**
52          * Comments for this company
53          */
54         private String companyComments;
55
56         /**
57          * Companies (main) email address (example: info@company.example)
58          */
59         private String companyEmailAddress;
60
61         /**
62          * Company legal status (example: Incorporated, GmbH)
63          */
64         private String companyLegalStatus;
65
66         /**
67          * Company name
68          */
69         private String companyName;
70
71         /**
72          * Area code for fax number
73          */
74         private Integer faxAreaCode;
75
76         /**
77          * Country for fax number
78          */
79         private Country faxCountry;
80
81         /**
82          * Dial number for fax number
83          */
84         private Long faxNumber;
85
86         /**
87          * Area code for land-line number
88          */
89         private Integer landLineAreaCode;
90
91         /**
92          * Country for land-line number
93          */
94         private Country landLineCountry;
95
96         /**
97          * Dial number for land-line number
98          */
99         private Long landLineNumber;
100
101         /**
102          * User instance
103          */
104         @Inject
105         private PizzaUserLoginWebSessionController userLoginController;
106
107         /**
108          * Constructor
109          */
110         public PizzaBusinessContactWebSessionBean () {
111                 // Call super constructor
112                 super();
113         }
114
115         /**
116          * Getter for comments
117          * <p>
118          * @return Comments
119          */
120         public String getCompanyComments () {
121                 return this.companyComments;
122         }
123
124         /**
125          * Setter for comments
126          * <p>
127          * @param companyComments Comments
128          */
129         public void setCompanyComments (final String companyComments) {
130                 this.companyComments = companyComments;
131         }
132
133         /**
134          * Getter for company's (main) email address
135          * <p>
136          * @return Company's (main) email address
137          */
138         public String getCompanyEmailAddress () {
139                 return this.companyEmailAddress;
140         }
141
142         /**
143          * Setter for company's (main) email address
144          * <p>
145          * @param companyEmailAddress Company's (main) email address
146          */
147         public void setCompanyEmailAddress (final String companyEmailAddress) {
148                 this.companyEmailAddress = companyEmailAddress;
149         }
150
151         /**
152          * Getter for company's legal status
153          * <p>
154          * @return Company's legal status
155          */
156         public String getCompanyLegalStatus () {
157                 return this.companyLegalStatus;
158         }
159
160         /**
161          * Setter for company's legal status
162          * <p>
163          * @param companyLegalStatus Company's legal status
164          */
165         public void setCompanyLegalStatus (final String companyLegalStatus) {
166                 this.companyLegalStatus = companyLegalStatus;
167         }
168
169         /**
170          * Getter for company name
171          * <p>
172          * @return Company name
173          */
174         public String getCompanyName () {
175                 return this.companyName;
176         }
177
178         /**
179          * Setter for company name
180          * <p>
181          * @param companyName Company name
182          */
183         public void setCompanyName (final String companyName) {
184                 this.companyName = companyName;
185         }
186
187         /**
188          * Getter for fax number's area code
189          * <p>
190          * @return Fax number's area code
191          */
192         public Integer getFaxAreaCode () {
193                 return this.faxAreaCode;
194         }
195
196         /**
197          * Setter for fax number's area code
198          * <p>
199          * @param faxAreaCode Fax number's area code
200          */
201         public void setFaxAreaCode (final Integer faxAreaCode) {
202                 this.faxAreaCode = faxAreaCode;
203         }
204
205         /**
206          * Getter for fax's country instance
207          * <p>
208          * @return Fax' country instance
209          */
210         public Country getFaxCountry () {
211                 return this.faxCountry;
212         }
213
214         /**
215          * Setter for fax's country instance
216          * <p>
217          * @param faxCountry Fax' country instance
218          */
219         public void setFaxCountry (final Country faxCountry) {
220                 this.faxCountry = faxCountry;
221         }
222
223         /**
224          * Getter for fax number
225          * <p>
226          * @return Fax number
227          */
228         public Long getFaxNumber () {
229                 return this.faxNumber;
230         }
231
232         /**
233          * Setter for fax number
234          * <p>
235          * @param faxNumber Fax number
236          */
237         public void setFaxNumber (final Long faxNumber) {
238                 this.faxNumber = faxNumber;
239         }
240
241         /**
242          * Getter for land-line number's area code
243          * <p>
244          * @return Land-line number's area code
245          */
246         public Integer getLandLineAreaCode () {
247                 return this.landLineAreaCode;
248         }
249
250         /**
251          * Setter for land-line number's area code
252          * <p>
253          * @param landLineAreaCode Land-line number's area code
254          */
255         public void setLandLineAreaCode (final Integer landLineAreaCode) {
256                 this.landLineAreaCode = landLineAreaCode;
257         }
258
259         /**
260          * Getter for land-line number's country instance
261          * <p>
262          * @return Land-line number's country instance
263          */
264         public Country getLandLineCountry () {
265                 return this.landLineCountry;
266         }
267
268         /**
269          * Setter for land-line number's country instance
270          * <p>
271          * @param landLineCountry Land-line number's country instance
272          */
273         public void setLandLineCountry (final Country landLineCountry) {
274                 this.landLineCountry = landLineCountry;
275         }
276
277         /**
278          * Getter for land-line number
279          * <p>
280          * @return Land-line number
281          */
282         public Long getLandLineNumber () {
283                 return this.landLineNumber;
284         }
285
286         /**
287          * Setter for land-line number
288          * <p>
289          * @param landLineNumber Land-line number
290          */
291         public void setLandLineNumber (final Long landLineNumber) {
292                 this.landLineNumber = landLineNumber;
293         }
294
295         /**
296          * Post-initialization of this class
297          */
298         @PostConstruct
299         public void init () {
300                 // Try it
301                 try {
302                         // Get initial context
303                         Context context = new InitialContext();
304
305                         // Try to lookup
306                         this.businessDataBean = (BusinessDataSessionBeanRemote) context.lookup("java:global/pizzaapplication-ejb/businessContact!org.mxchange.jcontactsbusiness.BusinessContactSessionBeanRemote"); //NOI18N
307                 } catch (final NamingException e) {
308                         // Throw again
309                         throw new FaceletException(e);
310                 }
311         }
312
313 }