java.lang.Object | ||
↳ | com.microstrategy.web.beans.AbstractWebFeatures | |
↳ | com.microstrategy.web.beans.AggregatedWebFeatures |
![]() |
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
EnumWebFeatures
enumeration.
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
AggregatedWebFeatures
abstract class. The only method that needs to be implemented
is the resolveCustomFeature(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 resolveCustomFeature
method can query
this object to determine if the feature must be enabled or not.
WebFeatures
class:
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 the WebComponent
to 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);
}
}
}
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AggregatedWebFeatures() | |||||||||||
AggregatedWebFeatures(BeanContext bc)
Constructor for AggregatedWebFeatures.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
aggregateFeatures(WebComponent bean)
Adds new features to the ones currently available in the corresponding bean.
| ||||||||||
void |
aggregateFeatures(WebFeatures features)
Adds new features to the ones currently available in the corresponding features-manager.
| ||||||||||
void |
flushCache()
Flushes the internal cache where resolved values of features are stored.
| ||||||||||
WebComponent |
getWebComponent()
Returns the associated
WebComponent with this FeaturesManager. | ||||||||||
abstract boolean |
resolveCustomFeature(String feature)
This method should be used to resolve new features or disable existing ones. | ||||||||||
boolean |
resolveFeature(String feature)
Derived classes are expected to implement this method to indicate whether
the feature is supported
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
BeanContext | getBeanContext() | ||||||||||
boolean |
resolveOriginalFeature(String feature)
Resolves the features in the original Features Manager (if any).
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
Constructor for AggregatedWebFeatures.
bc | BeanContext |
---|
Adds new features to the ones currently available in the corresponding bean.
Adds new features to the ones currently available in the corresponding features-manager.
Flushes the internal cache where resolved values of features are stored.
Returns the associated WebComponent
with this FeaturesManager.
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 true
for unknown feature-ids.
feature | Feature-id |
---|
true
to enable a feature (default). false
to disable it.
Derived classes are expected to implement this method to indicate whether the feature is supported
feature | the feature to check for |
---|
Resolves the features in the original Features Manager (if any).
It will return true
or false
based
on what the original manager returns.
feature | Feature-id |
---|
false
if the features should not be enabled.