如何使用 groovy 编辑 ODI 中的现有映射
How to a edit an existing mapping in ODI using groovy
我正在尝试弄清楚如何使用 groovy 来编辑现有映射。
我可以创建新的映射。我试图删除代码的删除部分,但它会给我一个错误,我需要删除现有映射
//delete old mapping
/* remove delete portion to use edit existing mapping
removeMapping(folder, mappingName)
txnDef = new DefaultTransactionDefinition()
tm = odiInstance.getTransactionManager()
tme = odiInstance.getTransactionalEntityManager()
txnStatus = tm.getTransaction(txnDef)
dsf = (IOdiDataStoreFinder)tme.getFinder(OdiDataStore.class)
mapf = (IMappingFinder) tme.getFinder(Mapping.class)
*/
//create new mapping
map = new Mapping(mappingName, folder);
tme.persist(map)
从错误来看,似乎必须删除映射 (Load_TRG_CUSTOMER)。
如果您需要更多代码,请告诉我。
错误:
ODI-16096: A mapping with name Load_TRG_CUSTOMER already exists in folder TEST_FOLDER.
(Subtract 18 from the error line number to account for the standard imports)
oracle.odi.domain.mapping.exception.MappingException: ODI-16096: A mapping with name Load_TRG_CUSTOMER already exists in folder TEST_FOLDER.
at oracle.odi.domain.mapping.Mapping.checkName(Mapping.java:153)
感谢大家的帮助。
IMappingFinder provides useful methods to find an existing mapping. As you already know the name and folder, I guess that the findByName方法最适合你。
我看到您已经实例化了 IMappingFinder(尽管目前已对其进行评论)。所以你只需要替换 :
map = new Mapping(mappingName, folder);
来自
map = (Mapping) mapf.findByName(folder, mappingName);
我正在尝试弄清楚如何使用 groovy 来编辑现有映射。
我可以创建新的映射。我试图删除代码的删除部分,但它会给我一个错误,我需要删除现有映射
//delete old mapping
/* remove delete portion to use edit existing mapping
removeMapping(folder, mappingName)
txnDef = new DefaultTransactionDefinition()
tm = odiInstance.getTransactionManager()
tme = odiInstance.getTransactionalEntityManager()
txnStatus = tm.getTransaction(txnDef)
dsf = (IOdiDataStoreFinder)tme.getFinder(OdiDataStore.class)
mapf = (IMappingFinder) tme.getFinder(Mapping.class)
*/
//create new mapping
map = new Mapping(mappingName, folder);
tme.persist(map)
从错误来看,似乎必须删除映射 (Load_TRG_CUSTOMER)。 如果您需要更多代码,请告诉我。
错误:
ODI-16096: A mapping with name Load_TRG_CUSTOMER already exists in folder TEST_FOLDER.
(Subtract 18 from the error line number to account for the standard imports)
oracle.odi.domain.mapping.exception.MappingException: ODI-16096: A mapping with name Load_TRG_CUSTOMER already exists in folder TEST_FOLDER.
at oracle.odi.domain.mapping.Mapping.checkName(Mapping.java:153)
感谢大家的帮助。
IMappingFinder provides useful methods to find an existing mapping. As you already know the name and folder, I guess that the findByName方法最适合你。
我看到您已经实例化了 IMappingFinder(尽管目前已对其进行评论)。所以你只需要替换 :
map = new Mapping(mappingName, folder);
来自
map = (Mapping) mapf.findByName(folder, mappingName);