MicroStrategy ONE

Using a custom web feature to provide special functionality for a user group

This scenario shows you how to display a map icon on the report toolbar only when members of a specific user group log in to MicroStrategy Web. This customization is performed using a custom feature, called 'mapGroup-member', which resolves to 'true' if the logged-in user is a member of the 'MapGroup' user group.

MicroStrategy Web includes an extensive set of out-of-the-box web features that can be used to create conditional functionality, but you can also create custom web features. In this scenario, you create a user group called 'MapGroup' and add one or more users. You conditionally add an icon to the report toolbar when users who are members of this group log into MicroStrategy Web and run a report. These users see a special map icon on the report toolbar, which opens a link when clicked. This scenario does not include instructions for writing code to associate behavior with this icon; you must add your own custom code to accomplish this. An example of behavior that you might use in this scenario would be to link the icon to an application that you want to make available to only a subset of your users. Assume that you have a third-party mapping application for which you have a limited number of licenses and that you want to give a special group of users access to this application from an icon on the toolbar. By creating a special user group with a limited number of users and using a feature-related attribute to display the icon only for users who are members of this group, you can ensure compliance with your license limitations without affecting the use of MicroStrategy Web by other users. Only users who are members of 'MapGroup' see the map icon on the toolbar and are able to access the mapping application.

Before customization:

After customization (for user mapUser only):

To create a custom web feature, you must create a custom feature class that includes the code needed to resolve the custom feature and reference this class in a new add-on that you add to the Page Configuration file. The custom feature class must extend the AggregatedWebFeatures abstract class and implement the resolveCustomFeature method. The custom feature classes for this scenario, EnumCustomWebFeatures.java and CustomFeatures.java, are provided for you.

AggregatedWebFeatures provides a getWebComponent() method that returns the corresponding WebComponent associated with this feature. The resolveCustomFeature method receives the featureID and queries it to determine if the feature is enabled or not.

This customization can be accomplished using either of the following methods:

Creating the MapGroup user group, adding the mapUser, and making the map icon available

Follow the steps listed below to create the user group and user required by this scenario. You must have administrative privileges to do this.

  1. Open MicroStrategy Developer, and log in as an administrative user.  

  2. Expand MicroStrategy Analytics Modules, then expand Administration.  

    1. Right-click User Manager, and choose New -> Group.  

    2. On the Group Editor, enter MapGroup as the Full Name and click OK. Click OK.  

    3. Right-click MapGroup and choose Grant access to projects. On the Group Editor, give this group all Web privileges (Web Reporter, Web Analyst and Web Professional) and click OK. Click OK.

    4. Right-click MapGroup and choose New -> User.  

    5. Enter mapUser as the Developer Login and Full Name. Enter a password and reconfirm.  

Save the icon that you want to use for the link on the report toolbar in a location where it is accessible. Create or obtain an icon or use the one provided for you.

Using the plug-in provided for you

The MicroStrategy SDK provides an out-of-the-box plug-in (ZIP file) that adds the custom web feature, adds the icon, and conditionally displays the icon on the report toolbar. Follow the simple steps below to deploy the plug-in and view the results in MicroStrategy Web. 

  1. Access the plug-in: JSP version or ASP .NET version.

  2. Extract the plug-in to the plugins subfolder inside the MicroStrategy Web installation folder.    

  3. Restart your web server.  

  4. Launch MicroStrategy Web to view the customization.

To test the conditional functionality that you deployed, follow the steps below:

  1. Log in to MicroStrategy Web as mapUser.  

  2. Run a report. The map icon should display on the report toolbar.:

    Remember that clicking this icon does not cause anything to happen. You must create an event that causes the appropriate behavior when this icon is clicked.  

  3. Log off and then log back on as any user that is not a member of the MapGroup user group.  

  4. Run the same report. The map icon should not display on the report toolbar.

Using the Web Customization Editor to create a plug-in

