]> git.mxchange.org Git - addressbook-war.git/blob - src/java/org/mxchange/addressbook/beans/resendlink/AddressbookResendLinkWebSessionBean.java
665dd59b3ed7c159df7b6a345acd1991aa305c40
[addressbook-war.git] / src / java / org / mxchange / addressbook / beans / resendlink / AddressbookResendLinkWebSessionBean.java
1 /*
2  * Copyright (C) 2016 Roland Haeder
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.addressbook.beans.resendlink;
18
19 import javax.enterprise.context.SessionScoped;
20 import javax.faces.view.facelets.FaceletException;
21 import javax.inject.Named;
22 import javax.naming.Context;
23 import javax.naming.InitialContext;
24 import javax.naming.NamingException;
25 import org.mxchange.addressbook.beans.BaseAddressbookController;
26
27 /**
28  * A web session bean for resending confirmation link
29  * <p>
30  * @author Roland Haeder<roland@mxchange.org>
31  */
32 @Named ("resendController")
33 @SessionScoped
34 public class AddressbookResendLinkWebSessionBean extends BaseAddressbookController implements AddressbookResendLinkWebSessionController {
35
36         /**
37          * Serial number
38          */
39         private static final long serialVersionUID = 186_078_724_659_153L;
40
41         /**
42          * Email address 1 (changing)
43          */
44         private String emailAddress;
45
46         /**
47          * EJB for resending confirmation link
48          */
49         private ResendLinkSessionBeanRemote emailBean;
50
51         /**
52          * Default constructor
53          */
54         public AddressbookResendLinkWebSessionBean () {
55                 // Try it
56                 try {
57                         // Get initial context
58                         Context context = new InitialContext();
59
60                         // Try to lookup
61                         this.emailBean = (ResendLinkSessionBeanRemote) context.lookup(""); //NOI18N
62                 } catch (final NamingException e) {
63                         // Throw again
64                         throw new FaceletException(e);
65                 }
66         }
67
68         @Override
69         public String doResendLink () {
70                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
71         }
72
73         @Override
74         public String getEmailAddress () {
75                 return this.emailAddress;
76         }
77
78         @Override
79         public void setEmailAddress (final String emailAddress) {
80                 this.emailAddress = emailAddress;
81         }
82
83         /**
84          * Clears email address fields so the user has to re-enter them
85          */
86         private void clear () {
87                 // Clear fields
88                 this.setEmailAddress(null);
89         }
90
91 }