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:
-
Using the plug-in provided for you::
This method lets you view the customization right away, without having to do anything except deploying the plug-in provided with the MicroStrategy SDK and creating the MapGroup user group and adding the mapUser.
-
Creating the plug-in yourself using the Web Customization Editor:
This method gives you hands-on experience in performing this customization, as it steps you through the process of creating and deploying the plug-in. In addition to performing the steps, you must create the MapGroup user group and add the mapUser.
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.
-
Open MicroStrategy Developer, and log in as an administrative user.
-
Expand MicroStrategy Analytics Modules, then expand Administration.
-
Right-click User Manager, and choose New -> Group.
-
On the Group Editor, enter MapGroup as the Full Name and click OK. Click OK.
-
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.
-
Right-click MapGroup and choose New -> User.
-
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.
-
Access the plug-in: JSP version or ASP .NET version.
-
Extract the plug-in to the plugins subfolder inside the MicroStrategy Web installation folder.
-
Restart your web server.
-
Launch MicroStrategy Web to view the customization.
To test the conditional functionality that you deployed, follow the steps below:
-
Log in to MicroStrategy Web as mapUser.
-
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.
-
Log off and then log back on as any user that is not a member of the MapGroup user group.
-
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.
-
On the Application Settings tab, click the Select Plug-in icon.:
-
On the Select Plug-in dialog box, click New and enter a meaningful name for the plug-in, such as HideToolbarItemWebFeature.
-
Click OK.
-
Open Eclipse to create the classes needed for this scenario. Use the source code provided for you.
-
Create an interface class called EnumCustomWebFeatures.
-
Use the code in EnumCustomWebFeatures.java to create a new java class.
-
Compile EnumCustomWebFeatures.java.
-
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.
-
Create a class for custom Web features.
-
Use the code in CustomFeatures.java to create a new java class.
-
Compile CustomFeatures.java.
-
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.
-
Create a class for custom Web feature add-on.
-
Use the code in AggregatedFeaturesAddOn.java to create a new java class.
-
Compile AggregatedFeaturesAddOn.java.
-
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.
-
If the Web Customization Editor is closed, launch it again. Make sure that your plug-in is selected.
-
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.
-
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::
-
For Select an icon for your new toolbar element, click Browse and navigate to the image you want to add to the report toolbar.
-
For Tooltip Description, enter Map Group.
-
Select A hyperlink to a different page, and enter http://www.maps.google.com.
-
From the Target for this toolbar elment drop-down list, select _blank.
-
For Select the feature that will determine whether this toolbar element should be shown, enter mapGroup-member.
-
Click Next.
-
-
On the final panel, click Finish.
-
-
Right-click report (Report Execution) and select Create New Add-on to launch the Add-on Creation Wizard.
-
On the first panel:
-
For the Source Folder, click Browse to navigate to the src folder for your project and click OK.
-
For Package, click Browse to navigate to com.microstrategy.sdk.samples.addons and click OK.
-
For Name, enter AggregatedFeaturesAddOn.
-
For Description, enter Add-on for aggregating web features.
-
Select Add custom logic after fetching data from the Intelligence Server (postCollectData).
-
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.
-
Double-click report (Report Execution) to display the Properties Editor. Select the Add-on Properties tab at the bottom of the editor.
-
Select com.microstrategy.sdk.samples.addon.AggregatedFeaturesAddOn in the Add-ons section, then click Add New in the Add-on properties section.
-
Select customFeaturesClassName and targetBean, add them to the shopping cart, and click OK.
-
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.
-
Save your changes.
-
-
-
Expand Styles to view the list of styles used in MicroStrategy Web.
-
Double-click ReportFrameLayoutStyle to launch the Style Properties Editor.
-
Click the Style Parameters tab at the bottom of the editor.
-
Click Add.
-
From the list of available transform parameters, select customJavaScriptFeatures, add it to the shopping cart, and click OK.
-
From the list of Transform Parameters, select customJavaScriptFeatures and enter mapGroup-member as the Value under parameter Properties.
-
Save your changes.
-
-
Launch MicroStrategy Web to view the customization.
To test the conditional functionality that you added, follow the steps below:
-
Log in to MicroStrategy Web as mapUser (or any user that belongs to the MapGroup user group).
-
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.
-
Log off and then log back on as any user that is not a member of the MapGroup user group.
-
Run the same report. The map icon should not display on the report toolbar.
See Also
-
Customizing MicroStrategy Web: User Privileges and Web Features
-
Advanced Customization Topics: Web Features
-
Advanced Customization Topics: Add-ons