Search in sources :

Example 6 with TemplateUtil

use of org.talend.designer.codegen.config.TemplateUtil in project tesb-studio-se by Talend.

the class ContextPartGenerator method generatePart.

public CharSequence generatePart(IContext designerContext) throws CodeGeneratorException {
    List<IContextParameter> listParameters = designerContext.getContextParameterList();
    if (listParameters == null) {
        return "";
    }
    CodeGeneratorArgument codeGenArgument = argumentBuilder.build();
    codeGenArgument.setContextName(designerContext.getName());
    List<IContextParameter> listParametersCopy = tranformEncryptedParams(listParameters);
    codeGenArgument.setNode(listParametersCopy);
    JetBean jetBean = JetUtil.createJetBean(codeGenArgument);
    CodeGeneratorInternalTemplatesFactory codegenTemplatesFactory = CodeGeneratorInternalTemplatesFactoryProvider.getInstance();
    if (codegenTemplatesFactory.getTemplates() == null) {
        codegenTemplatesFactory.init();
    }
    for (TemplateUtil template : codegenTemplatesFactory.getTemplatesFromType(EInternalTemplate.CONTEXT)) {
        jetBean.setJetPluginRepository(template.getJetPluginRepository());
        jetBean.setTemplateRelativeUri(template.getTemplateRelativeUri());
    }
    return JetUtil.jetGenerate(jetBean);
}
Also used : JetBean(org.talend.designer.codegen.config.JetBean) TemplateUtil(org.talend.designer.codegen.config.TemplateUtil) CodeGeneratorArgument(org.talend.designer.codegen.config.CodeGeneratorArgument) CodeGeneratorInternalTemplatesFactory(org.talend.designer.codegen.model.CodeGeneratorInternalTemplatesFactory) IContextParameter(org.talend.core.model.process.IContextParameter)

Aggregations

TemplateUtil (org.talend.designer.codegen.config.TemplateUtil)6 ArrayList (java.util.ArrayList)3 CodeGeneratorArgument (org.talend.designer.codegen.config.CodeGeneratorArgument)3 JetBean (org.talend.designer.codegen.config.JetBean)3 File (java.io.File)2 IOException (java.io.IOException)2 URL (java.net.URL)2 Path (org.eclipse.core.runtime.Path)2 IContextParameter (org.talend.core.model.process.IContextParameter)2 FileFilter (java.io.FileFilter)1 IFile (org.eclipse.core.resources.IFile)1 CoreException (org.eclipse.core.runtime.CoreException)1 JETException (org.eclipse.emf.codegen.jet.JETException)1 Test (org.junit.Test)1 Bundle (org.osgi.framework.Bundle)1 CamelJetFileProvider (org.talend.camel.designer.codegen.jet.CamelJetFileProvider)1 EInternalTemplate (org.talend.designer.codegen.config.EInternalTemplate)1 CodeGeneratorException (org.talend.designer.codegen.exception.CodeGeneratorException)1 CodeGeneratorInternalTemplatesFactory (org.talend.designer.codegen.model.CodeGeneratorInternalTemplatesFactory)1