Home » Archived » BIRT » Java and beforeOpen: stop birt execution
Java and beforeOpen: stop birt execution [message #517958] |
Tue, 02 March 2010 05:40  |
Eclipse User |
|
|
|
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 06:02   |
Eclipse User |
|
|
|
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 15:07   |
Eclipse User |
|
|
|
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 03:20   |
Eclipse User |
|
|
|
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 10:47   |
Eclipse User |
|
|
|
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
>>
|
|
| | | | |
Goto Forum:
Current Time: Sat Jul 05 19:01:42 EDT 2025
Powered by FUDForum. Page generated in 0.06302 seconds
|