Introduction

This document provides the introduction of packages for customizing Business Objects Enterprise XI 3.1 i.e. Business Objects Enterprise SDK and Report Engine SDK.


Business Objects Enterprise SDK

Business Objects Enterprise SDK is a platform package and framework of servers that facilities distribution of reports. The functionalities of Business Objects Enterprise can be accessed by Web applications through APIs. It provides platform functions of the Business Objects servers and document scheduling.


Report Engine SDK

Report Engine SDK is a component of Business Objects Enterprise SDK. It is used to create, view or modify Web Intelligence documents. It should be used in integration with Business Objects Enterprise SDK in order to view or modify Web Intelligence documents. Report Engine Server provides this report modification services .Any API interfaces like Java, .NET, etc. can be used to view web portals that access the back-end Business Objects Enterprise server.


Setting up Development Environment

The Development Environment need not have to be on same machine as the Business Objects Enterprise. But it is necessary to connect to running Business Objects Enterprise server.

We will be using Report Engine Java environment. For Java environment we will be using Eclipse IDE.

Eclipse IDE (Integrated Development Environment) is an open development platform which provides a universal toolset for application development. Application server Apache Tomcat will be needed and Java development kit (JDK) should be installed on machine.

In Eclipse, developer should create a dynamic web project in which JSP files, images, WEB-INF, lib, classes, etc. will be predefined.


Developing Web Application using Report Engine SDK in Java

The first step to develop any web application is to create Business Objects Enterprise session. The application should gather login details from the user and sends these details to another page which will use Business Objects Enterprise SDK to open session. Each page that uses Business Object Enterprise SDK must create or reference an IEnterpriseSession and IInfoStore object. 

Developer should add all the libraries in the WEB-INF\lib directory of JSP project.

On every page that uses Business Objects Enterprise SDK, developer will have to import some packages. The following line of code should be added on every such page.

<%@ page import=“com.businessobjects.rebean.wi.DocumentInstance,

com.businessobjects.rebean.wi.ReportEngine,

com.businessobjects.rebean.wi.ReportEngines,

com.crystaldecisions.sdk.exception.SDKException,

com.crystaldecisions.sdk.framework.CrystalEnterprise,

com.crystaldecisions.sdk.framework.IEnterpriseSession,

com.crystaldecisions.sdk.framework.ISessionMgr,

com.crystaldecisions.sdk.occa.infostore.IInfoObject,

com.crystaldecisions.sdk.occa.infostore.IInfoObjects,

com.crystaldecisions.sdk.occa.infostore.IInfoStore”%>

Creating a new user Session

“ISessionMgr” is used to log into BusinessObjects Enterprise server. It is used to create the session.”IEnterpriseSession” object stores the information of session. Session information is returned by logon method called by “ISessionMgr” object.

To create a session for a user, following four things would be needed.

  1. 1.    Username
  2. 2.    Password
  3. 3.    Central Management System(CMS)
  4. 4.    Authentication Type ( Enterprise ,LDAP, winAD)

Developer will develop one jsp page to get the user login details such as Username, Password, CMS and authentication type. On submitting the form, the values will be passed to another page through query string for further processing. For example:- The following code we used to develop index.jsp page.

If user enters wrong username, password, CMS and authentication type then error message will be shown on the same page showing message Try Again.!! The following code written on validate.jsp page can be used to reflect the error message on index.jsp page.

Closing Business Object Enterprise Session.

Developer will have to use IEnterpriseSession.logoff() to close the session.

Closing a session is important in the following ways:-

  1. 1)    It frees the resource held by the user.
  2. 2)    It helps other users to start their own sessions.


Accessing InfoView user preferences.

Users can set the Report Engine viewing options in the preferences page in Business Objects Enterprise SDK. With Business Objects Enterprise SDK user can get, set and add new preferences in the user`s profile.

Users can set the Report Engine viewing options in the preferences page in Business Objects Enterprise SDK. With Business Objects Enterprise SDK user can get, set and add new preferences in the user`s profile.

Variable Name

Possible Values

Meaning

Webi_view

Webi_panel

P,I,H

Java,HTML

View documents in PDF Format, Interactive format, DHTML format

Create documents using java report panel, html report panel

Printing user’s preferences

<%!

//returns a string containing a user’s web intelligence preferences

String getWebiPrefs(IInfostore iStore,int uId){

String prefs=” “;

String sQuery=”SI_ID, SI_NAME,SI_DATAFROM”+” CI_SYSTEMOBJECTS where SI_ID=” ‘”+”

UiD” ‘”;

IInfoObjects users=null;

try{

users=iStore.query(sQuery);

if(users.size()>0){

Iuser user=(Iuser)users.Iterator.next();

Prefs=user.getProfileString(“desktopsettings”);

}

}

catch(SDKException ***){

return “”;

}

return prefs;

}

