MicroStrategy ONE

Web Beans Layer

The Web beans layer consists of a number of objects implementing the WebBean interface. A Web bean generally represents a MicroStrategy data component, such as a report, folder, or prompt. Examples of Web beans include the ReportBean, FolderBean, and PromptBean. A Web bean encapsulates the XML data that corresponds to a given MicroStrategy data component. It is responsible for collecting the XML from MicroStrategy Intelligence Server. It is not responsible for rendering the data into HTML, however. That responsibility is reserved for a transform object from the Web transforms layer.

The Web beans layer is application-independent. That is, it has no knowledge of application-specific data structures (such as cookies or URLs, for example). This ensures that Web bean objects can be readily used in custom applications without having to replicate MicroStrategy Web application data structures.

Objects extending the WebBean interface are JavaBeans. Note, however, that these are not Enterprise Java Beans (EJBs). These objects can only be instantiated inside the caller’s Java Virtual Machine (JVM). Unlike EJBs, they cannot be distributed across the network and have no backing to a database. The objects in this layer are Java classes with specific naming conventions.

Web beans

In the context of a Model-View-Controller design paradigm, a Web bean is a miniature, combined Model and Controller object. It is a Model object in that it represents a high-level data concept (such as a report). It also fulfills the role of a Controller by coordinating the use of several Web objects to fulfill the collection of XML and by managing the transform objects (which are the View objects).

The core features of a Web bean are represented in the following diagram:

The key points from the diagram above include the following:

  • The underlying content of a Web bean is in the form of XML. All Web beans expose:

    • An XML DOM node for accessing their content in its native XML form.  

    • A set of applicable Web objects that are responsible for providing the Web bean its behavior. These Web objects can be manipulated and fine-tuned for retrieving data from Intelligence Server.  

  • A Web bean can persist and restore its state from a string. See the Web beans and state section below for more information.  

  • The Web bean is capable of handling events. See the Web beans and events section below for details.  

  • A Web bean contains a collection of transform objects, each of which is responsible for constructing some markup representation for the object. See the Web beans and transforms section below for details.

Web beans and state

Many Web beans are objects that require a state. That is, they change as a user interacts with the object through a sequence of pages. For proper operation, these changes are recorded as a part of the state of the object itself. This allows applications to preserve bean states between page executions. For example, in the case of a report, several key data structures must be maintained to enable the report data to be retrieved from Intelligence Server in a specific one of the report's various states. The Web bean's state is saved on the page by default in the form of a URL parameter or hidden form field, though it can also be passed in a number of others ways.

The Web bean's ability to maintain its own state allows it to be application-independent. Specifically, a Web bean's state can be converted into a string representation, and then later restored from that string. (This state information is considered to be opaque and only meaningful to the Web bean itself). For example, in the case of a ReportBean, the bean's state needs to be persisted so that after performing a manipulation like pivoting or sorting, the properties for the resulting displayed report are the same as the original report. In the MicroStrategy Web application, the Page Configuration file specifies how much persistence each Web bean is to have, each time it is defined. The state of a Web bean can be persisted to the HTTP request (as a URL parameter or as FORM values). The state can also be saved as a session variable, or using the Preferences mechanism.

Web beans and events

The WebBeaninterface extends the WebComponent interface, and all WebComponent objects are capable of handling any number of events. An event represents some action that can be performed or handled by a WebComponent. For example, a ReportBean can handle an event for executing a report or for performing a pivot, while a FolderBean can maintain a Browse event. A specific type of Web bean event is generally exposed through the unique EventHandler associated with that Web bean by default. To enable a Web bean to perform a custom action, you can extend the bean's default EventHandler.

See also

Web beans and transforms

Transforms also use events to generate URL links and forms. Whenever a transform needs to generate a link or a form, it searches for the corresponding event and obtains a set of required and optional arguments from that event. The transform uses this information to construct a URL string or a form that encapsulates the request. If no event is found, then the transform does not generate any output for it. This prevents the transform from generating a request that cannot be fulfilled by the Web page components.