]> git.mxchange.org Git - addressbook-ejb.git/blob - src/java/org/mxchange/jphone/model/phonenumbers/mobile/AddressbookMobileSessionBean.java
28ee67306d86d004e588cbd07b92fd2b4f55b9c7
[addressbook-ejb.git] / src / java / org / mxchange / jphone / model / phonenumbers / mobile / AddressbookMobileSessionBean.java
1 /*
2  * Copyright (C) 2016 - 2024 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.mobile;
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.addressbook.enterprise.BaseAddressbookEnterpriseBean;
24
25 /**
26  * A general mobile number EJB
27  * <p>
28  * @author Roland Häder<roland@mxchange.org>
29  */
30 @Stateless (name = "mobile", description = "A bean handling mobile number data")
31 public class AddressbookMobileSessionBean extends BaseAddressbookEnterpriseBean implements MobileSessionBeanRemote {
32
33         /**
34          * Serial number
35          */
36         private static final long serialVersionUID = 134_945_698_127_602L;
37
38         /**
39          * Default constructor
40          */
41         public AddressbookMobileSessionBean () {
42                 // Call super constructor
43                 super();
44         }
45
46         @SuppressWarnings ("unchecked")
47         @Override
48         public List<DialableMobileNumber> fetchAllMobileNumbers () {
49                 // Trace message
50                 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMobileNumbers: CALLED!", this.getClass().getSimpleName())); //NOI18N
51
52                 // Get query
53                 final Query query = this.getEntityManager().createNamedQuery("AllMobileNumbers", MobileNumber.class); //NOI18N
54
55                 // Get list from it
56                 final List<DialableMobileNumber> list = query.getResultList();
57
58                 // Trace message
59                 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMobileNumbers: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
60
61                 // Return it
62                 return list;
63         }
64
65 }