0% found this document useful (0 votes)
393 views118 pages

Microstrategy Web SDK: Api Essentials

This document outlines MicroStrategy's instructor-led curriculum, which includes courses on MicroStrategy products like Web, Desktop, Architect, and the SDK. It describes certifications in areas like project design, reporting, administration, and the SDK. Course topics range from 1 to 3 days and cover essentials, advanced concepts, and customization/integration using the SDK. Certification paths are available to specialize in areas such as Web development, implementation, or as a certified developer.

Uploaded by

bhargava
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
393 views118 pages

Microstrategy Web SDK: Api Essentials

This document outlines MicroStrategy's instructor-led curriculum, which includes courses on MicroStrategy products like Web, Desktop, Architect, and the SDK. It describes certifications in areas like project design, reporting, administration, and the SDK. Course topics range from 1 to 3 days and cover essentials, advanced concepts, and customization/integration using the SDK. Certification paths are available to specialize in areas such as Web development, implementation, or as a certified developer.

Uploaded by

bhargava
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 118

MicroStrategy Web SDK:

API Essentials
MicroStrategy Instructor-Led Curriculum

• MicroStrategy Web • MicroStrategy Narrowcast Server


 MicroStrategy Web: Report Analysis  MicroStrategy Narrowcasting Essentials
 MicroStrategy Web: Report Design
 MicroStrategy Advanced Narrowcasting
 MicroStrategy Report Services: Document Essentials
for MicroStrategy Web  MicroStrategy Narrowcast Server Administration & Tuning
 MicroStrategy Report Services: Dynamic Dashboards 100
 MicroStrategy Report Services: Dynamic Dashboards 200• MicroStrategy Intelligence Server
 MicroStrategy Intelligence Server Administration
• MicroStrategy Office  MicroStrategy Intelligence Server Tuning & Advanced
Administration
 MicroStrategy Office Essentials  MicroStrategy Web Administration & Tuning
 SQL Essentials
• MicroStrategy Desktop  MicroStrategy Engine Essentials
 MicroStrategy Desktop: Reporting Essentials  MicroStrategy Engine Tuning & VLDB Properties
 MicroStrategy Desktop: Advanced Reporting 100
 MicroStrategy Report Services: Document Essentials • MicroStrategy Administrator
for MicroStrategy Desktop  MicroStrategy Administrator
 MicroStrategy Report Services: Advanced Documents  MicroStrategy Enterprise Manager Essentials
for MicroStrategy Desktop


MicroStrategy Freeform SQL Essentials
MicroStrategy Desktop: Advanced Reporting 200
• MicroStrategy SDK
 MicroStrategy Web SDK: Customization Essentials
 MicroStrategy Web SDK: Portal Integration
• MicroStrategy Architect  MicroStrategy Web SDK: API Essentials
 MicroStrategy Architect: Project Design  MicroStrategy Web SDK: Customizing Security
 MicroStrategy Advanced Data Warehousing  MicroStrategy Web SDK: Customizing User Interactions
 MicroStrategy Visualization SDK Essentials
MicroStrategy Certifications
Certified Project Designer Program
Desktop: Reporting Essentials 2 days

CPD
Architect: Project Design 2 days
Certified Project Designer Exam (CPD) 1 day

Certified Report Developer Program


Document Essentials 1 day
CRD Desktop: Advanced Reporting 100 3 days
Certified Report Developer Exam (CRD) 1 day

Certified Platform Administrator Program


Intelligence Server Administration 2 days
CPA

Narrowcasting Essentials 2 days


Certified Platform Administrator Exam (CPA) 1 day

MicroStrategy Certified Engineer


MCE

MicroStrategy Certified Engineer Project 3 days

MCE
Comprehensive Certification Focus Area Certification
MicroStrategy Certifications
Certified Engine Specialist Program

MCE
SQL Essentials 1 day
Engine Essentials 2 days

CES
Engine Tuning & VLDB Properties 1 day
Advanced Data Warehousing 2 days
Certified Engine Specialist Exam (CES) 1 day

Certified Narrowcast Developer

ANY
Narrowcasting Essentials 2 days
Advanced Narrowcasting 1 day Certified Enterprise Reporter
CND

Narrowcast Administration & Tuning 1 day Document Essentials 1 day


Certified Narrowcast Developer Exam (CND) 1 day Advanced Documents 1 day
Dynamic Dashboards 100 1 day

CER
Certified Advanced Adm inistrator Program Dynamic Dashboards 200 1 day

ONE
Intelligence Server Tuning & Advanced Administration 2 days Freeform SQL Essentials 1 day
Web Administration & Tuning 1 day Certified Enterprise Reporter Exam (CER) 1 day
CAA

MicroStrategy Administrator 1 day


MicroStrategy Enterprise Manager Essentials 1 day
Certified Advanced Administrator Exam (CAA) 1 day

MCEP
Comprehensive Certification Focus Area Certification
MicroStrategy Certifications

Certified Web SDK Specialist Program


Web SDK: Customization Essentials 3 days

CWS
Web SDK: Portal Integration 2 days
Certified Web SDK Specialist Exam (CWS) 1 day

Certified Web SDK Developer Program


MicroStrategy Visualization SDK Essentials 1 day
Web SDK: API Essentials 1 day
Web SDK: Customizing User Interactions 2 days

CWD
Web SDK: Customizing Security 1 day

MicroStrategy Certified Developer


MCD

MicroStrategy Certified Developer Project 3 days

MCD
Comprehensive Certification Focus Area Certification
Certification Paths

To specialize in Web interface To be a proficient MicroStrategy


integration and customization implementation specialist

MCD MCE

To be able to provide advanced,


strategic advice on MicroStrategy
implementations

MCEP
Course Approach

• MicroStrategy Enterprise Manager Essentials training is


organized into lessons.
• Each lesson contains:
• Lesson Description
• Lesson Topic Objectives
• Content
• Review Questions and/or Hands-on Exercises
Course Prerequisites

• MicroStrategy Desktop: Reporting Essentials


• Basic Programming Skills for Web, including HTML, XML
• SDK: Customization Essentials Course
• Advanced Java and JSP skill required
Course Agenda

• Review MicroStrategy Web architecture and page


execution flow
• Use Web Objects API to create session and perform basic
browsing and searching manipulations
• Understand Web Objects API and how to incorporate
custom beans into MicroStrategy Web
• Understand the Transforms infrastructure and how to
create custom transforms to render folder, grid and
prompts
1

Introduction to
MicroStrategy SDK
1
Customization & Integration with MicroStrategy Platform
MicroStrategy Web
Customization Integration

Adding Data
functionality Visualization

Report & Dashboards


Prompts & Portals

Out of the Box


Look & Feel,
Collaboration
Navigation

Customization Integration

SSO, User Other


management Engines
SDK

MicroStrategy Platform

Data Warehouse
1,000s Attributes
1,000s Metrics
1
The SDK comprises of the following components:

• Open Application Programming Interface (API) set


• API documentation
• Development tools
• Embedding and packaging
1
The Web SDK customization tools include:

• MicroStrategy Developer Library (MSDL)


• Page Configuration file, MicroStrategy Web Page Reference, and
MicroStrategy Custom HTML tags reference
• Style Catalog configuration file and Transform Parameters reference
• SDK kits and sample applications
• Sample codes
• Complete API reference
• Other customization references
• MicroStrategy XML schema reference
1
The Layered View of the Architecture
Page
Configuration
Navigation, Look & Feel
Presentation Presentation
XML
Layer
(JSP)
Layer
(ASP .NET)
– Page and Content Layout
– Custom Text, Links, etc
– Custom Workflow

