MicroStrategy ONE
Creating Tasks
You use the Web Customization Editor to create and register new tasks. Once the Web Customization Editor has created and registered a task—either by saving an XML task file in a specified location or making a task class entry in a special task configuration file—it is available under Tasks in the MicroStrategy Web Configuration settings of the Web Customization Editor. If it is a public task, it is also available in the Task Administrator application, depending on whether it is an administrative task or a non-administrative user task. When you create a new task, you specify whether it is an administrative task by setting the Admin Task flag.
New tasks can be created in two ways.
-
A bean-based task is made up of a bean, an event, and a transform. The Web Customization Editor creates a new bean-based task by constructing an XML file, in a specified format, that defines the classes that make up the task and registers it by saving the XML file in a location where the Task Processor will look for it. If a new bean-based task can be expressed in terms of an existing web bean, event, and transform and it uses the default base class, no Java programming skills are required. On the other hand, if a custom bean, event handler, or transform is needed or a different base class is used, then you must be able to write the Java code to create the necessary classes.
Examples of bean-based tasks include actions such as executing a report or document, browsing through folders, and saving or deleting subscriptions.
-
Creating a Java-based task requires Java programming skills. The Web Customization Editor creates a new Java-based task by constructing a skeleton task class. You must be able to write the Java code to create the custom Java class that defines the task.
Examples of Java-based tasks include actions such as logging in or out of a web application, a Flex application, or a mobile application.
If you are planning on exposing functionality from MicroStrategy Web through a task, chances are that it is already being implemented by an event handler for a specific web bean. If this is the case, even if you possess the necessary programming skills, it may be far easier to describe your task using a bean-based task. When a task is formed using an existing web bean, event, and transform and uses the default base class, very little (if any) Java code needs to be written.
Determining which method to use for creating a new task
The method that you choose to create a new task depends on your specific skills and requirements. If you think that you want or need to create a new task to satisfy a specific requirement of yours, you should proceed in the following fashion.
-
Before you actually begin to create a new task, you should first determine whether there is an existing task that does what you want. To review the tasks that are available to you out-of-the-box, open the Task Administrator Application and click the Tasks tab. Chances are good that you will find an existing task that you can use.
-
If you don't find an existing task that satisfies your needs, you should see if you can assemble a new task using an existing bean, event, and transform and the default base class. This is the easiest way to create a new task because it does not require any Java programming skills. With the wide range of web beans, events, and transforms that are available in MicroStrategy Web, it is quite possible that you will be able to create your new task in this way, eliminating the need to write even one line of Java code.
-
If you are unable to find a web bean/event/transform combination that does exactly what you want, it is often possible to extend an existing bean, event, and/or transform and then create a new bean-based task made up of this bean, event, and/or transform. While this method of task creation does require some Java programming skills, you are not creating a new bean, event, or transform from scratch, but rather extending one that already exists. You are able to leverage all of the functionality in the existing bean, event, or transform, which substantially reduces the amount of Java code that you have to write. There is a good likelihood that you will find an existing bean, event, or transform that contains the core functionality that you require, and you will have to write code only for the required functionality that is missing.
For example, if you want to customize the way data is collected for your task, you might be able to extend an existing event handler. Or, if you want to customize the way content is generated, you might be able to extend an existing transform. Finally, you might want to provide a different base class for the bean in order to modify the task’s behavior if the nature of your task is more dynamic or complex. Specifying a base class causes your class to be invoked and lets you override certain method calls. This allows you to declare some aspects of your task through the XML and implement the rest in Java. -
If you are unable to find or leverage any existing classes to create your new task, you must write one or more new Java classes. While this is an excellent way to wrap up functionality that is exposed only through the Web Objects APIs, it does require sophisticated Java programming skills and involves much more effort than the methods described in the previous steps.