2 * Copyright (C) 2015 Roland Haeder
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.
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.
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/>.
17 package org.mxchange.pizzaapplication.beans.customer;
19 import java.lang.reflect.Field;
20 import java.lang.reflect.InvocationTargetException;
21 import java.util.Iterator;
23 import javax.enterprise.context.SessionScoped;
24 import javax.inject.Named;
25 import javax.servlet.ServletException;
26 import org.mxchange.jcore.client.Client;
27 import org.mxchange.jcore.contact.Contact;
28 import org.mxchange.jcore.contact.Gender;
29 import org.mxchange.jshop.beans.BaseFrameworkBean;
30 import org.mxchange.pizzaapplication.customer.PizzaServiceCustomer;
33 * A customer bean which hides the customer instance
35 * @author Roland Haeder
39 public class PizzaServiceCustomerBean extends BaseFrameworkBean implements CustomerBean {
43 private static final long serialVersionUID = 542145347916L;
48 private Contact contact;
53 public PizzaServiceCustomerBean () {
55 Contact customer = new PizzaServiceCustomer();
58 this.setContact(customer);
62 public String getBirthday () {
63 // Deligate to "hidden" object
64 return this.getContact().getBirthday();
68 public void setBirthday (final String birthday) {
69 // Deligate to "hidden" object
70 this.getContact().setBirthday(birthday);
74 public String getCellphoneNumber () {
75 // Deligate to "hidden" object
76 return this.getContact().getCellphoneNumber();
80 public void setCellphoneNumber (final String cellphoneNumber) {
81 // Deligate to "hidden" object
82 this.getContact().setCellphoneNumber(cellphoneNumber);
86 public String getCity () {
87 // Deligate to "hidden" object
88 return this.getContact().getCity();
92 public void setCity (final String city) {
93 // Deligate to "hidden" object
94 this.getContact().setCity(city);
98 public String getComment () {
99 // Deligate to "hidden" object
100 return this.getContact().getComment();
104 public void setComment (final String comment) {
105 // Deligate to "hidden" object
106 this.getContact().setComment(comment);
110 public String getCompanyName () {
111 // Deligate to "hidden" object
112 return this.getContact().getCompanyName();
116 public void setCompanyName (final String companyName) {
117 // Deligate to "hidden" object
118 this.getContact().setCompanyName(companyName);
122 public String getCountryCode () {
123 // Deligate to "hidden" object
124 return this.getContact().getCountryCode();
128 public void setCountryCode (final String countryCode) {
129 // Deligate to "hidden" object
130 this.getContact().setCountryCode(countryCode);
134 public String getEmailAddress () {
135 // Deligate to "hidden" object
136 return this.getContact().getEmailAddress();
140 public void setEmailAddress (final String emailAddress) {
141 // Deligate to "hidden" object
142 this.getContact().setEmailAddress(emailAddress);
146 public String getFamilyName () {
148 //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
150 // Deligate to "hidden" object
151 return this.getContact().getFamilyName();
155 public void setFamilyName (final String familyName) {
157 //* NOISY-DEBUG: */ this.getLogger().trace(MessageFormat.format("familyName={0} - CALLED!", familyName));
159 // Deligate to "hidden" object
160 this.getContact().setFamilyName(familyName);
164 public String getFaxNumber () {
165 // Deligate to "hidden" object
166 return this.getContact().getFaxNumber();
170 public void setFaxNumber (final String faxNumber) {
171 // Deligate to "hidden" object
172 this.getContact().setFaxNumber(faxNumber);
176 public Gender getGender () {
177 // Deligate to "hidden" object
178 return this.getContact().getGender();
182 public void setGender (final Gender gender) {
183 // Deligate to "hidden" object
184 this.getContact().setGender(gender);
188 public Long getHouseNumber () {
189 // Deligate to "hidden" object
190 return this.getContact().getHouseNumber();
194 public void setHouseNumber (final Long houseNumber) {
195 // Deligate to "hidden" object
196 this.getContact().setHouseNumber(houseNumber);
200 public String getPhoneNumber () {
201 // Deligate to "hidden" object
202 return this.getContact().getPhoneNumber();
206 public void setPhoneNumber (final String phoneNumber) {
207 // Deligate to "hidden" object
208 this.getContact().setPhoneNumber(phoneNumber);
212 public String getStreet () {
213 // Deligate to "hidden" object
214 return this.getContact().getStreet();
218 public void setStreet (final String street) {
219 // Deligate to "hidden" object
220 this.getContact().setStreet(street);
224 public String getFirstName () {
225 // Deligate to "hidden" object
226 return this.getContact().getFirstName();
230 public void setFirstName (final String firstName) {
231 // Deligate to "hidden" object
232 this.getContact().setFirstName(firstName);
236 public String getTranslatedGender () {
237 // Deligate to "hidden" object
238 return this.getContact().getTranslatedGender();
242 public Long getZipCode () {
243 // Deligate to "hidden" object
244 return this.getContact().getZipCode();
248 public void setZipCode (final Long zipCode) {
249 // Deligate to "hidden" object
250 this.getContact().setZipCode(zipCode);
254 public boolean isOwnContact () {
255 throw new UnsupportedOperationException("Not supported yet."); //NOI18N
259 public Iterator<Map.Entry<Field, Object>> iterator () throws ServletException {
261 // Deligate to "hidden" object
262 return this.getContact().iterator();
263 } catch (final NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
265 throw new ServletException(ex);
270 public void show (final Client client) {
271 throw new UnsupportedOperationException("Not supported yet."); //NOI18N
275 public Object getValueFromColumn (final String columnName) throws ServletException {
277 // Deligate to "hidden" object
278 return this.getContact().getValueFromColumn(columnName);
279 } catch (final IllegalArgumentException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
281 throw new ServletException(ex);
286 public void setValueFromColumn (final String columnName, final Object value) throws ServletException {
288 // Deligate to "hidden" object
289 this.getContact().setValueFromColumn(columnName, value);
290 } catch (final NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
292 throw new ServletException(ex);
297 * Setter for Contact instance
298 * @param contact Contact instance to set
300 private void setContact (final Contact contact) {
301 this.contact = contact;
305 * Getter for Contact instance
306 * @return Contact instance
308 private Contact getContact () {