XML (Java) Custom Data Rendering


Transform Layer
Style – Reports, Folders, etc.
Catalog

BI Information Layer
(Java)
(Web Beans) Custom Functionality

BI Function Layer
(Web Objects)
(Java)
Functionality used in all of above
Communication Layer
(Java)
(XML API)

MicroStrategy Web & Web


Universal 8
1
MicroStrategy Web Architecture
1
XML API Layer

 The base layer


 Written in Java
 Handles all interactions with Intelligence Server
1
Web Objects Layer

 Makes customization easier and faster


Consists of various objects which generate the required
XML for processing user requests
1
Web Beans

• Represent high-level GUI components


– Application independent
– Java beans
– State
– Event
• Data transformed via transforms
1
Web Transforms

• Transform Web Bean data into its final output


1
Application Objects Layer

• Represent MicroStrategy-Web specific


functionality
• This layer includes:
– Application beans
– Page Configuration file
– Style Catalog file
– Preferences
– Message Bundle
1
Presentation Layer

• Supports J2EE and .NET technologies


1
Web 8.0 Query Flow – Send HTML to Client

Web server

Load page Pre execution Data Data


collection Formatting

Identify Custom
page logic Transform
beans
Load page
Execute Collect
definition
Client events data Arrange Client
content
Bean Custom
instances logic
created

Customizable
component
1
Customizable Components - Transforms
Web server

Load page Pre execution Data Data


collection Formatting

Identify Custom
page logic Transform
beans
Load page
Execute Collect
definition
Client events data Arrange Client
content
Bean Custom
instances logic
created

Transform
Customizable
•The data of a bean is transformed into HTML using transform
component
components
•These allow great flexibility in how a bean’s data is transformed
into HTML
1
Customizable Components – Arrange Content
Web server

Load page Pre execution Data Data


collection Formatting

Identify Custom
page logic Transform
beans
Load page
Execute Collect
definition
Client events data Arrange Client
content
Bean Custom
instances logic
created

Arrange Content Customizable


component
•Content is arranged using JSP or ASP.NET files
•These are highly customizable as they contain no true code just
pure HTML and MicroStrategy Custom HTML tags
1
Web Workflow
1
SDK Package Structure: Overview

• The diagram below describes the most fundamental


packages useful for customization.
com.microstrategy
web All SDK APIs except utils, XMLAPI

objects Web Objects API

beans Web Beans API

transform Web Transform Infrastructure


Contains app-specific classes and sub-
app packages (app beans, app transforms)

webapi Java XMLAPI


2

Web Objects API


2
Using the MicroStrategy Web Objects APIs – Objectives

• To gain a cursory understanding of the main Web APIs and


the characteristics of each, by taking a “bottom-up”
approach to working with the Web/Web Universal SDK 8.
• To become familiar with some important and representative
objects from the Web Objects and Web Beans APIs,
enabling you to continue to learn how to use other objects
on your own, for your specific purposes
• To use Web Objects to be able to:
• Log into and establish a session with Intelligence Server
• Perform basic object browsing and searching
• Retrieve the properties of an object defined in the metadata
2
Web Objects API – Overview

• The Web Objects API is:


• Built on top of XML API to provide completely object-
oriented access to complete set of XML API functionality
• Report / Document execution and manipulation
• Prompt resolution for all prompt types
• Ad-hoc reporting, scheduling, formatting
• Object operations including object browsing/searching,
saving (searches, reports, prompt answers), Element
listing, Filter creation
• Generate and provide access to MicroStrategy XML
2
Taking a Task-Focused Approach

• In this class, we will look at some core and


representative Web Objects.
• We will do so by using a task-oriented approach.

• We will learn how to use Web Objects to do the


following:
1. Generate a session with Intelligence Server
2. Browse the contents on one or more folders
3. Perform a search for a MicroStrategy object in a
project.
2
Using the Web Objects API

• All objects in the Web Objects API are instantiated


through the WebObjectsFactory class
• Entry point to all classes in Web Objects API
• Static method: getInstance()

WebObjectsFactory factory=
WebObjectsFactory.getInstance()

* We will only look at the bare basics of the Web Objects API
2
Session Management: Concepts

• A layered structure of objects provide access to the web application


about an Intelligence Server session Bigger wrapper allowing web
application to extract
I-Server-specific properties
WebIServerSession
“Wrapper” allowing web
application to extract generic
WebSessionInfo
session properties

Session
ID

String that I-Server generates to


uniquely identify a session and
all associated properties
2
Web Objects API – Session Management

• WebSessionInfo contains methods relating to the


information associated interface
with a ‘generic’ session
com.microstrategy.utils.serialization.Persistable
• One-to-one relationship between WebObjectsFactory and Session
• getSessionID() attempts to establish connection (calls I-Server)
+saveState(howMuchState:int):String
+saveState():String
+restoreState(state:String):boolean

• WebIServerSession contains Intelligence Server-specific


calls. interface
CacheHint

com.microstrategy.web.objects.WebSessionInfo
interface
com.microstrategy.web.objects.WebIServerSession

+getSessionID():String
+getSessionID(create:boolean):String
+getServerName():String
+setSessionID(sessionID:String):void
+setServerName(serverName:String):void
+getLogin():String
+getServerPort():int
+setLogin(login:String):void
+setServerPort(portNumber:int):void
+setPassword(password:String):void
+getProjectName():String
+closeSession():void
+setProjectName(projectName:String):void
+getUserInfo():WebObjectInfo
+isAlive():boolean
+refresh():void
+reconnect():void
+getFactory():WebObjectsFactory
2
Web Objects API – Source Objects
• Obtain a WebObjectsFactory instance by calling
getInstance()

• Establish session with Intelligence Server


• WebIServerSession
com.microstrategy.web.objects.WebObjectsFactory

• Obtain access to all +getInstance():WebObjectsFactory


+getObjectSource():WebObjectSource
other objects through +getScheduleSource():WebScheduleSource
corresponding +getReportSource():WebReportSource
+getElementSourceObject():WebElementSource
source object: +getIServerSession():WebIServerSession
+getDocumentSource():WebDocumentSource
• WebReportSource +getInboxSource():WebInboxSource
• WebDocumentSource +getSubscriptionsSource():WebSubscriptionsSource
+getProjectSource():WebProjectSource
• WebObjectSource +getClusterAdmin():WebClusterAdmin
+checkUserPrivilege(privilegeType:int):boolean
• WebElementSource
• Etc.
2
Source Objects

• The following objects can be used to gain access to


MicroStrategy objects:
• getWebReportSource() returns an object allowing
access to a MicroStrategy report
• getRWSource() returns an object allowing access to a
MicroStrategy Report Services document
• getElementSource() returns an object allowing access to
the elements of a MicroStrategy attribute
• getObjectSource() returns an object allowing access to
folder contents or the results of a search
2
Example: Executing a report

• The WebReportSource object is used to execute,


manipulate, and display reports. Again, the factory object is
used to create an instance of this source object.
 
WebReportSource reportSource=factory.getReportSource();
WebReportInstance reportInstance=null;
try {
reportInstance=reportSource.getNewInstance(reportObject
.getID());
} catch (WebObjectsException ex) {}

2
Web Objects API – Object Browsing

• Viewing the contents of a folder utilizes the following


interfaces:
interface
com.microstrategy.web.objects.WebObjectSource

