]> git.mxchange.org Git - jjobs-war.git/blob - src/java/org/mxchange/jjobs/beans/BaseJobsBean.java
Please cherry-pick:
[jjobs-war.git] / src / java / org / mxchange / jjobs / beans / BaseJobsBean.java
1 /*
2  * Copyright (C) 2016 - 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.jjobs.beans;
18
19 import java.util.Locale;
20 import java.util.MissingResourceException;
21 import java.util.ResourceBundle;
22 import org.mxchange.jcoreee.bean.faces.BaseFacesBean;
23
24 /**
25  * A general controller
26  * <p>
27  * @author Roland Häder<roland@mxchange.org>
28  */
29 public abstract class BaseJobsBean extends BaseFacesBean {
30
31         /**
32          * Serial number
33          */
34         private static final long serialVersionUID = 50_837_597_127_567_140L;
35
36         /**
37          * Protected constructor
38          */
39         protected BaseJobsBean () {
40                 // Call super constructor
41                 super();
42         }
43
44         @Override
45         protected void loadResourceBundles (final Locale locale) {
46                 // Is any locale loaded? (Will be 2)
47                 if (BaseFacesBean.getBundles().isEmpty()) {
48                         // Load resource bundles, so it will be loaded from this JAR"
49                         // 1) Generic
50                         ResourceBundle bundle = ResourceBundle.getBundle("org.mxchange.localization.generic", locale);
51                         BaseFacesBean.getBundles().add(bundle);
52
53                         // 2) Project-specific
54                         bundle = ResourceBundle.getBundle("org.mxchange.localization.project", locale);
55                         BaseFacesBean.getBundles().add(bundle);
56
57                         // Try the local file
58                         try {
59                                 // 3) Local (not committed)
60                                 bundle = ResourceBundle.getBundle("org.mxchange.localization.local", locale);
61                                 BaseFacesBean.getBundles().add(bundle);
62                         } catch (final MissingResourceException ex) {
63                                 // Cannot load it, it is okay here
64                         }
65                 }
66         }
67
68 }