/*
- * 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
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;
}