]> git.mxchange.org Git - pizzaservice-war.git/blob - src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebBean.java
Continued:
[pizzaservice-war.git] / src / java / org / mxchange / pizzaapplication / beans / customer / CustomerWebBean.java
1 /*
2  * Copyright (C) 2015 Roland Haeder
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (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 General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 package org.mxchange.pizzaapplication.beans.customer;
18
19 import javax.annotation.PostConstruct;
20 import javax.enterprise.context.SessionScoped;
21 import javax.inject.Named;
22 import javax.naming.Context;
23 import javax.naming.InitialContext;
24 import javax.naming.NamingException;
25 import org.mxchange.jcore.model.contact.gender.Gender;
26 import org.mxchange.jcoreee.beans.BaseFrameworkBean;
27 import org.mxchange.jshopcore.model.customer.CustomerSessionBeanRemote;
28
29 /**
30  * A customer bean which hides the customer instance
31  *
32  * @author Roland Haeder<roland@mxchange.org>
33  */
34 @Named("customer")
35 @SessionScoped
36 public class CustomerWebBean extends BaseFrameworkBean implements CustomerWebController {
37         /**
38          * Serial number
39          */
40         private static final long serialVersionUID = 542_145_347_916L;
41
42         /**
43          * Remote customer bean
44          */
45         private final CustomerSessionBeanRemote customerBean;
46
47         /**
48          * Cellphone number
49          */
50         private String cellphoneNumber;
51
52         /**
53          * City
54          */
55         private String city;
56
57         /**
58          * Optional comments
59          */
60         private String comment;
61
62         /**
63          * Company name
64          */
65         private String companyName;
66
67         /**
68          * Country code
69          */
70         private String countryCode;
71
72         /**
73          * Email address
74          */
75         private String emailAddress;
76
77         /**
78          * Gender instance
79          */
80         private Gender gender;
81
82         /**
83          * Family name
84          */
85         private String familyName;
86
87         /**
88          * Fax number
89          */
90         private String faxNumber;
91
92         /**
93          * First name
94          */
95         private String firstName;
96
97         /**
98          * House number
99          */
100         private Long houseNumber;
101
102         /**
103          * Phone number
104          */
105         private String phoneNumber;
106
107         /**
108          * Street
109          */
110         private String street;
111
112         /**
113          * ZIP code
114          */
115         private Long zipCode;
116
117         /**
118          * Default constructor
119          *
120          * @throws javax.naming.NamingException If something happens?
121          */
122         public CustomerWebBean () throws NamingException {
123                 // Get initial context
124                 Context context = new InitialContext();
125
126                 // Set gender to UNKNOWN
127                 this.gender = Gender.UNKNOWN;
128
129                 // Try to lookup
130                 this.customerBean = (CustomerSessionBeanRemote) context.lookup("ejb/stateless-customer");
131         }
132
133         @PostConstruct
134         public void init () throws RuntimeException {
135                 // Call super init first
136                 super.genericInit();
137         }
138
139         @Override
140         public Gender getGender () {
141                 return this.gender;
142         }
143
144         @Override
145         public void setGender (final Gender gender) {
146                 this.gender = gender;
147         }
148
149         @Override
150         public String getCompanyName () {
151                 return this.companyName;
152         }
153
154         @Override
155         public void setCompanyName (final String companyName) {
156                 this.companyName = companyName;
157         }
158
159         @Override
160         public String getFirstName () {
161                 return this.firstName;
162         }
163
164         @Override
165         public void setFirstName (final String firstName) {
166                 this.firstName = firstName;
167         }
168
169         @Override
170         public String getFamilyName () {
171                 return this.familyName;
172         }
173
174         @Override
175         public void setFamilyName (final String familyName) {
176                 this.familyName = familyName;
177         }
178
179         @Override
180         public String getStreet () {
181                 return this.street;
182         }
183
184         @Override
185         public void setStreet (final String street) {
186                 this.street = street;
187         }
188
189         @Override
190         public Long getHouseNumber () {
191                 return this.houseNumber;
192         }
193
194         @Override
195         public void setHouseNumber (final Long houseNumber) {
196                 this.houseNumber = houseNumber;
197         }
198
199         @Override
200         public Long getZipCode () {
201                 return this.zipCode;
202         }
203
204         @Override
205         public void setZipCode (final Long zipCode) {
206                 this.zipCode = zipCode;
207         }
208
209         @Override
210         public String getCity () {
211                 return this.city;
212         }
213
214         @Override
215         public void setCity (final String city) {
216                 this.city = city;
217         }
218
219         @Override
220         public String getCountryCode () {
221                 return this.countryCode;
222         }
223
224         @Override
225         public void setCountryCode (final String countryCode) {
226                 this.countryCode = countryCode;
227         }
228
229         @Override
230         public String getEmailAddress () {
231                 return this.emailAddress;
232         }
233
234         @Override
235         public void setEmailAddress (final String emailAddress) {
236                 this.emailAddress = emailAddress;
237         }
238
239         @Override
240         public String getPhoneNumber () {
241                 return this.phoneNumber;
242         }
243
244         @Override
245         public void setPhoneNumber (final String phoneNumber) {
246                 this.phoneNumber = phoneNumber;
247         }
248
249         @Override
250         public String getFaxNumber () {
251                 return this.faxNumber;
252         }
253
254         @Override
255         public void setFaxNumber (final String faxNumber) {
256                 this.faxNumber = faxNumber;
257         }
258
259         @Override
260         public String getCellphoneNumber () {
261                 return this.cellphoneNumber;
262         }
263
264         @Override
265         public void setCellphoneNumber (final String cellphoneNumber) {
266                 this.cellphoneNumber = cellphoneNumber;
267         }
268 }