//convert a string of preferences to map

Map webiPrefsToMap(String prefs){

StringTokenizer st= new StringTokenizer(prefs,”&”);

Map webiPrefs =null;

While(st.hasMoreTokens()){

String s2=st.nextToken();

StringTokenizer st2=new Stringtokenizer(s2,”=”);

If(st2.countTokens()==2)

  1. webiPrefs.put(st2.nextToken(),st2.nextToken());

Printing BuisnessObjects Enterprise preferences to an HTML stream

<%

int userID=myEnterpriseSession.getUserInfo.getUserID();

PrintWriter myWriter=response.getWriter();

String prefs=getWebiPrefs(myIInfoStore,userID);

Map prefsMap=webiPrefsToMap(prefs);

if(prefsMap!=null){

Iterator it =prefsMap.entrySet.iterator();

While(it.hasNext()){

  1. Map.Entry current=(Map.Entry)it.next();
  2. myWriter.print(current.getKey() + “=” + current.getValue() +”<br>”):

}

}
%>

}

return webiPrefs;

}

%>

Working with Report Engine SDK

All applications that view, refresh, edit or save Web Intelligence documents must:

  1. 1. Reference Report Engine SDK.
  2. 2. Retrieve the Report Engines service.
  3. 3. Retrieve the Report Engine instance.
  4. 4. Close the Report Engine object.

To access Report Engine SDK functions, developer needs to reference Report Engine packages. Developer must reference REBean if the web application uses J2EE. Developer must import the ReBean package in every JSP page through the following line of code.

<%@ page import= “com.businessobjects.rebean.wi.*”%>


Creating a Report Engine object

The ReportEngines object can be retrieved from user IEnterpriseSession to create the Report Engine Object. In this way, Report Engine instance can be retrieved to open Web Intelligence documents. Following lines of code has to be added for instantiating the Report Engine object.

ISessionMgr mySessionMgr = CrystalEnterprise.getSession

Mgr();

enterpriseSession =

  1. mySessionMgr.logon(userID,password,CMS,auth);

if (enterpriseSession != null)

{

ILogonTokenMgr iLManager =

  1. enterpriseSession.getLogonTokenMgr() ;

ReportEngines repEngines = (ReportEngines)

  1. enterpriseSession.getService(“ReportEngines”);

ReportEngine widocRepEngine =

(ReportEngine)repEngines.getService(

  1. ReportEngines.ReportEngineType.WI_REPORT_ENGINE);
  2. session.setAttribute(“widReportEngine”, widocRe

pEngine);

}

Closing a ReportEngines Object

Developer must close ReportEngines instance to close the Business Objects Enterprise session. ReportEngines.close() statement can be used to close the ReportEngines instance. This will deallocate the memory assigned to object and it must be called before you call IEnterpriseSession.logoff().


Document Management

This section includes how to open, view and list the documents. The type of document we will discuss here will be Web Intelligence documents. By Report Engine SDK developer can do everything like viewing documents in DHTML,PDF,XML,etc format or refresh, open, create ,or delete documents.

We can open a document in two ways-

  1. 1. By getting Document Id.
  2. 2. By using storage token.

Opening Documents

Steps to be followed in opening the document.

  1. 1.    Firstly, Business Object Enterprise session for the user is established.
  2. 2.    Identifier for the document is taken into account – This identifier can be document`s Id or storage token.
  3. 3.    To open the document, Report Engine instance is retrieved.
  4. 4.    Statement ReportEngine.openDocument can be used to open Web Intelligence document.

Displaying document

To display documents, following steps are followed

  1. 1.    IInfoObjects representing the root directory of the user`s documents can be retrieved through the use of the statement IInfoStore.query method.
  2. 2.    IInfoObject list can be iterated and values of fields in each row can be printed.

IInfoObject is the base of the BusinessObjects Enterprise type. IInfoObject can store any type of object in CMS. The following code can be written on “conn.jsp” page

Document State: Storage Tokens

Storage Token represents the state of a document at particular stage, each time a document is edited. For E.g.: Document state changes when the document is refreshed .

Report Engine SDK generates a storage token: when you open a document.

: When micro cube content s are modified or formatted.

Document management also includes features such as saving and scheduling documents.

Saving and Scheduling Documents

To save a document to Central Management Server-use DocumentInstance.save

<%

DocumentInstance docu=myReportEngine.openDocument (docId);

