Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Java and beforeOpen: stop birt execution
Java and beforeOpen: stop birt execution [message #517958] Tue, 02 March 2010 10:40 Go to next message
Nicola is currently offline NicolaFriend
Messages: 184
Registered: July 2009
Senior Member
Hi,
how can I stop birt from continuing its execution in a beforeOpen method?
What command should be called (if any)?

@Override
public void beforeOpen(IDataSourceInstance dataSource, IReportContext
reportContext) throws ScriptException {
if (hasPermission(reportContext)) {
// show report
super.beforeOpen(dataSource, reportContext);
} else {
// Stop BIRT from continuing
}
}


thank you
Nicola
Re: Java and beforeOpen: stop birt execution [message #517995 is a reply to message #517958] Tue, 02 March 2010 12:08 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Nicola,

Another approach would be to do this in the beforeFactory and just drop
the report items. Then you could display a message to the user with a
BIRT label report item.

Jason

nicola wrote:
> Hi,
> how can I stop birt from continuing its execution in a beforeOpen method?
> What command should be called (if any)?
>
> @Override
> public void beforeOpen(IDataSourceInstance dataSource, IReportContext
> reportContext) throws ScriptException {
> if (hasPermission(reportContext)) {
> // show report
> super.beforeOpen(dataSource, reportContext);
> } else {
> // Stop BIRT from continuing
> }
> }
>
>
> thank you
> Nicola
Re: Java and beforeOpen: stop birt execution [message #518000 is a reply to message #517995] Tue, 02 March 2010 17:42 Go to previous messageGo to next message
Nicola is currently offline NicolaFriend
Messages: 184
Registered: July 2009
Senior Member
Hi,
thank you for the reply.
Is there an example of code?

Regards,
Nicola

Jason Weathersby ha scritto:
> Nicola,
>
> Another approach would be to do this in the beforeFactory and just drop
> the report items. Then you could display a message to the user with a
> BIRT label report item.
>
> Jason
>
> nicola wrote:
>> Hi,
>> how can I stop birt from continuing its execution in a beforeOpen method?
>> What command should be called (if any)?
>>
>> @Override
>> public void beforeOpen(IDataSourceInstance dataSource, IReportContext
>> reportContext) throws ScriptException {
>> if (hasPermission(reportContext)) {
>> // show report
>> super.beforeOpen(dataSource, reportContext);
>> } else {
>> // Stop BIRT from continuing
>> }
>> }
>>
>>
>> thank you
>> Nicola
Re: Java and beforeOpen: stop birt execution [message #518014 is a reply to message #518000] Tue, 02 March 2010 18:04 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Nicola,

In script it would be something like:

reportContext.getDesignHandle().findElement("mytable").drop();

Just name the table "mytable" in its general properties. You could then
add a label that says "You do not have permission to view this report".
and drop it if they do have permission.

Jason

nicola wrote:
> Hi,
> thank you for the reply.
> Is there an example of code?
>
> Regards,
> Nicola
>
> Jason Weathersby ha scritto:
>> Nicola,
>>
>> Another approach would be to do this in the beforeFactory and just drop
>> the report items. Then you could display a message to the user with a
>> BIRT label report item.
>>
>> Jason
>>
>> nicola wrote:
>>> Hi,
>>> how can I stop birt from continuing its execution in a beforeOpen method?
>>> What command should be called (if any)?
>>>
>>> @Override
>>> public void beforeOpen(IDataSourceInstance dataSource, IReportContext
>>> reportContext) throws ScriptException {
>>> if (hasPermission(reportContext)) {
>>> // show report
>>> super.beforeOpen(dataSource, reportContext);
>>> } else {
>>> // Stop BIRT from continuing
>>> }
>>> }
>>>
>>>
>>> thank you
>>> Nicola
Re: Java and beforeOpen: stop birt execution [message #531518 is a reply to message #518014] Wed, 05 May 2010 10:02 Go to previous messageGo to next message
Nicola is currently offline NicolaFriend
Messages: 184
Registered: July 2009
Senior Member
Hi,
is there a way to drop the source before doing any query?
I have my datasource defined in a library.
I named it and try the code you suggested, but with no results.

Am I wrong or there's a problem with dropping a datasource defined in a
library?

Thank you,
Nicola

Jason Weathersby ha scritto:
> Nicola,
>
> In script it would be something like:
>
> reportContext.getDesignHandle().findElement("mytable").drop();
>
> Just name the table "mytable" in its general properties. You could then
> add a label that says "You do not have permission to view this report".
> and drop it if they do have permission.
>
> Jason
>
> nicola wrote:
>> Hi,
>> thank you for the reply.
>> Is there an example of code?
>>
>> Regards,
>> Nicola
>>
>> Jason Weathersby ha scritto:
>>> Nicola,
>>>
>>> Another approach would be to do this in the beforeFactory and just drop
>>> the report items. Then you could display a message to the user with a
>>> BIRT label report item.
>>>
>>> Jason
>>>
>>> nicola wrote:
>>>> Hi,
>>>> how can I stop birt from continuing its execution in a beforeOpen
>>>> method?
>>>> What command should be called (if any)?
>>>>
>>>> @Override
>>>> public void beforeOpen(IDataSourceInstance dataSource, IReportContext
>>>> reportContext) throws ScriptException {
>>>> if (hasPermission(reportContext)) {
>>>> // show report
>>>> super.beforeOpen(dataSource, reportContext);
>>>> } else {
>>>> // Stop BIRT from continuing
>>>> }
>>>> }
>>>>
>>>>
>>>> thank you
>>>> Nicola
Re: Java and beforeOpen: stop birt execution [message #531691 is a reply to message #531518] Wed, 05 May 2010 19:07 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I assume you named it in the library. If your script is in the report
it does not have access to the name. So do something like:

//Get the first datasource and drop it
reportContext.getDesignHandle().getDataSources().get(0).drop ();

Jason


On 5/5/2010 6:02 AM, nicola wrote:
> Hi,
> is there a way to drop the source before doing any query?
> I have my datasource defined in a library.
> I named it and try the code you suggested, but with no results.
>
> Am I wrong or there's a problem with dropping a datasource defined in a
> library?
>
> Thank you,
> Nicola
>
> Jason Weathersby ha scritto:
>> Nicola,
>>
>> In script it would be something like:
>>
>> reportContext.getDesignHandle().findElement("mytable").drop();
>>
>> Just name the table "mytable" in its general properties. You could then
>> add a label that says "You do not have permission to view this report".
>> and drop it if they do have permission.
>>
>> Jason
>>
>> nicola wrote:
>>> Hi,
>>> thank you for the reply.
>>> Is there an example of code?
>>>
>>> Regards,
>>> Nicola
>>>
>>> Jason Weathersby ha scritto:
>>>> Nicola,
>>>>
>>>> Another approach would be to do this in the beforeFactory and just drop
>>>> the report items. Then you could display a message to the user with a
>>>> BIRT label report item.
>>>>
>>>> Jason
>>>>
>>>> nicola wrote:
>>>>> Hi,
>>>>> how can I stop birt from continuing its execution in a beforeOpen
>>>>> method?
>>>>> What command should be called (if any)?
>>>>>
>>>>> @Override
>>>>> public void beforeOpen(IDataSourceInstance dataSource, IReportContext
>>>>> reportContext) throws ScriptException {
>>>>> if (hasPermission(reportContext)) {
>>>>> // show report
>>>>> super.beforeOpen(dataSource, reportContext);
>>>>> } else {
>>>>> // Stop BIRT from continuing
>>>>> }
>>>>> }
>>>>>
>>>>>
>>>>> thank you
>>>>> Nicola
Re: Java and beforeOpen: stop birt execution [message #538265 is a reply to message #531691] Mon, 07 June 2010 07:20 Go to previous messageGo to next message
Nicola is currently offline NicolaFriend
Messages: 184
Registered: July 2009
Senior Member
Hi Jason,
this solution does not work.
Nothing happens and the report is shown.

Regards,
Nicola

Jason Weathersby ha scritto:
> I assume you named it in the library. If your script is in the report
> it does not have access to the name. So do something like:
>
> //Get the first datasource and drop it
> reportContext.getDesignHandle().getDataSources().get(0).drop ();
>
> Jason
>
>
> On 5/5/2010 6:02 AM, nicola wrote:
>> Hi,
>> is there a way to drop the source before doing any query?
>> I have my datasource defined in a library.
>> I named it and try the code you suggested, but with no results.
>>
>> Am I wrong or there's a problem with dropping a datasource defined in a
>> library?
>>
>> Thank you,
>> Nicola
>>
>> Jason Weathersby ha scritto:
>>> Nicola,
>>>
>>> In script it would be something like:
>>>
>>> reportContext.getDesignHandle().findElement("mytable").drop();
>>>
>>> Just name the table "mytable" in its general properties. You could then
>>> add a label that says "You do not have permission to view this
>>> report".
>>> and drop it if they do have permission.
>>>
>>> Jason
>>>
>>> nicola wrote:
>>>> Hi,
>>>> thank you for the reply.
>>>> Is there an example of code?
>>>>
>>>> Regards,
>>>> Nicola
>>>>
>>>> Jason Weathersby ha scritto:
>>>>> Nicola,
>>>>>
>>>>> Another approach would be to do this in the beforeFactory and just
>>>>> drop
>>>>> the report items. Then you could display a message to the user with a
>>>>> BIRT label report item.
>>>>>
>>>>> Jason
>>>>>
>>>>> nicola wrote:
>>>>>> Hi,
>>>>>> how can I stop birt from continuing its execution in a beforeOpen
>>>>>> method?
>>>>>> What command should be called (if any)?
>>>>>>
>>>>>> @Override
>>>>>> public void beforeOpen(IDataSourceInstance dataSource, IReportContext
>>>>>> reportContext) throws ScriptException {
>>>>>> if (hasPermission(reportContext)) {
>>>>>> // show report
>>>>>> super.beforeOpen(dataSource, reportContext);
>>>>>> } else {
>>>>>> // Stop BIRT from continuing
>>>>>> }
>>>>>> }
>>>>>>
>>>>>>
>>>>>> thank you
>>>>>> Nicola
>
Re: Java and beforeOpen: stop birt execution [message #538399 is a reply to message #538265] Mon, 07 June 2010 14:47 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

You may need to change the index number (ie get(0) to get(1)) depending
on what datasource it is. You also may need to drop the dataset.

Jason

On 6/7/2010 3:20 AM, nicola wrote:
> Hi Jason,
> this solution does not work.
> Nothing happens and the report is shown.
>
> Regards,
> Nicola
>
> Jason Weathersby ha scritto:
>> I assume you named it in the library. If your script is in the report
>> it does not have access to the name. So do something like:
>>
>> //Get the first datasource and drop it
>> reportContext.getDesignHandle().getDataSources().get(0).drop ();
>>
>> Jason
>>
>>
>> On 5/5/2010 6:02 AM, nicola wrote:
>>> Hi,
>>> is there a way to drop the source before doing any query?
>>> I have my datasource defined in a library.
>>> I named it and try the code you suggested, but with no results.
>>>
>>> Am I wrong or there's a problem with dropping a datasource defined in a
>>> library?
>>>
>>> Thank you,
>>> Nicola
>>>
>>> Jason Weathersby ha scritto:
>>>> Nicola,
>>>>
>>>> In script it would be something like:
>>>>
>>>> reportContext.getDesignHandle().findElement("mytable").drop();
>>>>
>>>> Just name the table "mytable" in its general properties. You could then
>>>> add a label that says "You do not have permission to view this
>>>> report".
>>>> and drop it if they do have permission.
>>>>
>>>> Jason
>>>>
>>>> nicola wrote:
>>>>> Hi,
>>>>> thank you for the reply.
>>>>> Is there an example of code?
>>>>>
>>>>> Regards,
>>>>> Nicola
>>>>>
>>>>> Jason Weathersby ha scritto:
>>>>>> Nicola,
>>>>>>
>>>>>> Another approach would be to do this in the beforeFactory and just
>>>>>> drop
>>>>>> the report items. Then you could display a message to the user with a
>>>>>> BIRT label report item.
>>>>>>
>>>>>> Jason
>>>>>>
>>>>>> nicola wrote:
>>>>>>> Hi,
>>>>>>> how can I stop birt from continuing its execution in a beforeOpen
>>>>>>> method?
>>>>>>> What command should be called (if any)?
>>>>>>>
>>>>>>> @Override
>>>>>>> public void beforeOpen(IDataSourceInstance dataSource, IReportContext
>>>>>>> reportContext) throws ScriptException {
>>>>>>> if (hasPermission(reportContext)) {
>>>>>>> // show report
>>>>>>> super.beforeOpen(dataSource, reportContext);
>>>>>>> } else {
>>>>>>> // Stop BIRT from continuing
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> thank you
>>>>>>> Nicola
>>
Re: Java and beforeOpen: stop birt execution [message #696559 is a reply to message #538399] Thu, 14 July 2011 09:49 Go to previous messageGo to next message
arlene86  is currently offline arlene86 Friend
Messages: 6
Registered: July 2011
Junior Member
Hi...

I need some help here...

i put below codes to my beforeFactory event :

if (params["name"].value == null) {
javax.swing.JOptionPane.showMessageDialog(null,"ALERT", "ALERT",
javax.swing.JOptionPane.ERROR_MESSAGE);

}

The message appear when i put null for my parameter input. But, i want report stop from continue running after i click "OK" button on my message dialog.Can anyone help me...


thanks,
Arlene

[Updated on: Thu, 14 July 2011 09:52]

Report message to a moderator

Re: Java and beforeOpen: stop birt execution [message #696692 is a reply to message #696559] Thu, 14 July 2011 15:53 Go to previous messageGo to next message
sam va is currently offline sam vaFriend
Messages: 121
Registered: July 2011
Senior Member
I have a similar requirement.
If the number of data rows is more than 10000 records, the report execution should STOP. There will not be any report output.

Any pointers will be helpful.
Using BIRT 2.6.2

Thanks
Re: Java and beforeOpen: stop birt execution [message #696694 is a reply to message #696692] Thu, 14 July 2011 16:04 Go to previous messageGo to next message
sam va is currently offline sam vaFriend
Messages: 121
Registered: July 2011
Senior Member
Can I throw a java exception.

if (row > 10000)
throw new EngineException()

I mean call a java class which just throws this exception

Thanks

[Updated on: Thu, 14 July 2011 16:07]

Report message to a moderator

Re: Java and beforeOpen: stop birt execution [message #698041 is a reply to message #696694] Mon, 18 July 2011 16:45 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

There is a way to cancel the task but this will cause a very generic
exception. Is forwarding the request an option?

Jason

On 7/14/2011 12:04 PM, forums-noreply@eclipse.org wrote:
> Can I throw a java exception.
>
> if (row > 10000)
> throw new EngineException()
>
> ???
Previous Topic:Birt 404 and JDBC error
Next Topic:birt.ini
Goto Forum:
  


Current Time: Sat Apr 20 03:38:02 GMT 2024

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

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

Back to the top