]> 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 a4171f1256c97069b4cff80f8ec7118727595764..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
 package org.mxchange.addressbook.beans.features;
 
 import javax.enterprise.context.ApplicationScoped;
-import javax.faces.context.FacesContext;
 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
@@ -46,13 +53,13 @@ public class AddressbookFeatureWebApplicationBean extends BaseAddressbookControl
                        throw new IllegalArgumentException("feature is empty"); //NOI18N
                }
 
-               // Get context parameter
-               String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter(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?
-               boolean isEnabled = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N
+               // Default is not enabled
+               final boolean isEnabled = Boolean.parseBoolean(contextParameter);
 
-               // Return value
+               // Return status
                return isEnabled;
        }