Данная страница была утеряна на оригинальном сайте http://odiexperts.com/, и я попытался восстановить ее содержание используя http://web.archive.org/.
Hi Friends!
First of all HAPPY NEW YEAR!
We, from ODI Experts, hope that 2012 be a fantastic year for all of you!
Continuing our "Java code series" take a look on this new one.
The below code is used to Generate/Regenerate All Scenario and depending on the options the appropriate ODI Objects scenario will be generated/regenerated.
Also make sure you use the appropriate Generating option i.e INCREMENTAL_MODE (OR) REGENERATE_MODE (OR) REPLACE_MODE
GenerationOptions options=new GenerationOptions(GenerationOptions.INCREMENTAL_MODE, GenerateFromPackage, GenerateFromInterface, GenerateFromProcedure, GenerateFromVariable);
package odi.sdk;
import oracle.odi.core.OdiInstance;
import oracle.odi.core.config.MasterRepositoryDbInfo;
import oracle.odi.core.config.OdiInstanceConfig;
import oracle.odi.core.config.PoolingAttributes;
import oracle.odi.core.config.WorkRepositoryDbInfo;
import oracle.odi.core.persistence.transaction.ITransactionStatus;
import oracle.odi.core.persistence.transaction.support.DefaultTransactionDefinition;
import oracle.odi.core.security.Authentication;
import oracle.odi.domain.project.OdiFolder;
import oracle.odi.domain.project.OdiProject;
import oracle.odi.domain.project.finder.IOdiProjectFinder;
import oracle.odi.domain.runtime.scenario.OdiScenario;
import oracle.odi.generation.GenerationOptions;
import oracle.odi.generation.support.OdiScenarioGeneratorImpl;
import oracle.odi.impexp.EncodingOptions;
import oracle.odi.impexp.support.ExportServiceImpl;
public class RegenrateAllScen {
private static String Project_Code;
private static OdiProject project;
private static String Folder_Name;
private static OdiFolder folder;
/**
* @param args
*/
public static void main(String[] args) {
/****** Please change these Parameters *********/
/** Development Repository ****/
String Url = "jdbc:oracle:thin:@localhost:1521:xe";
String Driver="oracle.jdbc.OracleDriver";
String Master_User="ODI_MASTER_11G";
String Master_Pass="ODI_MASTER_11G";
String WorkRep="WORKREP1";
String Odi_User="SUPERVISOR";
String Odi_Pass="SUNOPSIS";
// Generating ODI Objects options
Boolean GenerateFromInterface = true;
Boolean GenerateFromPackage = true;
Boolean GenerateFromProcedure = true;
Boolean GenerateFromVariable = true;
Project_Code ="XMT";
/********************************************/
MasterRepositoryDbInfo masterInfo = new MasterRepositoryDbInfo(Url, Driver, Master_User,Master_Pass.toCharArray(), new PoolingAttributes());
WorkRepositoryDbInfo workInfo = new WorkRepositoryDbInfo(WorkRep, new PoolingAttributes());
OdiInstance odiInstance=OdiInstance.createInstance(new OdiInstanceConfig(masterInfo,workInfo));
Authentication auth = odiInstance.getSecurityManager().createAuthentication(Odi_User,Odi_Pass.toCharArray());
odiInstance.getSecurityManager().setCurrentThreadAuthentication(auth);
ITransactionStatus trans = odiInstance.getTransactionManager().getTransaction(new DefaultTransactionDefinition());
//Regenerating All Scenario by Project
// Get Project
project = ((IOdiProjectFinder) odiInstance.getTransactionalEntityManager().getFinder(OdiProject.class)).findByCode(Project_Code);
OdiScenarioGeneratorImpl generatescen=new OdiScenarioGeneratorImpl(odiInstance);
//
// Please change your Generating Option ie INCREMENTAL (or) REGENERATE (or) REPLACE
//
GenerationOptions options=new GenerationOptions(GenerationOptions.INCREMENTAL_MODE, GenerateFromPackage, GenerateFromInterface, GenerateFromProcedure, GenerateFromVariable);
OdiScenario[] scen =generatescen.generateAllScenarios(project, options);
for (OdiScenario odiScenario : scen) {
System.out.println( options.getMode()+" Generating Scenario " +odiScenario.getName()+"\t"+odiScenario.getVersion());
}
odiInstance.getTransactionManager().commit(trans);
System.out.println("Commiting Changes \n Process Completed");
odiInstance.close();
}
}
Keep visiting us!
Комментариев нет:
Отправить комментарий
Примечание. Отправлять комментарии могут только участники этого блога.