]> git.mxchange.org Git - jfinancials-war.git/blob - src/java/org/mxchange/jfinancials/beans/phone/FinancialsAdminPhoneWebRequestBean.java
Please cherry-pick:
[jfinancials-war.git] / src / java / org / mxchange / jfinancials / beans / phone / FinancialsAdminPhoneWebRequestBean.java
1 /*
2  * Copyright (C) 2016 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.jfinancials.beans.phone;
18
19 import javax.annotation.PostConstruct;
20 import javax.enterprise.context.RequestScoped;
21 import javax.faces.view.facelets.FaceletException;
22 import javax.inject.Named;
23 import javax.naming.Context;
24 import javax.naming.InitialContext;
25 import javax.naming.NamingException;
26 import org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote;
27 import org.mxchange.jfinancials.beans.BaseFinancialsController;
28 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
29 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
30 import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
31
32 /**
33  * Administrative bean (controller) for phone numbers
34  * <p>
35  * @author Roland Häder<roland@mxchange.org>
36  */
37 @Named ("adminPhoneController")
38 @RequestScoped
39 public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsController implements FinancialsAdminPhoneWebRequestController {
40
41         /**
42          * Serial number
43          */
44         private static final long serialVersionUID = 184_598_175_371_269_016L;
45
46         /**
47          * Remote EJB for phone number (administrative)
48          */
49         private AdminContactsPhoneSessionBeanRemote adminPhoneBean;
50
51         /**
52          * Fax number
53          */
54         private DialableFaxNumber fax;
55
56         /**
57          * Land-line number
58          */
59         private DialableLandLineNumber landLine;
60
61         /**
62          * Cell phone number
63          */
64         private DialableMobileNumber mobileNumber;
65
66         /**
67          * Default constructor
68          */
69         public FinancialsAdminPhoneWebRequestBean () {
70         }
71
72         @Override
73         public DialableFaxNumber getFax () {
74                 return this.fax;
75         }
76
77         @Override
78         public void setFax (final DialableFaxNumber fax) {
79                 this.fax = fax;
80         }
81
82         @Override
83         public DialableLandLineNumber getLandLine () {
84                 return this.landLine;
85         }
86
87         @Override
88         public void setLandLine (final DialableLandLineNumber landLine) {
89                 this.landLine = landLine;
90         }
91
92         @Override
93         public DialableMobileNumber getMobileNumber () {
94                 return this.mobileNumber;
95         }
96
97         @Override
98         public void setMobileNumber (final DialableMobileNumber mobileNumber) {
99                 this.mobileNumber = mobileNumber;
100         }
101
102         /**
103          * Post-construction method
104          */
105         @PostConstruct
106         public void init () {
107                 // Try it
108                 try {
109                         // Get initial context
110                         Context context = new InitialContext();
111
112                         // Try to lookup the beans
113                         this.adminPhoneBean = (AdminContactsPhoneSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/admincontactphone!org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote"); //NOI18N
114                 } catch (final NamingException e) {
115                         // Throw it again
116                         throw new FaceletException(e);
117                 }
118         }
119
120 }