Home » Archived » BIRT » Java and beforeOpen: stop birt execution
|
Re: Java and beforeOpen: stop birt execution [message #517995 is a reply to message #517958] |
Tue, 02 March 2010 12:08 |
|
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 |
|
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 |
Nicola 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 |
|
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 |
Nicola 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 |
|
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 |
arlene86 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
|
|
| | | |
Goto Forum:
Current Time: Sat Apr 20 03:38:02 GMT 2024
Powered by FUDForum. Page generated in 0.03819 seconds
|