Skip to main content



      Home
Home » Archived » BIRT » Get Session Context through scriptin
Get Session Context through scriptin [message #54295] Wed, 06 July 2005 07:58 Go to next message
Eclipse UserFriend
Hi all

I just forward a very interesting comment (question) i have recieved in my
blog entry about "BIRT and POJOs as data sources" [1]

"... Is there also a possibility to access objects in the session context
through scripting? ..."

Any idea?


[1] http://tools.osmosis.gr/blog/archives/2005/06/birt_and_objec t.html

Regard

Stavros
Re: Get Session Context through scriptin [message #56088 is a reply to message #54295] Mon, 11 July 2005 14:04 Go to previous messageGo to next message
Eclipse UserFriend
Hi, Stavros,

The engine API has a function

public void addScriptableJavaObject(String jsName, Object obj);

in the IEngineTask interface. This allows you to register an object
(i.e., sesion context) and give it a name (say, myContext), so that you
can write myContext.foo() in your scripting code. Try this out and let
us know if it solves your problem.

We are considering whether we need to automatically mage session context
available in sripting, when it is running in app server. We are
hesitated because engine is generic and could run outside of app server.
Any comments on this?

Stanley Wang
BIRT Engine

Stavros Kounis wrote:
> Hi all
>
> I just forward a very interesting comment (question) i have recieved in my
> blog entry about "BIRT and POJOs as data sources" [1]
>
> "... Is there also a possibility to access objects in the session context
> through scripting? ..."
>
> Any idea?
>
>
> [1] http://tools.osmosis.gr/blog/archives/2005/06/birt_and_objec t.html
>
> Regard
>
> Stavros
>
>
Re: Get Session Context through scriptin [message #58238 is a reply to message #56088] Thu, 14 July 2005 07:19 Go to previous message
Eclipse UserFriend
At first to say thank you to Stavros for posting this topic to this
newsgroup.

It is not really neccessary to have the session in the script. This would
only be a workaround for another problem: it is currently not possible to
set
the DataSource during runtime of an own program.

However, because I needed a fast solution I switched to JasperReport
library
with iReport GUI Editor. JasperReport already provides the possibilities:

1. during design time
* to create template in GUI editor
* use a DummyDataSource for designer
* also use Objects as report parameter with scripted default value
e.g. parameter["ReportUser"] = new DummyUser("Marco", "male")
* write script to access parameter content
e.g. parameter["ReportUser"].getName()

2. during own application runtime
* to load the template
* set real DataSource
e.g. to (DataSource) session.getAttribute("searchResult")
* set real report parameter
e.g. to session.getAttribute("currentUser")
* create PDF with report

IMO BIRT should go a similar way. JasperReport already offers me this
possibilities. Moreover I can use multiple GUI editors all using the same
*.jrxml structure.
Previous Topic:Programmatically adding Groups to a report design
Next Topic:Problem with summing across groups
Goto Forum:
  


Current Time: Thu May 08 05:57:33 EDT 2025

Powered by FUDForum. Page generated in 0.03314 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top