]> git.mxchange.org Git - jjobs-ejb.git/blob - src/java/org/mxchange/jphone/model/phonenumbers/phone/JobsPhoneSessionBean.java
49bff00db96a5f3887a5da9cdf9d5cd00b4a5ebf
[jjobs-ejb.git] / src / java / org / mxchange / jphone / model / phonenumbers / phone / JobsPhoneSessionBean.java
1 /*
2  * Copyright (C) 2016 - 2018 Free Software Foundation
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.jphone.model.phonenumbers.phone;
18
19 import java.text.MessageFormat;
20 import java.util.List;
21 import javax.ejb.Stateless;
22 import javax.persistence.Query;
23 import org.mxchange.jjobs.enterprise.BaseJobsEnterpriseBean;
24 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
25 import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber;
26 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
27 import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumber;
28 import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
29 import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber;
30
31 /**
32  * A general phone EJB
33  * <p>
34  * @author Roland Häder<roland@mxchange.org>
35  */
36 @Stateless (name = "phone", description = "A bean handling phone data")
37 public class JobsPhoneSessionBean extends BaseJobsEnterpriseBean implements PhoneSessionBeanRemote {
38
39         /**
40          * Serial number
41          */
42         private static final long serialVersionUID = 134_945_698_127_601L;
43
44         /**
45          * Default constructor
46          */
47         public JobsPhoneSessionBean () {
48                 // Call super constructor
49                 super();
50         }
51
52         @SuppressWarnings ("unchecked")
53         @Override
54         public List<DialableFaxNumber> allFaxNumbers () {
55                 // Trace message
56                 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allFaxNumbers: CALLED!", this.getClass().getSimpleName())); //NOI18N
57
58                 // Get query
59                 final Query query = this.getEntityManager().createNamedQuery("AllFaxNumbers", FaxNumber.class); //NOI18N
60
61                 // Get list from it
62                 final List<DialableFaxNumber> list = query.getResultList();
63
64                 // Trace message
65                 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allFaxNumbers: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
66
67                 // Return it
68                 return list;
69         }
70
71         @SuppressWarnings ("unchecked")
72         @Override
73         public List<DialableLandLineNumber> allLandLineNumbers () {
74                 // Trace message
75                 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allLandLineNumbers: CALLED!", this.getClass().getSimpleName())); //NOI18N
76
77                 // Get query
78                 final Query query = this.getEntityManager().createNamedQuery("AllLandLineNumbers", LandLineNumber.class); //NOI18N
79
80                 // Get list from it
81                 final List<DialableLandLineNumber> list = query.getResultList();
82
83                 // Trace message
84                 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allLandLineNumbers: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
85
86                 // Return it
87                 return list;
88         }
89
90         @SuppressWarnings ("unchecked")
91         @Override
92         public List<DialableMobileNumber> allMobileNumbers () {
93                 // Trace message
94                 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMobileNumbers: CALLED!", this.getClass().getSimpleName())); //NOI18N
95
96                 // Get query
97                 final Query query = this.getEntityManager().createNamedQuery("AllMobileNumbers", MobileNumber.class); //NOI18N
98
99                 // Get list from it
100                 final List<DialableMobileNumber> list = query.getResultList();
101
102                 // Trace message
103                 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMobileNumbers: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
104
105                 // Return it
106                 return list;
107         }
108
109 }