Run a report against a dynamic EMF data source [message #756387] |
Sat, 12 November 2011 09:57  |
Eclipse User |
|
|
|
Hello guys,
i designed a report that visualizes data from an EMF model using the new EMF ODA driver.
Currently the defined data source points to one XMI file, what is good for debugging purposes.
But the use case is not to run the report always against this single XMI file, but against any kind of EMF model that corresponds to the metamodel of this file. The selection of the model, the report should run against, depends on user selection in a RCP application. So the data source isn't fixed, just the format.
Is it possible to change the URI of the EMF data source programmatically? Or with some parameter binding? I haven't found anything yet.
Many thanks in advance.
Best regards,
Stefan
|
|
|
Re: Run a report against a dynamic EMF data source [message #756675 is a reply to message #756387] |
Mon, 14 November 2011 11:04   |
Eclipse User |
|
|
|
Stefan,
I have not used that driver, but look at the report design in xml view.
Does it have a data set property for the xmi file. If it does it
should be changeable in script in the beforeOpen:
this.setExtensionProperty("xmlprop","value");
Jason
On 11/12/2011 9:57 AM, Stefan wrote:
> Hello guys,
>
> i designed a report that visualizes data from an EMF model using the new
> EMF ODA driver.
>
> Currently the defined data source points to one XMI file, what is good
> for debugging purposes.
>
> But the use case is not to run the report always against this single XMI
> file, but against any kind of EMF model that corresponds to the
> metamodel of this file. The selection of the model, the report should
> run against, depends on user selection in a RCP application. So the data
> source isn't fixed, just the format.
>
> Is it possible to change the URI of the EMF data source
> programmatically? Or with some parameter binding? I haven't found
> anything yet.
>
> Many thanks in advance.
>
> Best regards,
> Stefan
|
|
|
Re: Run a report against a dynamic EMF data source [message #756712 is a reply to message #756387] |
Mon, 14 November 2011 13:47   |
Eclipse User |
|
|
|
Hello Stefan,
I too have a similar use case (I suspect many people will as well).
What I have done is to use external connection properties and a script
that searches for these properties.
My model instances are located in projects of the workspace. Each
project has an external connection property file that points to the
ECore instance for the project.
I have a reports project that contains all the reports. I simply copy a
report to the project. (Would like to have used links but I had
problems with that approach.)
Here is copy of the oda-data-source element that shows the script.
<oda-data-source extensionID="org.eclipse.emf.oda.ecore.dataSource"
name="Premises" id="326">
<method name="beforeOpen"><![CDATA[
importPackage( Packages.java.io );
var reportFolderAndReportName = null;
try{
reportFolderAndReportName =
reportContext.getReportRunnable().getReportName();
}catch (err){
}
reportFolderAndReportName="+reportFolderAndReportName);
if(reportFolderAndReportName!=null){
var index = reportFolderAndReportName.lastIndexOf("/");
var reportFolder = reportFolderAndReportName.slice(0,index);
this.setExtensionProperty("OdaConnProfileStorePath", reportFolder +
"/default.cps");
}
]]>
<property
name="resource">platform:/resource/Example_Farm/example.premises</property>
<property name="OdaConnProfileName">Premises</property>
<property
name="OdaConnProfileStorePath">/home/jconlon/workspace/com.verticon.tracker.premises.reports/default.cps</property>
</oda-data-source>
On 11/12/2011 08:57 AM, Stefan wrote:
> Hello guys,
>
> i designed a report that visualizes data from an EMF model using the new
> EMF ODA driver.
>
> Currently the defined data source points to one XMI file, what is good
> for debugging purposes.
>
> But the use case is not to run the report always against this single XMI
> file, but against any kind of EMF model that corresponds to the
> metamodel of this file. The selection of the model, the report should
> run against, depends on user selection in a RCP application. So the data
> source isn't fixed, just the format.
>
> Is it possible to change the URI of the EMF data source
> programmatically? Or with some parameter binding? I haven't found
> anything yet.
>
> Many thanks in advance.
>
> Best regards,
> Stefan
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04413 seconds