READ ME – THEN DELETE SLIDE

Download Report

Transcript READ ME – THEN DELETE SLIDE

Changing InfoView
without
Changing InfoView
Matthias Nott, Business Objects
Introduction
Who I am
Matthias Nott,
Business Objects Service Line Leader for Products, EMEA
What is this all about
Changing InfoView without Changing InfoView?
What I want you to do
If you are not a Technical Person:
Understand what Technical Persons can do for you easily
If you are a Technical Person: Understand everything
If you don‘t know... Choose a side 
What I want you not to do
Take Notes
Answer your Phone
SLIDE 3
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Topics
Introduction
What is BOInterface?
What is a Servlet Filter?
What is going on in InfoView?
What is a Regular Expression?
Visual Modifications to InfoView
Functional Modifications to InfoView
Functional Modifications to the Report Applet
Overview of the Rich Client
Q&A
SLIDE 4
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
What Is BOInterface?
SDK library that greatly simplifies using the SDK
You do not have to worry about document types
Most common SDK tasks 1 line of code
Does not limit you, it helps you
Helps you to employ best practices on your projects
Based on 5 years of development
More than 35,000 lines of code behind the scenes
Actively used by customers worldwide
Consulting solution
Ask your account manager
Ask local professional services contact
Ask me [email protected]
SLIDE 5
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
What Is BOInterface?
SLIDE 6
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
What Is BOInterface?
SLIDE 7
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Topics
Introduction
What is BOInterface?
What is a Servlet Filter?
What is going on in InfoView?
What is a Regular Expression?
Visual Modifications to InfoView
Functional Modifications to InfoView
Functional Modifications to the Report Applet
Overview of the Rich Client
Q&A
SLIDE 8
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
What is a Servlet Filter?
Java Code sitting between the Client and the End Point
Can filter multiple End Points
Multiple Filters can be stacked
Registered through web.xml
No Code Change required!
Can modify:
Request variables
Header variables
Cookies
Page/Session/Application Beans
Initialisation Parameters
...and the entire Response!
SLIDE 9
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
What is a Servlet Filter?
Sample Servlet Filter Declaration for web.xml
<filter>
<filter-name>Name of the Filter</filter-name>
<filter-class>com.bo....</filter-class>
<init-param>
<param-name>debug</param-name>
<param-value>false</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Name of the Filter</filter-name>
<url-pattern>/InfoView/main/headerPlus.do</url-pattern>
</filter-mapping>
SLIDE 10
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Topics
Introduction
What is BOInterface?
What is a Servlet Filter?
What is going on in InfoView?
What is a Regular Expression?
Visual Modifications to InfoView
Functional Modifications to InfoView
Functional Modifications to the Report Applet
Overview of the Rich Client
Q&A
SLIDE 11
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
What is going on in InfoView?
Find out with a Servlet Filter!
<filter>
<filter-name>RequestAnalyzer</filter-name>
<filterclass>com.bo.bointerface.tools.http.HttpRequestAnalyzer</filter
-class>
<init-param>
<param-name>init</param-name>
<param-value>false</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>RequestAnalyzer</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
SLIDE 12
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
What is going on in InfoView?
-----------------------------------------[http://linux:9090/businessobjects/enterprise115/desktoplaunch/InfoView/main/navWork.do]
-----------------------------------------Header Data: Fri Apr 13 22:23:02 CEST 2007
-----------------------------------------par: temp [java.lang.String]=1176495784473
-----------------------------------------hdr: accept [java.lang.String]=text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
hdr: host [java.lang.String]=linux:9090
hdr: user-agent [java.lang.String]=Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20061201 Firefox/2.0.0.3 (Ubuntu-feisty)
-----------------------------------------coo: CE_LastAps [java.lang.String]=linux:6400
coo: CE_LastAuthType [java.lang.String]=secEnterprise
coo: CE_LastUser [java.lang.String]=Administrator
coo: CE_LogonToken [java.lang.String]=LINUX@25378JBCl8HYL8NgXIpeb25376JFUZkV8pIHsLKLCx
coo: JSESSIONID [java.lang.String]=AAC57380EC0701D7DE5BD2821EEA22D9
-----------------------------------------ses: CE_ENTERPRISESESSION
[com.crystaldecisions.sdk.framework.internal.b]=(EnterpriseSession:logon=(SecuritySession:userInfo=(UserInfo:
username=Administrator,userID=12,userDesc=AdministratorKonto,auth=token),
apsName=LINUX,userURI=osca:iiop://LINUX;SI_SESSIONID=25402JLaVCP
ses: javax.servlet.jsp.jstl.fmt.request.charset [java.lang.String]=utf-8
ses: org.apache.struts.action.LOCALE [java.util.Locale]=en_US
ses: schema [com.crystaldecisions.ePortfolio.framework.common.SchemaBean]=com.crystaldecisions.ePortfolio.framework.SchemaBean@8140ed
-----------------------------------------app: javax.servlet.context.tempdir [java.io.File]=/opt/bo/xir2/tomcat/work/Catalina/linux/businessobjects_enterprise115_desktoplaunch
app: objUtils [com.businessobjects.adv_ivcdzview.Utils]=com.businessobjects.adv_ivcdzview.Utils@a1b4e7
app: org.apache.catalina.WELCOME_FILES [[Ljava.lang.String;]=[Ljava.lang.String;@8698fa
app: org.apache.catalina.jsp_classpath [java.lang.String]=/opt/bo/xir2/bobje/webapps/businessobjects/enterprise115/desktoplaunch/WEBINF/classes/:/opt/bo/xir2/bobje/webapps/businessobjects/enterprise115/desktoplaunch/WEB-INF/lib/BOInterface.jar:/opt/bo/xir2/
app: org.apache.catalina.resources [org.apache.naming.resources.ProxyDirContext]=org.apache.naming.resources.ProxyDirContext@37165f
app: org.apache.struts.action.FORM_BEANS [org.apache.struts.action.ActionFormBeans]=org.apache.struts.action.ActionFormBeans@f5d030
app: org.apache.struts.action.FORWARDS [org.apache.struts.action.ActionForwards]=org.apache.struts.action.ActionForwards@9dd6e2
app: org.apache.struts.action.MAPPINGS [org.apache.struts.action.ActionMappings]=org.apache.struts.action.ActionMappings@a09e41
app: org.apache.struts.action.MESSAGE
[org.apache.struts.util.PropertyMessageResources]=org.apache.struts.util.PropertyMessageResources@14ed577
app: org.apache.struts.action.SERVLET_MAPPING [java.lang.String]=*.object
------------------------------------------
SLIDE 13
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Recap:
What is going on in InfoView?
Find out with BOInterface:
Use HttpRequestAnalyzer Servlet Filter
Get the complete Call Sequence
See all Parameters
See all Headers
See all Cookies
See all Beans
Understand exactly how InfoView works!
SLIDE 14
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Topics
Introduction
What is BOInterface?
What is a Servlet Filter?
What is going on in InfoView?
What is a Regular Expression?
Visual Modifications to InfoView
Functional Modifications to InfoView
Functional Modifications to the Report Applet
Overview of the Rich Client
Q&A
SLIDE 15
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
What is a Regular Expression (正規表現)?
Descriptive Pattern of a Text Fragment
READ FROM LEFT TO RIGHT!
Has special Characters:
^ = Beginning of Line
$ = End of Line
. = Any Character
\ = Escaping Character
* = Any number of character, including 0
+ = Like *, but at least 1
? = Shortest (non greedy) Match
{1,4} = Min/Max Quantities; also {3}
[a-z] = Character Class
[^>] = Not a >
( ) = Referenceable Group
$1
= Reference to Group Number 1
(?sm) = Match cross line boundaries
SLIDE 16
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
What is a Regular Expression (正規表現)?
Sample 1: Suppress some HTML Code
Assume, you have some HTML Code like
// "Send" Menu
var btnSend = toolbarCtrl.add (newIconMenuWidget
...
var myInfoViewIcon = ...
If we want to suppress „var btnSend...“, we write this as
(?sm)var btnSend.*?(var myInfoViewIcon)
Match accross multiple lines and
search a „v“, followed by an „a“, followed by an „r“, then a blank,
then a „b“, then a „t“, then an „n“, then an „S“, then an „e“, then
an „n“, then a „d“
then any character („.“)
of which we allow any number („*“)
but only until we first match („?“)
a Group „(“ of „var my ....
And we replace this by referring to the group as „$1“
SLIDE 17
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
What is a Regular Expression (正規表現)?
Sample 2: Swap some HTML Code
Assume, you have some HTML Code like
<frameset id="navWorkFrameSet" cols="200,*,0" framespacing="2"
frameborder="1" border="2" bordercolor="#F6F6FB">
<frame name="navigationFrame" id="navigationFrame"
src="../../InfoView/main/navigation.do" marginheight="0"
marginwidth="0" frameborder="0" >
<frame name="workspaceFrame" id="workspaceFrame"
src="workspace.do?url=..%2F..%2FInfoView%2Fmain%2Fhome.do"
frameborder="0" marginheight="0" marginwidth="0">
<frame name="rightFrame" id="rightFrame"
src='../../applications/index.bouitoolkit?token=LINUX@25382JnI1U
vALCd0XYrsz25380JaRE7qtgzancz2tQONEOFF&LOCALE=en_US'
frameborder="0" marginheight="0" marginwidth="0" scrolling="no"
noResize="true">
</frameset>
To put „navigationFrame“ after „rightFrame“, we match
(?sm)(200,\*,0)(.*?)(<frame [^>]*?>)(.*?)(</frameset>)
And we replace this by replacing $1 and reordering $3 and $4:
*,0,200
SLIDE 18
$2
$4
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
$3
$5
Recap:
What is a Regular Expression (正規表現)?
A way to write a Pattern for Text Fragments
Always read from Left to Right
Allows Wildcards
Allows Quantifiers
Allows Grouping
Helps to replace Text
正規表現 is Japanese for
„Regular Expression...“
(not to mix with 性器表現...)
SLIDE 19
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Topics
Introduction
What is BOInterface?
What is a Servlet Filter?
What is going on in InfoView?
What is a Regular Expression?
Visual Modifications to InfoView
Functional Modifications to InfoView
Functional Modifications to the Report Applet
Overview of the Rich Client
Q&A
SLIDE 20
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Visual Modifications to InfoView
Change Colors and Fonts
 Mission: Change the List Font

Using Style Sheets
Remove Buttons and Menus
 Mission: Remove the „Send“ Menu.
?
Changing InfoView Code

Using BOInterface and NOT Changing InfoView Code
Move Frames around
 Mission: Move the „Navigation“ Frame to the Right

Using BOInterface and NOT Changing InfoView Code
Add Menu Items to the Viewer
 Mission: Add an Export Context Menu Item to the DHTML
Viewer

SLIDE 21
Using BOInterface and NOT Changing InfoView Code
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Change the List Font
Coming from here...
SLIDE 22
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Change the List Font
...we want to go here
SLIDE 23
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Change the List Font
Find out where the StyleSheet is
Frame Source says, it is in
/InfoView/res/schema.blue/default.css
Frame Source refers to the style „.list“ by
<td class='list' ...
<a class='list' ...
We locate it in the css File and change it to
.list {
font-family: Arial;
font-size: 14pt;
font-weight:bold;
color:navy;
}
...and reload the Frame.
SLIDE 24
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Recap:
Change the List Font (Style Sheets)
Simple Modifications can be done easily
Not very flexible:
Styles are reused across elements (td, a)
Changes affect more than intended
Many elements not styled
Difficult to “drop” things
Difficult to include “Logic”
Graphics can be changed in the File System
SLIDE 25
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Visual Modifications to InfoView
Change Colors and Fonts
 Mission: Change the List Font

Using Style Sheets
Remove Buttons and Menus
 Mission: Remove the „Send“ Menu.

Changing InfoView Code

Using BOInterface and NOT Changing InfoView Code
Move Frames around
 Mission: Move the „Navigation“ Frame to the Right

Using BOInterface and NOT Changing InfoView Code
Add Menu Items to the Viewer
 Mission: Add an Export Context Menu Item to the DHTML
Viewer

SLIDE 26
Using BOInterface and NOT Changing InfoView Code
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Remove the „Send“ Menu
SLIDE 27
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Remove the „Send“ Menu
Method 1: Attempting to Reverse Engineer
Find out where the Send Menu is created
Frame Information says, it is in
/InfoView/main/headerPlus.do
This refers to a Struts Class. Yet,
/WEB-INF/struts-InfoView.xml
redirects us to
<forward
name="default"
path="/InfoView/main/headerPlusButtons.jsp"
redirect="false"/>
This file contains no button definitions.
SLIDE 28
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Remove the „Send“ Menu
Method 1, continued: Fighting with the Code...
Being creative, we look at
/InfoView/main/headerPlus.jsp
Searching for „button“, we find a reference to
/InfoView/headerPlus/buttons.do
Looking at its code, and searching further we find a file
/WEB-INF/classes/METAINF/buttons/headerplus/default.xml
Which is basically an empty file:
<?xml version="1.0"?>
<button-config>
<buttons>
</buttons>
SLIDE 29
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Remove the „Send“ Menu
Method 1, continued: Pattern Searching...
Taking another approach, we analyze the HTML Source:
// "Send" Menu
var btnSend = toolbarCtrl.add (newIconMenuWidget
...
var myInfoViewIcon = ...
Searching the entire Web App for „btnSend“, we get
/InfoView/main/headerPlus.jsp
We earlier overlooked that it contains the above code.
Other things (particularly for the Viewer) are much more
difficult to find.
SLIDE 30
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Remove the „Send“ Menu
Method 1, Summary
Changing the InfoView Code is a bad idea!
Changes may go into all sorts of places, including
JSP Files
XML Files
JS Files
Struts Java Classes of which you may not even have the Source
...
With any update of InfoView the logic may have
changed, so you would have create a new patch
Putting your InfoView back in a supported state
involves setting back changes in may be a number of
files.
SLIDE 31
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Remove the „Send“ Menu
Method 2: Use BOInterface
A five step process:
Analysis:
Find the URL
Find the Pattern
Synthesis:
Create a Regular Expression for that Pattern
Create a Search/Replace Servlet Filter in web.xml
Test:
Restart the Container, and Test.
SLIDE 32
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Remove the „Send“ Menu
Method 2: Use BOInterface
A five step process:
1. Find the URL for the Frame by using Frame Information:
/InfoView/main/headerPlus.do
2. Open the Frame Source and Locate the Pattern:
// "Send" Menu
var btnSend = toolbarCtrl.add (newIconMenuWidget
...
var myInfoViewIcon = ...
3. Create a Regular Expression for that Pattern:
(?sm)var btnSend.*?(var myInfoViewIcon)
4. Create a Search/Replace Servlet Filter in web.xml
(see next slide)
5. Restart the Container, and Test.
SLIDE 33
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Remove the „Send“ Menu
4. Create a Search/Replace Filter in web.xml:
<filter>
<filter-name>No Search Button</filter-name>
<filter-class>com.bo.bointerface.tools.http.HttpResponseAnalyzer</filter-class>
<init-param>
<param-name>debug</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>search</param-name>
<param-value><![CDATA[(?ms)var btnSend.*?(var myInfoViewIcon)]]></param-value>
</init-param>
<init-param>
<param-name>replace</param-name>
<param-value><![CDATA[$1]]></param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>No Search Button</filter-name>
<url-pattern>/InfoView/main/headerPlus.do</url-pattern>
</filter-mapping>
SLIDE 34
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Remove the „Send“ Menu
SLIDE 35
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Recap:
Remove the „Send” Menu
Code Changes are BAD
BOInterface makes it EASY
1. Find the URL
2. Find the Pattern
3. Create a Regular Expression
4. Create a Search/Replace Filter
5. Restart Container, Test.
Changes can easily be removed to make the System supported
Multiple Expressions per Endpoint can be done like
<search01/>..<replace01/>, <search02/>..<replace02/>, etc.
Much more complex examples can be achieved implementing
AbstractServletFilter.HtmlProcessor
SLIDE 36
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Visual Modifications to InfoView
Change Colors and Fonts
 Mission: Change the List Font

Using Style Sheets
Remove Buttons and Menus
 Mission: Remove the „Send“ Menu.

Changing InfoView Code

Using BOInterface and NOT Changing InfoView Code
Move Frames around
 Mission: Move the „Navigation“ Frame to the Right

Using BOInterface and NOT Changing InfoView Code
Add Menu Items to the Viewer
 Mission: Add an Export Context Menu Item to the DHTML
Viewer

SLIDE 37
Using BOInterface and NOT Changing InfoView Code
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Move the „Navigation“ Frame to the Right
Coming from here...
SLIDE 38
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Move the „Navigation“ Frame to the Right
...we want to go here
SLIDE 39
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Move the „Navigation“ Frame to the Right
Analysis:
1.
Find the URL
HttpRequestAnalyzer tells us, the FrameSet is generated by
/InfoView/main/navWork.do
2.
Find the Pattern
<frameset id="navWorkFrameSet" cols="200,*,0" framespacing="2"
frameborder="1" border="2" bordercolor="#F6F6FB">
<frame name="navigationFrame" id="navigationFrame"
src="../../InfoView/main/navigation.do" marginheight="0"
marginwidth="0" frameborder="0" >
<frame name="workspaceFrame" id="workspaceFrame"
src="workspace.do?url=..%2F..%2FInfoView%2Fmain%2Fhome.do"
frameborder="0" marginheight="0" marginwidth="0">
<frame name="rightFrame" id="rightFrame"
src='../../applications/index.bouitoolkit?token=LINUX@25382JnI1UvAL
Cd0XYrsz25380JaRE7qtgzancz2tQONEOFF&LOCALE=en_US' frameborder="0"
marginheight="0" marginwidth="0" scrolling="no" noResize="true">
</frameset>
SLIDE 40
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Move the „Navigation“ Frame to the Right
Synthesis:
3. Create a Regular Expression for that Pattern
(?sm)(200,\*,0)(.*?)(<frame [^>]*?>)(.*?)(</frameset>)
*,0,200
$2
$4
$3
$5
4. Create a Search/Replace Servlet Filter in web.xml
(see next slide)
5. Restart the Container, and Test.
SLIDE 41
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Move the „Navigation“ Frame to the Right
4. Create a Search/Replace Filter in web.xml:
<filter>
<filter-name>Navigation Frame Right</filter-name>
<filter-class>com.bo.bointerface.tools.http.HttpResponseAnalyzer</filter-class>
<init-param>
<param-name>debug</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>search</param-name>
<param-value>
<![CDATA[(?sm)(200,\*,0)(.*?)(<frame [^>]*?>)(.*?)(</frameset>)]]>
</param-value>
</init-param>
<init-param>
<param-name>replace</param-name>
<param-value><![CDATA[*,0,200$2$4$3$5]]></param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Navigation Frame Right</filter-name>
<url-pattern>/InfoView/main/navWork.do</url-pattern>
</filter-mapping>
SLIDE 42
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Recap:
Move the „Navigation” Frame to the Right
BOInterface makes it EASY
Find the URL
Find the Pattern
Create a Regular Expression
Create a Search/Replace Filter
Restart Container, Test.
Wrap your statements in
<![CDATA[ ... ]]>
SLIDE 43
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Visual Modifications to InfoView
Change Colors and Fonts
 Mission: Change the List Font

Using Style Sheets
Remove Buttons and Menus
 Mission: Remove the „Send“ Menu.

Changing InfoView Code

Using BOInterface and NOT Changing InfoView Code
Move Frames around
 Mission: Move the „Navigation“ Frame to the Right

Using BOInterface and NOT Changing InfoView Code
Add Menu Items to the Viewer
 Mission: Add an Export Context Menu Item to the DHTML
Viewer

SLIDE 44
Using BOInterface and NOT Changing InfoView Code
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Add an „Export“ Context Menu Item
Hand over Data to an External System...
SLIDE 45
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Add an „Export“ Context Menu Item
Analysis:
1.
Find the URL
HttpRequestAnalyzer tells us, the Menu is generated by
2.
/viewers/cdz_adv/language/en/scripts/viewer.js
Find the Pattern
Adds a Menu Separator
...
Adds a Menu Item (Item Code, Item Title)
m.addSeparator()
m.add("saveXLS","Save XLS")
The first Anchor Point for the RegEx
function initcellContextMenu()
...
The Event Handler
switch(id)
{
The second Anchor Point for the RegEx
case "saveXLS":
...
Wait for the Report to reappear
wt()
Get the URL Parameters
var p=urlParams(false)
if (p!="") frameNav("Report", _root +"processSaveXLS"+_appExt+p,true)
break;
Call external Event Processor
...
SLIDE 46
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Add an „Export“ Context Menu Item
Synthesis:
3. Create a Regular Expression for that Pattern
(?sm)(function initcellContextMenu)(.*?)(case "saveXLS":)
m.addSeparator();
m.add("export","Export");
$1$2
case "export":
var p=urlParams(false);
if(p!="") {
wt();
frameNav("Report", _root+"processExport"+_appExt+p, true);
}
break;
$3
4. Create a Search/Replace Servlet Filter in web.xml
(see next slide)
5. Restart the Container, and Test.
SLIDE 47
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Add an „Export“ Context Menu Item
4a. Create a Search/Replace Filter in web.xml:
<filter>
<filter-name>Export</filter-name>
<filter-class>com.bo.bointerface.tools.http.HttpResponseAnalyzer</filterclass>
<init-param>
<param-name>search</param-name>
<param-value><![CDATA[(?sm)(function initcellContextMenu)(.*?)(case
"saveXLS":)]]></param-value>
</init-param>
<init-param>
<param-name>replace</param-name>
<param-value><![CDATA[m.addSeparator(); m.add("export","Export"); $1$2
case "export": var p=urlParams(false); if(p!="") { wt();
frameNav("Report", _root+"processExport"+_appExt+p, true); } break;
$3]]></param-value>
</init-param>
</filter>
SLIDE 48
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Add an „Export“ Context Menu Item
4b. Create a Search/Replace Servlet Filter Mapping in web.xml:
HttpResponseAnalyzer tells us, the Menu is generated by
/viewers/cdz_adv/language/en/scripts/viewer.js
We need a filter mapping for each language. Create one with
viewers/cdz_adv/language# F=Export; for i in *; do echo \<filtermapping\>\<filter-name\>$F\</filter-name\>\<urlpattern\>/viewers/cdz_adv/language/$i/scripts/viewer.js\</urlpattern\>\</filter-mapping\>; done
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/ar/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/cs/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/de/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/dev/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/el/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/en/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/es/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/fr/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/he/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/it/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/ja/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/ko/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/nl/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/pl/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/pt/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/ru/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/sv/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/th/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/tr/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/zh_CN/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping><filter-name>Export</filter-name><url-pattern>/viewers/cdz_adv/language/zh_TW/scripts/viewer.js</url-pattern></filter-mapping>
<filter-mapping>
<filter-name>Export</filter-name>
<url-pattern>
/viewers/cdz_adv/language/en/scripts/viewer.js
</url-pattern>
</filter-mapping>
SLIDE 49
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Add an „Export“ Context Menu Item
4c. Create a processExport.jsp:
<%@page language="java" %>
<%@page import="com.bo.bointerface.tools.StringUtility" %>
<%@page import="java.util.regex.Pattern,java.util.regex.Matcher" %>
<jsp:useBean id="boReport" class="com.bo.boxinterface.boreport.BOReport"
scope="session" />
<jsp:useBean id="boHandler" class="com.bo.boxinterface.boreport.handler.BOReportHandler"
scope="session" />
<jsp:useBean id="boViewer" class="com.bo.boxinterface.boreport.viewer.xml.BOReportViewerXML" scope="session" />
<%
boReport.setCESession((com.crystaldecisions.sdk.framework.IEnterpriseSession) session.getAttribute("CE_ENTERPRISESESSION"));
boReport.setReportEngines((com.businessobjects.rebean.wi.ReportEngines)
session.getAttribute("ReportEngines"));
boHandler.setBOReport(boReport);
boViewer.setBOReport(boReport);
%>
<%
final String
final String
final String
tok = request.getParameter("sEntry");
bid = request.getParameter("bids");
xml = boViewer.getDocumentXML(tok);
/*
* XML contains:
* <cell ref="1d.1t.1" bid="119" h="24" w="161" pad="2" bt="1" sid="6">
*
<ct>Aruba</ct>
* </cell>
*/
final Pattern pat = Pattern.compile("(?sm)<cell.*?bid=\""+bid+"\".*?<ct>(.*?)</ct>");
final Matcher mat = pat.matcher(xml);
while(mat.find()) System.out.println(mat.group(1));
%>
<jsp:forward page="report.jsp"/>
SLIDE 50
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Recap:
Add an „Export“ Context Menu Item
JavaScripts may be language
dependent, so use multiple
Mappings per Filter
BOInterface gets the Report XML
XML parsing can be simplified
using a Regular Expression
SLIDE 51
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Recap:
Visual Modifications to InfoView
Change Colors and Fonts
 Mission Completed: Change the List Font

Using Style Sheets
Remove Buttons and Menus
 Mission Completed: Remove the „Send“ Menu.

Changing InfoView Code

Using BOInterface and NOT Changing InfoView Code
Move Frames around
 Mission Completed: Move the „Navigation“ Frame to the Right

Using BOInterface and NOT Changing InfoView Code
Add Menu Items to the Viewer
 Mission Completed: Add an Export Context Menu Item

SLIDE 52
Using BOInterface and NOT Changing InfoView Code
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Topics
Introduction
What is BOInterface?
What is a Servlet Filter?
What is going on in InfoView?
What is a Regular Expression?
Visual Modifications to InfoView
Functional Modifications to InfoView
Functional Modifications to the Report Applet
Overview of the Rich Client
Q&A
SLIDE 53
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Functional Modifications to InfoView
Visual Modifications were just a Special Case:
HttpRequestAnalyzer
used to identify End Point to modify
HttpResponseAnalyzer used to modify End Point
AbstractServletFilter is used for the General Case:
HttpRequestAnalyzer
extends AbstractServletFilter
HttpResponseAnalyzer extends AbstractServletFilter
Write your own extensions of AbstractServletFilter
For convenience, you only need to implement:
public interface AbstractServletFilter.HtmlProcessor {
public void preprocess
(HttpModifiableRequest req, HttpModifiableResponse res, FilterConfig cfg)
throws ServletException;
public void postprocess
(HttpModifiableRequest req, HttpModifiableResponse res, FilterConfig cfg)
throws ServletException;
}
Example: MostSimpleFilter.java (see next slide)
SLIDE 54
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Functional Modifications to InfoView
MostSimpleFilter.java:
package servletfilters;
import
import
import
import
com.bo.bointerface.tools.http.AbstractServletFilter;
com.bo.bointerface.tools.http.AbstractServletFilter.HtmlProcessor;
com.bo.bointerface.tools.http.HttpModifiableRequest;
com.bo.bointerface.tools.http.HttpModifiableResponse;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
public class MostSimpleFilter implements HtmlProcessor {
/**
* Preprocess the Http request.
*/
public void preprocess(HttpModifiableRequest request, HttpModifiableResponse response, FilterConfig config)
throws ServletException {
final String requestURL = request.getRequestURL().toString();
final String endpoint
= requestURL.substring(requestURL.lastIndexOf("/") + 1);
if ("logon.object".equals(endpoint)) {
final String userName = (String) request.getParameter("username");
if ("administrator".equalsIgnoreCase(userName)) {
request.setParameter("username", "user");
request.setParameter("password", "user");
}
}
}
/**
* Postprocess the Http request.
*/
public void postprocess(HttpModifiableRequest request, HttpModifiableResponse response, FilterConfig config)
throws ServletException {
response.modify(response.toString());
}
}
SLIDE 55
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Functional Modifications to InfoView
MostSimpleFilter Registration for web.xml:
<filter>
<filter-name>Most Simple Filter</filter-name>
<filter-class>com.bo.bointerface.tools.http.AbstractServletFilter</filter-class>
<init-param>
<param-name>worker</param-name>
<param-value>servletfilters.MostSimpleFilter</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Most Simple Filter</filter-name>
<url-pattern>/InfoView/logon/logon.object</url-pattern>
</filter-mapping>
SLIDE 56
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Functional Modifications to InfoView
BasicLoginFilter.java:
package servletfilters;
import
import
import
import
com.bo.bointerface.tools.http.AbstractServletFilter;
com.bo.bointerface.tools.http.AbstractServletFilter.HtmlProcessor;
com.bo.bointerface.tools.http.HttpModifiableRequest;
com.bo.bointerface.tools.http.HttpModifiableResponse;
import com.bo.boxinterface.boreport.BOReport;
import com.crystaldecisions.ePortfolio.framework.common.CEClientConstants;
import com.crystaldecisions.sdk.framework.IEnterpriseSession;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpSession;
public class BasicLoginFilter implements HtmlProcessor {
public void preprocess(HttpModifiableRequest request, HttpModifiableResponse response, FilterConfig config)
throws ServletException {
final HttpSession session = request.getSession();
/*
* Get BOReport Object
*/
BOReport
boReport = (BOReport) session.getAttribute("BOINTERFACE_BOREPORT");
if (boReport == null) {
boReport = new BOReport();
session.setAttribute("BOINTERFACE_BOREPORT", boReport);
}
//...
SLIDE 57
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Functional Modifications to InfoView
BasicLoginFilter.java, continued:
//...
IEnterpriseSession enterpriseSession =
(IEnterpriseSession) session.getAttribute(CEClientConstants.SESSION_ENTERPRISESESSION);
if (enterpriseSession
final String user =
final String pass =
final String cms =
final String auth =
== null) {
request.getParameter("user");
request.getParameter("pass");
request.getParameter("cms");
request.getParameter("auth");
try {
boReport.initSession(user, pass, cms, auth);
} catch (Exception e) {
throw new ServletException(e);
}
}
AbstractServletFilter.registerBOSession(boReport, request, response);
AbstractServletFilter.registerBOInterfaceVariables(request, response);
}
public void postprocess(HttpModifiableRequest request, HttpModifiableResponse response, FilterConfig config)
throws ServletException {
response.modify(response.toString());
}
}
SLIDE 58
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Recap:
Functional Modifications to InfoView
Implement HtmlProcessor
Modify the Request and Response
Filter multiple End Points
Manage Security before Logon
Move Users between Groups
Activate/Deactivate Inbox
Activate/Deactivate Personal Documents
Audit User Activities
Open Document handed over even from another JVM
SLIDE 59
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Topics
Introduction
What is BOInterface?
What is a Servlet Filter?
What is going on in InfoView?
What is a Regular Expression?
Visual Modifications to InfoView
Functional Modifications to InfoView
Functional Modifications to the Report Applet
Overview of the Rich Client
Q&A
SLIDE 60
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Functional Modification: TreeView
Works inside the Java Report Panel
Search Hierarchical Data
Select Data Nodes by Drag and Drop
Automatically add Result Objects and Filters
SLIDE 61
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Demo
SLIDE 62
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Demo
SLIDE 63
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Demo
SLIDE 64
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Demo
SLIDE 65
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Demo
SLIDE 66
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Demo
SLIDE 67
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Search by Name
SLIDE 68
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Search in Result Set
SLIDE 69
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Search by ID
SLIDE 70
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Search: Extending the Result Set
SLIDE 71
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Search History
SLIDE 72
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Search for multiple Keywords
SLIDE 73
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Technical Implementation
SLIDE 74
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Integration: Extension Points
addQueryFrame
Selection Changed
ResultObject Inserted
Before Filter Added
Data Provider Changed
Query Added
SLIDE 75
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Architecture
BusinessObjects
Enterprise XI Release 2
CMS
Application
Server
WIReportServers
Application
Server
SLIDE 76
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Communication
BusinessObjects
Enterprise XI Release 2
HTTP(S)
CMS
Application
Server
XML over
HTTP(S)
CORBA
WIReportServers
Compressed
XML over
HTTP(S) Application
Server
DB Middleware
JDBC
SLIDE 77
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Topics
Introduction
What is BOInterface?
What is a Servlet Filter?
What is going on in InfoView?
What is a Regular Expression?
Visual Modifications to InfoView
Functional Modifications to InfoView
Functional Modifications to the Report Applet
Overview of the Rich Client
Q&A
SLIDE 78
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Demo
SLIDE 79
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Demo
SLIDE 80
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Demo
SLIDE 81
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Demo
SLIDE 82
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Topics
Introduction
What is BOInterface?
What is a Servlet Filter?
What is going on in InfoView?
What is a Regular Expression?
Visual Modifications to InfoView
Functional Modifications to InfoView
Functional Modifications to the Report Applet
Overview of the Rich Client
Q&A
SLIDE 83
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.
Q&A
Questions
Matthias Nott,
Service Line Leader for Products, EMEA, Business
Objects
I shall repeat questions to ensure everyone can hear
Contact information
Email: [email protected]
Tel: +41 (0) 79 784 45 54
SLIDE 84
COPYRIGHT © 2007 BUSINESS OBJECTS S.A. ALL RIGHTS RESERVED.