Compare commits

...

8 Commits

Author SHA1 Message Date
vyu-talend
175bad96cf fix(TDI-49458):bump talend_file_enhanced.jar (#8623) 2023-03-30 22:08:33 +08:00
Jane Ding
8d6f6a9453 fix(TUP-37227):Issue building when items names too long (#8621)
* fix(TUP-37227):Issue building when items names too long (#8412)

* fix(TUP-37227):Issue building when items names too long
https://jira.talendforge.org/browse/TUP-37227

* fix(TUP-37227):Issue building when items names too long
https://jira.talendforge.org/browse/TUP-37227

* fix(TUP-37227):Issue building when items names too long
https://jira.talendforge.org/browse/TUP-37227

* fix(TUP-37227):Issue building when items names too long
https://jira.talendforge.org/browse/TUP-37227

* fix(TUP-38185):job run fail if joblet use db connection from other
joblet
https://jira.talendforge.org/browse/TUP-38185

* fix(TUP-38185):job run fail if joblet use db connection from other
joblet
https://jira.talendforge.org/browse/TUP-38185

* fix(TUP-38185):job run fail if joblet use db connection from other
joblet
https://jira.talendforge.org/browse/TUP-38185

* fix(TUP-38185):job run fail if joblet use db connection from other
joblet
https://jira.talendforge.org/browse/TUP-38185

* fix(TUP-38185):job run fail if joblet use db connection from other
joblet
https://jira.talendforge.org/browse/TUP-38185

* fix(TUP-38185):job run fail if joblet use db connection from other
joblet
https://jira.talendforge.org/browse/TUP-38185

* fix(TUP-38185):job run fail if joblet use db connection from other
joblet
https://jira.talendforge.org/browse/TUP-38185

* fix(TUP-38185):job run fail if joblet use db connection from other
joblet
https://jira.talendforge.org/browse/TUP-38185

* fix(TUP-38185):job run fail if joblet use db connection from other
joblet
https://jira.talendforge.org/browse/TUP-38185
2023-03-30 18:15:18 +08:00
Oleksandr Zhelezniak
b0c97b42b3 fix(TDI-49549): BigQuery catch NPE (#8577)
* problem in google-cloud-bigquery, catch NPE when we try to covert to JSON statistic object
2023-03-22 11:47:42 +02:00
hzhao
f8a24814fb fix(TUP-38282): Guess Schema doesn't show Context options (#8567)
* fix(TUP-38282): Guess Schema doesn't show Context options

* fix(TUP-38282): Guess Schema doesn't show Context options
2023-03-21 21:03:33 +08:00
Oleksandr Zhelezniak
3fe5cfeeac fix(TDI-49487): BigQuery forceSingleQueryExecution (#8549)
* add a new checkbox forceSingleQueryExecution. It forces the execution of complex queries as one query and get the single result.
* return the behavior of job\query executions before feature that splits query to multiquery execution
2023-03-21 10:51:02 +02:00
jzhao
2ef6fa24ee fix(TDI-49446):tFTPPut is transferring the file to the remote directory but the current status shows "No file transfered." (#8515)
* fix(TDI-49446):tFTPPut is transferring the file to the remote directory
but the current status shows "No file transfered."

* fix(TDI-49446):not change ftps part

* fix(TDI-49446):exception catch like before
2023-03-07 17:11:17 +08:00
Jane Ding
9a2e5f7bfa fix(TUP-38093):Studio 8.0.1 hangs in "Loading user component" after (#8500)
* fix(TUP-38093):Studio 8.0.1 hangs in "Loading user component" after
patch R2023-01
https://jira.talendforge.org/browse/TUP-38093

* fix(TUP-38093):Studio 8.0.1 hangs in "Loading user component" after
patch R2023-01
https://jira.talendforge.org/browse/TUP-38093
2023-03-03 17:09:52 +08:00
Jane Ding
175e48eb16 Revert "fix(TUP-37227):Issue building when items names too long (#8412)" (#8517)
This reverts commit 2ea39fb234.
2023-03-02 09:45:08 +08:00
35 changed files with 331 additions and 109 deletions

View File

@@ -74,7 +74,6 @@ import org.talend.core.model.components.IComponentsFactory;
import org.talend.core.model.components.IComponentsHandler;
import org.talend.core.model.components.filters.ComponentsFactoryProviderManager;
import org.talend.core.model.components.filters.IComponentFactoryFilter;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.runtime.util.ComponentsLocationProvider;
import org.talend.core.ui.IJobletProviderService;
import org.talend.core.ui.ISparkJobletProviderService;
@@ -119,6 +118,8 @@ public class ComponentsFactory implements IComponentsFactory {
private SubMonitor subMonitor;
private static Map<IComponent, File> customComponentFolderMap = new HashMap<IComponent, File>();
private static Map<String, Map<String, IComponent>> componentsCache = new HashMap<String, Map<String, IComponent>>();
// keep a list of the current provider for the selected component, to have the family translation
@@ -170,6 +171,7 @@ public class ComponentsFactory implements IComponentsFactory {
} // not used anymore
long startTime = System.currentTimeMillis();
customComponentFolderMap.clear();
// TimeMeasure.display = true;
// TimeMeasure.displaySteps = true;
// TimeMeasure.measureActive = true;
@@ -226,6 +228,8 @@ public class ComponentsFactory implements IComponentsFactory {
isInitialising.set(false);
initialiseLock.unlock();
}
// sync custom component libs after init
syncCustomComponentLibs();
}
private boolean wait4InitialiseFinish() {
@@ -632,7 +636,7 @@ public class ComponentsFactory implements IComponentsFactory {
componentList.add(currentComp);
if (isCustom) {
customComponentList.add(currentComp);
syncCustomComponentLibs(currentFolder, currentComp.getModulesNeeded());
customComponentFolderMap.put(currentComp, currentFolder);
}
if (pathSource != null) {
Path userComponent = new Path(pathSource);
@@ -672,18 +676,22 @@ public class ComponentsFactory implements IComponentsFactory {
}
}
private void syncCustomComponentLibs(File componentFolder, List<ModuleNeeded> modulesNeeded) {
private void syncCustomComponentLibs() {
try {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibraryManagerService.class)) {
ILibraryManagerService libraryService = GlobalServiceRegister.getDefault()
.getService(ILibraryManagerService.class);
libraryService.deployLibsFromCustomComponents(componentFolder, modulesNeeded);
if (libraryService != null) {
customComponentFolderMap.forEach((component, componentFolder) -> libraryService
.deployLibsFromCustomComponents(componentFolder, component.getModulesNeeded()));
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
} finally {
customComponentFolderMap.clear();
}
}
/**
* DOC smallet Comment method "checkComponentFolder".
*

View File

@@ -149,7 +149,7 @@
<IMPORTS>
<IMPORT
NAME="Talen File Enhanced"
MODULE="talend_file_enhanced-1.2.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.2" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.2.jar"
MODULE="talend_file_enhanced-1.3.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.3" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.3.jar"
REQUIRED="true"
/>
</IMPORTS>

View File

@@ -38,6 +38,7 @@
boolean advancedSeparator = (advancedSeparatorStr!=null&&!("").equals(advancedSeparatorStr))?("true").equals(advancedSeparatorStr):false;
String thousandsSeparator = ElementParameterParser.getValueWithJavaType(node, "__THOUSANDS_SEPARATOR__", JavaTypesManager.CHARACTER);
String decimalSeparator = ElementParameterParser.getValueWithJavaType(node, "__DECIMAL_SEPARATOR__", JavaTypesManager.CHARACTER);
final boolean forceSingleQueryExecution = ElementParameterParser.getBooleanValue(node,"__FORCE_SINGLE_QUERY_EXEC__");
query = query.replaceAll("\n"," ");
query = query.replaceAll("\r"," ");
@@ -406,7 +407,7 @@ globalMap.put("<%=cid%>_ERROR_MESSAGE",ee_<%=cid%>.getMessage());
long nb_line_<%=cid%> = 0;
java.util.List<String> child_statistics_<%=cid%> = null;
java.util.List<com.google.cloud.bigquery.Job> childJobs_<%=cid%>;
if(job_<%=cid%>.getStatistics().getNumChildJobs() != null){
if(!<%=forceSingleQueryExecution%> && job_<%=cid%>.getStatistics().getNumChildJobs() != null){
childJobs_<%=cid%> = java.util.Optional.ofNullable(bigquery_<%=cid%>.listJobs(com.google.cloud.bigquery.BigQuery.JobListOption.parentJobId(jobId_<%=cid%>.getJob())))
.map(com.google.api.gax.paging.Page::getValues)
.flatMap(iterable_<%=cid%> ->
@@ -496,7 +497,7 @@ globalMap.put("<%=cid%>_ERROR_MESSAGE",ee_<%=cid%>.getMessage());
%>
} else {
java.util.List<com.google.api.services.bigquery.model.Job> insert_jobs_<%=cid%>;
if (insert_<%=cid %>.getStatistics().getNumChildJobs() != null) {
if (!<%=forceSingleQueryExecution%> && insert_<%=cid %>.getStatistics().getNumChildJobs() != null) {
insert_jobs_<%=cid%> = bigQueryUtil_<%=cid%>.listChildJobs(insert_<%=cid %>.getJobReference().getJobId());
} else {
insert_jobs_<%=cid%> = java.util.Collections.singletonList(insert_<%=cid%>);

View File

@@ -198,6 +198,10 @@
SHOW_IF="(USE_CUSTOM_TEMPORARY_DATASET == 'true') AND (RESULT_SIZE != 'SMALL')">
<DEFAULT>"temp_dataset"</DEFAULT>
</PARAMETER>
<PARAMETER NAME="FORCE_SINGLE_QUERY_EXEC" FIELD="CHECK" REQUIRED="true" NUM_ROW="50">
<DEFAULT>false</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
<IMPORTS>

View File

@@ -15,6 +15,7 @@ CLIENT_SECRET.NAME=Client Secret
PROJECT_ID.NAME=Project ID
AUTHORIZATION_CODE.NAME=Authorization Code
ACCESS_TOKEN.NAME=OAuth Access Token
FORCE_SINGLE_QUERY_EXEC.NAME=Force single query execution
QUERY.NAME=Query
SCHEMA.NAME=Schema

View File

@@ -184,6 +184,10 @@
<ITEM NAME="AUTO" VALUE="AUTO"/>
</ITEMS>
</PARAMETER>
<PARAMETER NAME="FORCE_SINGLE_QUERY_EXEC" FIELD="CHECK" REQUIRED="true" NUM_ROW="40">
<DEFAULT>false</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
<IMPORTS>

View File

@@ -26,6 +26,8 @@
query = query.replaceAll("\n"," ").replaceAll("\r"," ");
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
final boolean forceSingleQueryExecution = ElementParameterParser.getBooleanValue(node,"__FORCE_SINGLE_QUERY_EXEC__");
if (authMode.equals("OAUTH") || authMode.equals("TOKEN")) {
String resultSizeType = ElementParameterParser.getValue(node,"__RESULT_SIZE__");
%>
@@ -70,7 +72,7 @@
%>
} else {
java.util.List<com.google.api.services.bigquery.model.Job> insert_jobs_<%=cid%>;
if (insert_<%=cid %>.getStatistics().getNumChildJobs() != null) {
if (!<%=forceSingleQueryExecution%> && insert_<%=cid %>.getStatistics().getNumChildJobs() != null) {
insert_jobs_<%=cid%> = bigQueryUtil_<%=cid%>.listChildJobs(insert_<%=cid %>.getJobReference().getJobId());
} else {
insert_jobs_<%=cid%> = java.util.Collections.singletonList(insert_<%=cid%>);
@@ -110,9 +112,17 @@
%>
} else {
com.google.gson.Gson gsonObject_<%=cid%> = new com.google.gson.Gson();
globalMap.put("<%=cid%>_STATISTICS", gsonObject_<%=cid%>.toJson(job_<%=cid%>.getStatistics()));
try {
globalMap.put("<%=cid%>_STATISTICS", gsonObject_<%=cid%>.toJson(job_<%=cid%>.getStatistics()));
} catch (NullPointerException npeex_<%=cid%>) {
// quick fix for TDI-49549 (google-cloud-bigquery library problem)
globalMap.put("<%=cid%>_STATISTICS", null);
<%if(isLog4jEnabled){%>
log.warn("<%=cid%> - Can't retrieve statistics " + jobId_<%=cid%> + " with query: " + <%=query%>);
<%}%>
}
java.util.List<com.google.cloud.bigquery.Job> childJobs_<%=cid%>;
if (job_<%=cid%>.getStatistics().getNumChildJobs() != null) {
if (!<%=forceSingleQueryExecution%> && job_<%=cid%>.getStatistics().getNumChildJobs() != null) {
childJobs_<%=cid%> = java.util.Optional.ofNullable(bigquery_<%=cid%>.listJobs(com.google.cloud.bigquery.BigQuery.JobListOption.parentJobId(jobId_<%=cid%>.getJob())))
.map(com.google.api.gax.paging.Page::getValues)
.flatMap(iterable_<%=cid%> ->

View File

@@ -14,6 +14,7 @@ PROJECT_ID.NAME=Project ID
AUTHORIZATION_CODE.NAME=Authorization Code
ACCESS_TOKEN.NAME=OAuth Access Token
FORCE_SINGLE_QUERY_EXEC.NAME=Force single query execution
QUERY.NAME=Query
SCHEMA.NAME=Schema

View File

@@ -149,7 +149,7 @@
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Talen File Enhanced"
MODULE="talend_file_enhanced-1.2.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.2" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.2.jar" REQUIRED="true" />
MODULE="talend_file_enhanced-1.3.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.3" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.3.jar" REQUIRED="true" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -245,6 +245,13 @@ globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
if(listings<%=cid %> != null && listings<%=cid %>.length > 0){
for (int m<%=cid %> = 0; m<%=cid %> < listings<%=cid %>.length; m<%=cid %>++){
<%
if (!ftps) {
%>
try {
<%
}
%>
if (listings<%=cid %>[m<%=cid %>].getName().matches(mask<%=cid %>)){
java.io.File file_in_localDir_<%=cid%> = listings<%=cid %>[m<%=cid %>];
java.io.FileInputStream file_stream_<%=cid %> = new java.io.FileInputStream(file_in_localDir_<%=cid%>);
@@ -314,6 +321,7 @@ globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
<%
if (!ftps) {
%>
currentStatus_<%=cid %> = "File rename OK.";
msg_<%=cid%>.add("file: " + file_in_localDir_<%=cid%>.getAbsolutePath() + ", size: "
+ file_in_localDir_<%=cid%>.length() + " bytes upload successfully");
<%
@@ -321,6 +329,17 @@ globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
%>
nb_file_<%=cid%>++;
}
<%
if (!ftps) {
%>
}catch(java.io.IOException e_<%=cid%>){
currentStatus_<%=cid %> = "File rename fail.";
globalMap.put("<%=cid %>_CURRENT_STATUS", currentStatus_<%=cid %>);
throw e_<%=cid%>;
}
<%
}
%>
}
}else{
<%if(isLog4jEnabled){%>
@@ -329,6 +348,7 @@ globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
System.err.println("No matches found for mask '" + key<%=cid %> + "'!");
}
}
globalMap.put("<%=cid %>_CURRENT_STATUS", currentStatus_<%=cid %>);
<%}%>
}catch(java.lang.Exception e_<%=cid%>){
globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
@@ -352,4 +372,4 @@ globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
<%
}
%>
}
}

View File

@@ -213,7 +213,7 @@
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Talen File Enhanced"
MODULE="talend_file_enhanced-1.2.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.2" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.2.jar" REQUIRED="true" />
MODULE="talend_file_enhanced-1.3.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.3" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.3.jar" REQUIRED="true" />
<IMPORT NAME="Talend_CSV" MODULE="talendcsv.jar" MVN="mvn:org.talend.libraries/talendcsv/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.csv/lib/talendcsv.jar"
REQUIRED="true" />
</IMPORTS>

View File

@@ -131,7 +131,7 @@
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Talend File Enhanced" MODULE="talend_file_enhanced-1.2.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.2" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.2.jar" REQUIRED="true" />
<IMPORT NAME="Talend File Enhanced" MODULE="talend_file_enhanced-1.3.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.3" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.3.jar" REQUIRED="true" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -118,7 +118,7 @@
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Talen File Enhanced"
MODULE="talend_file_enhanced-1.2.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.2" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.2.jar" REQUIRED="true" />
MODULE="talend_file_enhanced-1.3.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.3" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.3.jar" REQUIRED="true" />
<IMPORT NAME="Talend_CSV" MODULE="talendcsv.jar" MVN="mvn:org.talend.libraries/talendcsv/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.csv/lib/talendcsv.jar" REQUIRED="true" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -81,7 +81,7 @@
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Talen File Enhanced" MODULE="talend_file_enhanced-1.2.jar" REQUIRED="true" />
<IMPORT NAME="Talen File Enhanced" MODULE="talend_file_enhanced-1.3.jar" REQUIRED="true" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -39,7 +39,7 @@
String skipEmptyRows = "true"; //("true").equals(ElementParameterParser.getValue(node, "__SKIP_EMPTY_ROWS__"));
boolean trimAll = ("true").equals(ElementParameterParser.getValue(node,"__TRIMALL__"));
String encoding = ElementParameterParser.getValue(node,"__ENCODING__");
//need to process rows longger than 100,000 characters, the property SafetySwitch(in talend_file_enhanced-1.2.jar) should be sent to false.(the default is true)
//need to process rows longger than 100,000 characters, the property SafetySwitch(in talend_file_enhanced-1.3.jar) should be sent to false.(the default is true)
//that means if check the option(true), the logic value of bSafetySwitch should be changed to false (negate the property)
boolean bSafetySwitch = !(("true").equals(ElementParameterParser.getValue(node, "__PROCESS_LONG_ROW__")));
String advancedSeparatorStr = ElementParameterParser.getValue(node, "__ADVANCED_SEPARATOR__");

View File

@@ -128,7 +128,7 @@
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Talen File Enhanced" MODULE="talend_file_enhanced-1.2.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.2" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.2.jar" REQUIRED="true" />
<IMPORT NAME="Talen File Enhanced" MODULE="talend_file_enhanced-1.3.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.3" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.3.jar" REQUIRED="true" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -69,7 +69,7 @@
String dieOnErrorStr = ElementParameterParser.getValue(node, "__DIE_ON_ERROR__");
boolean dieOnError = (dieOnErrorStr!=null&&!("").equals(dieOnErrorStr))?("true").equals(dieOnErrorStr):false;
//need to process rows longger than 100 000 characters, the property SafetySwitch(in talend_file_enhanced-1.2.jar) should be sent to false.(the default is true)
//need to process rows longger than 100 000 characters, the property SafetySwitch(in talend_file_enhanced-1.3.jar) should be sent to false.(the default is true)
//that means if check the option(true), the logic value of bSafetySwitch should be changed to false (XOR with 'true')
boolean bSafetySwitch = (("true").equals(ElementParameterParser.getValue(node, "__PROCESS_LONG_ROW__")) ^ true);
String advancedSeparatorStr = ElementParameterParser.getValue(node, "__ADVANCED_SEPARATOR__");

View File

@@ -258,7 +258,7 @@
<IMPORTS>
<IMPORT
NAME="Talen File Enhanced"
MODULE="talend_file_enhanced-1.2.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.2" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.2.jar"
MODULE="talend_file_enhanced-1.3.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.3" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.3.jar"
REQUIRED="true"
/>
</IMPORTS>

View File

@@ -175,7 +175,7 @@
<IMPORTS>
<IMPORT
NAME="Talen File Enhanced"
MODULE="talend_file_enhanced-1.2.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.2" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.2.jar"
MODULE="talend_file_enhanced-1.3.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.3" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.3.jar"
REQUIRED="true"
/>
</IMPORTS>

View File

@@ -79,7 +79,7 @@
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Talen File Enhanced" MODULE="talend_file_enhanced-1.2.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.2" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.2.jar" REQUIRED="true" />
<IMPORT NAME="Talen File Enhanced" MODULE="talend_file_enhanced-1.3.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.3" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.3.jar" REQUIRED="true" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -381,6 +381,9 @@ public enum EParameterName {
REPAINT("REPAINT"), //$NON-NLS-1$
// for joblet short unique name
SHORT_UNIQUE_NAME("SHORT_UNIQUE_NAME"), //$NON-NLS-1$
// for automap algorithms
LEVENSHTEIN("LEVENSHTEIN"), //$NON-NLS-1$
JACCARD("JACCARD"), //$NON-NLS-1$

View File

@@ -554,9 +554,6 @@ public class DataProcess implements IGeneratingProcess {
uniqueName = prefix + uniqueName;
}
dataNode.setUniqueName(uniqueName);
if (!graphicalNode.getUniqueName().equals(graphicalNode.getGeneratingUniqueName())) {
dataNode.setGeneratingUniqueName(graphicalNode.getGeneratingUniqueName());
}
dataNode.setSubProcessStart(graphicalNode.isSubProcessStart());
dataNode.setThereLinkWithHash(graphicalNode.isThereLinkWithHash());
dataNode.setHasConditionalOutputs(graphicalNode.hasConditionalOutputs());
@@ -906,9 +903,6 @@ public class DataProcess implements IGeneratingProcess {
AbstractNode curNode;
if (component.getPluginExtension() == null) {
curNode = new DataNode(component, uniqueName);
if (!graphicalNode.getUniqueName().equals(graphicalNode.getGeneratingUniqueName())) {
curNode.setGeneratingUniqueName(graphicalNode.getGeneratingUniqueName() + "_" + curItem.getName());
}
} else {
// mapper
curNode = (AbstractNode) ExternalNodesFactory.getInstance(component.getPluginExtension());
@@ -928,9 +922,6 @@ public class DataProcess implements IGeneratingProcess {
curNode.setListConnector(graphicalNode.getListConnector());
copyElementParametersValue(graphicalNode, curNode);
curNode.setUniqueName(uniqueName);
if (!graphicalNode.getUniqueName().equals(graphicalNode.getGeneratingUniqueName())) {
curNode.setGeneratingUniqueName(graphicalNode.getGeneratingUniqueName() + "_" + curItem.getName());
}
curNode.setSubProcessStart(graphicalNode.isSubProcessStart());
curNode.setThereLinkWithHash(graphicalNode.isThereLinkWithHash());
curNode.setHasConditionalOutputs(graphicalNode.hasConditionalOutputs());
@@ -1757,9 +1748,7 @@ public class DataProcess implements IGeneratingProcess {
}
// Build a simple copy of the process (to have new objects, avoid to modify the ones in the designer..)
List<INode> newGraphicalNodeList = buildCopyOfGraphicalNodeList(graphicalNodeList);
clearNodeReplaceProviderCache();
replaceNodeFromProviders(newGraphicalNodeList);
clearNodeReplaceProviderCache();
// job settings extra (feature 2710)
if (JobSettingsManager.isImplicittContextLoadActived(duplicatedProcess)) {
List<DataNode> contextLoadNodes = JobSettingsManager.createExtraContextLoadNodes(duplicatedProcess);
@@ -3739,12 +3728,6 @@ public class DataProcess implements IGeneratingProcess {
}
}
public void clearNodeReplaceProviderCache() {
if (IJobletProviderService.get() != null) {
IJobletProviderService.get().clearJobletProcessProviderCache();
}
}
private INode addDataNode(INode dataNode) {
if (dataNode != null) {
String addedUniqueName = dataNode.getUniqueName();

View File

@@ -727,7 +727,7 @@ public class ConnectionCreateAction extends SelectionAction {
listArgs.add(meta.getTableName());
}
} else {
listArgs.add(node.getUniqueName());
listArgs.add(node.getUniqueName(false));
}
String baseName = node.getConnectionName();

View File

@@ -99,6 +99,7 @@ import org.talend.core.model.repository.ExternalNodesFactory;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.model.utils.ContextParameterUtils;
import org.talend.core.model.utils.NodeUtil;
import org.talend.core.model.utils.TalendPropertiesUtil;
import org.talend.core.model.utils.TalendTextUtils;
import org.talend.core.prefs.ITalendCorePrefConstants;
import org.talend.core.repository.model.ProxyRepositoryFactory;
@@ -329,10 +330,6 @@ public class Node extends Element implements IGraphicalNode {
private IReplaceNodeHandler replaceNodeHandler;
private String uniqueShortName;
private String generatingUniqueName;
/**
* Getter for index.
*
@@ -612,6 +609,23 @@ public class Node extends Element implements IGraphicalNode {
}
setPropertyValue(EParameterName.UNIQUE_NAME.getName(), uniqueName2);
IElementParameter shortUniqueNameParam = getElementParameter(EParameterName.SHORT_UNIQUE_NAME.getName());
if (shortUniqueNameParam != null) {
// Only for SHORT_UNIQUE_NAME element parameter exist.
// Joblet SHORT_UNIQUE_NAME init in AbstractJobletComponent.createElementParameters(INode)
String shortUniqueName = "";
if (shortUniqueNameParam.getValue() != null && !"".equals(shortUniqueNameParam.getValue())) {
shortUniqueName = (String) shortUniqueNameParam.getValue();
}
if (!reloadingComponent && shortUniqueName != null
&& (shortUniqueNameParam.getValue() == null || "".equals(shortUniqueNameParam.getValue()))) {
shortUniqueName = ((Process) getProcess()).generateUniqueNodeName(this, true);
((Process) getProcess()).addUniqueNodeName(shortUniqueName);
}
setPropertyValue(EParameterName.SHORT_UNIQUE_NAME.getName(), shortUniqueName);
}
/*
* for implements [TESB-10335], need to replace "__NODE_UNIQUE_NAME__" to node unique name in expression.
*/
@@ -880,17 +894,28 @@ public class Node extends Element implements IGraphicalNode {
*/
@Override
public String getUniqueName() {
return getUniqueName(TalendPropertiesUtil.isEnabledUseShortJobletName());
}
public String getUniqueName(boolean enableShortName) {
String uniqueName = null;
IElementParameter param = getElementParameter(EParameterName.UNIQUE_NAME.getName());
if (param != null) {
uniqueName = (String) param.getValue();
}
if (enableShortName) {
IElementParameter parameter = getElementParameter(EParameterName.SHORT_UNIQUE_NAME.getName());
if (parameter != null) {
uniqueName = (String) parameter.getValue();
}
}
return uniqueName;
}
// can only be set with the properties
private void setUniqueName(String uniqueName) {
((Process) getProcess()).removeUniqueNodeName(getUniqueName());
((Process) getProcess()).removeUniqueNodeName(getUniqueName(false));
((Process) getProcess()).addUniqueNodeName(uniqueName);
}
@@ -2078,13 +2103,10 @@ public class Node extends Element implements IGraphicalNode {
externalNode.setIncomingConnections(inputs);
externalNode.setOutgoingConnections(outputs);
externalNode.setElementParameters(getElementParameters());
externalNode.setUniqueName(getUniqueName());
externalNode.setUniqueName(getUniqueName(false));
externalNode.setSubProcessStart(isSubProcessStart());
externalNode.setProcess(getProcess());
externalNode.setComponent(getComponent());
if (!getUniqueName().equals(getGeneratingUniqueName())) {
externalNode.setGeneratingUniqueName(getGeneratingUniqueName());
}
}
return this.externalNode;
}
@@ -5337,14 +5359,8 @@ public class Node extends Element implements IGraphicalNode {
*/
@Override
public String getUniqueShortName() {
// should't be call from here normally, should be called from something extends AbstractNode (DataNode,
// ExternalNode...). used for joblet here
return this.uniqueShortName;
}
@Override
public void setUniqueShortName(String uniqueShortName) {
this.uniqueShortName = uniqueShortName;
// should't be call from here, should be called from something extends AbstractNode (DataNode, ExternalNode...).
return null;
}
public List<INode> getNodesFromSubProcess() {
@@ -5792,17 +5808,4 @@ public class Node extends Element implements IGraphicalNode {
this.replaceNodeHandler = replaceNodeHandler;
}
@Override
public String getGeneratingUniqueName() {
if (StringUtils.isNotBlank(generatingUniqueName)) {
return generatingUniqueName;
}
return getUniqueName();
}
@Override
public void setGeneratingUniqueName(String generatingUniqueName) {
this.generatingUniqueName = generatingUniqueName;
}
}

View File

@@ -124,6 +124,7 @@ import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.model.routines.RoutinesUtil;
import org.talend.core.model.update.IUpdateManager;
import org.talend.core.model.utils.NodeUtil;
import org.talend.core.model.utils.TalendPropertiesUtil;
import org.talend.core.model.utils.TalendTextUtils;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.repository.utils.ConvertJobsUtil;
@@ -745,6 +746,10 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
String uniqueName = nodeContainer.getNode().getUniqueName();
removeUniqueNodeName(uniqueName);
if (nodeContainer instanceof AbstractJobletContainer) {
// remove SHORT_UNIQUE_NAME and UNIQUE_NAME for joblet
String name = nodeContainer.getNode().getUniqueName(false);
removeUniqueNodeName(name);
// use readedContainers to record the containers alreay be read, in case of falling into dead loop
Set<NodeContainer> readedContainers = new HashSet<NodeContainer>();
removeUniqueNodeNamesInJoblet((AbstractJobletContainer) nodeContainer, readedContainers);
@@ -1153,7 +1158,8 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
|| param.getFieldType().equals(EParameterFieldType.PROPERTY_TYPE)
|| param.getFieldType().equals(EParameterFieldType.VALIDATION_RULE_TYPE)
|| param.getFieldType().equals(EParameterFieldType.UNIFIED_COMPONENTS)
|| param.getName().equals(EParameterName.UPDATE_COMPONENTS.getName())) {
|| param.getName().equals(EParameterName.UPDATE_COMPONENTS.getName())
|| param.getName().equals(EParameterName.SHORT_UNIQUE_NAME.getName())) {
return;
}
if (param.getParentParameter() != null) {
@@ -1284,6 +1290,19 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
} else if (param.getFieldType().equals(EParameterFieldType.PASSWORD) && value instanceof String) {
pType.setRawValue((String) value);
} else if (param.getFieldType().equals(EParameterFieldType.COMPONENT_LIST) && value != null) {
String componentValue = value.toString();
if (TalendPropertiesUtil.isEnabledUseShortJobletName() && (param.getElement() instanceof INode)) {
INode node = (INode) param.getElement();
String completeValue = DesignerUtilities.getNodeInJobletCompleteUniqueName(node, componentValue);
// possible blank when joblet node removed from process
componentValue = completeValue;
if (StringUtils.isBlank(completeValue) && param.isContextMode()
&& !DesignerUtilities.validateJobletShortName(value.toString())) {
componentValue = value.toString();
}
}
pType.setValue(componentValue);
} else {
if (value == null) {
pType.setValue(""); //$NON-NLS-1$
@@ -1820,10 +1839,11 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
for (Connection element : connList) {
connec = element;
cType = fileFact.createConnectionType();
cType.setSource(node.getUniqueName());
cType.setSource(node.getUniqueName(false));
INode jTarget = connec.getTarget();
String targetUniqueName = jTarget.getUniqueName();
if (jTarget instanceof Node) {
targetUniqueName = ((Node) jTarget).getUniqueName(false);
Node jn = (Node) jTarget.getJobletNode();
if (jn != null) {
targetUniqueName = jn.getUniqueName();
@@ -2195,6 +2215,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
loadNotes(processType);
loadSubjobs(processType);
checkNodeComponentListElementParameters();
initExternalComponents();
initJobletComponents();
setActivate(true);
@@ -2230,6 +2251,32 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
}
public void checkNodeComponentListElementParameters() {
if (!TalendPropertiesUtil.isEnabledUseShortJobletName()) {
return;
}
// load short unique name value for component list value
for (INode node : getGraphicalNodes()) {
for (IElementParameter param : node.getElementParameters()) {
loadComponentListShortNameValue(node, param);
Collection<IElementParameter> childrenParameter = param.getChildParameters().values();
for (IElementParameter childParameter : childrenParameter) {
loadComponentListShortNameValue(node, childParameter);
}
}
}
}
private void loadComponentListShortNameValue(INode node, IElementParameter param) {
if (param != null && EParameterFieldType.COMPONENT_LIST == param.getFieldType()) {
String originalValue = param.getValue().toString();
String shortUniqueName = DesignerUtilities.getNodeInJobletShortUniqueName(node, originalValue);
if (StringUtils.isNotBlank(shortUniqueName)) {
param.setValue(shortUniqueName);
}
}
}
@SuppressWarnings("unchecked")
private void checkNodeTableParameters() {
for (INode node : getGraphicalNodes()) {
@@ -2543,7 +2590,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
loadElementParameters(nc, listParamType);
if (nodesHashtable.containsKey(nc.getUniqueName())) {
if (nodesHashtable.containsKey(nc.getUniqueName(false))) {
// if the uniquename is already in the list, there must be a problem with the job.
// simply don't load the component
return null;
@@ -2586,7 +2633,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
NodeContainer nodeContainer = loadNodeContainer(nc, isJunitContainer);
addNodeContainer(nodeContainer);
nodesHashtable.put(nc.getUniqueName(), nc);
nodesHashtable.put(nc.getUniqueName(false), nc);
updateAllMappingTypes();
nc.setNeedLoadLib(false);
if (nc.isJoblet()) {
@@ -3455,12 +3502,18 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
public String generateUniqueNodeName(INode node) {
return generateUniqueNodeName(node, false);
}
public String generateUniqueNodeName(INode node, boolean useShortName) {
IComponent component = node.getComponent();
if (node instanceof Node) {
component = ((Node) node).getDelegateComponent();
}
String baseName = component.getOriginalName();
if (EComponentType.GENERIC.equals(component.getComponentType())) {
if (useShortName) {
baseName = component.getShortName();
} else if (EComponentType.GENERIC.equals(component.getComponentType())) {
baseName = component.getDisplayName();
}
return UniqueNodeNameGenerator.generateUniqueNodeName(baseName, uniqueNodeNameList);

View File

@@ -31,6 +31,7 @@ import org.talend.core.ui.metadata.dialog.CustomTableManager;
import org.talend.core.ui.metadata.dialog.MetadataDialog;
import org.talend.core.ui.metadata.editor.MetadataTableEditor;
import org.talend.core.ui.metadata.editor.MetadataTableEditorView;
import org.talend.designer.core.model.components.EParameterName;
import org.talend.designer.core.ui.editor.connections.Connection;
import org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController;
import org.talend.designer.core.ui.views.properties.MultipleThreadDynamicComposite;
@@ -78,8 +79,10 @@ public class MainConnectionComposite extends MultipleThreadDynamicComposite {
// Composite compositeEditorView = new Composite(composite, SWT.BORDER);
// compositeEditorView.setLayoutData(data);
String elementName = (String) ((Connection) elem).getSource()
.getElementParameter(EParameterName.UNIQUE_NAME.getName()).getValue();
metadataTableEditor = new MetadataTableEditor(outputMetaTable, "Schema from " //$NON-NLS-1$
+ ((Connection) elem).getSource().getElementName() + " output "); //$NON-NLS-1$
+ elementName + " output "); //$NON-NLS-1$
metadataTableEditorView = new MetadataTableEditorView(composite, SWT.NONE, metadataTableEditor, true, false,
true, false);
MetadataDialog.initializeMetadataTableView(metadataTableEditorView, ((Connection) elem).getSource(),

View File

@@ -18,6 +18,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CommandStack;
import org.eclipse.jface.fieldassist.DecoratedField;
@@ -48,6 +49,7 @@ import org.talend.core.model.process.IElement;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.INode;
import org.talend.core.model.process.IProcess2;
import org.talend.core.model.utils.TalendPropertiesUtil;
import org.talend.core.runtime.services.IGenericService;
import org.talend.core.ui.IJobletProviderService;
import org.talend.core.ui.process.IGraphicalNode;
@@ -57,6 +59,7 @@ import org.talend.designer.core.ui.AbstractMultiPageTalendEditor;
import org.talend.designer.core.ui.editor.AbstractTalendEditor;
import org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand;
import org.talend.designer.core.ui.editor.nodes.Node;
import org.talend.designer.core.utils.DesignerUtilities;
/**
* DOC nrousseau class global comment. Detailled comment <br/>
@@ -305,19 +308,23 @@ public class ComponentListController extends AbstractElementPropertySectionContr
if (node.getJobletNode() != null) {
node = node.getJobletNode();
}
final String uniqueName = node.getUniqueName();
String uniqueName = node.getUniqueName();
if (uniqueName.equals(currentNode.getUniqueName())) {
continue;
}
String displayName = (String) node.getElementParameter("LABEL").getValue(); //$NON-NLS-1$
String displayUniqueName = getDisplayUniqueName(node, uniqueName);
if (displayName == null) {
displayName = uniqueName;
displayName = displayUniqueName;
}
if (displayName.indexOf("__UNIQUE_NAME__") != -1) { //$NON-NLS-1$
displayName = displayName.replaceAll("__UNIQUE_NAME__", uniqueName); //$NON-NLS-1$
displayName = displayName.replaceAll("__UNIQUE_NAME__", displayUniqueName); //$NON-NLS-1$
}
if (!displayName.equals(uniqueName)) {
displayName = uniqueName + " - " + displayName; //$NON-NLS-1$
if (!uniqueName.equals(displayUniqueName) && displayName.indexOf(uniqueName) != -1) {
displayName = displayName.replaceAll(uniqueName, displayUniqueName);
}
if (!displayName.equals(displayUniqueName)) {
displayName = displayUniqueName + " - " + displayName; //$NON-NLS-1$
}
componentUniqueNames.add(uniqueName);
componentDisplayNames.add(displayName);
@@ -361,6 +368,13 @@ public class ComponentListController extends AbstractElementPropertySectionContr
}
}
private static String getDisplayUniqueName(INode node, String uniqueName) {
if (TalendPropertiesUtil.isEnabledUseShortJobletName()) {
return DesignerUtilities.getNodeInJobletCompleteUniqueName(node, uniqueName);
}
return uniqueName;
}
SelectionListener listenerSelection = new SelectionAdapter() {
@Override
@@ -391,9 +405,18 @@ public class ComponentListController extends AbstractElementPropertySectionContr
}
if (param.isContextMode()) {
String paramValue = (String) value;
if (elem instanceof INode) {
INode currentNode = (INode) elem;
String completeValue = getDisplayUniqueName(currentNode, paramValue);
if (StringUtils.isNotBlank(completeValue)
|| StringUtils.isBlank(completeValue) && DesignerUtilities.validateJobletShortName(paramValue)) {
paramValue = completeValue;
}
}
combo.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_YELLOW));
combo.setEnabled(false);
combo.setText((String) value);
combo.setText(paramValue);
} else {
combo.setItems(curComponentNameList);
if (numValue == -1) {

View File

@@ -21,6 +21,8 @@ import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -36,7 +38,7 @@ public class OpenContextChooseComboDialog extends Dialog {
@Override
protected Point getInitialSize() {
return new Point(300, 100);
return new Point(400, 180);
}
private List<IContext> allContexts;
@@ -82,29 +84,16 @@ public class OpenContextChooseComboDialog extends Dialog {
// basicComp = new Composite(parent.getShell(), SWT.NONE);
basicComp = (Composite) super.createDialogArea(parent);
basicComp.setLayout(new FormLayout());
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
basicComp.setLayout(gridLayout);
basicComp.setSize(200, 200);
Label label = new Label(basicComp, SWT.NONE);
label.setText(Messages.getString("OpenContextChooseComboDialog.context")); //$NON-NLS-1$
label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
contextCombo = new Combo(basicComp, SWT.DROP_DOWN | SWT.READ_ONLY);
// layout for label
FormData labelCompData = new FormData();
labelCompData.top = new FormAttachment(20, 0);
labelCompData.bottom = new FormAttachment(50, 10);
labelCompData.left = new FormAttachment(0, 10);
labelCompData.right = new FormAttachment(contextCombo, 0);
label.setLayoutData(labelCompData);
// layout for combo
FormData contexComboFormData = new FormData();
contexComboFormData.top = new FormAttachment(10, 0);
contexComboFormData.bottom = new FormAttachment(50, 10);
contexComboFormData.left = new FormAttachment(label, 30);
contexComboFormData.right = new FormAttachment(60, 10);
contextCombo.setLayoutData(contexComboFormData);
contextCombo.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, false, false));
List<String> names = new ArrayList<String>();
for (IContext context : allContexts) {

View File

@@ -512,7 +512,7 @@ public class SubjobContainer extends Element implements ISubjobContainer {
String subjobStartUniqueName = (String) getPropertyValue(EParameterName.UNIQUE_NAME.getName());
if (process != null && (List<Node>) process.getGraphicalNodes() != null) {
for (Node node : (List<Node>) process.getGraphicalNodes()) {
if (node.getUniqueName() != null && node.getUniqueName().equals(subjobStartUniqueName)) {
if (node.getUniqueName(false) != null && node.getUniqueName(false).equals(subjobStartUniqueName)) {
return node;
}
}
@@ -521,7 +521,7 @@ public class SubjobContainer extends Element implements ISubjobContainer {
}
public void setSubjobStartNode(Node node) {
setPropertyValue(EParameterName.UNIQUE_NAME.getName(), node.getUniqueName());
setPropertyValue(EParameterName.UNIQUE_NAME.getName(), node.getUniqueName(false));
if (node.getComponent().getName().equals("tPrejob") || node.getComponent().getName().equals("tPostjob")) { //$NON-NLS-1$ //$NON-NLS-2$
setPropertyValue(EParameterName.SHOW_SUBJOB_TITLE.getName(), Boolean.TRUE);

View File

@@ -17,6 +17,7 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.collections.BidiMap;
import org.apache.commons.lang.StringUtils;
import org.eclipse.emf.common.ui.celleditor.ExtendedComboBoxCellEditor;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CommandStack;
@@ -56,6 +57,7 @@ import org.talend.core.model.process.Element;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.IProcess2;
import org.talend.core.model.properties.ConnectionItem;
import org.talend.core.model.utils.TalendPropertiesUtil;
import org.talend.core.ui.CoreUIPlugin;
import org.talend.core.ui.process.IGEFProcess;
import org.talend.core.ui.properties.tab.IDynamicProperty;
@@ -472,12 +474,28 @@ public class AdvancedContextComposite extends ScrolledComposite implements IDyna
@Override
public Object get(IElementParameter bean) {
final Object value = bean.getValue();
Object value = bean.getValue();
if (EParameterFieldType.COMPONENT_LIST == bean.getFieldType()
&& TalendPropertiesUtil.isEnabledUseShortJobletName()) {
String completeValue = DesignerUtilities.getNodeInJobletCompleteUniqueName(node, value.toString());
if (StringUtils.isNotBlank(completeValue)
|| StringUtils.isBlank(completeValue)
&& DesignerUtilities.validateJobletShortName(value.toString())) {
value = completeValue;
}
}
return value == null ? "" : String.valueOf(value); //$NON-NLS-1$
}
@Override
public void set(IElementParameter bean, Object value) {
if (EParameterFieldType.COMPONENT_LIST == bean.getFieldType()
&& TalendPropertiesUtil.isEnabledUseShortJobletName()) {
String shortValue = DesignerUtilities.getNodeInJobletShortUniqueName(node, value.toString());
if (StringUtils.isNotBlank(shortValue)) {
value = shortValue;
}
}
if (value != null && !value.equals(bean.getValue())) {
executeCommand(new PropertyChangeCommand(node, bean.getName(), value));
getTableViewerCreator().refresh();

View File

@@ -553,7 +553,7 @@ public class ComponentSettingsView extends ViewPart implements IComponentSetting
Node node = (Node) elem;
label = node.getLabel();
String uniqueName = node.getUniqueName();
String uniqueName = node.getUniqueName(false);
if (!label.equals(uniqueName)) {
label = label + "(" + uniqueName + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}

View File

@@ -14,7 +14,10 @@ package org.talend.designer.core.utils;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang.StringUtils;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -23,6 +26,8 @@ import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.PlatformUI;
import org.talend.commons.CommonsPlugin;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.CorePlugin;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.PluginChecker;
@@ -264,4 +269,97 @@ public class DesignerUtilities {
}
return null;
}
/**
* Get the complete unique name for the node in joblet by short unique name.
*
* e.g. jc_1_tDBConnection_1 =>testjoblet_1_tDBConnection_1
*
* @param node
* @param shortUniqueName
* @return
*/
public static String getNodeInJobletCompleteUniqueName(INode node, String shortUniqueName) {
if (StringUtils.isBlank(shortUniqueName) || !validateJobletShortName(shortUniqueName)) {
return shortUniqueName;
}
String graphicalName = "";
StringBuffer graphNameBuffer = new StringBuffer();
boolean findOut = findGraphicNodeInJoblet(node.getProcess(), shortUniqueName, graphNameBuffer, true);
if (findOut) {
graphicalName = graphNameBuffer.toString();
} else {
if (CommonsPlugin.isDebugMode()) {
ExceptionHandler.process(new Exception("Can't find out " + shortUniqueName + " in " + node.getProcess()
+ " for node " + node.getElementParameter(EParameterName.UNIQUE_NAME.getName())));
}
}
return graphicalName;
}
public static boolean validateJobletShortName(String shortUniqueName) {
if (StringUtils.isBlank(shortUniqueName)) {
return false;
}
Matcher matcher = Pattern.compile("jc[0-9]+_[0-9]").matcher(shortUniqueName);
return matcher.find();
}
/**
* Get the complete unique name for the node in joblet by short unique name.
*
* e.g. testjoblet_1_tDBConnection_1 => jc_1_tDBConnection_1
*
* @param node
* @param shortUniqueName
* @return
*/
public static String getNodeInJobletShortUniqueName(INode node, String completeUniqueName) {
if (StringUtils.isBlank(completeUniqueName)) {
return completeUniqueName;
}
String graphicalName = "";
StringBuffer graphNameBuffer = new StringBuffer();
boolean findOut = findGraphicNodeInJoblet(node.getProcess(), completeUniqueName, graphNameBuffer, false);
if (findOut) {
graphicalName = graphNameBuffer.toString();
} else {
if (CommonsPlugin.isDebugMode()) {
ExceptionHandler.process(new Exception("Can't find out " + completeUniqueName + " in " + node.getProcess()
+ " for node " + node.getElementParameter(EParameterName.UNIQUE_NAME.getName())));
}
}
return graphicalName;
}
private static boolean findGraphicNodeInJoblet(IProcess process, String uniqueName, StringBuffer graphNameBuffer,
boolean matchShortName) {
List<? extends INode> nodes = process.getGraphicalNodes();
for (INode iNode : nodes) {
Node graphNode = (Node) iNode;
String graphNodeName = graphNode.getUniqueName(matchShortName);
if (isJobletComponent(graphNode) && uniqueName.startsWith(graphNodeName)) {
if (graphNodeName.equals(uniqueName)) {
graphNameBuffer.append(graphNode.getUniqueName(!matchShortName));
return true;
}
String nonJobletName = uniqueName.replaceFirst(graphNodeName + "_", "");
graphNameBuffer.append(graphNode.getUniqueName(!matchShortName)).append("_");
boolean findOut = findGraphicNodeInJoblet(graphNode.getComponent().getProcess(), nonJobletName, graphNameBuffer,
matchShortName);
if (findOut) {
return true;
}
}
if (graphNodeName.equals(uniqueName)) {
graphNameBuffer.append(uniqueName);
return true;
}
}
return false;
}
public static boolean isJobletComponent(INode node) {
return node.getComponent().getComponentType() == EComponentType.JOBLET;
}
}

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="lib/talend_file_enhanced-1.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/talend_file_enhanced-1.3.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>

View File

@@ -4,7 +4,7 @@ Bundle-Name: Custom
Bundle-SymbolicName: org.talend.libraries.custom;singleton:=true
Bundle-Version: 7.3.1.qualifier
Bundle-ClassPath: .,
lib/talend_file_enhanced-1.2.jar
lib/talend_file_enhanced-1.3.jar
Export-Package: org.talend.fileprocess,
org.talend.fileprocess.delimited
Bundle-ActivationPolicy: lazy

View File

@@ -61,7 +61,7 @@
<artifactItem>
<groupId>org.talend.components.lib</groupId>
<artifactId>talend_file_enhanced</artifactId>
<version>1.2</version>
<version>1.3</version>
</artifactItem>
</artifactItems>
</configuration>