• WebObjectSource +getObject(objectID:String,objectType:int,populate:boolean):WebObjectInfo
+getObject(objectID:String,objectType:int):WebObjectInfo
• WebObjectInfo +getObject(objectID:String,objectType:int,objectSubType:int):WebObjectInfo
+getObject(objectID:String,objectType:int,objectSubType:int,populate:boolean):WebObjectInfo
+getRoot():WebFolder
• WebFolder +getBlockBegin():int
+setBlockBegin(blockBegin:int):void
+getBlockCount():int
+setBlockCount(blockCount:int):void
+getFlags():int
+setFlags(flags:int):void

* EnumDSSMXLObjectFlags interface
WebDisplayUnit

determine how much information com.microstrategy.web.objects.WebObjectInfo


0..*
about an object is brought back
from the Intelligence Server 1

...web.objects.WebFolder ...web.objects.WebAttribute
2
Web Objects API – WebObjectInfo

interface
com.microstrategy.web.objects.WebDisplayUnit
• WebObjectInfo represents a
generic MicroStrategy object
interface
com.microstrategy.web.objects.WebObjectInfo interface
...web.objects.WebTemplate

+getID():String
+getType():int
+getSubType():int
• Contains methods commonPersistable
interface
+getName():String
+getAbbreviation():String
+getDescription():String
among most other
...web.objects.WebSearch

+getCreationTime():String
+getModificationTime():String
+isHidden():boolean
MicroStrategy objects
interface
+getAccessGranted():int ...web.objects.WebDimension
+getState():int
+getOwner():WebObjectInfo
• ID, Name, Description, etc.
+getPropertySets():WebPropertyGroup
+getAncestors():SimpleList interface
+getParent():WebFolder ...web.objects.WebAttribute

* An object on a template is referenced


Persistable
as a WebDisplayUnit
interface
...microstrategy.web.objects.WebFilter

+getFilterType():int
2
Web Objects API – WebObjectInfo
interface
com.microstrategy.web.objects.WebDisplayUnit
• Most specific
MicroStrategy objects
interface
interface
have specific
com.microstrategy.web.objects.WebObjectInfo
...web.objects.WebTemplate
interfaces extending
+getID():String
+getType():int Persistable
WebObjectInfo
+getSubType():int interface
+getName():String ...web.objects.WebSearch
+getAbbreviation():String
+getDescription():String
+getCreationTime():String
+getModificationTime():String
+isHidden():boolean interface
+getAccessGranted():int ...web.objects.WebDimension
+getState():int
+getOwner():WebObjectInfo
+getPropertySets():WebPropertyGroup
+getAncestors():SimpleList interface
+getParent():WebFolder ...web.objects.WebAttribute

Persistable
interface
...microstrategy.web.objects.WebFilter * Many other objects
extend WebObjectInfo
+getFilterType():int
+getExpression():WebExpression
beyond those listed here.
2
Web Objects API – WebFolder

• WebFolder is one specific type of WebObjectInfo


• Find number of items in folder; whether folder is empty
WebDisplayUnit
interface
com.microstrategy.web.objects.WebObjectInfo

interface
0..*
1 • Determine types of objects
com.microstrategy.web.objects.WebFolder
in folder, whether folder is
+getFolderType():int
+getRoot():WebFolder
root
+findTypedObjects(types:int[]):WebFolder
+objectTypes():SimpleList
+isReadOnly():boolean
+add(newObject:WebObjectInfo):int
+add(newObject:WebObjectInfo,beforeKey:int):int
+add(newObject:WebObjectInfo,beforeObject:WebObjectInfo):int
+get(index:int):WebObjectInfo
+getItemByKey(key:int):WebObjectInfo
• Methods for adding or
+remove(index:int):void
+removeItemByKey(key:int):void
+remove(object:WebObjectInfo):void
removing items
+clear():void
+isEmpty():boolean (typically read-only)
+size():int
+containsKey(key:int):boolean
+contains(object:WebObjectInfo):boolean
+keyOf(object:WebObjectInfo):int
+elements():Enumeration
+isRoot():boolean
+isNamedFolder(folderName:int):boolean
2
Object Browsing – General Steps

1: Create an Instance of the Web Objects Factory


• Use the getInstance() method to create a starting point for using
the Web Objects API.

2: Create WebIServerSession and get Session ID


• This can be instantiated directly from the factory.
* Since the Server Session and factory have a 1:1 relationship, all
objects associated with this factory will automatically be tied to the
session.

3: Get the Root Folder from the WebObjectSource


