MicroStrategy ONE

Creating a New Java-based Task

This topic provides step-by-step instructions on creating a new Java-based task. You use the Web Customization Editor to create, register, and edit a Java-based task. You create and register a new task using the Task Creation Wizard, and you modify an existing task using the Task Editor. To use either the wizard or the editor, you must first launch the Web Customization Editor.

The job of registering a new Java-based task is performed automatically for you when you use the Task Creation Wizard. You can also manually register or re-register a Java-based task.

The steps below walk you through the process of using both the Task Creation Wizard and Task Editor and provide a brief explanation of the information that is entered in each step.

  

Using the Task Creation Wizard

  1. Select the Application Settings tab and click MicroStrategy Web Configuration to expand the hierarchical tree of customizable features.  

  2. Right-click Tasks and select New Task to launch the Task Creation Wizard.  

  3. On the first panel in the wizard, click Create a Task by writing a Java class only to specify that you want to create a Java-based task, rather than a bean-based task. Click Next.  

  4. On the second panel of the wizard, enter the following information:  

    1. In the Source folder field, enter the source folder for the MicroStrategy project or click Browse to search for it.  

    2. In the Package field, enter the name of the package that will contain the task class or click Browse to search for it.  

    3. In the Superclass field, enter the name of the base class that the task class will extend or click Browse to search for it.  

    4. In the Interface field, specify the interfaces that you want to implement in your task class.  

      1. Click Add.. to select a new interface to implement.  

      2. Highlight a previously added interface and click Removeto deselect it.  

    5. In the Name field, enter the name for the Java class.  

    6. In the Task ID field, enter a user-friendly name for the task.

      This is the internal identifier that will be used to register the task class. This is also the name that users will see in the Web Customization editor and on the Home page of the Task Administrator application. Make this name as intuitive as possible to help users quickly understand what the task does.  

    7. In the Task Description field, enter a description for the task.

    8. Check the Admin Task field if you want the new task you are creating to be available only to users who have the security role of Web Server Administrator (that is, whose role is admin).  

    9. Check the Inherit abstract methods field if you want stub code for the abstract methods in the underlying Task class to be added to the skeleton code of the Java class for the new task you are creating. This makes it easier for you to override these methods in your new task.

    10. Click Next.
  5. On the third panel of the wizard, use the arrow buttons to select/deselect the methods in the superclass that you want to override in your task class. Click Finish.

    A Java file for the task is launched. Skeleton code is generated using the information you supplied. You must add your own custom code to the Java file to achieve your customization objectives. For example, you need to add code for all of the methods that you want to override.  

  6. Save your new task class as the name you entered in the Name field.

Your new Java-based task is now registered in a special XML configuration file (called aggregatingTaskFactoryConfig.xml) with an admin flag that determines whether it is available to both Task Developers and Web Server Administrators or only to Web Server Administrators. It appears under the Tasks setting of the Web Customization Editor, identified by the letter "J", where it is available to any client.

  • If the admin flag is turned on, the new task is available only to users who have the role of Web Server Administrator. The task appears on the Home page of the Task Administrator application and in the combo boxes of available tasks on the Parameters page and the Builder page of that application.  

  • If the admin flag is turned off, the new task is available to users who have the role of either Web Server Administrator or Task Developer. The task appears on the Home page of the Task Administrator application, as well as in the combo boxes of available tasks on the Parameters page and the Builder page of each application.

If you have specified parameters for the task, they are displayed on the Parameters page and the Builder page when the task is selected in the combo box.

Using the Task Editor

  1. Select the Application Settings tab and click MicroStrategy Web Configuration to expand the hierarchical tree of customizable features.  

  2. Under Tasks, select your Java-based task class.  

  3. In the right-hand pane, a tab appears with the code for your task class. Modify the code as desired and save your changes.

Refer to Task Class for information about the interfaces, abstract classes, and methods used to write the Java class for the task. Refer to Code Sample for a Java-based Task for an annotated code sample that illustrates a simple Java-based task that performs folder browsing.