If you want to understand how to create and use the custom web feature, use the Web Customization Editor to create the plug-in and deploy it. 

  1. Launch the Web Customization Editor.  

  2. Create a new plug-in and give it a meaningful name.   

    1. On the Application Settings tab, click the Select Plug-in icon.:


    2. On the Select Plug-in dialog box, click New and enter a meaningful name for the plug-in, such as HideToolbarItemWebFeature.  

    3. Click OK.  

  3. Open Eclipse to create the classes needed for this scenario. Use the source code provided for you.  

    1. Create an interface class called EnumCustomWebFeatures.  

      1. Use the code in EnumCustomWebFeatures.java to create a new java class.  

      2. Compile EnumCustomWebFeatures.java.  

      3. In Windows Explorer, copy the class file to the WEB-INF\classes folder of your customization plug-in, using the package structure: com\microstrategy\sdk\samples\beans.

    2. Create a class for custom Web features.  

      1. Use the code in CustomFeatures.java to create a new java class.  

      2. Compile CustomFeatures.java.  

      3. In Windows Explorer, copy the class file to the WEB-INF\classes folder of your customization plug-in, using the package structure: com\microstrategy\sdk\samples\beans.  

    3. Create a class for custom Web feature add-on.  

      1. Use the code in AggregatedFeaturesAddOn.java to create a new java class.  

      2. Compile AggregatedFeaturesAddOn.java.

      3. In Windows Explorer, copy the class file to the WEB-INF\classes folder of your customization plug-in, using the package structure: com\microstrategy\sdk\samples\addons.  

  4. If the Web Customization Editor is closed, launch it again. Make sure that your plug-in is selected.  

  5. On the Application Settings tab, expand MicroStrategy Web Configuration to view the list of settings that can be modified to perform customization.  

    • Expand Pages to view the list of pages used in MicroStrategy Web.

      1. Right-click report (Report Execution) and select Toolbars->Add Custom Toolbar Elements to launch the New Toolbar Element Wizard.

        • On the first panel, select ReportViewToolbarModel and click Next.

        • On the second panel::

          1. For Select an icon for your new toolbar element, click Browse and navigate to the image you want to add to the report toolbar.

          2. For Tooltip Description, enter Map Group.

          3. Select A hyperlink to a different page, and enter http://www.maps.google.com.  

          4. From the Target for this toolbar elment drop-down list, select _blank.

          5. For Select the feature that will determine whether this toolbar element should be shown, enter mapGroup-member.

          6. Click Next.

        • On the final panel, click Finish.

      2. Right-click report (Report Execution) and select Create New Add-on to launch the Add-on Creation Wizard.

        • On the first panel:

          1. For the Source Folder, click Browse to navigate to the src folder for your project and click OK.

          2. For Package, click Browse to navigate to com.microstrategy.sdk.samples.addons and click OK.

          3. For Name, enter AggregatedFeaturesAddOn.  

          4. For Description, enter Add-on for aggregating web features.

          5. Select Add custom logic after fetching data from the Intelligence Server (postCollectData).

          6. Click Next.

        • On the final panel, click Finish. AggregatedFeaturesAddOn.java opens in the editor. The sample, AggregatedFeaturesAddOn.java, contains the entire code for this custom add-on.

      3. Double-click report (Report Execution) to display the Properties Editor. Select the Add-on Properties tab at the bottom of the editor.

        1. Select com.microstrategy.sdk.samples.addon.AggregatedFeaturesAddOn in the Add-ons section, then click Add New in the Add-on properties section.

        2. Select customFeaturesClassName and targetBean, add them to the shopping cart, and click OK.

        3. In the Add-on properties section:  

          • As the Value for add-on property customFeaturesClassName, enter com.microstrategy.sdk.samples.beans.CustomFeatures.  

          • As the value for add-on property targetBean, enter frame.  

        4. Save your changes.

    • Expand Styles to view the list of styles used in MicroStrategy Web.

      1. Double-click ReportFrameLayoutStyle to launch the Style Properties Editor.

      2. Click the Style Parameters tab at the bottom of the editor.

      3. Click Add.

      4. From the list of available transform parameters, select customJavaScriptFeatures, add it to the shopping cart, and click OK.

      5. From the list of Transform Parameters, select customJavaScriptFeatures and enter mapGroup-member as the Value under parameter Properties.  

      6. Save your changes.

  6. Launch MicroStrategy Web to view the customization.

To test the conditional functionality that you added, follow the steps below:

  1. Log in to MicroStrategy Web as mapUser (or any user that belongs to the MapGroup user group).  

  2. Run a report. The map icon should display on the report toolbar.:

    Remember that clicking this icon does not cause anything to happen. You must create an event that causes the appropriate behavior when this icon is clicked.

  3. Log off and then log back on as any user that is not a member of the MapGroup user group.

  4. Run the same report. The map icon should not display on the report toolbar.

See Also