Dylan's BI Study Notes

My notes about Business Intelligence, Data Warehousing, OLAP, and Master Data Management

ODI SDK: Create Project

This is a very simple test of ODI SDK using Groovy.  I created a new ODI project called “New Project”.  Nothing else…

import oracle.odi.core.persistence.transaction.ITransactionDefinition;
import oracle.odi.core.persistence.transaction.support.DefaultTransactionDefinition;
import oracle.odi.core.persistence.transaction.ITransactionManager;
import oracle.odi.core.persistence.transaction.ITransactionStatus;
import oracle.odi.domain.project.OdiProject;
import oracle.odi.domain.project.OdiFolder;

ITransactionDefinition txnDef = new DefaultTransactionDefinition();

ITransactionManager tm = odiInstance.getTransactionManager()
ITransactionStatus txnStatus = tm.getTransaction(txnDef)

OdiProject myProject = new OdiProject("New Project","NEW_PROJECT")
// OdiFolder myFolder = new OdiFolder(myProject,"Test Folder 001")

odiInstance.getTransactionalEntityManager().persist(myProject)

tm.commit(txnStatus)

If you create a Groovy script using the built-in editor, you do not need to specify which repository you will create this project.  You connect to a repository and run this Groovy script, the new project will be created.

To run this script, you can just simply copy the above script to the editor.

To open the editor, you can use Tool -> Groovy -> New Script.

Currently CTRL-Save is not working.  You need to use Tool -> Groovy -> Save Script to save this as a script that can be reused later.

To run this script, click on the Execute icon in the toolbar.

After running  this script, click on the refresh icon under Designer, you will see this new project.

ODI’s transaction model is quite simple.  You create a transaction in the beginning and you commit the transaction after you finish your changes.

I commented the folder creation part out, you can comment it to create a new folder under the project.

 

Advertisements

One Response to “ODI SDK: Create Project”

  1. […] tried to use ODI SDK to create a project, create a folder, create a subfolder, create a short to an interface, create a variable, and update […]

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s