]> 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         /////////////////////// Properties /////////////////////
48         /**
49          * Cellphone number
50          */
51         private String cellphoneNumber;
52
53         /**
54          * City
55          */
56         private String city;
57
58         /**
59          * Optional comments
60          */
61         private String comment;
62
63         /**
64          * Company name
65          */
66         private String companyName;
67
68         /**
69          * Country code
70          */
71         private String countryCode;
72
73         /**
74          * Email address
75          */
76         private String emailAddress;
77
78         /**
79          * Gender instance
80          */
81         private Gender gender;
82
83         /**
84          * Family name
85          */
86         private String familyName;
87
88         /**
89          * Fax number
90          */
91         private String faxNumber;
92
93         /**
94          * First name
95          */
96         private String firstName;
97
98         /**
99          * House number
100          */
101         private Long houseNumber;
102
103         /**
104          * Phone number
105          */
106         private String phoneNumber;
107
108         /**
109          * Street
110          */
111         private String street;
112
113         /**
114          * ZIP code
115          */
116         private Long zipCode;
117
118         /**
119          * Default constructor
120          *
121          * @throws javax.naming.NamingException If something happens?
122          */
123         public CustomerWebBean () throws NamingException {
124                 // Get initial context
125                 Context context = new InitialContext();
126
127                 // Set gender to UNKNOWN
128                 this.gender = Gender.UNKNOWN;
129
130                 // Try to lookup
131                 this.customerBean = (CustomerSessionBeanRemote) context.lookup("ejb/stateless-customer");
132         }
133
134         @PostConstruct
135         public void init () throws RuntimeException {
136                 // Call super init first
137                 super.genericInit();
138         }
139
140         @Override
141         public Gender getGender () {
142                 return this.gender;
143         }
144
145         @Override
146         public void setGender (final Gender gender) {
147                 this.gender = gender;
148         }
149
150         @Override
151         public String getCompanyName () {
152                 return this.companyName;
153         }
154
155         @Override
156         public void setCompanyName (final String companyName) {
157                 this.companyName = companyName;
158         }
159
160         @Override
161         public String getFirstName () {
162                 return this.firstName;
163         }
164
165         @Override
166         public void setFirstName (final String firstName) {
167                 this.firstName = firstName;
168         }
169
170         @Override
171         public String getFamilyName () {
172                 return this.familyName;
173         }
174
175         @Override
176         public void setFamilyName (final String familyName) {
177                 this.familyName = familyName;
178         }
179
180         @Override
181         public String getStreet () {
182                 return this.street;
183         }
184
185         @Override
186         public void setStreet (final String street) {
187                 this.street = street;
188         }
189
190         @Override
191         public Long getHouseNumber () {
192                 return this.houseNumber;
193         }
194
195         @Override
196         public void setHouseNumber (final Long houseNumber) {
197                 this.houseNumber = houseNumber;
198         }
199
200         @Override
201         public Long getZipCode () {
202                 return this.zipCode;
203         }
204
205         @Override
206         public void setZipCode (final Long zipCode) {
207                 this.zipCode = zipCode;
208         }
209
210         @Override
211         public String getCity () {
212                 return this.city;
213         }
214
215         @Override
216         public void setCity (final String city) {
217                 this.city = city;
218         }
219
220         @Override
221         public String getCountryCode () {
222                 return this.countryCode;
223         }
224
225         @Override
226         public void setCountryCode (final String countryCode) {
227                 this.countryCode = countryCode;
228         }
229
230         @Override
231         public String getEmailAddress () {
232                 return this.emailAddress;
233         }
234
235         @Override
236         public void setEmailAddress (final String emailAddress) {
237                 this.emailAddress = emailAddress;
238         }
239
240         @Override
241         public String getPhoneNumber () {
242                 return this.phoneNumber;
243         }
244
245         @Override
246         public void setPhoneNumber (final String phoneNumber) {
247                 this.phoneNumber = phoneNumber;
248         }
249
250         @Override
251         public String getFaxNumber () {
252                 return this.faxNumber;
253         }
254
255         @Override
256         public void setFaxNumber (final String faxNumber) {
257                 this.faxNumber = faxNumber;
258         }
259
260         @Override
261         public String getCellphoneNumber () {
262                 return this.cellphoneNumber;
263         }
264
265         @Override
266         public void setCellphoneNumber (final String cellphoneNumber) {
267                 this.cellphoneNumber = cellphoneNumber;
268         }
269 }