Search in sources :

Example 16 with JetBean

use of org.talend.designer.codegen.config.JetBean in project tdi-studio-se by Talend.

the class CodeGenerator method initializeJetBean.

/**
     * Initialize Jet Bean to pass to the Jet Generator.
     * 
     * @param argument the node to convert
     * @return the initialized JetBean
     */
private JetBean initializeJetBean(Object argument) {
    JetBean jetBean = new JetBean();
    if (argument == null) {
        jetBean.setJetPluginRepository(CodeGeneratorActivator.PLUGIN_ID);
    } else {
        if (argument instanceof CodeGeneratorArgument) {
            CodeGeneratorArgument codeArgument = (CodeGeneratorArgument) argument;
            if (codeArgument.getArgument() instanceof INode) {
                String componentsPath = IComponentsFactory.COMPONENTS_LOCATION;
                IBrandingService breaningService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
                if (breaningService.isPoweredOnlyCamel()) {
                    componentsPath = IComponentsFactory.CAMEL_COMPONENTS_LOCATION;
                }
                jetBean.setJetPluginRepository(componentsPath);
            } else {
                jetBean.setJetPluginRepository(CodeGeneratorActivator.PLUGIN_ID);
            }
        } else {
            jetBean.setJetPluginRepository(CodeGeneratorActivator.PLUGIN_ID);
        }
    }
    jetBean.setArgument(argument);
    return jetBean;
}
Also used : JetBean(org.talend.designer.codegen.config.JetBean) INode(org.talend.core.model.process.INode) CodeGeneratorArgument(org.talend.designer.codegen.config.CodeGeneratorArgument) IBrandingService(org.talend.core.ui.branding.IBrandingService)

Aggregations

JetBean (org.talend.designer.codegen.config.JetBean)16 LightJetBean (org.talend.designer.codegen.config.LightJetBean)8 CodeGeneratorArgument (org.talend.designer.codegen.config.CodeGeneratorArgument)7 JETException (org.eclipse.emf.codegen.jet.JETException)5 ArrayList (java.util.ArrayList)4 CoreException (org.eclipse.core.runtime.CoreException)3 IComponentFileNaming (org.talend.core.model.components.IComponentFileNaming)3 IBrandingService (org.talend.core.ui.branding.IBrandingService)3 CodeGeneratorException (org.talend.designer.codegen.exception.CodeGeneratorException)3 HashMap (java.util.HashMap)2 BusinessException (org.talend.commons.exception.BusinessException)2 IContextParameter (org.talend.core.model.process.IContextParameter)2 INode (org.talend.core.model.process.INode)2 TalendJetEmitter (org.talend.designer.codegen.config.TalendJetEmitter)2 TemplateUtil (org.talend.designer.codegen.config.TemplateUtil)2 JetProxy (org.talend.designer.codegen.proxy.JetProxy)2 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 IFile (org.eclipse.core.resources.IFile)1 IProject (org.eclipse.core.resources.IProject)1