2 * Copyright (C) 2016 Roland Haeder
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.
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.
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/>.
17 package org.mxchange.pizzaapplication.beans.features;
19 import javax.enterprise.context.ApplicationScoped;
20 import javax.inject.Named;
21 import org.mxchange.pizzaapplication.beans.BasePizzaController;
26 * @author Roland Haeder<roland@mxchange.org>
28 @Named ("featureController")
30 public class PizzaFeatureWebApplicationBean extends BasePizzaController implements PizzaFeaturesWebApplicationController {
35 private static final long serialVersionUID = 64_237_512_690_168_674L;
38 public boolean isFeatureEnabled (final String feature) {
39 // The parameter must be set
40 if (null == feature) {
42 throw new NullPointerException("feature is null"); //NOI18N
43 } else if (feature.isEmpty()) {
45 throw new IllegalArgumentException("feature is empty"); //NOI18N
48 // Default is not enabled
49 boolean isEnabled = false;
51 // Try it as an NPE may come
53 // Get value from property
54 String value = this.getStringContextParameter(String.format("is_feature_%s_enabled", feature)); //NOI18N
57 isEnabled = (value.toLowerCase().equals("true")); //NOI18N
58 } catch (final NullPointerException ex) {