]> git.mxchange.org Git - addressbook-war.git/blobdiff - src/java/org/mxchange/addressbook/beans/features/AddressbookFeatureWebApplicationBean.java
Updated copyright year
[addressbook-war.git] / src / java / org / mxchange / addressbook / beans / features / AddressbookFeatureWebApplicationBean.java
index ec9d6eb4b8d3815d63e3ae8b26556d678fe526c2..60f0031a6948c65757fc49e3f6b8dd481629ac74 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Roland Haeder
+ * Copyright (C) 2016 - 2024 Free Software Foundation
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as
@@ -18,22 +18,30 @@ package org.mxchange.addressbook.beans.features;
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Named;
-import org.mxchange.addressbook.beans.BaseAddressbookController;
+import org.mxchange.addressbook.beans.BaseAddressbookBean;
 
 /**
  * A feature bean
  * <p>
- * @author Roland Haeder<rhaeder@cho-time.de>
+ * @author Roland Häder<roland@mxchange.org>
  */
 @Named ("featureController")
 @ApplicationScoped
-public class AddressbookFeatureWebApplicationBean extends BaseAddressbookController implements AddressbookFeaturesWebApplicationController {
+public class AddressbookFeatureWebApplicationBean extends BaseAddressbookBean implements AddressbookFeaturesWebApplicationController {
 
        /**
         * Serial number
         */
        private static final long serialVersionUID = 64_237_512_690_168_674L;
 
+       /**
+        * Default constructor
+        */
+       public AddressbookFeatureWebApplicationBean () {
+               // Call super constructor
+               super();
+       }
+
        @Override
        public boolean isFeatureEnabled (final String feature) {
                // The parameter must be set
@@ -45,21 +53,13 @@ public class AddressbookFeatureWebApplicationBean extends BaseAddressbookControl
                        throw new IllegalArgumentException("feature is empty"); //NOI18N
                }
 
-               // Default is not enabled
-               boolean isEnabled = false;
-
-               // Try it as an NPE may come
-               try {
-                       // Get value from property
-                       String value = this.getStringContextParameter(String.format("is_feature_%s_enabled", feature)); //NOI18N
+               // Get value from property
+               final String contextParameter = this.getStringContextParameter(String.format("is_feature_%s_enabled", feature)); //NOI18N
 
-                       // Is it set?
-                       isEnabled = (value.toLowerCase().equals("true")); //NOI18N
-               } catch (final NullPointerException ex) {
-                       // Ignored
-               }
+               // Default is not enabled
+               final boolean isEnabled = Boolean.parseBoolean(contextParameter);
 
-               // Return value
+               // Return status
                return isEnabled;
        }