Search in sources :

Example 1 with CodeGeneratorInternalTemplatesFactory

use of org.talend.designer.codegen.model.CodeGeneratorInternalTemplatesFactory 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

IContextParameter (org.talend.core.model.process.IContextParameter)1 CodeGeneratorArgument (org.talend.designer.codegen.config.CodeGeneratorArgument)1 JetBean (org.talend.designer.codegen.config.JetBean)1 TemplateUtil (org.talend.designer.codegen.config.TemplateUtil)1 CodeGeneratorInternalTemplatesFactory (org.talend.designer.codegen.model.CodeGeneratorInternalTemplatesFactory)1