Class AggregatedWebFeatures
- java.lang.Object
-
- com.microstrategy.web.beans.AbstractWebFeatures
-
- com.microstrategy.web.beans.AggregatedWebFeatures
-
- All Implemented Interfaces:
WebFeatures
- Direct Known Subclasses:
ServerAdminFeatures
public abstract class AggregatedWebFeatures extends AbstractWebFeatures
MicroStrategy Web provides out of the box just a finite number of features based on its own requirements. The features that are resolved by beans in the SDK layer are listed in the
EnumWebFeaturesenumeration.Clearly itÂ’s not possible for the application to provide a feature for every different value that can be checked through the SDK, so we provide customers the ability to aggregate their own features to those already been checked by any WebComponent in the application.
To do this, customers need only to create a new class that extends this
AggregatedWebFeaturesabstract class. The only method that needs to be implemented is theresolveCustomFeature(java.lang.String)that receives the featureId to check.The class also provides a getWebComponent() method that returns the corresponding WebComponent associated with this feature (if any). The
An example of a customresolveCustomFeaturemethod can query this object to determine if the feature must be enabled or not.WebFeaturesclass:public class MyFeatures extends AggregatedWebFeatures { private static String REPORT_NAME = "f. Page-by"; public boolean resolveCustomFeature(String featureId) { boolean __result = true; if ("CustomFeature".equals(featureId)) { // // @todo: DO YOUR ONE CHECK HERE! // // In this scenario, we assume that the associated web-component // is a ReportBean and we return true only if the object-name // is a pre-defined value: // if (getWebComponent() instanceof ReportBean) { String reportName = ((ReportBean) getWebComponent()).getObjectName(); __result = REPORT_NAME.equals(reportName); } else { __result = false; } } return __result; } }To associate this class to a particular bean, invoke the
aggregateFeatures(WebComponent)method of the new class (inherited from this classAggregatedWebFeatures), this method expects as an argument theWebComponentto whom WebFeatures will be associated. You can call this method in Microstrategy Web using an add-on. For example:public class MyFeaturesAddOn extends AbstractAppAddOn { public void preCollectData(WebComponent page) { ReportBean rb = page.getChildByClass(ReportBean.class); if (rb != null) { MyFeatures custom = new MyFeatures(); custom.aggregateFeatures(rb); } } }- Since:
- MicroStrategy Web 8.0.1
-
-
Field Summary
-
Fields inherited from class com.microstrategy.web.beans.AbstractWebFeatures
_wc
-
-
Constructor Summary
Constructors Constructor Description AggregatedWebFeatures()AggregatedWebFeatures(BeanContext bc)Constructor for AggregatedWebFeatures.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaggregateFeatures(WebComponent bean)Adds new features to the ones currently available in the corresponding bean.voidaggregateFeatures(WebFeatures features)Adds new features to the ones currently available in the corresponding features-manager.voidflushCache()Flushes the internal cache where resolved values of features are stored.protected BeanContextgetBeanContext()WebComponentgetWebComponent()Returns the associatedWebComponentwith this FeaturesManager.abstract booleanresolveCustomFeature(java.lang.String feature)This method should be used to resolve new features or disable existing ones.booleanresolveFeature(java.lang.String feature)Derived classes are expected to implement this method to indicate whether the feature is supportedprotected booleanresolveOriginalFeature(java.lang.String feature)Resolves the features in the original Features Manager (if any).-
Methods inherited from class com.microstrategy.web.beans.AbstractWebFeatures
checkUserPrivilege, getSession, isFeatureAvailable, isFeatureAvailable
-
-
-
-
Constructor Detail
-
AggregatedWebFeatures
public AggregatedWebFeatures()
- Since:
- MicroStrategy Web 9.0.0
-
AggregatedWebFeatures
public AggregatedWebFeatures(BeanContext bc)
Constructor for AggregatedWebFeatures.- Parameters:
bc-BeanContext- Since:
- MicroStrategy Web 9.0.0
-
-
Method Detail
-
getBeanContext
protected BeanContext getBeanContext()
- Returns:
BeanContextrelated with the current instance- Since:
- MicroStrategy Web 9.0.0
-
resolveFeature
public boolean resolveFeature(java.lang.String feature)
Description copied from class:AbstractWebFeaturesDerived classes are expected to implement this method to indicate whether the feature is supported- Specified by:
resolveFeaturein classAbstractWebFeatures- Parameters:
feature- the feature to check for- Returns:
- boolean indicating whether the feature is supported
-
resolveOriginalFeature
protected boolean resolveOriginalFeature(java.lang.String feature)
Resolves the features in the original Features Manager (if any). It will returntrueorfalsebased on what the original manager returns.- Parameters:
feature- Feature-id- Returns:
falseif the features should not be enabled.
-
resolveCustomFeature
public abstract boolean resolveCustomFeature(java.lang.String feature)
This method should be used to resolve new features or disable existing ones. It will only be call if the original feature is enabled.
By convention this method should return
truefor unknown feature-ids.- Parameters:
feature- Feature-id- Returns:
trueto enable a feature (default).falseto disable it.
-
aggregateFeatures
public void aggregateFeatures(WebComponent bean)
Adds new features to the ones currently available in the corresponding bean.
-
aggregateFeatures
public void aggregateFeatures(WebFeatures features)
Adds new features to the ones currently available in the corresponding features-manager.
-
getWebComponent
public WebComponent getWebComponent()
Returns the associatedWebComponentwith this FeaturesManager.
-
flushCache
public void flushCache()
Description copied from class:AbstractWebFeaturesFlushes the internal cache where resolved values of features are stored.- Overrides:
flushCachein classAbstractWebFeatures- Since:
- MicroStrategy Web 9.0.0
-
-