|
|
Re: Upgrading report definitions for newer BIRT version? [message #630934 is a reply to message #630775] |
Tue, 05 October 2010 15:36 |
|
Jim,
I do not think we have anything to do this quickly, but you could write
a simple DE API app that opens all the rptdesigns in a folder and does
the save.
Jason
On 10/4/2010 5:40 PM, Jim Garrison wrote:
> I figured out that "Save As..." will update the rptdesign file to 2.6.1
> compatibility. However I have a large number of such files. Is there a
> way to automate the upgrade process?
|
|
|
|
Re: Upgrading report definitions for newer BIRT version? [message #631195 is a reply to message #631001] |
Wed, 06 October 2010 14:25 |
|
Jim,
I was just thinking to do it with a command line app like the following:
import java.io.File;
import java.io.IOException;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.model.api.DesignConfig;
import org.eclipse.birt.report.model.api.IDesignEngine;
import org.eclipse.birt.report.model.api.IDesignEngineFactory;
import org.eclipse.birt.report.model.api.ReportDesignHandle;
import org.eclipse.birt.report.model.api.SessionHandle;
import org.eclipse.birt.report.model.api.activity.SemanticException ;
import com.ibm.icu.util.ULocale;
/**
* Simple BIRT Design Engine API (DEAPI) demo.
*/
public class FileIterSave
{
public static void main( String[] args )
{
try
{
updateReports( );
}
catch ( IOException e )
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch ( SemanticException e )
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
static void updateReports( ) throws IOException, SemanticException
{
// Create a session handle. This is used to manage all open designs.
// Your app need create the session only once.
DesignConfig config = new DesignConfig( );
config.setBIRTHome("C:/birt/birt-runtime-2_5_1/birt-runtime-2_5_1/ReportEngine ");
IDesignEngine engine = null;
try{
Platform.startup( config );
IDesignEngineFactory factory = (IDesignEngineFactory) Platform
.createFactoryObject(
IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY );
engine = factory.createDesignEngine( config );
}catch( Exception ex){
ex.printStackTrace();
}
SessionHandle session = engine.newSessionHandle( ULocale.ENGLISH ) ;
ReportDesignHandle design = null;
try{
File f1= new File("C:/work/TestReports/");
File []fileList = f1.listFiles();
for(File f2:fileList){
System.out.println(f2.getPath());
design = session.openDesign(f2.getPath());
design.save();
design.close( );
}
Platform.shutdown();
}catch(Exception e){
e.printStackTrace();
}
System.out.println("Finished");
// We're done!
}
}
Jason
n 10/5/2010 3:48 PM, Jim Garrison wrote:
> That's the direction I'm headed
>
> I'm a strong Java developer but a complete noob with regards to Eclipse
> plugins. I've read a lot of the "getting started" material on the
> Eclipse site, but there seems to be quite a bit of undocumented "plugin
> lore" that one has to learn. For example, the docs are all written from
> the perspective of adding new functionality, with little covering the
> USE of existing commands. I could not find a list anywhere of the
> available org.eclipse.ui.* command IDs.
>
> Is there anything with examples of using the PDE API to do things like
>
> enumerate the files in a directory
> iterate over the list, opening each one in the report designer, then
> issuing a "Save As..." command
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.04396 seconds