• Store the results in a WebFolder
4: Loop thru Folder Contents & Output to screen
• Call getName() to output each object’s name.
2
Object Browsing – Code Sample
try {
//Create WebObjectsFactory
WebObjectsFactory factory = WebObjectsFactory.getInstance();
//Setup session, and trigger session creation
WebIServerSession session = factory.getIServerSession();
session.setServerName(“servername");
session.setServerPort(0);
session.setProjectName("MicroStrategy Tutorial");
session.setLogin("Administrator");
session.setPassword("");
  String sessionID = session.getSessionID();
//Obtain the object source, and get Root folder
WebObjectSource objSource = factory.getObjectSource();
WebFolder rootFolder = objSource.getRoot();

//Display the contents of the root folder


for(int i = 0; i < rootFolder.size(); i++) {
WebObjectInfo object = rootFolder.get(i);
out.println("Object Name: " + object.getName() + "; " + "Object Type: " + object.getType());
}
//Catch any errors
} catch(WebObjectsException woe) {
out.println("Unexpected error:" + woe.getErrorCode() + " Error Message: " + woe.getMessage());
}
2
Web Objects API – WebSearch

• Allows execution of a MicroStrategy object search.


interface Persistable
com.microstrategy.web.objects.WebObjectSource interface
com.microstrategy.web.objects.WebSearch

+getNewSearchObject():WebSearch
+getDomain():int
+setDomain(domain:int):void
+getMaxObjects():int
+setMaxObjects(maxObjects:int):void
+getNamePattern():String
+setNamePattern(namePattern:String):void
+getSearchOwner():String
+setSearchOwner(searchOwner:String):void
WebDisplayUnit +getSearchRoot():String
...web.objects.WebObjectInfo +setSearchRoot(searchRoot:String):void
+types():SimpleList
0..*
+usedBy():SimpleList
+uses():SimpleList
+submit():void
+submit(searchXML:String):void
1 +getStatus():int
+getSearchID():String
1 1 +setSearchID(searchID:String):void
...web.objects.WebFolder +isAsync():boolean
+setAsync(async:boolean):void
+getMaxWait():int
+setMaxWait(millis:int):void
+getPollingFrequency():int
+setPollingFrequency(millis:int):void
+getResults():WebFolder
+purge():void
+reset():void
2
Object Searching – General Steps

1: Create a WebSearch Object


• Call getNewSearchObject() from the ObjectSource object created earlier
2: Set Search Properties
• Type() method of WebSearch interface to retrieve the type of the object.
Also some more properties can be set by using setMaxObjects(),
setAsync() and so on methods
3: Submit Search Request and Get Results
• Calling getResults() returns a WebFolder that contains the resulting
objects
4: Loop thru Folder Contents & Output to screen
• The folder contents can be displayed to the screen like any ordinary folder’s
contents can be.
2
Object Searching – Code Sample

//Create WebSearch Object


WebSearch search = objSource.getNewSearchObject();
// Specify Search criteria
search.types().add(new Integer(EnumDSSXMLObjectTypes.DssXmlTypeAttribute));
 // Set other desired properties
search.setMaxObjects(10);
search.setAsync(false);
search.setMaxWait(120000); 
// Submit search to the Intelligence Server
search.submit();
 // Retrieve Search results and confirm that you have results
WebFolder results = search.getResults();
 if(search.getStatus() ==
EnumDSSXMLObjectSearchStatus.DssXmlObjectSearchStatusResultXML) {
for(int i = 0; i < results.size(); i++) {
WebObjectInfo object = results.get(i);
System.out.println("Object Name: " + object.getName() + "; " +
"Object Type: : " + object.getType());
}
}
2
Report Object Searching – General Steps

1: Search for a particular report


• WebobjectSource interface is the starting point for this operation
• setNamePattern() method of WebSearch interface is used to set
the name of the search

2: Set Search Flags


• Dictates the behavior of the search

3: Submit Search
• Result set of the search is retrieved and placed into a folder object
which is created using the WebFolder interface
2
Searching for a particular MicroStrategy Report

//Search for a particular report


WebObjectSource objectSource=factory.getObjectSource();
WebSearch webSearch=objectSource.getNewSearchObject();
webSearch.setNamePattern("Regional Sales by Year");
webSearch.setSearchFlags(EnumDSSXMLSearchFlags.DssXmlSearchNameWildCard+EnumDSS
XMLSearchFlags.DssXmlSearchRootRecursive);
webSearch.setAsync(false);
// Submit search to the Intelligence Server
try {
webSearch.submit();
      } catch (WebObjectsException ex) {}
        
WebFolder resultsFolder=null;
// Retrieve search results
try {
resultsFolder=webSearch.getResults();
      } catch (WebObjectsException ex) {}

// Assume that search returned results… 


WebObjectInfo reportObject=resultsFolder.get(0);
3

Web Beans API


3
Web Beans API – Overview

• The Web Beans API:


• Contains objects that represent key logical MicroStrategy data
elements such as a report, folder or prompt.
• It is through these interfaces that collection of object data and
manipulation of that object is performed in Web/Web Universal 8.

• Is a collection of interfaces
• Conforms to JavaBeans standard and provide methods for
JavaBeans instantiation and data collection
• Essentially a wrapper of the Web Objects API for convenient use
in a web programming environment

• Provides interfaces for simplified client data-rendering


(Transformable) and state management (Persistable).
3
Taking a Task-Focused Approach

• In this class, we will look at some core and


representative Web Beans.
• We will understand how Web Beans work by
examining the code for:
• Report execution
• Accessing the prompts
• We will learn how to create new beans to collect
custom data
3
Using the Web Beans API

• All objects in the Web Beans API are instantiated through the
singleton WebBeanFactory class
• Entry point to all Bean and other Transformable classes
• Static method: getInstance()
• Summary of important objects for understanding Web Bean
usage in and outside of Web/Web Universal 8:
• WebComponent
• WebBean
• ObjectBean
• ReportBean
• PromptsBean
3
WebBeanFactory
3
WebBean Interface

• This interface represents a generic WebBean. It


provides a common set of services for any of the
Web Beans. Some of the main features of this
interface includes:
• Session Information: Each Web Bean is supplied a
WebSessionInfo object which defines how the Web Bean interacts
with backend servers.
• Error Information: The top-level error from a Web Bean request
is stored in the WebBeanError object that is accessible from the
getErrorInfo method of a Web Bean.
3
The WebBean Interface and characteristics

• A WebBean is a WebComponent.
• Any class that is associated with a WebBean must implement the WebComponent
interface.
• Represent high-level GUI objects.

• In addition, it is Persistable and Transformable


• Have the ability to render themselves
• Generally stateful – State can be set or changed either through events or through
methods on the bean

RequestPersistable
...web.beans.WebComponent
WebComponent
Transformable
interface
com.microstrategy.web.beans.WebBean Persistable
...web.beans.Transformable ...web.beans.RequestPersistable

+getSessionInfo():WebSessionInfo
+setSessionInfo(sessionInfo:WebSessionInfo):void
+getErrorInfo():WebBeanError
+getDocument():Document
+isStale():boolean
+setStale(stale:boolean):void
com.microstrategy.web.beans.WebBean
3
The WebComponent Interface

• WebComponent objects are Java classes that have business logic and
can be plugged into the application as an abstraction of any component
in a Web application
• In Web/Web Universal 8, every page, bean, and frame element is a
web component. Page
Toolbar

Report
3
The WebComponent Interface

• WebComponent interface defines the following


functionality:
• Name information: Each WebComponent on a single
page should have a unique name
• Parent-Child relationship
• Event Handling
• State Synchronization
• State Serialization
• Rendering
3
The WebComponent Hierarchy
• Except for the root component, each individual WebComponent
has a single parent WebComponent.
• Therefore each WebComponent has a unique path from the root
to itself in a Web application.
Page

DrillEditorBean
FilterEditorBean
Etc…
ReportFrame
Bean

Page
ReportFrame
ReportBean
Bean

DrillEditor FilterEditor
Etc… ReportBean
Bean Bean
3
Using the WebComponent Interface

• Methods to build or manipulate a hierarchy of WebComponents


• Necessary to delegate responsibility or processing requests to
proper component
• Example: evt=2001&src=mstrWeb.shared.fb.2001
interface
com.microstrategy.web.beans.WebComponent

+getParent():WebComponent
+setParent(parent:WebComponent):void
+getRoot():WebComponent
+getChildCount():int
+getChildByType(childType:int):WebComponent
+getChild(key:String):WebComponent
+getChild(index:int):WebComponent
+searchChild(key:String):WebComponent
+addChild(key:String,child:WebComponent):void
+removeChild(key:String):WebComponent
+removeChild(component:WebComponent):WebComponent
3
Using the WebComponent: Supporting Events

• Methods to handle event-based requests


• Encapsulates every user request as a WebEvent.
• Event typically causes a change in the state of the component
• Events can be associated with event handlers to process these user
requests.

interface
com.microstrategy.web.beans.WebComponent

+getWebEvent(event:int):WebEvent
+getWebEvent(event:int,recurse:boolean):WebEvent
+handleRequest(keys:RequestKeys):boolean
+getWebEventHandler():WebEventHandler
+setWebEventHandler(handler:WebEventHandler):void
3
Supporting Events with the RequestKeys

• RequestKeys interface contains a collection of keys from the


request context.
• Each key is a name-value pair that originates from one of several different
sources such as the URL query string, form data, cookies, or session
variables.
• Important keys include event ID and event arguments
3
Using the WebComponent: Retrieving Data

• Methods for retrieving data and generating output:


• Output formats picked from EnumBeanOutputFormat enumeration:
interface interface
HTML,DHTML,Screen
com.microstrategy.web.beans.WebComponent com.microstrategy.web.beans.MarkupOutput

• collectData() triggers Intelligence


Server execution
+getOutputFormat():int +send(writer:Writer):void
+setOutputFormat(outputFormat:int):void +send(outStream:OutputStream):void
• generateOutput() sends
+generateOutput():MarkupOutput data to a +append(element:MarkupOutput):void
+collectData():void +append(element:String):void
MarkupOutput +append(element:byte[]):void
+append(element:Object):void
+getTextChunkAt(i:int):String
+getBinaryChunkAt(i:int):byte[]
interface +chunkCount():int
com.microstrategy.web.beans.WebComponent +getBinaryMode():boolean
+getContentType():String
+setContentType(contentType:String):void
+addHeader(key:String,value:String):void
+getOutputFormat():int
+getHeaderCount():int
+setOutputFormat(outputFormat:int):void
+getHeaderKey(i:int):String
+generateOutput():MarkupOutput
+getHeaderValue(key:String):String
+collectData():void
+getCopyAsString():String
3
WebBeans are Transformable

• A Transformable object has methods that support working with a


transforms layer to render itself
• Object can be associated with multiple transforms (via TransformInstance –
see next slide)
• Represents something that is capable of generating MarkupOutput
interface
com.microstrategy.web.beans.Transformable

RequestPersistable
WebComponent +getType():int
Transformable +addTransform(transform:Transform):TransformInstance
...web.beans.WebBean +addTransformByClass(transformClass:String):TransformInstance
+addTransformByStyle(styleName:String):TransformInstance
+hasTransform():boolean
+hasTransform(key:String):boolean
+getTransformInstance():TransformInstance
+getTransformInstance(key:String):TransformInstance
+transform():MarkupOutput
+transform(key:String):MarkupOutput
+getTransformInstances():Enumeration
+getBeanContext():BeanContext
+setBeanContext(beanContext:BeanContext):void
+getMessageString(key:String):String
3
Transformable Objects Employ Transforms
• Any object (WebComponent, WebBean) that is Transformable, can
employ a Transform.
• All Web/Web Universal 8 transform objects implement the Transform
interface.
com.microstrategy.web.beans.WebBean
• Transform applied RequestPersistable
as a TransformInstance – WebComponent
...web.beans.WebBean
enables multiple transforms 1
to be applied, each 0..*
0..* 1
uniquely identified ...Transformable
com.microstrategy.web. com.microstrategy.web.
by a key. ...TransformInstance
beans.TransformInstance beans.Transformable
1

* For instance, notice how 1


interface
one prompt can be displayed com.microstrategy.web.transform.Transform

in many different ways –


using different +transform(data:Transformable,transOut:MarkupOutput):void
+supports(data:Transformable):boolean
TransformInstances. +canTransform(data:Transformable):boolean
3
TransformInstance

// Create Report Bean and TransformInstances to be used later


WebBeanFactory factory = WebBeanFactory.getInstance();
ReportBean rb = factory.newReportBean();

TransformInstance ti1 = rb.addTransform


(new
com.microstrategy.web.app.transforms.ReportGridTransformImpl());
TransformInstance ti2 = rb.addTransform
(new mypackage.name.MySimpleTransformClass());

ti1.setKey(“grid");
ti2.setKey(“simple");
3
WebBeans are Persistable

• The Persistable interface represents objects that


are capable of serializing their states in string
representation and restoring it back.
• It has the following methods:
• saveState(): Yields a string that an application can
easily pass between components and pages.
• restoreState(): Restores the object’s state.
3
WebBeans are Persistable

• The RequestPersistable (extends Persistable) interface


provides state management capability
• Restored either from a string or from RequestKeys
• Example, an existing, defined ReportBean from one page can be
persisted into and used in another page.
interface
com.microstrategy.web.beans.RequestPersistable
WebC
Tra
...microstrategy.web.beans.
WebComponent
+restoreStateFromRequest(rk:RequestKeys):boolean
Transformable
* Warehouse data
+restoreStateFromRequest(rk:RequestKeys,keyName:String):boolean
...microstrategy.web.beans.
WebBean

is not saved –
collectData() must still interface
com.microstrategy.utils.serialization.Persistable
be called in order to
accumulate the results +saveState(howMuchState:int):String
+saveState():String
+restoreState(state:String):boolean
+saveState(buf:StringBuffer,howMuchState:int):void
+restoreState(parser:SAXSupport,uri:String,localName:String,qName:String,attrs:Attributes):boolean
3
Types of WebBeans

• Different types of MicroStrategy objects correspond to different


interfaces that extend WebBean.
• Bean creation varies by bean type but is generally of the following
form: com.microstrategy.web.beans.WebBean

//Create a FolderBean and a PromptsBean


WebBeanFactory factory =
WebBeanFactory.getInstance(); com.microstrategy.web.
beans.ObjectBean

FolderBean fb = factory. com.microstrategy.web.


beans.PromptsBean
newFolderBean();

ReportBean = factory.
newReportBean(); com.microstrategy.web. com.microstrategy.web.
beans.ReportBean beans.DocumentBean
3
Types of WebBeans

• We will look closer at the following beans:

• ReportBean – representing a MicroStrategy report


• PromptsBean – representing a collection of prompts

* Historically, most customizations are performed on these two beans


3
The ObjectBean

• Root object for FolderBean, ReportBean, and


RWBean (beans representing objects in the
metadata). interface
WebBean

com.microstrategy.web.beans.ObjectBean
• Property access
methods for all generic +getObjectName():String
+setObjectName(objectName:String):void
MSTR object properties +getObjectType():int
+setObjectType(objectType:int):void
(name, ID, type, etc.) +getObjectID():String
+setObjectID(objectID:String):void
+getObjectInfo():WebObjectInfo
+getParentID():String
+getParentFolderBean(name:String):FolderBean
* Exposes relevant +getFlags():int
+setFlags(flags:int):void
properties of underlying +getBlockBegin():int
+setBlockBegin(blockBegin:int):void
WebObjectSource +getBlockCount():int
+setBlockCount(blockCount:int):void
3
The ReportBean

• Base object for report execution


• Contains methods to access objects for report manipulation, prompt
answering, etc.

• The steps necessary to execute a report via the ReportBean:


• Creating the ReportBean
• Setting or Restoring State
• Setting Execution Properties
• Report Execution and Data Retrieval
• Saving State for later Restoration
• Rendering the data
3
The ReportBean: Setting State

• The second step in executing a report is to set or


restore its state.
• Setting report state occurs in one of 3 ways:
• Specify a report ID or name
ObjectBean
• Specify a interface
com.microstrategy.web.beans.ReportBean
template ID
and filter ID
+getMessageID():String
• Specify a +setMessageID(msgID:String):void
+getStateID():int
MessageID +setStateID(stateID:int):void
+setFilterID(filterID:String):void
(and optional +setTemplateID(templateID:String):void

state ID)
3
The ReportBean: Setting Execution Properties

• Once state has been provided, the report’s execution


properties can be set:
• Set execution flags
• Set result flags ObjectBean
interface
• Set view mode com.microstrategy.web.beans.ReportBean

+setMaxWait(millis:int):void
+setPollingFrequency(millis:int):void
+setUseCaches(useCaches:boolean):void
+setExpiration(hoursExpire:int):void
+setViewMode(viewMode:int):void
+setPromptsEventHandler(promptsEventHandler:WebEventHandler):void
+setExecutionFlags(executionFlags:int):void
+setResultFlags(resultFlags:int):void
3
ReportBean: Report Execution & Data Retrieval

• Many ways to access a report’s data, in addition to


calling collectData():
• WebReportInstance (from WebObjects API)
• WebReportData (from WebObjects API)
• ReportPageInfo interface
ObjectBean

• PromptsBean com.microstrategy.web.beans.ReportBean

+getReportInstance():WebReportInstance
+getReportData():WebReportData
+getWebGraph():WebGraph
+getReportPageInfo():ReportPageInfo
+getReportPageInfo(reportPageType:int):ReportPageInfo
+getPromptsBean():PromptsBean
3
The ReportBean: Saving State for Restoration

• Working with ReportBean usually alters bean state.


• To use this bean later, bean state must be saved.
• Amount of state saved depends on the input parameter (constant
from EnumWebPersistableState)

interface
com.microstrategy.utils.serialization.Persistable

+saveState(howMuchState:int):String
+saveState():String
+restoreState(state:String):boolean
+saveState(buf:StringBuffer,howMuchState:int):void
+restoreState(parser:SAXSupport,uri:String,localName:String,qName:String,attrs:Attributes):boolean
3
The ReportBean: Rendering Data

• The ReportBean extends Transformable interface.


• Data can be rendered using the
transform(TransformInstance) method.
• The transform() method results are stored in
MarkupOutput object.
• Send() method flushes the results out to the screen.
3
Using the ReportBean – Code Sample

• You want to understand what happens to the bean


behind the scenes when you execute a report
• The code on the following slide is an example of a
Java snippet on a JSP page
• It is very unlikely that you have to create and execute
any bean on a JSP page using Java
* In Web/Web Universal, beans are rendered using HTML tags that call the
underlying Java classes, and not Java snippets on the page
* Instead, you will use addons and event handlers to affect the lifecycle of the
bean; you may end up using code similar to the slides ahead to accomplish it
* Appendix A has exercises that use JSP snippets to execute, manipulate and
render a report and its prompt
3
Using the ReportBean – General Steps

1: Create the Bean


• Use the WebBeanFactory to create the ReportBean.
2: Set the SessionID & other Execution Values
• This can be done explicitly, or by restoring the state of a previously
defined bean whose state has been saved.

3: Collect and Store Transformed Data


• Execution request is made using the collectData() method.
• Data is rendered using transform(TransformInstance)
method.
• transform() method results are stored in MarkupOutput object.
4: Send Markup Output to Screen
• Call the MarkupOutput object’s send() method.
3
Using the ReportBean – Code Sample
//1. Create Report Bean and TransformInstances to be used later
WebBeanFactory factory = WebBeanFactory.getInstance();
ReportBean rb = factory.newReportBean();
TransformInstance ti1 = rb.addTransform
(new com.microstrategy. web.app.transforms.ReportGridTransformImpl());
TransformInstance ti2 = rb.addTransform
(new mypackage.name.MySimpleTransformClass());
ti1.setKey(“grid");
ti2.setKey(“simple");
//2. Set I-Server Session, and set bean state through arbitarary name
rb.setSessionInfo((WebSessionInfo)mySess);
rb.setName("MyReportBean");

//3. Specify report to be used by name or ID, and call collectData()


rb.setObjectID(“EB3CD5D14F4C8C77782AC0882C986B8D”);
rb.collectData();

//4. Render collected data


MarkupOutput mo = rb.transform("simple");
StringWriter sw = new StringWriter();
mo.send(sw);
out.println(sw.getBuffer().toString());
3
The PromptsBean

• Base object for handling prompts associated with a report


• Contains methods to access individual PromptObjects

• PromptObject provides access to WebPrompts collection and a


WebPrompt (from Web Objects API) for each prompt in the report
for handling all aspects of prompt answering and manipulation:
• Access to Prompt Name, Description, Type, Question, and Current/Default
Answer
• Access to Number of Prompts in a Report, Prompt XML, Minimum and
Maximum values for prompt answer
• Open or Close, Answer a Prompt, Continue Report Execution

• PromptsBean’s state is usually initialized from report:


PromptsBean pb = rb.getPromptsBean();
3
The PromptsBean: Access to PromptObjects

• Prompt and Data Access:


• Can iterate through different types of prompts (open, closed,
cancelled, required, etc.)
• Get or set the current prompt position
• Each Prompt in collection exposed as PromptObject
WebBean
interface
com.microstrategy.web.beans.PromptsBean

+getCount(typeOfPrompt:int):int
+getCurrentPromptPosition():int
+setCurrentPromptPosition(position:int):void
+getNextPromptPosition(type:int,startPos:int):int
+getNextPromptPosition(type:int):int
+getNextPromptPosition():int
+getPromptObject(position:int):PromptObject
+getPromptObject():PromptObject
+getPromptObjects(typeOfPrompt:int):Iterator
+addPromptsSource(promptSourceType:int):PromptsSource
+getPromptsSources():Iterator
+getPreviousPromptPosition(type:int,startPos:int):int
+getPreviousPromptPosition(type:int):int
+getPreviousPromptPosition():int
3
The PromptsBean: Access to WebPrompts

• PromptObject is a wrapper to underlying WebPrompt (from Web Objects


API) and adds:
interface
WebBean
• promptPosition
com.microstrategy.web.beans.PromptsBean
• reference to PromptsBean
+getPromptObject(position:int):PromptObject
+getPromptObject():PromptObject • highlighted objects
+getPromptObjects(typeOfPrompt:int):Iterator

1..*
Transformable
interface 1 1
com.microstrategy.web.beans.PromptObject WebObjectInfo
...objects.WebPrompt

+getPromptPosition():int
+getWebPrompt():WebPrompt
+getPromptsBean():PromptsBean
+getValidationInfo():WebBeanError
+setValidationInfo(wbe:WebBeanError):void
+getHighlightedObjects():HighlightedObjects
3
Using the PromptsBean – General Steps

1: Create the ReportBean and Set State


• Create a ReportBean and set its state as you did before.
2: Get PromptsBean from ReportBean
• Do this by using the getPromptsBean() method.
3: Add TranformInstance to PromptsBean
• Apply the TransformInstance to the PromptsBean rather than the
ReportBean

4: Create Markup Output by transforming


PromptsBean
• Call the MarkupOutput object’s send() method as before.
3
Using the PromptsBean – Code Sample

//This example uses a transform to render a prompt’s data

//1. Create Report Bean, set State and I-Server session as done before
rb.setObjectName("Prompt Report Example");

//2. Get PromptsBean, and associate a TransformInstance that supports a PromptsBean

PromptsBean pb = rb.getPromptsBean();
TransformInstance ti1 = pb.addTransform(new com.microstrategy.
web.app.transforms.PromptsClassicTransform());
ti1.setKey("prompt");

//3. Call collectData() and render data – be sure to transform the PromptsBean to
render the data returned by a prompt
rb.collectData();
MarkupOutput mo = pb.transform(“prompt");
StringWriter sw = new StringWriter();
mo.send(sw);
out.println(sw.getBuffer().toString());
3
Using the MicroStrategy Web APIs – Review

• The Web Objects and Web Beans APIs can be used


together to access core XML API functionality.
• The Web Objects API is an object-oriented way to access
the complete set of Web API functionality.
• You worked with Server Session Authentication, Object
Browsing/Searching
• The Web Beans API provides JavaBeans that represent
high-level MicroStrategy object concepts
• You worked with the ReportBean and PromptsBean
• You should be able to use the API reference to assist you in
learning and using more Web Objects and Web Beans than
you learned today.
3
Web Beans API - Exercise

• Sometimes you may need to create a custom bean and


integrate it with MicroStrategy Web
• Custom beans are responsible for collecting data either from
the MicroStrategy environment, or from third-party
applications and integrating it with MicroStrategy BI data
• Examples:
• Exercise – the StatisticsBean – gives administrators access to the
latest Intelligence Server statistics, such as number of executing
reports etc.
• Last Data Warehouse update timestamp (on top of, for instance, the
Last Report Cache update stamp on report execution page) – gives
users the ability to compare whether the warehouse and/or report
data is up to date; if the report cache needs to be updated (useful if
accessing reports from the History List), etc.
4

Customizing Transforms
4
Web 8 Query Flow – Data Formatting

Web server

Load page Pre execution Data Data


collection Formatting

Identify Custom
page logic Transform
beans
Load page
Execute Collect
definition
Client events data Arrange
content
Bean Custom
instances logic
created

Customizable
component
4
The Transform Infrastructure Package

• Transform-related classes are packaged in


com.microstrategy.web.transform
• Objects include:
• StyleCatalogFactory / StyleCatalog
• Transforms / Transform
• FormalParameters / FormalParameter
• TransformDefns / TransformDefn
• BeanDefns / BeanDefn
• Styles / Style
• ActualParameters / ActualParameter
• Objects are useful to varying degrees depending
upon the task you wish to accomplish.
4
Modifying Component HTML: Using transforms

Data from bean

Transform HTML output

Formal parameter values

Style

• Transforms take data from the Intelligence Server and convert it


into an output format (HTML, WML)
• They also expose formal parameters that allow the behavior of
the transform to be modified
• A style is the combination of a transform plus the values of the
formal parameters
4
Infrastructure Package

• Custom Transform uses Transform, FormalParameters


and FormalParameter
• Transform interface contains properties and methods common to all
transform class implementations
• Transform has the ability to define formal parameters whose actual
values can be set by the style designer.
• Example of the style definition in styleCatalog.xml (combination of
Transform and FormalParameters):
<Style description="Style: …" name="OMDBrowserStyle"
transform="ObjectBrowserTabOMDTransform">
<ActualParameters>
<ActualParameter name="createForm" type="4" value="false"/>
<ActualParameter name="iframeEnabled" type="4" value="true"/>
<ActualParameter name="editorElements" type="2" value="112"/>
</ActualParameters>
</Style>
Transform Employment by Transformable Web 4
Beans
• Transforms are employed by any object that is
Transformable – generally a WebBean.

• The TransformInstance is the bridge between the Transform-related


classes and Transformable
objects (i.e. Web Beans). com.microstrategy.web.beans.WebBean

RequestPersistable
WebComponent
...web.beans.WebBean

• The goal for your 1

custom transform is 0..*


0..* 1
...Transformable
for it to be usable by com.microstrategy.web. com.microstrategy.web.
...TransformInstance
a specific type of beans.TransformInstance beans.Transformable

WebBean. 1

1
interface
com.microstrategy.web.transform.Transform

+transform(data:Transformable,transOut:MarkupOutput):void
+supports(data:Transformable):boolean
+canTransform(data:Transformable):boolean
4
Transform Interface and AbstractTransform Class

• Transform and AbstractTransform contain methods shared


by all transforms for:
• Accessing formal parameters
• Determining component support
interface
Transform 1 1 interface
FormalParameters

+getDescription():String
+getFormalParams():FormalParameters
+isResolved():boolean interface
+isPreviewAvailable():boolean com.microstrategy.web.beans.Transformable
+getPreview():MarkupOutput
+transform(data:Transformable,transOut:MarkupOutput):void
+getSupportedBeanType():Class
+supports(data:Transformable):boolean interface
+supports(beanClass:Class):boolean com.microstrategy.web.beans.MarkupOutput
+canTransform(data:Transformable):boolean

Class
AbstractTransform

+addFormalParam(FormalParameterImpl formal)
4
FormalParameters and FormalParameter Interfaces

• The FormalParameters interface provides access to formal


parameter (FormalParameter) creation and use.
interface
FormalParameters
interface
1 1
Transform
+getCount():int
+getFormalParameter(index:int):FormalParameter
+getFormalParameter(name:String):FormalParameter
+containsFormalParameter(name:String):boolean interface
FormalParameter

+PARAM_TYPE_UNKNOWN:int=0
+PARAM_TYPE_STRING:int=1
+PARAM_TYPE_INTEGER:int=2
interface interface +PARAM_TYPE_FLOAT:int=3
Transform 1 1 FormalParameters 1 1..* +PARAM_TYPE_BOOLEAN:int=4

+getName():String
+getType():int
+paramTypeToString(paramType:int):String
+getDescription():String
+isRequired():boolean
+getDefaultValue():Object
* Lifetime of the FormalParameters object +getValue():Object
+setValue(value:Object):void
coincides with the transform object +checkValue(value:Object):void
4
Implementation Package

• Specific implementations of transforms ship with


Web Universal and are packaged in:
com.microstrategy.web.app.transforms
• Objects include a number of specialized abstract
classes and many concrete classes:
• AbstractAppTransform

• AbstractReportTransform,AbstractFolderTransform,
AbstractPromptObjectTransform, Other abstract classes…

• ReportGridTransformImpl, ReportGraphTransformImpl,
FolderViewTransform, Other concrete classes…
4
AbstractAppTransform

• This is an abstract class that acts


as the parent of all Transforms:
• Defines set of parameters common to all
transforms.
• cssName, cssPrefix
• Implements methods to initialize the
transforms, images, css classes and other
transform fields
• Provides convenient methods to get
descriptors, add formal parameters, check
for features and get resource folders.
• Only transformForRequest
Successful() method abstract
4
transformForRequestSuccessful()

• transformForRequestSuccessful() is responsible for rendering final


output to the client.
• Implemented differently by each transform class.
This is a sample GUI interface for report grid in design mode: ReportDesignModeTransformImpl
transformForRequestSuccessful(MarkupOutput out)
renderDesignMode(MarkupOutput out, ArrayList cachedObjects) 
    renderEmptyTemplate(mo, rb); 
         renderTemplate(mo, rb, cachedObjects); 
        renderRowAxis(mo, rb, rowAxis, cachedObjects); 
renderDummyData(mo, rb);

This is a sample GUI interface for report grid in execute mode. 


transformForRequestSuccessful(MarkupOutput out)
renderExecuteMode(MarkupOutput out, ArrayList
cachedObjects)
    renderOutlineModeLevels(mo, rb, cachedObjects) ReportGridTransformImpl
renderIncreFetchOnColumnLeftPart(mo, rb);
renderReportGrid(mo, rb, cachedObjects);
generatePreHTMLForResizeColumns(mo);
    generateReportGridTable(mo, rb, true, true);
    renderLayout(mo, rb, cachedObjects, true, true, true);
renderRowTitles(mo, rb, rowTitles, cachedObjects);
        renderRowTitlesAccessibility(mo, rb, rowTitles,
cachedObjects);
    renderColHeaders(mo, rb, colHeaders,
cachedObjects, colTitles.size());    
    renderOutlineModeData(mo, rb, cachedObjects, true);
    renderData(mo, rb, cachedObjects, true);
renderIncreFetchOnColumnRightPart(mo, rb);
4
Abstract Transform Class Groups

• There are many derived abstract classes that are used by


different bean types.
AbstractTransform

AbstractAppTransform AbstractPromptObject
Transform

PromptsClassicTransform
AbstractReportTransform AbstractFolderTransform
PromptsSummaryTransform

ReportFrameClassic
ReportGridTransformImpl FolderViewTransform Transform
ReportGraphTransformImpl FolderDetailsTransform
ReportPageByTransform FolderPathTransform
... FolderBulletTransform
...
4
AbstractReportTransform
interface AbstractTranform

• Many derived classes


Transform
AbstractAppTransform

work together to render ReportExportPlainTextTransform


AbstractReportTransform
ReportPagebyInfoTransform

report data
ReportIncrementalFetchTransform

ReportExportHTMLTransform
ReportToolbarTransform

• ReportDataTransform
ReportDetailsTransform
ReportQuickLinksTransform

ReportSavePropertiesTransform
ReportGraphImageTransform

provides access to AbstractReportDataTransform


ReportGraphTransformImpl

incremental fetch,
interface
ReportDataTransform

drilling, and other AbstractReportGridTrasnform ReportGridGraphTransformImpl

report grid GUI


ReportPageByTransform ReportGridTransformImpl ReportDesignModeTransformImpl

functionality
ReportOutlinModeTransformImpl
4
AbstractFolderTransform

• The AbstractFolderTransform
contains many child transforms
• However, only one derived class – FolderViewTransform
– is used to render both the Icon View and the List View
on the Shared Report and My Reports pages
4
ReportFrameClassicTransform
COMPONENT_DESIGN_MODE_BUTTONS renderDesign
ModeProcessForm
COMPONENT_PAGE_BY
• Extends AbstractAppTransform renderTemplateEditor

COMPONENT_REPORT_DATA

• Responsible for rendering all


beans in ReportFrameBean COMPONENT_OBJECT_BROWSER

• Supports COMPONENT_DESIGN_MODE_BUTTONS
COMPONENT_REPORT_FILTER
renderDesign
ModeProcessForm

• Design or Execute mode COMPONENT_VIEW_FILTER


renderTemplateEditor
• Presence or absence of COMPONENT_OBJECT_BROWSER

standard report-related beans


renderMenus
• HTML or DHTML mode
COMPONENT_REPORT_MENUS

COMPONENT_VIEW_FILTER generateDesignMode()
COMPONENT_GRID_TOOLBAR renderReportElements
COMPONENT_PAGE_BY
COMPONENT_REPORT_TOOLBAR

renderGrid

COMPONENT_MESSAGE_BEFORE_DATA
COMPONENT_OBJECT_BROWSER

COMPONENT_REPORT_DATA
generateExecuteMode()
4
What does Extending a Transform Mean

• Transforms allows object oriented techniques to extend and override features of existing
transform

FolderViewTransform
renderList CustomFolderViewTransform
renderFolderName
extends FolderViewTransform
renderModificationInfo
renderFolderName
renderDescriptionInfo

• A class that extends a transform will inherit all the


formatting
• Override the methods you want changed in the output
• Look for ‘renderXYZ’ methods – they render areas
4
Modify an Existing Transform
Case study: Add a summary of the prompt answer to the report title

To modify a transform:
1. Extend the existing transform, override the render methods that you want
to replace
2. Add a new style in the style catalog that defines the style name and any
formal parameter values
3. Replace the web component with the new style name
4
Rendering The Report Grid and Prompts

• Rendering the Report Grid


• Become familiar with the different parts of the report grid.
• Once you understand how a report grid is structured, it will be easy to
identify the relevant classes or methods that need to be modified to
achieve your customization.

• Rendering Prompts
• Understand the modifications required for customizing the data
presentation in a prompt.
• Rendering prompts in MicroStrategy Web products involves two parts:
• Rendering of the PromptsBean (using PromptsClassicTransform)
• Rendering of each individual prompt question
4
Rendering The Report Grid

• A report grid is composed of two main components: Report Headers


and Report Data.
• ReportGridTransformImpl, is the transform applied to all report grids, by default. It
calls series of nested methods in its transformForRequestsuccessful() method.
4
Report Headers

• The Report Headers section of the grid is full of


titles and columns as shown in the figure below:

• renderRowTitles()
• renderRowTitle()
• renderColumnTitle()
• renderColumnHeaders()
• renderColumnHeader()
4
Report Data

• The Report Data section is rendered through the


cooperation of many methods:

• renderGridData()
• renderSingleRow()
• renderRowHeaders()
• renderRowHeader()
• renderMetricValues()
• renderMetricValue()
4
Cell Rendering Classes

• Cell rendering task is then delegated to the appropriate


transform class:
Example: Display Report Cell Contents as Preformatted 4
Text

• Extend ReportGridCellRowHeaderImpl
4
Simple Code Sample: Report Transform

• On rare occasions you will have to extend the


AbstractTransform to achieve your goal
4
Simple Code Sample: Report Transform

package mypackage.name;
import com.microstrategy.web.beans.*;
import com.microstrategy.web.objects.*;
import com.microstrategy.web.transform.*;
import com.microstrategy.webapi.*;
import java.io.*;

public class MySimpleTransformClass extends AbstractTransform{

//Custom Formal Parameter Definiton


private FormalParameterImpl fontNameParam;

//Set Values in Constructor


public MySimpleTransformClass() {
fontNameParam = new FormalParameterImpl("fontName",
FormalParameter.PARAM_TYPE_STRING);
fontNameParam.setRequired(true);
fontNameParam.setDescription("This is the font name
to use in rendering my transform");
addFormalParam(fontNameParam);
}
//Conclusion of this sample on next slide
}
Simple Code Sample: Report Transform 4
(continued)
//Imports indicated on previous slide
public class MySimpleTransformClass extends AbstractTransform{
//Formal Parameter definition sample code on previous slide
public String getDescription() {
return “My simple transform class to display basic report info";
}
public void transform(Transformable t, MarkupOutput out) {
try{
ReportBean rb = (ReportBean)t;
WebObjectInfo woi = rb.getObjectInfo();
out.append(“<p style='font-family:” + fontNameParam.getValue()+ “’<br>")
out.append("Report Name= " + woi.getName() + "<br>");
out.append("Report Owner= " + woi.getOwner() + "<br>");
out.append("Report Desc= " +woi.getDescription()+ "<br>");
out.append("</p>")
} catch (Exception e){
out.append("Report Execution error " +e.getMessage());
}
}
public Class getSupportedBeanType() {
return ReportBean.class;
}
}
4
Rendering Prompts

• PromptsClassicTransform is the default transform


used to render a
collection of prompt
questions
(PromptsBean)
4
Rendering Prompts

• AbstractPromptObjectTransform is the superclass that is


responsible for rendering any individual prompt
(PromptObject)
4
Example: Extending PromptsClassicTransform
4
Example of Prompt Customization
4
Simple Code Sample: Prompts Transform

• On rare occasions you will have to extend the


AbstractTransform to achieve your goal (if existing
transforms do not meet your needs)
4
Simple Code Sample: Prompts Transform

package mypackage.name;
import com.microstrategy.web.beans.*;
import com.microstrategy.web.objects.*;
import com.microstrategy.web.transform.*;
import com.microstrategy.webapi.*;
import java.io.*;

public class SimplePromptTransform extends AbstractTransform{


public String getDescription() {
return “This transform outputs to the screen the current prompt answer for a constant prompt”;
}
public void transform(Transformable parm1, MarkupOutput out) {
try{
PromptsBean pb = (PromptsBean)parm1;
Iterator i = pb.getPromptObjects( EnumPromptsBeanTypes.PromptsBeanTypeOpen);
while(i.hasNext()){
PromptObject po = (PromptObject)i.next();
renderPrompt(po,out);
} This function is
} catch (Exception e){ described on
out.append("Execution ends in error " + e.getMessage()); next slide
}
}
public Class getSupportedBeanType() {
return PromptsBean.class;
}
}
4
Simple Code Sample: Prompts Transform (cont)

private void renderPrompt(PromptObject po, MarkupOutput out) throws Exception{


int pos = po.getPromptPosition();
out.append("Rendering prompt at position " + pos + "\n");
WebPrompt wp = po.getWebPrompt();
switch (wp.getPromptType()){
case EnumWebPromptType.WebPromptTypeConstant:
String ans = ((WebConstantPrompt)wp).getAnswer();
out.append("The current answer is " + ans + "\n");
break;
default:
out.append("The prompt type " + wp.getPromptType() + " is not supporter \n");
}
}

You might also like