]> git.mxchange.org Git - jjobs-war.git/blobdiff - src/java/org/mxchange/jjobs/beans/features/JobsFeatureWebApplicationBean.java
Please cherry-pick:
[jjobs-war.git] / src / java / org / mxchange / jjobs / beans / features / JobsFeatureWebApplicationBean.java
index 6727e653c6783426118ac1ceba85b5be0049bfd8..8b452dae645fe8cda08d511ac0425fb2e63f9ccd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Roland Haeder
+ * Copyright (C) 2016 - 2020 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.jjobs.beans.features;
 
+import javax.annotation.PostConstruct;
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Named;
-import org.mxchange.jjobs.beans.BaseJobsController;
+import org.mxchange.jjobs.beans.BaseJobsBean;
 
 /**
  * A feature bean
  * <p>
- * @author Roland Haeder<rhaeder@cho-time.de>
+ * @author Roland Häder<roland@mxchange.org>
  */
 @Named ("featureController")
 @ApplicationScoped
-public class JobsFeatureWebApplicationBean extends BaseJobsController implements JobsFeaturesWebApplicationController {
+public class JobsFeatureWebApplicationBean extends BaseJobsBean implements JobsFeaturesWebApplicationController {
 
        /**
         * Serial number
         */
        private static final long serialVersionUID = 64_237_512_690_168_674L;
 
+       /**
+        * Default constructor
+        */
+       public JobsFeatureWebApplicationBean () {
+               // Call super constructor
+               super();
+       }
+
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void init () {
+       }
+
        @Override
        public boolean isFeatureEnabled (final String feature) {
                // The parameter must be set
@@ -48,18 +64,16 @@ public class JobsFeatureWebApplicationBean extends BaseJobsController implements
                // 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 the context parameter found?
+               if (contextParameter instanceof String) {
                        // Is it set?
-                       isEnabled = (value.toLowerCase().equals("true")); //NOI18N
-               } catch (final NullPointerException ex) {
-                       // Ignored
+                       isEnabled = (Boolean.parseBoolean(contextParameter) == Boolean.TRUE);
                }
 
-               // Return value
+               // Return status
                return isEnabled;
        }