/
Using Transformation Manager from other components

Using Transformation Manager from other components

In order to use transformation manager from another epsos common component you can use the following part of code

Transform Document

// Here is the target language of the transformation method
lrtLang="el-GR";
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("ctx_tm.xml");
ITransformationService tService = (ITransformationService) applicationContext.getBean(ITransformationService.class.getName());
TMResponseStructure tmResponse = tService.translate(doc, ltrLang);
Document translatedDoc = tmResponse.getResponseCDA();

As you can see you have to have access to ctx_tm.xml file in your application. A sample ctx_tm.xml file can be found here

Get List of Available Languages exist in the LTR Database

ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("ctx_tm.xml");
ITransformationService tService = (ITransformationService) applicationContext.getBean(ITransformationService.class.getName());
List<String> ltrLanguages = tService.getLtrLanguages();