]> git.mxchange.org Git - pizzaservice-war.git/blob - src/java/org/mxchange/pizzaapplication/beans/customer/PizzaServiceCustomerWebBean.java
They are all web beans (controller)
[pizzaservice-war.git] / src / java / org / mxchange / pizzaapplication / beans / customer / PizzaServiceCustomerWebBean.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 java.lang.reflect.Field;
20 import java.lang.reflect.InvocationTargetException;
21 import java.util.Iterator;
22 import java.util.Map;
23 import javax.enterprise.context.SessionScoped;
24 import javax.inject.Named;
25 import org.mxchange.jcore.client.Client;
26 import org.mxchange.jcore.contact.Contact;
27 import org.mxchange.jcore.contact.gender.Gender;
28 import org.mxchange.jshop.beans.BaseFrameworkBean;
29 import org.mxchange.jshop.model.customer.ShopCustomer;
30
31 /**
32  * A customer bean which hides the customer instance
33  *
34  * @author Roland Haeder
35  */
36 @Named("customer")
37 @SessionScoped
38 public class PizzaServiceCustomerWebBean extends BaseFrameworkBean implements CustomerWebBean {
39         /**
40          * Serial number
41          */
42         private static final long serialVersionUID = 542145347916L;
43
44         /**
45          * Contact instance
46          */
47         private Contact contact;
48
49         /**
50          * Default constructor
51          */
52         public PizzaServiceCustomerWebBean () {
53                 // Instance customer
54                 Contact customer = new ShopCustomer();
55
56                 // And set it here
57                 this.setContact(customer);
58         }
59
60         @Override
61         public String getBirthday () {
62                 // Deligate to "hidden" object
63                 return this.getContact().getBirthday();
64         }
65
66         @Override
67         public void setBirthday (final String birthday) {
68                 // Deligate to "hidden" object
69                 this.getContact().setBirthday(birthday);
70         }
71
72         @Override
73         public String getCellphoneNumber () {
74                 // Deligate to "hidden" object
75                 return this.getContact().getCellphoneNumber();
76         }
77
78         @Override
79         public void setCellphoneNumber (final String cellphoneNumber) {
80                 // Deligate to "hidden" object
81                 this.getContact().setCellphoneNumber(cellphoneNumber);
82         }
83
84         @Override
85         public String getCity () {
86                 // Deligate to "hidden" object
87                 return this.getContact().getCity();
88         }
89
90         @Override
91         public void setCity (final String city) {
92                 // Deligate to "hidden" object
93                 this.getContact().setCity(city);
94         }
95
96         @Override
97         public String getComment () {
98                 // Deligate to "hidden" object
99                 return this.getContact().getComment();
100         }
101
102         @Override
103         public void setComment (final String comment) {
104                 // Deligate to "hidden" object
105                 this.getContact().setComment(comment);
106         }
107
108         @Override
109         public String getCompanyName () {
110                 // Deligate to "hidden" object
111                 return this.getContact().getCompanyName();
112         }
113
114         @Override
115         public void setCompanyName (final String companyName) {
116                 // Deligate to "hidden" object
117                 this.getContact().setCompanyName(companyName);
118         }
119
120         @Override
121         public String getCountryCode () {
122                 // Deligate to "hidden" object
123                 return this.getContact().getCountryCode();
124         }
125
126         @Override
127         public void setCountryCode (final String countryCode) {
128                 // Deligate to "hidden" object
129                 this.getContact().setCountryCode(countryCode);
130         }
131
132         @Override
133         public String getEmailAddress () {
134                 // Deligate to "hidden" object
135                 return this.getContact().getEmailAddress();
136         }
137
138         @Override
139         public void setEmailAddress (final String emailAddress) {
140                 // Deligate to "hidden" object
141                 this.getContact().setEmailAddress(emailAddress);
142         }
143
144         @Override
145         public String getFamilyName () {
146                 // Trace call
147                 //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
148
149                 // Deligate to "hidden" object
150                 return this.getContact().getFamilyName();
151         }
152
153         @Override
154         public void setFamilyName (final String familyName) {
155                 // Trace call
156                 //* NOISY-DEBUG: */ this.getLogger().trace(MessageFormat.format("familyName={0} - CALLED!", familyName));
157
158                 // Deligate to "hidden" object
159                 this.getContact().setFamilyName(familyName);
160         }
161
162         @Override
163         public String getFaxNumber () {
164                 // Deligate to "hidden" object
165                 return this.getContact().getFaxNumber();
166         }
167
168         @Override
169         public void setFaxNumber (final String faxNumber) {
170                 // Deligate to "hidden" object
171                 this.getContact().setFaxNumber(faxNumber);
172         }
173
174         @Override
175         public Gender getGender () {
176                 // Deligate to "hidden" object
177                 return this.getContact().getGender();
178         }
179
180         @Override
181         public void setGender (final Gender gender) {
182                 // Deligate to "hidden" object
183                 this.getContact().setGender(gender);
184         }
185
186         @Override
187         public Long getHouseNumber () {
188                 // Deligate to "hidden" object
189                 return this.getContact().getHouseNumber();
190         }
191
192         @Override
193         public void setHouseNumber (final Long houseNumber) {
194                 // Deligate to "hidden" object
195                 this.getContact().setHouseNumber(houseNumber);
196         }
197
198         @Override
199         public String getPhoneNumber () {
200                 // Deligate to "hidden" object
201                 return this.getContact().getPhoneNumber();
202         }
203
204         @Override
205         public void setPhoneNumber (final String phoneNumber) {
206                 // Deligate to "hidden" object
207                 this.getContact().setPhoneNumber(phoneNumber);
208         }
209
210         @Override
211         public String getStreet () {
212                 // Deligate to "hidden" object
213                 return this.getContact().getStreet();
214         }
215
216         @Override
217         public void setStreet (final String street) {
218                 // Deligate to "hidden" object
219                 this.getContact().setStreet(street);
220         }
221
222         @Override
223         public String getFirstName () {
224                 // Deligate to "hidden" object
225                 return this.getContact().getFirstName();
226         }
227
228         @Override
229         public void setFirstName (final String firstName) {
230                 // Deligate to "hidden" object
231                 this.getContact().setFirstName(firstName);
232         }
233
234         @Override
235         public String getTranslatedGender () {
236                 // Deligate to "hidden" object
237                 return this.getContact().getTranslatedGender();
238         }
239
240         @Override
241         public Long getZipCode () {
242                 // Deligate to "hidden" object
243                 return this.getContact().getZipCode();
244         }
245
246         @Override
247         public void setZipCode (final Long zipCode) {
248                 // Deligate to "hidden" object
249                 this.getContact().setZipCode(zipCode);
250         }
251
252         @Override
253         public boolean isOwnContact () {
254                 throw new UnsupportedOperationException("Not supported yet."); //NOI18N
255         }
256
257         @Override
258         public void show (final Client client) {
259                 throw new UnsupportedOperationException("Not supported yet."); //NOI18N
260         }
261
262         /**
263          * Setter for Contact instance
264          * @param contact Contact instance to set
265          */
266         private void setContact (final Contact contact) {
267                 this.contact = contact;
268         }
269
270         /**
271          * Getter for Contact instance
272          * @return Contact instance
273          */
274         private Contact getContact () {
275                 return this.contact;
276         }
277 }