]> git.mxchange.org Git - pizzaservice-ejb.git/blob - src/java/org/mxchange/jcontactsbusiness/model/headquarter/PizzaHeadquarterSessionBean.java
Please cherry-pick:
[pizzaservice-ejb.git] / src / java / org / mxchange / jcontactsbusiness / model / headquarter / PizzaHeadquarterSessionBean.java
1 /*
2  * Copyright (C) 2017 - 2020 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.jcontactsbusiness.model.headquarter;
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.jcontactsbusiness.model.headquarter.HeadquarterSessionBeanRemote;
24 import org.mxchange.pizzaapplication.enterprise.BasePizzaEnterpriseBean;
25
26 /**
27  * A stateless session bean for general headquarter purposes
28  * <p>
29  * @author Roland Häder<roland@mxchange.org>
30  */
31 @Stateless (name = "headquarter", description = "A general statless bean for handling headquarter data (all)")
32 public class PizzaHeadquarterSessionBean extends BasePizzaEnterpriseBean implements HeadquarterSessionBeanRemote {
33
34         /**
35          * Serial number
36          */
37         private static final long serialVersionUID = 58_467_386_571_701L;
38
39         @Override
40         @SuppressWarnings ("unchecked")
41         public List<Headquarter> fetchAllHeadquarters () {
42                 // Trace message
43                 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allHeadquarters: CALLED!", this.getClass().getSimpleName())); //NOI18N
44
45                 // Get query
46                 final Query query = this.getEntityManager().createNamedQuery("AllHeadquarters"); //NOI18N
47
48                 // Get list from it
49                 final List<Headquarter> list = query.getResultList();
50
51                 // Trace message
52                 this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allHeadquarters: list.size()={1} - EXIT!", this.getClass().getSimpleName(), list.size())); //NOI18N
53
54                 // Return it
55                 return list;
56         }
57
58 }