Dylan's BI Study Notes

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

ODI SDK – Create Shortcut to Interface

I created an interface manually before testing this SDK.

ODI provides the shortcut functionality.  ODI shortcut allows us to reuse our adapter codes for different OLTP releases.

All shortcuts can be automatically created when a new OLTP release becomes available.

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.OdiInterface;
import oracle.odi.domain.topology.OdiContext;
import oracle.odi.domain.project.finder.IOdiProjectFinder;
import oracle.odi.domain.project.finder.IOdiFolderFinder;
import oracle.odi.domain.project.finder.IOdiInterfaceFinder;
import oracle.odi.domain.topology.finder.IOdiContextFinder;

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");
Collection<OdiFolder> folders = ((IOdiFolderFinder) mgr.getFinder(OdiFolder.class))
.findByName("Test Sub-Folder 2.0", proj.getCode());
OdiFolder subFolder = folders.iterator().next();

Collection<OdiInterface> interfaces  = ((IOdiInterfaceFinder) mgr.getFinder(OdiInterface.class))
.findByName("Load Table Interface", proj.getCode());
OdiInterface base_interface = interfaces.iterator().next();

OdiContext context = ((IOdiContextFinder)mgr.getFinder(OdiContext.class)).findByCode("GLOBAL");

OdiInterface new_interface = new OdiInterface(subFolder, "Load 2", base_interface, context);

odiInstance.getTransactionalEntityManager().persist(proj);

tm.commit(txnStatus);

 

I tried the InterfaceFinder and ContextFinder in this script.

Creating as shortcut to an interface is very easy.  You just need to first find the interface you would like to create shortcut for and pass the interface to the API during creating the new shortcut.

 

One Response to “ODI SDK – Create Shortcut to Interface”

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

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