Source:
<code>protected void beforeCreatingItem(ImportItem importItem) { IComponent component = ComponentsFactoryProvider.getInstance().get("cTimer", "CAMEL"); <START> <END> String camelVersionSubString = ""; String camelVersion = ""; String camelPrefix = "camel-core-"; for (ModuleNeeded mn : component.getModulesNeeded()) { if (mn.getModuleName().startsWith(camelPrefix)) { camelVersionSubString = mn.getModuleName().substring(camelPrefix.length()); camelVersion = camelVersionSubString.substring(0, camelVersionSubString.lastIndexOf(".jar")); break; } } super.beforeCreatingItem(importItem); if (importItem != null && importItem.getItem() != null && importItem.getItem() instanceof BeanItem) { EList imports = ((BeanItem) importItem.getItem()).getImports(); String camelCxfPrefix = "camel-cxf-"; for (Object imp : imports) { if (imp instanceof IMPORTType) { IMPORTType importType = (IMPORTType) imp; String impName = importType.getMODULE().substring(importType.getMODULE().lastIndexOf('-') + 1); if (StringUtils.startsWith(importType.getMODULE(), camelCxfPrefix) && "TESB.jar".equals(impName)) { importType.setMODULE(camelCxfPrefix + camelVersionSubString); importType.setMVN("mvn:org.talend.libraries/" + camelCxfPrefix + camelVersion + "/6.0.0-SNAPSHOT/jar"); } } for (ModuleNeeded defaultNeed : ModulesNeededProvider.getModulesNeededForBeans()) { String moduleName = defaultNeed.getId(); if (imp instanceof IMPORTType) { IMPORTType importType = (IMPORTType) imp; String impName = importType.getMODULE().substring(0, importType.getMODULE().lastIndexOf('-')); if (moduleName.equals(impName) && !importType.getMODULE().equals(defaultNeed.getModuleName())) { importType.setMODULE(defaultNeed.getModuleName()); importType.setMESSAGE(defaultNeed.getInformationMsg()); importType.setMVN(defaultNeed.getMavenUri()); } } } } } }</code><technical_language>ModulesNeededProvider.getComponentModuleById("CAMEL", "camel-core") get camel-core version</technical_language>

Target:
protected void beforeCreatingItem(ImportItem importItem) { IComponent component = ComponentsFactoryProvider.getInstance().get("cTimer", "CAMEL"); String camelVersionSubString = ""; String camelVersion = ""; String camelPrefix = "camel-core-"; for (ModuleNeeded mn : component.getModulesNeeded()) { if (mn.getModuleName().startsWith(camelPrefix)) { camelVersionSubString = mn.getModuleName().substring(camelPrefix.length()); camelVersion = camelVersionSubString.substring(0, camelVersionSubString.lastIndexOf(".jar")); break; } } super.beforeCreatingItem(importItem); if (importItem != null && importItem.getItem() != null && importItem.getItem() instanceof BeanItem) { EList imports = ((BeanItem) importItem.getItem()).getImports(); String camelCxfPrefix = "camel-cxf-"; for (Object imp : imports) { if (imp instanceof IMPORTType) { IMPORTType importType = (IMPORTType) imp; String impName = importType.getMODULE().substring(importType.getMODULE().lastIndexOf('-') + 1); if (StringUtils.startsWith(importType.getMODULE(), camelCxfPrefix) && "TESB.jar".equals(impName)) { importType.setMODULE(camelCxfPrefix + camelVersionSubString); importType.setMVN("mvn:org.talend.libraries/" + camelCxfPrefix + camelVersion + "/6.0.0-SNAPSHOT/jar"); } } for (ModuleNeeded defaultNeed : ModulesNeededProvider.getModulesNeededForBeans()) { String moduleName = defaultNeed.getId(); if (imp instanceof IMPORTType) { IMPORTType importType = (IMPORTType) imp; if (importType.getMODULE().indexOf('-') > 0) { String impName = importType.getMODULE().substring(0, importType.getMODULE().lastIndexOf('-')); if (moduleName.equals(impName) && !importType.getMODULE().equals(defaultNeed.getModuleName())) { importType.setMODULE(defaultNeed.getModuleName()); importType.setMESSAGE(defaultNeed.getInformationMsg()); importType.setMVN(defaultNeed.getMavenUri()); } } } } } } }