Dylan's BI Study Notes

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

ODI SDK: Create a Folder

I tried to create a folder under an existing project.

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.core.persistence.IOdiEntityManager;
import oracle.odi.domain.project.OdiProject;
import oracle.odi.domain.project.OdiFolder;
import oracle.odi.domain.project.finder.IOdiProjectFinder;
import oracle.odi.domain.project.finder.IOdiFolderFinder;

ITransactionDefinition txnDef = new DefaultTransactionDefinition();

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

IOdiEntityManager mgr = odiInstance.getTransactionalEntityManager();

OdiProject proj = ((IOdiProjectFinder) mgr.getFinder(OdiProject.class)).findByCode("NEW_PROJECT");
OdiFolder myFolder = new OdiFolder(proj,"Test Folder");


odiInstance.getTransactionalEntityManager().persist(proj);

tm.commit(txnStatus);

Going through this exercise, we can learn how to navigate the objects using Finder.

A folder is created under a project.  To create a folder, you need to get a project first.

To get the existing project, ODI provided a Finder.  You can find a project by name or by code.

The above example is to get the project by the project code.

2 Responses to “ODI SDK: Create a Folder”

  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 a […]

  2. angelocastriotta said

    Hi Dylan,
    how did you get the odiInstance object?

    Usually I have to do this to get it ” odiInstance = OdiInstance.createInstance(new OdiInstanceConfig(master, work)); ”

    There is a way to get it from the excution runtime ?

    Thanks in advance,
    Angelo

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