String docToken docu.getStorageToken ();

//User will perform actions on document docu

//open the first version of document and save

DocumentInstance docuToSave=theReportEngines.getDocumentFromStorageToken (docToken);

  1. docuToSave.save();

%>

Scheduling refreshes a document automatically at a specified time or times.

To schedule a document:

  1. 1. Query the IInfostore to get the IInfoObject representing the specific document.
  2. 2. Get the document’s ISchedulingInfo object.
  3. 3. Set the type and frequency of the scheduling.
  4. 4. Use the IInfostore to schedule the document

Creating Documents

First we should establish connection with the CMS and initialize the report engine, then perform CMS query to find universe eFashion (It is assumed that universe exists).

IInfoStore istore= (IInfostore) enterpriseSession.getservice (“Infostore”);

String uQuery=”select * from CI_APPOBJECTS where SI_KIND=”Universe”+

“and SI_NAME=”eFashion”;

IInfoObjects infoObjects= (IInfoObjects) istore.query(uQuery);

IInfoObject infoObject= (IInfoObject) infoObjects.get(0);

//we create a new document

DocumentInstance documentInstance=repEngine.newDocument (“UnivCUID=”+infoObject.getCUID());

//Then we initialize some helper variables

DataProviders dp=documentIstance.getDataProviders();

DataProvider da=dp.getItem(0);

Query query=da.getQuery();

DataSource ds=da.getDataSource();

//Add a couple of objects available in data source (Service, Revenue)

DataSourceObjects objectss=ds.getClasses();

  1. query.addResultObject(objectss.getChildByName(“Service”);
  2. query.addResultObject(objectss.getChildByName(“Revenue”);

//Add the condition (Country=”UK”)

ConditionContainer container1=query.createCondition(LogicalOperator.AND);

ConditionObject conditionObjectt=container1.createConditionObject (objectss.getChildByName(“Country”));

FilterCondition filterConditionn=conditionObjectt.createFilterCondition (operator.EQUAL);

  1. filterConditionn.createFilterConditionConstant(“UK”);
  2. da.runQuery();

//Final step is to save the document to a folder. Function used for that is

  1. DocumentInstance.saveAs(title, int destinationFolderId,categories,personalCategories,overwrite)

//we need to find the destination folder id

String folderQueryy=”select * from CI_INFOOBJECTS where SI_KIND=’Folder’ ”+” and SI_NAME=’Infy_Training’ “;

infoObjects= (IInfoObjects)infoStore.query(folderQueryy);

infoObject=(IInfoObject)infoObjects.get(0);

int folderId=infoObject.getID();

//Now,we can save the document with title “Sample”.

  1. documentInstance.saveAs(“Sample”,folderId,null,null,true);
  2. documentInstance.closeDocument();

Handling Prompts

Prompts are the way to get supplementary into a query before executing it.In ReportEngineSDK, the way you handle prompts depends on type of document you are working.

Prompts are raised when a document is refreshed using DocumentInstance.refresh.The refresh operation executes the query and therefore needs to collect the supplementary information that resolves filters and contexts.

Handling a single and simple prompt

“Simple Prompt “ means standard,text-entry prompts only

DocumentInstance doc=reportEngines.getServiceFromStorageToken(Token):

If(doRefresh) doc.refresh();//refresh first time only

Prompts prompts=doc.getPrompts();

//try to enter value and set prompts

String [] values=request.getParameterValues(“PromptsInput”):

If((values !=null)&&(!(values[0].equals(“”)))){

  1. prompts.getItem(0).entervalues(values);
  2. doc.setPrompts();

//also sets getMustFillPrompts to false

}

//get user input

If(doc.getMustFillPrompts()){

//build a form to get user input for the prompt

%>

<formname=”PromptsForm” action=refresh.jsp?=Token=<%doc.getStorageToken()%>” method=”post”>

<input name=”PromptInput” type=”text” />

<input name=”Submit” type=”submit” value=”ok” />

</form>

<%

}

  1. Response.sendRedirect(“view.jsp?Token=”+doc.getStorageToken());

Best Practices to improve ReportEngine performance

While working with ReportEngine SDK , following best practices recommended by Business Objects should be used.

  1. 1.    As long as the session lasts, user can open, view and edit the documents. As a result many documents opened together will significantly occupy heap memory on server. Developer should close the document explicitly when no longer required by using the statement DocumentInstance.closeDocument()
  2. 2.    It is recommended to store the ReportEngines object in the session object. Report Engine object can be retrieved through session object.


Please do not forget to share your comments and feedback.

Thanks in advance. 

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply