Class 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 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(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 resolveCustomFeature method can query this object to determine if the feature must be enabled or not.

    An example of a custom 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); } } }
    Since:
    MicroStrategy Web 8.0.1
    • 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:
        BeanContext related with the current instance
        Since:
        MicroStrategy Web 9.0.0
      • resolveFeature

        public boolean resolveFeature​(java.lang.String feature)
        Description copied from class: AbstractWebFeatures
        Derived classes are expected to implement this method to indicate whether the feature is supported
        Specified by:
        resolveFeature in class AbstractWebFeatures
        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 return true or false based on what the original manager returns.
        Parameters:
        feature - Feature-id
        Returns:
        false if 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 true for unknown feature-ids.

        Parameters:
        feature - Feature-id
        Returns:
        true to enable a feature (default). false to 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 associated WebComponent with this FeaturesManager.
      • flushCache

        public void flushCache()
        Description copied from class: AbstractWebFeatures
        Flushes the internal cache where resolved values of features are stored.
        Overrides:
        flushCache in class AbstractWebFeatures
        Since:
        MicroStrategy Web 9.0.0