Compare commits
12 Commits
patch/TPS-
...
feature/ma
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
526a25c1d6 | ||
|
|
032815cee6 | ||
|
|
f6bb55ee73 | ||
|
|
384437ce2f | ||
|
|
cd1a6f1941 | ||
|
|
15b909fefc | ||
|
|
76782144d2 | ||
|
|
6f726b2c57 | ||
|
|
dde0daffd2 | ||
|
|
aaf34ef8ca | ||
|
|
6a272cdb18 | ||
|
|
f38d25fbfc |
@@ -58,6 +58,21 @@ public class Project {
|
||||
|
||||
private IReferenceProjectProvider referenceProjectProvider;
|
||||
|
||||
private boolean camel3 = false;
|
||||
|
||||
public boolean isCamel3() {
|
||||
return "3".equals(project.getCamelFamilyVersion());
|
||||
}
|
||||
|
||||
public void setCamel3(boolean camel3) {
|
||||
|
||||
if (camel3) {
|
||||
project.setCamelFamilyVersion("3");
|
||||
}
|
||||
|
||||
this.camel3 = camel3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for mainProject.
|
||||
*
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
@@ -62,7 +63,6 @@ import org.talend.designer.core.model.utils.emf.talendfile.RoutinesParameterType
|
||||
import org.talend.designer.runprocess.ItemCacheManager;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
|
||||
/**
|
||||
* DOC bqian class global comment. Detailled comment
|
||||
@@ -1032,6 +1032,12 @@ public final class ProcessUtils {
|
||||
return hasJettyEndpoint;
|
||||
}
|
||||
|
||||
public static boolean isCamel3(IProcess process) {
|
||||
Project project = ProjectManager.getInstance().getCurrentProject();
|
||||
|
||||
return project.isCamel3();
|
||||
}
|
||||
|
||||
private static boolean hasJettyEndpoint(EList<NodeType> nodesList) {
|
||||
for (NodeType node : nodesList) {
|
||||
if ("cMessagingEndpoint".equals(node.getComponentName())) {
|
||||
|
||||
@@ -22,7 +22,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.RegExUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IContributor;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
@@ -32,8 +33,10 @@ import org.talend.commons.utils.workbench.extensions.IExtensionPointLimiter;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ILibraryManagerService;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.designer.core.model.utils.emf.component.IMPORTType;
|
||||
import org.talend.librariesmanager.i18n.Messages;
|
||||
import org.talend.repository.ProjectManager;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -158,6 +161,8 @@ public class ExtensionModuleManager {
|
||||
return clonedList;
|
||||
}
|
||||
|
||||
Project project = ProjectManager.getInstance().getCurrentProject();
|
||||
|
||||
public List<ModuleNeeded> getModuleNeededForComponent(String context, IMPORTType importType) {
|
||||
List<ModuleNeeded> importNeedsList = new ArrayList<ModuleNeeded>();
|
||||
String id = null;
|
||||
@@ -170,6 +175,12 @@ public class ExtensionModuleManager {
|
||||
id = moduleGroup;
|
||||
isGroup = true;
|
||||
}
|
||||
|
||||
if (project != null && project.isCamel3() && StringUtils.startsWith(context, "c")
|
||||
&& StringUtils.startsWith(id, "camel-")) {
|
||||
id = RegExUtils.replaceFirst(id, "camel-", "camel3-");
|
||||
}
|
||||
|
||||
List<ModuleNeeded> modulesNeeded = getModuleNeeded(id, isGroup);
|
||||
for (ModuleNeeded moduleNeeded : modulesNeeded) {
|
||||
String msg = importType.getMESSAGE();
|
||||
|
||||
@@ -63,6 +63,7 @@ import org.talend.core.model.components.ComponentManager;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.components.IComponentsFactory;
|
||||
import org.talend.core.model.components.IComponentsService;
|
||||
import org.talend.core.model.general.ILibrariesService;
|
||||
import org.talend.core.model.general.ILibrariesService.IChangedLibrariesListener;
|
||||
import org.talend.core.model.general.LibraryInfo;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
@@ -83,7 +84,6 @@ import org.talend.core.model.routines.IRoutinesProvider;
|
||||
import org.talend.core.runtime.maven.MavenArtifact;
|
||||
import org.talend.core.runtime.maven.MavenUrlHelper;
|
||||
import org.talend.core.runtime.process.TalendProcessOptionConstants;
|
||||
import org.talend.core.ui.ITestContainerProviderService;
|
||||
import org.talend.core.utils.CodesJarResourceCache;
|
||||
import org.talend.core.utils.TalendCacheUtils;
|
||||
import org.talend.core.utils.TalendQuoteUtils;
|
||||
@@ -95,6 +95,7 @@ import org.talend.librariesmanager.model.service.CustomUriManager;
|
||||
import org.talend.librariesmanager.model.service.LibrariesIndexManager;
|
||||
import org.talend.librariesmanager.prefs.LibrariesManagerUtils;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.documentation.ExportFileResource;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.talend.repository.model.IRepositoryService;
|
||||
|
||||
@@ -305,6 +306,7 @@ public class ModulesNeededProvider {
|
||||
for (ModuleNeeded neededLibrary : neededLibraries) {
|
||||
boolean alreadyInImports = false;
|
||||
for (ModuleNeeded module : getModulesNeeded()) {
|
||||
if (module == null) continue;
|
||||
if (module != null && module.getModuleName() != null
|
||||
&& module.getModuleName().equals(neededLibrary.getModuleName())) {
|
||||
if (StringUtils.equals(module.getMavenUri(), neededLibrary.getMavenUri())) {
|
||||
@@ -521,7 +523,7 @@ public class ModulesNeededProvider {
|
||||
if (ComponentCategory.CATEGORY_4_CAMEL.getName().equals(process.getComponentsType())) {
|
||||
// route do not save any relationship with beans , so add all for now
|
||||
modulesNeeded.addAll(getCodesModuleNeededs(ERepositoryObjectType.BEANS));
|
||||
modulesNeeded.addAll(getModulesNeededForRoutes());
|
||||
modulesNeeded.addAll(getModulesNeededForRoutes(processItem));
|
||||
}
|
||||
return modulesNeeded;
|
||||
}
|
||||
@@ -576,14 +578,6 @@ public class ModulesNeededProvider {
|
||||
}
|
||||
EList<RoutinesParameterType> routinesParameterTypes = null;
|
||||
if (item instanceof ProcessItem) {
|
||||
ITestContainerProviderService testcaseService = ITestContainerProviderService.get();
|
||||
if (testcaseService != null && testcaseService.isTestContainerItem(item)) {
|
||||
try {
|
||||
item = testcaseService.getParentJobItem(item);
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
if (((ProcessItem) item).getProcess() != null && ((ProcessItem) item).getProcess().getParameters() != null) {
|
||||
routinesParameterTypes = ((ProcessItem) item).getProcess().getParameters().getRoutinesParameter();
|
||||
}
|
||||
@@ -782,12 +776,33 @@ public class ModulesNeededProvider {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<ModuleNeeded> getModulesNeededForRoutes() {
|
||||
/**
|
||||
* DOC sunchaoqun Comment method "getModulesNeededForRoutes".
|
||||
*
|
||||
* @param processes
|
||||
* @return
|
||||
*/
|
||||
private static List<ModuleNeeded> getModulesNeededForRoutes(ProcessItem processItem) {
|
||||
ILibrariesService service = null;
|
||||
if (!GlobalServiceRegister.getDefault().isServiceRegistered(ILibrariesService.class)) {
|
||||
return null;
|
||||
}
|
||||
service = (ILibrariesService) GlobalServiceRegister.getDefault().getService(ILibrariesService.class);
|
||||
|
||||
Project project = ProjectManager.getInstance().getCurrentProject();
|
||||
|
||||
if (importNeedsListForRoutes == null) {
|
||||
|
||||
importNeedsListForRoutes = new ArrayList<ModuleNeeded>();
|
||||
importNeedsListForRoutes.add(getComponentModuleById("CAMEL", "camel-core"));
|
||||
importNeedsListForRoutes.add(getComponentModuleById("CAMEL", "camel-spring"));
|
||||
|
||||
if (processItem != null && project.isCamel3()) {
|
||||
importNeedsListForRoutes.addAll(service.getModuleNeeded("camel3-core", true));
|
||||
importNeedsListForRoutes.addAll(service.getModuleNeeded("camel3-spring", true));
|
||||
} else {
|
||||
importNeedsListForRoutes.add(getComponentModuleById("CAMEL", "camel-core"));
|
||||
importNeedsListForRoutes.add(getComponentModuleById("CAMEL", "camel-spring"));
|
||||
}
|
||||
|
||||
importNeedsListForRoutes.add(getComponentModuleById("CAMEL", "spring-context"));
|
||||
importNeedsListForRoutes.add(getComponentModuleById("CAMEL", "spring-beans"));
|
||||
importNeedsListForRoutes.add(getComponentModuleById("CAMEL", "spring-core"));
|
||||
@@ -800,9 +815,16 @@ public class ModulesNeededProvider {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
importNeedsListForRoutes.removeIf(m-> (m==null));
|
||||
|
||||
return importNeedsListForRoutes;
|
||||
}
|
||||
|
||||
public static List<ModuleNeeded> getModulesNeededForRoutes() {
|
||||
return getModulesNeededForRoutes(null);
|
||||
}
|
||||
|
||||
private static void getModulesNeededForRoutesJava11() {
|
||||
/**
|
||||
* importNeedsListForRoutes.add(getModuleNeededForName("istack-commons-runtime-3.0.8.jar"));
|
||||
@@ -838,9 +860,32 @@ public class ModulesNeededProvider {
|
||||
}
|
||||
|
||||
public static List<ModuleNeeded> getModulesNeededForBeans() {
|
||||
return getModulesNeededForBeans(null);
|
||||
}
|
||||
|
||||
public static List<ModuleNeeded> getModulesNeededForBeans(ExportFileResource[] processes) {
|
||||
ProcessItem processItem = null;
|
||||
if (processes != null && processes.length > 0) {
|
||||
if (processes[0].getItem() instanceof ProcessItem) {
|
||||
processItem = (ProcessItem) processes[0].getItem();
|
||||
}
|
||||
}
|
||||
|
||||
if (importNeedsListForBeans == null) {
|
||||
importNeedsListForBeans = getModulesNeededForRoutes();
|
||||
importNeedsListForBeans.add(getComponentModuleById("CAMEL", "camel-cxf"));
|
||||
importNeedsListForBeans = getModulesNeededForRoutes(processItem);
|
||||
|
||||
Project project = ProjectManager.getInstance().getCurrentProject();
|
||||
boolean camel3 = true;
|
||||
if (processItem != null && project.isCamel3()) {
|
||||
camel3 = true;
|
||||
}
|
||||
|
||||
if (camel3) {
|
||||
importNeedsListForBeans.add(getComponentModuleById("CAMEL", "camel3-cxf"));
|
||||
} else {
|
||||
importNeedsListForBeans.add(getComponentModuleById("CAMEL", "camel-cxf"));
|
||||
}
|
||||
|
||||
importNeedsListForBeans.add(getComponentModuleById("CAMEL", "cxf-core"));
|
||||
importNeedsListForBeans.add(getComponentModuleById("CAMEL", "javax.ws.rs-api"));
|
||||
for (ModuleNeeded need : importNeedsListForBeans) {
|
||||
|
||||
@@ -64,6 +64,8 @@
|
||||
eType="#//MigrationTask" containment="true"/>
|
||||
<eStructuralFeatures xsi:type="ecore:EAttribute" name="bigData" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
|
||||
defaultValueLiteral="true"/>
|
||||
<eStructuralFeatures xsi:type="ecore:EAttribute" name="camelFamilyVersion" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
|
||||
defaultValueLiteral="2"/>
|
||||
</eClassifiers>
|
||||
<eClassifiers xsi:type="ecore:EClass" name="ProjectComponentAuthorisation">
|
||||
<eStructuralFeatures xsi:type="ecore:EReference" name="project" lowerBound="1"
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute properties.ecore#//Project/migrationTasks"/>
|
||||
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference properties.ecore#//Project/migrationTask"/>
|
||||
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute properties.ecore#//Project/bigData"/>
|
||||
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute properties.ecore#//Project/camelFamilyVersion"/>
|
||||
</genClasses>
|
||||
<genClasses ecoreClass="properties.ecore#//ProjectComponentAuthorisation">
|
||||
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference properties.ecore#//ProjectComponentAuthorisation/project"/>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -373,13 +373,22 @@ public interface PropertiesPackage extends EPackage {
|
||||
*/
|
||||
int PROJECT__BIG_DATA = 34;
|
||||
|
||||
/**
|
||||
* The feature id for the '<em><b>Camel Family Version</b></em>' attribute.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int PROJECT__CAMEL_FAMILY_VERSION = 35;
|
||||
|
||||
/**
|
||||
* The number of structural features of the '<em>Project</em>' class.
|
||||
* <!-- begin-user-doc --> <!-- end-user-doc -->
|
||||
* @generated
|
||||
* @ordered
|
||||
*/
|
||||
int PROJECT_FEATURE_COUNT = 35;
|
||||
int PROJECT_FEATURE_COUNT = 36;
|
||||
|
||||
/**
|
||||
* The meta object id for the '{@link org.talend.core.model.properties.impl.PropertyImpl <em>Property</em>}' class.
|
||||
@@ -9966,6 +9975,17 @@ public interface PropertiesPackage extends EPackage {
|
||||
*/
|
||||
EAttribute getProject_Description();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the attribute '{@link org.talend.core.model.properties.Project#getCamelFamilyVersion <em>Camel Family Version</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the meta object for the attribute '<em>Camel Family Version</em>'.
|
||||
* @see org.talend.core.model.properties.Project#getCamelFamilyVersion()
|
||||
* @see #getProject()
|
||||
* @generated
|
||||
*/
|
||||
EAttribute getProject_CamelFamilyVersion();
|
||||
|
||||
/**
|
||||
* Returns the meta object for the attribute '{@link org.talend.core.model.properties.Project#getLanguage <em>Language</em>}'.
|
||||
* <!-- begin-user-doc --> <!-- end-user-doc -->
|
||||
@@ -16094,6 +16114,14 @@ public interface PropertiesPackage extends EPackage {
|
||||
*/
|
||||
EAttribute PROJECT__DESCRIPTION = eINSTANCE.getProject_Description();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Camel Family Version</b></em>' attribute feature.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
EAttribute PROJECT__CAMEL_FAMILY_VERSION = eINSTANCE.getProject_CamelFamilyVersion();
|
||||
|
||||
/**
|
||||
* The meta object literal for the '<em><b>Language</b></em>' attribute feature.
|
||||
* <!-- begin-user-doc --> <!--
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1098,6 +1098,15 @@ public class PropertiesPackageImpl extends EPackageImpl implements PropertiesPac
|
||||
return (EAttribute)projectEClass.getEStructuralFeatures().get(4);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public EAttribute getProject_CamelFamilyVersion() {
|
||||
return (EAttribute)projectEClass.getEStructuralFeatures().get(35);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
@@ -6382,6 +6391,7 @@ public class PropertiesPackageImpl extends EPackageImpl implements PropertiesPac
|
||||
createEAttribute(projectEClass, PROJECT__MIGRATION_TASKS);
|
||||
createEReference(projectEClass, PROJECT__MIGRATION_TASK);
|
||||
createEAttribute(projectEClass, PROJECT__BIG_DATA);
|
||||
createEAttribute(projectEClass, PROJECT__CAMEL_FAMILY_VERSION);
|
||||
|
||||
projectComponentAuthorisationEClass = createEClass(PROJECT_COMPONENT_AUTHORISATION);
|
||||
createEReference(projectComponentAuthorisationEClass, PROJECT_COMPONENT_AUTHORISATION__PROJECT);
|
||||
@@ -7161,6 +7171,7 @@ public class PropertiesPackageImpl extends EPackageImpl implements PropertiesPac
|
||||
initEAttribute(getProject_MigrationTasks(), theEcorePackage.getEString(), "migrationTasks", null, 0, -1, Project.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
initEReference(getProject_MigrationTask(), this.getMigrationTask(), null, "migrationTask", null, 0, -1, Project.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
initEAttribute(getProject_BigData(), ecorePackage.getEBoolean(), "bigData", "true", 0, 1, Project.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
initEAttribute(getProject_CamelFamilyVersion(), ecorePackage.getEString(), "camelFamilyVersion", "2", 0, 1, Project.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
|
||||
initEClass(projectComponentAuthorisationEClass, ProjectComponentAuthorisation.class, "ProjectComponentAuthorisation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
|
||||
initEReference(getProjectComponentAuthorisation_Project(), this.getProject(), this.getProject_AllowedComponents(), "project", null, 1, 1, ProjectComponentAuthorisation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
|
||||
|
||||
@@ -832,6 +832,7 @@ public class LocalRepositoryFactory extends AbstractEMFRepositoryFactory impleme
|
||||
project.setAuthor(projectInfor.getAuthor());
|
||||
project.setLocal(true);
|
||||
project.setTechnicalLabel(technicalLabel);
|
||||
project.setCamel3(true);
|
||||
|
||||
saveProject(prj, project);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user