Compare commits

..

2 Commits

162 changed files with 1111 additions and 6348 deletions

66
PATCH_RELEASE_NOTE.md Normal file
View File

@@ -0,0 +1,66 @@
---
version: 7.2.1
module: https://talend.poolparty.biz/coretaxonomy/42
product:
- https://talend.poolparty.biz/coretaxonomy/23
---
# TPS-4124
| Info | Value |
| ---------------- | ---------------- |
| Patch Name | Patch\_20200615\_TPS-4124\_v1-7.2.1 |
| Release Date | 2020-06-15 |
| Target Version | 20190620\_1446-V7.2.1 |
| Product affected | Talend Studio |
## Introduction
This is a self-contained patch.
**NOTE**: For information on how to obtain this patch, reach out to your Support contact at Talend.
## Fixed issues
This patch contains the following fixes:
- TPS-4124 [7.2.1] ClassCastException with tLibraryLoad's Dynamics Libs in Java 11 (TDI-44305)
## Prerequisites
Consider the following requirements for your system:
- Talend Studio 7.2.1 must be installed.
## Installation
### Installing the patch using Software update
1) Logon TAC and switch to Configuration->Software Update, then enter the correct values and save referring to the documentation: https://help.talend.com/reader/f7Em9WV_cPm2RRywucSN0Q/j9x5iXV~vyxMlUafnDejaQ
2) Switch to Software update page, where the new patch will be listed. The patch can be downloaded from here into the nexus repository.
3) On Studio Side: Logon Studio with remote mode, on the logon page the Update button is displayed: click this button to install the patch.
### Installing the patch using Talend Studio
1) Create a folder named "patches" under your studio installer directory and copy the patch .zip file to this folder.
2) Restart your studio: a window pops up, then click OK to install the patch, or restart the commandline and the patch will be installed automatically.
### Installing the patch using Commandline
Execute the following commands:
1. Talend-Studio-win-x86_64.exe -nosplash -application org.talend.commandline.CommandLine -consoleLog -data commandline-workspace startServer -p 8002 --talendDebug
2. initRemote {tac_url} -ul {TAC login username} -up {TAC login password}
3. checkAndUpdate -tu {TAC login username} -tup {TAC login password}
## Uninstallation
Backup the Affected files list below. Uninstall the patch by restore the backup files.
## Affected files for this patch
The following files are installed by this patch:
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tLibraryLoad/tLibraryLoad\_begin.javajet

View File

@@ -52,7 +52,7 @@ ProcessDebugDialog.errortext=Impossible de d\u00E9bugger le job.\\nV\u00E9rifiez
ShadowProcess.notGeneratedOutputException=Sortie non g\u00E9n\u00E9r\u00E9e.
ProcessComposite.contextGroup=Contexte
prefs.clientConfiguration=Configuration du client Talend
ProcessComposite.endPattern=Job {0} termin\u00e9 \u00e0 {1,date,HH\:mm dd/MM/yyyy}. [Code sortie\=\{2,number}]
ProcessComposite.endPattern=Le Job {0} s'est termin\u00E9 \u00E0 {1,date,HH:mm dd/MM/yyyy}. [code de sortie={2,number}]
ProcessView.title=Ex\u00E9cuter({0})
Processor.configurePerl=L'interpr\u00E9teur Perl n'est pas configur\u00E9.
JavaProcessor.notFoundedFolderException=Dossier introuvable dans le projet .Java

View File

@@ -584,16 +584,7 @@
} //endIf
%>
context.setContextType("<%=ctxParam.getName()%>", "<%=ctxParam.getType()%>");
if(context.getStringValue("<%=ctxParam.getName()%>") == null) {
context.<%=ctxParam.getName()%> = null;
} else {
<%//}B1 block%>
<%
String typeToGenerate ="String";
if( !(ctxParam.getType().equals("id_File") || ctxParam.getType().equals("id_Directory") ||ctxParam.getType().equals("id_List Of Value"))) {
typeToGenerate=JavaTypesManager.getTypeToGenerate(ctxParam.getType(),true);
}
if (ctxParam.getType().equals("id_Password")) {
%>
String pwd_<%=ctxParam.getName()%>_value = context.getProperty("<%=ctxParam.getName()%>");
@@ -611,7 +602,13 @@
}
}
<%
} else if(typeToGenerate.equals("java.util.Date")) {
continue;
}
String typeToGenerate ="String";
if( !(ctxParam.getType().equals("id_File") || ctxParam.getType().equals("id_Directory") ||ctxParam.getType().equals("id_List Of Value"))) {
typeToGenerate=JavaTypesManager.getTypeToGenerate(ctxParam.getType(),true);
}
if(typeToGenerate.equals("java.util.Date")) {
%>
try{
String context_<%=ctxParam.getName()%>_value = context.getProperty("<%=ctxParam.getName()%>");
@@ -670,10 +667,6 @@
}
<%
}
%>
<%//{B1 block%>
}
<%
}
%>
} <%/*close last method*/%>
@@ -1166,36 +1159,16 @@ if (execStat) {
<% if(exist_tSQLDB) { %>
private void closeSqlDbConnections() {
boolean shutdownAbandonedConnections = false;
try {
Object obj_conn;
<% for (INode sqlDbComponent : sqlDbComponentsList) { %>
obj_conn = globalMap.remove("conn_<%=sqlDbComponent.getUniqueName() %>");
if (obj_conn != null) {
java.sql.Connection conn = (java.sql.Connection)obj_conn;
String originalURL = conn.getMetaData().getURL();
java.sql.Driver drv = java.sql.DriverManager.getDriver(originalURL);
String driverClass = drv.getClass().getName();
conn.close();
if("com.mysql.cj.jdbc.Driver".equals(driverClass) && routines.system.BundleUtils.inOSGi()) {
shutdownAbandonedConnections = true;
}
if (null != obj_conn) {
((java.sql.Connection) obj_conn).close();
}
<% } %>
} catch (java.lang.Exception e) {
}
if (shutdownAbandonedConnections) {
try {
Class.forName("com.mysql.cj.jdbc.AbandonedConnectionCleanupThread").
getMethod("uncheckedShutdown").invoke(null, (Object[]) null);
} catch(java.lang.Exception e) {
}
}
}
<% } %>

View File

@@ -289,15 +289,6 @@ if(isRunInMultiThread){
}
<% } %>
}
//if the stored or passed value is "<TALEND_NULL>" string, it mean null
public String getStringValue(String key) {
String origin_value = this.getProperty(key);
if(NULL_VALUE_EXPRESSION_IN_COMMAND_STRING_FOR_CHILD_JOB_ONLY.equals(origin_value)) {
return null;
}
return origin_value;
}
<%
for (IContextParameter ctxParam :params)

View File

@@ -66,7 +66,6 @@ import org.talend.designer.codegen.model.CodeGeneratorEmittersPoolFactory;
import org.talend.designer.codegen.model.CodeGeneratorInternalTemplatesFactoryProvider;
import org.talend.designer.codegen.proxy.JetProxy;
import org.talend.designer.core.generic.model.Component;
import org.talend.designer.runprocess.ProcessorUtilities;
/**
* CodeGenerator.
@@ -354,12 +353,8 @@ public class CodeGenerator implements ICodeGenerator {
.getDefault().getService(IResourcesDependenciesService.class);
String resourcePathForContext = null;
if (process instanceof IProcess2) {
String value = contextPar.getValue();
// for runtime
if (!ProcessorUtilities.isExportConfig()) {
contextPar.setType(JavaTypesManager.FILE.getId());
}
resourcePathForContext = resourceService.getResourcePathForContext(process, value);
resourcePathForContext = resourceService.getResourcePathForContext(process,
contextPar.getValue());
} else {
// for PreviewFileInputContentDataProcess run
resourcePathForContext = resourceService.getResourceItemFilePath(contextPar.getValue());

View File

@@ -94,7 +94,7 @@ public class JavaRoutineSynchronizer extends AbstractRoutineSynchronizer {
private void syncRoutineItems(Collection<RoutineItem> routineObjects, boolean forceUpdate) throws SystemException {
for (RoutineItem routineItem : routineObjects) {
syncRoutine(routineItem, true, forceUpdate);
syncRoutine(routineItem, true, true, forceUpdate);
}
syncSystemRoutine(ProjectManager.getInstance().getCurrentProject());
}

View File

@@ -28,9 +28,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.Lock;
@@ -70,6 +70,7 @@ import org.talend.core.model.components.ComponentCategory;
import org.talend.core.model.components.ComponentManager;
import org.talend.core.model.components.ComponentProviderInfo;
import org.talend.core.model.components.ComponentUtilities;
import org.talend.core.model.components.EComponentType;
import org.talend.core.model.components.IComponent;
import org.talend.core.model.components.IComponentsFactory;
import org.talend.core.model.components.IComponentsHandler;
@@ -837,21 +838,23 @@ public class ComponentsFactory implements IComponentsFactory {
init(false);
}
// check if reference joblet component presents
JobletUtil jobletUtils = new JobletUtil();
Optional<IComponent> result = jobletUtils.findComponentByName(componentList, name, paletteType);
if (!result.isPresent()) {
// check if any name matching joblet component presents
if (jobletUtils.matchExpression(name)) {
name = StringUtils.substringAfterLast(name, ":"); //$NON-NLS-1$
if (StringUtils.isNotBlank(name)) {
result = jobletUtils.findComponentByName(componentList, name, paletteType);
for (IComponent comp : componentList) {
if (comp.getComponentType() != EComponentType.JOBLET) {
continue;
}
String comName = comp.getName();
if (comp != null && paletteType.equals(comp.getPaletteType())) {
if (comName.equals(name)) {
return comp;
} else if (new JobletUtil().matchExpression(comName)) {
String[] names = comName.split(":"); //$NON-NLS-1$
comName = names[1];
if (comName.equals(name)) {
return comp;
}
}
}
}
if (result.isPresent()) {
return result.get();
}
return null;
}

View File

@@ -569,18 +569,17 @@
loadJobBuilder_<%=cid%>.setDestinationTable(tableId_<%=cid%>);
com.google.cloud.bigquery.CsvOptions.Builder csvOptions_<%=cid%> = com.google.cloud.bigquery.CsvOptions.newBuilder();
csvOptions_<%=cid%>.setAllowQuotedNewLines(true);
csvOptions_<%=cid%>.setSkipLeadingRows(<%=ElementParameterParser.getValue(node, "__GS_FILE_HEADER__")%>);
<%if("true".equals(ElementParameterParser.getValue(node, "__SET_FIELD_DELIMITER__"))) {
%>
csvOptions_<%=cid%>.setFieldDelimiter(<%=fieldDelimiter%>);
loadJobBuilder_<%=cid%>.setFormatOptions(csvOptions_<%=cid%>.setFieldDelimiter(<%=fieldDelimiter%>).build());
<%
}
%>
loadJobBuilder_<%=cid%>.setFormatOptions(csvOptions_<%=cid%>.build());
loadJobBuilder_<%=cid%>.setNullMarker("\\N");
com.google.cloud.bigquery.Job job_<%=cid%> = bigquery_<%=cid%>.create(com.google.cloud.bigquery.JobInfo.of(loadJobBuilder_<%=cid%>.build()));
job_<%=cid%> = job_<%=cid%>.waitFor(com.google.cloud.RetryOption.initialRetryDelay(org.threeten.bp.Duration.ofSeconds(1)));
job_<%=cid%> = job_<%=cid%>.waitFor(com.google.cloud.RetryOption.initialRetryDelay(org.threeten.bp.Duration.ofSeconds(1)), com.google.cloud.RetryOption.totalTimeout(org.threeten.bp.Duration.ofSeconds(30)));
if (job_<%=cid%> != null && job_<%=cid%>.getStatus().getError() == null) {
<%
if(isLog4jEnabled){

View File

@@ -221,9 +221,10 @@
}
String query_<%=cid%> = <%=query%>;
<% if(isLog4jEnabled) { %>
log.info("<%=cid%> - query " + <%=query%>);
<% } %>
String dataset = query_<%=cid%>.substring(query_<%=cid%>.indexOf("from") + 4, query_<%=cid%>.indexOf(".")).trim();
String temp_table = "temp_" + dataset + java.util.UUID.randomUUID().toString().replaceAll("-", "")
+ "<%=cid%>".toLowerCase().replaceAll("[^a-z0-9]", "0").replaceAll("^[^a-z]", "a")
+ Integer.toHexString(java.util.concurrent.ThreadLocalRandom.current().nextInt());
com.google.cloud.bigquery.BigQuery bigquery_<%=cid%> = com.google.cloud.bigquery.BigQueryOptions.newBuilder()
.setCredentials(credentials_<%=cid%>)
@@ -232,55 +233,25 @@
.getService();
com.google.cloud.bigquery.QueryJobConfiguration.Builder queryConfiguration_<%=cid%> = com.google.cloud.bigquery.QueryJobConfiguration.newBuilder(<%=query%>).setUseLegacySql(<%=useLegacySql%>);
<%
if (resultSizeType.equals("LARGE") || resultSizeType.equals("AUTO")) {
%>
queryConfiguration_<%=cid%>.setDestinationTable(com.google.cloud.bigquery.TableId.of(dataset, temp_table)).setAllowLargeResults(true);
<%
}
%>
com.google.cloud.bigquery.JobId jobId_<%=cid%> = com.google.cloud.bigquery.JobId.of(java.util.UUID.randomUUID().toString());
com.google.cloud.bigquery.Job job_<%=cid%> = bigquery_<%=cid%>.create(com.google.cloud.bigquery.JobInfo.newBuilder(queryConfiguration_<%=cid%>.build()).setJobId(jobId_<%=cid%>).build());
<%if (resultSizeType.equals("LARGE") || resultSizeType.equals("AUTO")) {%>
com.google.cloud.bigquery.QueryJobConfiguration jobConfDryRun_<%=cid%> = queryConfiguration_<%=cid%> .setDryRun(true).build();
com.google.cloud.bigquery.Job jobDryRun_<%=cid%> = bigquery_<%=cid%>.create(com.google.cloud.bigquery.JobInfo.of(jobConfDryRun_<%=cid%>));
String queryLocation_<%=cid%> =jobDryRun_<%=cid%>.getJobId().getLocation();
String location_<%=cid%> = queryLocation_<%=cid%> == null ? "US" : queryLocation_<%=cid%>;
String tempDataset_<%=cid%> = java.util.UUID.randomUUID().toString().replaceAll("-", "")
+ Integer.toHexString(java.util.concurrent.ThreadLocalRandom.current().nextInt())
+ Integer.toHexString(java.util.concurrent.ThreadLocalRandom.current().nextInt());
String tempTable_<%=cid%> = java.util.UUID.randomUUID().toString().replaceAll("-", "")
+ Integer.toHexString(java.util.concurrent.ThreadLocalRandom.current().nextInt())
+ Integer.toHexString(java.util.concurrent.ThreadLocalRandom.current().nextInt());
<% if(isLog4jEnabled){ %>
log.info("<%=cid%> - query location :" + queryLocation_<%=cid%>);
log.info("<%=cid%> - temporary dataset location :" + location_<%=cid%>);
log.info("<%=cid%> - temporary Dataset name : " + tempDataset_<%=cid%>);
log.info("<%=cid%> - temporary table name : " + tempTable_<%=cid%>);
<% } %>
com.google.cloud.bigquery.DatasetInfo datasetInfo_<%=cid%> = com.google.cloud.bigquery.DatasetInfo.newBuilder(tempDataset_<%=cid%>).setLocation(location_<%=cid%>).build();
com.google.cloud.bigquery.Dataset dataset_<%=cid%> = bigquery_<%=cid%> .create(datasetInfo_<%=cid%>);
queryConfiguration_<%=cid%>
.setDryRun(false)
.setAllowLargeResults(true)
.setDestinationTable(com.google.cloud.bigquery.TableId.of(tempDataset_<%=cid%>, tempTable_<%=cid%>));
com.google.cloud.bigquery.JobId jobId_<%=cid%> = com.google.cloud.bigquery.JobId
.newBuilder().setProject(<%=projectId%>)
.setJob(java.util.UUID.randomUUID().toString())
.setLocation(location_<%=cid%>)
.build();
<% if(isLog4jEnabled){ %>
log.info("<%=cid%> - job location : " + jobId_<%=cid%>.getLocation());
<% } %>
<% } else { %>
com.google.cloud.bigquery.JobId jobId_<%=cid%> = com.google.cloud.bigquery.JobId.of(<%=projectId%>,java.util.UUID.randomUUID().toString());
<% } %>
com.google.cloud.bigquery.Job job_<%=cid%> = bigquery_<%=cid%>.create(com.google.cloud.bigquery.JobInfo.newBuilder(queryConfiguration_<%=cid%>.build()).setJobId(jobId_<%=cid%>).build());
<% if(isLog4jEnabled) { %>
<%
if(isLog4jEnabled){
%>
log.info("<%=cid%> - Sending job " + jobId_<%=cid%> + " with query: " + <%=query%>);
<% } %>
<%
}
%>
job_<%=cid%> = job_<%=cid%>.waitFor();
if (job_<%=cid%> == null) {
@@ -289,9 +260,13 @@
throw new RuntimeException(job_<%=cid%>.getStatus().getError().toString());
}
<% if(isLog4jEnabled) { %>
<%
if(isLog4jEnabled){
%>
log.info("<%=cid%> - Job " + jobId_<%=cid%> + " finished successfully.");
<% } %>
<%
}
%>
com.google.cloud.bigquery.TableResult result_<%=cid%> = job_<%=cid%>.getQueryResults();
long nb_line_<%=cid%> = 0;
<%

View File

@@ -10,10 +10,7 @@ imports="
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String authMode = ElementParameterParser.getValue(node,"__AUTH_MODE__");
String projectId = ElementParameterParser.getValue(node,"__PROJECT_ID__");
String resultSizeType = ElementParameterParser.getValue(node,"__RESULT_SIZE__");
String authMode = ElementParameterParser.getValue(node,"__AUTH_MODE__");
if (authMode.equals("OAUTH")) {
%>
}
@@ -27,10 +24,7 @@ imports="
} else if (authMode.equals("SERVICEACCOUNT")) {
%>
}
<% if (resultSizeType.equals("LARGE") || resultSizeType.equals("AUTO")) { %>
com.google.cloud.bigquery.DatasetId datasetId_<%=cid%> = com.google.cloud.bigquery.DatasetId.of(<%=projectId%>, tempDataset_<%=cid%>);
bigquery_<%=cid%>.delete(datasetId_<%=cid%>, com.google.cloud.bigquery.BigQuery.DatasetDeleteOption.deleteContents());
<% }%>
bigquery_<%=cid%>.delete(com.google.cloud.bigquery.TableId.of(dataset, temp_table));
<%
} else {
throw new IllegalArgumentException("authentication mode should be either \"SERVICEACCOUNT\" or \"OAUTH\", but it is " + authMode);

View File

@@ -25,7 +25,7 @@
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
org.talend.designer.dbmap.language.mssql.MssqlGenerationManager gm = new org.talend.designer.dbmap.language.mssql.MssqlGenerationManager();
org.talend.designer.dbmap.language.generation.GenericDbGenerationManager gm = new org.talend.designer.dbmap.language.generation.GenericDbGenerationManager();
String uniqueNameComponent = null;
IDbLanguage currentLanguage = gm.getLanguage();

View File

@@ -305,54 +305,48 @@ for(Column colStmt:stmtStructure){
if(("INSERT").equals(dataAction)){
%>
String insertQuery_<%=cid %> = "INSERT INTO "+tableName_<%=cid%>+"(<%=insertColName.toString()%>) ("+select_query_<%=cid %>+")";
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(insertQuery_<%=cid %>);
String insertQuery_<%=cid %> = "INSERT INTO "+tableName_<%=cid%>+"(<%=insertColName.toString()%>) ("+select_query_<%=cid %>+")";
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(insertQuery_<%=cid %>);
<%
}else if (("UPDATE").equals(dataAction)){
if(useUpdateStatement){
if(useUpdateStatement){
%>
String updateQuery_<%=cid %> = select_query_<%=cid %>;
String updateQuery_<%=cid %> = select_query_<%=cid %>
<%
}else{
}else{
%>
String updateQuery_<%=cid %> = "UPDATE "+tableName_<%=cid%>+" SET <%=updateSetStmt.toString()%> ";
String updateQuery_<%=cid %> = "UPDATE "+tableName_<%=cid%>+" SET <%=updateSetStmt.toString()%> "
<%
}
if(CodeGenerationUtils.hasAlphaNumericCharacter(whereClause)) {
if(useUpdateStatement){
}
%>
if(select_query_<%=cid %>.indexOf("WHERE")==-1){
updateQuery_<%=cid %> +=" WHERE ";
}else{
updateQuery_<%=cid %> +=" AND ";
}
updateQuery_<%=cid %>+= <%=CodeGenerationUtils.replaceAllCrBySpace(whereClause)%>;
<%
}else{
%>
updateQuery_<%=cid %> += " WHERE " + <%=CodeGenerationUtils.replaceAllCrBySpace(whereClause)%>;
<%
}
}
%>
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(updateQuery_<%=cid %>);
<%
}else if (("DELETE").equals(dataAction)){
%>
String deleteQuery_<%=cid %> = "DELETE FROM "+ tableName_<%=cid%>+" WHERE EXISTS ("+select_query_<%=cid %>+") "
<%
if(CodeGenerationUtils.hasAlphaNumericCharacter(whereClause)) {
%>
+" AND " + <%=CodeGenerationUtils.replaceAllCrBySpace(whereClause)%>
+" WHERE " + <%=CodeGenerationUtils.replaceAllCrBySpace(whereClause)%>
<%
}
%>
;
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(deleteQuery_<%=cid %>);
<%
}
%>
;
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(updateQuery_<%=cid %>);
<%
}else if (("DELETE").equals(dataAction)){
%>
String deleteQuery_<%=cid %> = "DELETE FROM "+ tableName_<%=cid%>+" WHERE EXISTS ("+select_query_<%=cid %>+") "
<%
if(CodeGenerationUtils.hasAlphaNumericCharacter(whereClause)) {
%>
+" AND " + <%=CodeGenerationUtils.replaceAllCrBySpace(whereClause)%>
<%
}
%>
;
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(deleteQuery_<%=cid %>);
<%
}
%>
int nb_line_<%=cid%> = 0;
int nb_line_updated_<%=cid%> = 0;
int nb_line_inserted_<%=cid%> = 0;

View File

@@ -33,4 +33,4 @@ USE_DIFFERENT_TABLE.NAME=Use different table name
DIFFERENT_TABLE_NAME.NAME=Table name
IS_TABLE_NAME_VARIABLE.NAME=Table name from connection name is variable
USE_UPDATE_STATEMENT.NAME=Use update statement without subqueries
USE_UPDATE_STATEMENT.NAME=Use update statement

View File

@@ -140,15 +140,7 @@
</PARAMETERS>
<ADVANCED_PARAMETERS>
<PARAMETER
NAME="USE_UPDATE_STATEMENT"
FIELD="CHECK"
NUM_ROW="10"
SHOW_IF="DATA_ACTION=='UPDATE'"
>
<DEFAULT>false</DEFAULT>
</PARAMETER>
<ADVANCED_PARAMETERS>
</ADVANCED_PARAMETERS>
<CODEGENERATION>

View File

@@ -35,7 +35,6 @@ skeleton="../templates/db_output_bulk.skeleton"
String differenttable = ElementParameterParser.getValue(node, "__DIFFERENT_TABLE_NAME__");
boolean useDifferentTable = "true".equals(ElementParameterParser.getValue(node, "__USE_DIFFERENT_TABLE__"));
boolean isTableNameVariable="true".equals(ElementParameterParser.getValue(node, "__IS_TABLE_NAME_VARIABLE__"));
boolean useUpdateStatement="true".equals(ElementParameterParser.getValue(node, "__USE_UPDATE_STATEMENT__"));
%>
String select_query_<%=cid %> = null;
String tableName_<%=cid%> = null;
@@ -157,36 +156,21 @@ skeleton="../templates/db_output_bulk.skeleton"
}
if(("INSERT").equals(dataAction)){
%>
String insertQuery_<%=cid %> = "INSERT INTO "+tableName_<%=cid%>+"(<%=insertColName.toString()%>) ("+select_query_<%=cid %>+")";
<%
} else if (("UPDATE").equals(dataAction)){
if(useUpdateStatement){
%>
String updateQuery_<%=cid %> = select_query_<%=cid %>;
<%
if(CodeGenerationUtils.hasAlphaNumericCharacter(whereClause)) {
%>
if (updateQuery_<%=cid %>.toUpperCase().contains(" WHERE ")) {
updateQuery_<%=cid %> += " AND (" + <%=CodeGenerationUtils.replaceAllCrBySpace(whereClause)%> + ")";
} else {
updateQuery_<%=cid %> += " WHERE " + <%=CodeGenerationUtils.replaceAllCrBySpace(whereClause)%>;
}
<%
}
} else {
%>
String updateQuery_<%=cid %> = "UPDATE "+tableName_<%=cid%>+" SET <%=updateSetStmt.toString()%> "
<%
if(CodeGenerationUtils.hasAlphaNumericCharacter(whereClause)) {
%>
+" WHERE " + <%=CodeGenerationUtils.replaceAllCrBySpace(whereClause)%>
<%
}
%>
;
%>
String insertQuery_<%=cid %> = "INSERT INTO "+tableName_<%=cid%>+"(<%=insertColName.toString()%>) ("+select_query_<%=cid %>+")";
<%
} else if (("UPDATE").equals(dataAction)){
%>
String updateQuery_<%=cid %> = "UPDATE "+tableName_<%=cid%>+" SET <%=updateSetStmt.toString()%> "
<%
if(CodeGenerationUtils.hasAlphaNumericCharacter(whereClause)) {
%>
+" WHERE " + <%=CodeGenerationUtils.replaceAllCrBySpace(whereClause)%>
<%
}
%>
;
<%
}
} else if (("DELETE").equals(dataAction)){
%>
String deleteQuery_<%=cid %> = "DELETE FROM "+ tableName_<%=cid%>+" WHERE EXISTS ("+select_query_<%=cid %>+") "

View File

@@ -40,6 +40,4 @@ TABLE_ACTION.ITEM.CREATE_IF_NOT_EXISTS=Create table if not exists
TABLE_ACTION.ITEM.DROP_IF_EXISTS_AND_CREATE=Drop table if exists and create
TABLE_ACTION.ITEM.DROP_CREATE=Drop and create table
TABLE_ACTION.ITEM.NONE=None
TABLE_ACTION.NAME=Action on table
USE_UPDATE_STATEMENT.NAME=Use update statement without subqueries
TABLE_ACTION.NAME=Action on table

View File

@@ -13,22 +13,9 @@
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String confLib = ElementParameterParser.getValue(node, "__CONF_LIB__");
Boolean setHadoopConf = ElementParameterParser.getBooleanValue(node, "__SET_HADOOP_CONF__");
String customHadoopConfPath = ElementParameterParser.getValue(node, "__HADOOP_CONF_SPECIFIC_JAR__");
if (setHadoopConf == null) {
setHadoopConf = Boolean.FALSE;
}
%>
<% if((confLib != null && confLib.length() > 0) || setHadoopConf){%>
String libPath_<%=cid %> = "";
<% if (setHadoopConf) { %>
libPath_<%=cid %> = <%=customHadoopConfPath %>;
<% } else { %>
<% if(confLib != null && confLib.length() > 0){%>
class DealJobLibrary_<%=cid%> {
@@ -88,9 +75,14 @@ class DealJobLibrary_<%=cid%> {
}
java.net.URLClassLoader currentLoader<%=cid %> = (java.net.URLClassLoader) Thread.currentThread().getContextClassLoader();
java.lang.reflect.Method method_<%=cid %> = java.net.URLClassLoader.class.getDeclaredMethod("addURL", new Class[] { java.net.URL.class });
method_<%=cid %>.setAccessible(true);
DealJobLibrary_<%=cid%> dealJobLibrary = new DealJobLibrary_<%=cid%>();
String confJarName = dealJobLibrary.getConfJarName(<%=confLib %>, this.contextStr);
String libPath_<%=cid %> = "";
<%if (ProcessorUtilities.isExportConfig()) {%>
libPath_<%=cid %> = "../lib/" + confJarName;
<%} else {
@@ -98,11 +90,6 @@ String confJarName = dealJobLibrary.getConfJarName(<%=confLib %>, this.contextSt
libPath_<%=cid %> = new java.io.File("<%=libFolder %>/" + confJarName).getAbsolutePath();
<%}%>
libPath_<%=cid %> = dealJobLibrary.replaceJarPathsFromCrcMap(libPath_<%=cid %>);
<%}%>
java.net.URLClassLoader currentLoader<%=cid %> = (java.net.URLClassLoader) Thread.currentThread().getContextClassLoader();
java.lang.reflect.Method method_<%=cid %> = java.net.URLClassLoader.class.getDeclaredMethod("addURL", new Class[] { java.net.URL.class });
method_<%=cid %>.setAccessible(true);
method_<%=cid %>.invoke(currentLoader<%=cid %>, new Object[] { new java.io.File(libPath_<%=cid %>).toURL() });
<%}%>

View File

@@ -42,12 +42,6 @@
>
<DEFAULT></DEFAULT>
</PARAMETER>
<PARAMETER NAME="SET_HADOOP_CONF" FIELD="CHECK" NUM_ROW="2" REPOSITORY_VALUE="SET_HADOOP_CONF" >
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="HADOOP_CONF_SPECIFIC_JAR" FIELD="TEXT" NUM_ROW="2" REPOSITORY_VALUE="HADOOP_CONF_SPECIFIC_JAR" >
<DEFAULT>"path/to/hadoop_conf.jar"</DEFAULT>
</PARAMETER>
</PARAMETERS>
<CODEGENERATION></CODEGENERATION>

View File

@@ -17,17 +17,19 @@
<% if(hotLibs!=null&&hotLibs.size() > 0){%>
java.net.URLClassLoader sysloader_<%=cid %> = (java.net.URLClassLoader) ClassLoader.getSystemClassLoader();
java.lang.reflect.Method method_<%=cid %> = java.net.URLClassLoader.class.getDeclaredMethod("addURL", new Class[] { java.net.URL.class });
method_<%=cid %>.setAccessible(true);
String[] libPaths_<%=cid %> = new String[] { <% for(Map<String, String> item : hotLibs) {%> <%=item.get("LIBPATH") %>, <%}%> };
String[] libPaths_<%=cid %> = new String[] { <% for(Map<String, String> item : hotLibs){%> <%=item.get("LIBPATH") %>, <%}%> };
for(String lib_<%=cid %>:libPaths_<%=cid %> ){
java.util.List<java.net.URL> libURL_<%=cid %> = new java.util.ArrayList<>();
for(String lib_<%=cid %>:libPaths_<%=cid %>) {
String separator_<%=cid %> = System.getProperty("path.separator");
String[] jarFiles_<%=cid %> = lib_<%=cid %>.split(separator_<%=cid %>);
for(String jarFile_<%=cid %>:jarFiles_<%=cid %>){
method_<%=cid %>.invoke(sysloader_<%=cid %>, new Object[] { new java.io.File(jarFile_<%=cid %>).toURL() });
for(String jarFile_<%=cid %> : jarFiles_<%=cid %>) {
libURL_<%=cid %>.add( new java.io.File(jarFile_<%=cid %>).toURI().toURL() );
}
}
java.net.URL[] libURLArray_<%=cid %> = libURL_<%=cid %>.toArray(new java.net.URL[] {});
ClassLoader threadClassLoader_<%=cid %> = Thread.currentThread().getContextClassLoader();
java.net.URLClassLoader newthreadClassLoader_<%=cid %> = new java.net.URLClassLoader(libURLArray_<%=cid %>, threadClassLoader_<%=cid %>);
Thread.currentThread().setContextClassLoader(newthreadClassLoader_<%=cid %>);
<%}%>

View File

@@ -208,8 +208,6 @@ boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.ge
mc_<%=cid%>.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
mc_<%=cid%>.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822");
javax.activation.CommandMap.setDefaultCommandMap(mc_<%=cid%>);
// add com.sun.mail.handlers to job imports / depenencies (TESB-27110)
com.sun.mail.handlers.text_plain text_plain_h_<%=cid%> = null;
// -- Send the message --
javax.mail.Transport.send(msg_<%=cid %>);
} catch(java.lang.Exception e){

View File

@@ -106,12 +106,7 @@
REQUIRED="false" NUM_ROW="11">
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER NAME="IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY" FIELD="CHECK" NUM_ROW="11"
SHOW_IF="CREATE_EMPTY_ELEMENT=='false'">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="EXPAND_EMPTY_ELM" FIELD="CHECK" NUM_ROW="11"
SHOW_IF="CREATE_EMPTY_ELEMENT=='true'">
<DEFAULT>false</DEFAULT>
@@ -178,8 +173,6 @@
TARGET="Out.CREATE" />
<TEMPLATE_PARAM SOURCE="self.CREATE_EMPTY_ELEMENT"
TARGET="Out.CREATE_EMPTY_ELEMENT" />
<TEMPLATE_PARAM SOURCE="self.IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY"
TARGET="Out.IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY" />
<TEMPLATE_PARAM SOURCE="self.EXPAND_EMPTY_ELM"
TARGET="Out.EXPAND_EMPTY_ELM" />
<TEMPLATE_PARAM SOURCE="self.OUTPUT_AS_XSD"

View File

@@ -43,5 +43,4 @@ SCHEMA.NAME=Schema
THOUSANDS_SEPARATOR.NAME=Thousands separator
XMLFIELD.NAME=Output Column
XSD_FILE.NAME=XSD file path
IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY.NAME = Ignore service attributes for empty elements
EXPAND_EMPTY_ELM.NAME = Expand Empty Element if needed(for dom4j)

View File

@@ -45,7 +45,6 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
String removeHeader = ElementParameterParser.getValue(node, "__REMOVE_HEADER__"); // add for feature7788
String encoding = ElementParameterParser.getValue(node, "__ENCODING__");
boolean isAllowEmpty = ("true").equals(ElementParameterParser.getValue(node, "__CREATE_EMPTY_ELEMENT__"));
boolean ignoreServiceAttributes = ("true").equals(ElementParameterParser.getValue(node, "__IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY__"));
boolean expandEmptyElm = ("true").equals(ElementParameterParser.getValue(node, "__EXPAND_EMPTY_ELM__"));
String mode = ElementParameterParser.getValue(node, "__GENERATION_MODE__");
List<Map<String, String>> rootTable =
@@ -201,18 +200,6 @@ java.util.Map<String,String> arraysValueMap_<%=cid%> = new java.util.HashMap<Str
%>
class NestXMLTool_<%=cid%>{
<%
if (!isAllowEmpty && ignoreServiceAttributes) {
%>
private java.util.Set<String> serviceAttributeNames = new java.util.HashSet<>();
{
serviceAttributeNames.add("type");
serviceAttributeNames.add("class");
serviceAttributeNames.add("array");
}
<%
}
%>
public void parseAndAdd(org.dom4j.Element nestRoot, String value){
try {
org.dom4j.Document doc4Str = org.dom4j.DocumentHelper.parseText("<root>"+ value + "</root>");
@@ -248,25 +235,16 @@ class NestXMLTool_<%=cid%>{
for (org.dom4j.Element tmp: (java.util.List<org.dom4j.Element>) root.elements()) {
removeEmptyElement(tmp);
}
boolean noSignificantDataAnnotationsExist = root.attributes().isEmpty() <%if (!isAllowEmpty && ignoreServiceAttributes) {%>|| isOnlyServiceAttributesDeclared(root.attributes()) <% } %>;
if (root.content().isEmpty()
&& noSignificantDataAnnotationsExist && root.declaredNamespaces().isEmpty()) {
if(root.getParent()!=null){
root.getParent().remove(root);
if (root.content().size() == 0
&& root.attributes().size() == 0
&& root.declaredNamespaces().size() == 0) {
if(root.getParent()!=null){
root.getParent().remove(root);
}
}
}
}
<%
if (!isAllowEmpty && ignoreServiceAttributes) {
%>
private boolean isOnlyServiceAttributesDeclared(List<org.dom4j.Attribute> attributes) {
return attributes.stream().allMatch(a -> serviceAttributeNames.contains(a.getName().toLowerCase()));
}
<%
}
%>
}
}
public String objectToString(Object value){
if(value.getClass().isArray()){
StringBuilder sb = new StringBuilder();

View File

@@ -99,11 +99,6 @@
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER NAME="IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY" FIELD="CHECK" NUM_ROW="11"
SHOW_IF="CREATE_EMPTY_ELEMENT=='false'">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="EXPAND_EMPTY_ELM" FIELD="CHECK" NUM_ROW="11"
SHOW_IF="CREATE_EMPTY_ELEMENT=='true'">
<DEFAULT>false</DEFAULT>

View File

@@ -44,6 +44,5 @@ THOUSANDS_SEPARATOR.NAME=Thousands separator
XMLFIELD.NAME=Output Column
XML_FIELD.NAME=XML Field
XSD_FILE.NAME=XSD file path
IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY.NAME = Ignore service attributes for empty elements
EXPAND_EMPTY_ELM.NAME = Expand Empty Element if needed(for dom4j)
COMPACT_FORMAT.NAME = Compact Format

View File

@@ -35,7 +35,6 @@ imports="
%>
String driverClass_<%=cid%> = "<%=this.getDirverClassName(node)%>";
java.lang.Class jdbcclazz_<%=cid%> = java.lang.Class.forName(driverClass_<%=cid%>);
globalMap.put("driverClass_<%=cid%>", driverClass_<%=cid%>);
<%
newInstance(node);
}

View File

@@ -165,12 +165,6 @@ imports="
close_begin();
%>
conn_<%=cid%>.close();
<% /* TESB-24900 - graceful shutdown for MYSQL connection */ %>
if("com.mysql.cj.jdbc.Driver".equals((String)globalMap.get("driverClass_<%=(connection!=null)?connection.replaceAll("'","").trim():""%>"))
&& routines.system.BundleUtils.inOSGi()) {
Class.forName("com.mysql.cj.jdbc.AbandonedConnectionCleanupThread").
getMethod("checkedShutdown").invoke(null, (Object[]) null);
}
<%
close_end();
}

View File

@@ -16,7 +16,6 @@ import java.beans.PropertyChangeEvent;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.gef.commands.Command;
import org.eclipse.swt.SWT;
@@ -127,9 +126,7 @@ public class ButtonController extends AbstractElementPropertySectionController {
continue;
}
for(String path : listString){
if (!StringUtils.isBlank(path)) {
jars.add(GenericTableUtils.getDriverJarPath(path));
}
jars.add(GenericTableUtils.getDriverJarPath(path));
}
}

View File

@@ -15,10 +15,8 @@ package org.talend.designer.core.generic.controller;
import java.beans.PropertyChangeEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
@@ -43,7 +41,6 @@ import org.talend.components.api.properties.ComponentReferenceProperties;
import org.talend.core.model.process.EParameterFieldType;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.INode;
import org.talend.core.model.process.IReplaceNodeHandler;
import org.talend.core.model.utils.TalendTextUtils;
import org.talend.core.ui.properties.tab.IDynamicProperty;
import org.talend.designer.core.generic.constants.IGenericConstants;
@@ -103,20 +100,15 @@ public class ComponentRefController extends AbstractElementPropertySectionContro
for (int j = 0; j < param.getListItemsValue().length; j++) {
if (((CCombo) ctrl).getText().equals(param.getListItemsDisplayName()[j])) {
value = (String) param.getListItemsValue()[j];
if (j == 0) {
if (j == 0 && (boolean) ((ElementParameter) propertyParameter)
.getTaggedValue(IGenericConstants.IS_PROPERTY_SHOW)) {
// The first item in the combo is
// this component
props.referenceType
.setValue(ComponentReferenceProperties.ReferenceType.THIS_COMPONENT);
props.componentInstanceId.setValue(null);
props.setReference(null);
boolean isPropertyShow = true;
Object isPropertyShowObj = ((ElementParameter) propertyParameter)
.getTaggedValue(IGenericConstants.IS_PROPERTY_SHOW);
if (isPropertyShowObj != null) {
isPropertyShow = Boolean.valueOf(isPropertyShowObj.toString());
}
propertyParameter.setShow(isPropertyShow);
propertyParameter.setShow(true);
} else {
props.referenceType
.setValue(ComponentReferenceProperties.ReferenceType.COMPONENT_INSTANCE);
@@ -285,12 +277,12 @@ public class ComponentRefController extends AbstractElementPropertySectionContro
INode currentNode = (INode) elem;
List<INode> refNodes = getRefNodes(param, props);
List<String> itemsLabel = new ArrayList<>();
Map<String, INode> itemsValue = new LinkedHashMap<>();
List<String> itemsValue = new ArrayList<>();
// First item is this component (see also createComboCommand)
// FIXME - I18N for this message
itemsLabel.add("Use this Component");
itemsValue.put(currentNode.getUniqueName(), currentNode);
itemsValue.add(currentNode.getUniqueName());
String selectedValue;
Object referenceType = props.referenceType.getValue();
if (referenceType != null && referenceType.equals(ComponentReferenceProperties.ReferenceType.COMPONENT_INSTANCE)) {
@@ -314,20 +306,19 @@ public class ComponentRefController extends AbstractElementPropertySectionContro
displayName = uniqueName + " - " + displayName; //$NON-NLS-1$
}
itemsLabel.add(displayName);
itemsValue.put(uniqueName, node);
itemsValue.add(uniqueName);
labelToValueMap.put(displayName, uniqueName);
}
List<String> itemValueList = new ArrayList<>(itemsValue.keySet());
param.setListItemsDisplayName(itemsLabel.toArray(new String[0]));
param.setListItemsDisplayCodeName(itemsLabel.toArray(new String[0]));
param.setListItemsValue(itemValueList.toArray(new String[0]));
param.setListItemsValue(itemsValue.toArray(new String[0]));
combo.setItems(itemsLabel.toArray(new String[0]));
String iLabel = null;
int selection = 0;
for (int i = 0; i < itemValueList.size(); i++) {
String iValue = itemValueList.get(i);
for (int i = 0; i < itemsValue.size(); i++) {
String iValue = itemsValue.get(i);
if ((selectedValue == null && (((INode) elem).getUniqueName()).equals(iValue))
|| isRefernceNode(currentNode, itemsValue.get(iValue), selectedValue, props)) {
|| (selectedValue != null && StringUtils.isNotEmpty(iValue) && iValue.endsWith(selectedValue))) {
iLabel = itemsLabel.get(i);
break;
}
@@ -340,33 +331,6 @@ public class ComponentRefController extends AbstractElementPropertySectionContro
}
private boolean isRefernceNode(INode selectedNode, INode checkingNode, String selectedUniqueName, ComponentReferenceProperties props) {
IReplaceNodeHandler selectedHandler = selectedNode.getReplaceNodeHandler();
IReplaceNodeHandler checkingHandler = checkingNode.getReplaceNodeHandler();
String selectedPrefix = Optional.ofNullable(selectedHandler).map(h -> h.getPrefix()).orElse("");
String checkingPrefix = Optional.ofNullable(checkingHandler).map(h -> h.getPrefix()).orElse("");
if (checkingPrefix.startsWith(selectedPrefix)) {
String selectedNameWithoutPrefix = selectedUniqueName;
String checkingUniqueNameWithoutPrefix = checkingNode.getUniqueName();
if (selectedNameWithoutPrefix.startsWith(selectedPrefix)) {
selectedNameWithoutPrefix = selectedNameWithoutPrefix.substring(selectedPrefix.length());
}
if (checkingUniqueNameWithoutPrefix.startsWith(selectedPrefix)) {
checkingUniqueNameWithoutPrefix = checkingUniqueNameWithoutPrefix.substring(selectedPrefix.length());
}
boolean isReferenceNode = StringUtils.equals(selectedNameWithoutPrefix, checkingUniqueNameWithoutPrefix);
if (isReferenceNode && selectedNode != checkingNode) {
props.componentInstanceId.setValue(selectedNameWithoutPrefix);
props.setReference(checkingNode.getComponentProperties());
}
return isReferenceNode;
} else {
return false;
}
}
private List<INode> getRefNodes(IElementParameter param, ComponentReferenceProperties props) {
callBeforeActive(param);
List<INode> refNodes = new ArrayList<>();

View File

@@ -1473,12 +1473,7 @@ public class Component extends AbstractBasicComponent {
//as sql type value may have newline and return characters, which make compiler issue in java code,
//so have to convert the newline characters to visible "\r", "\n" for pass the compiler issue and can't only convert them to white space as TDI-41898
//jdbc drivers, salesforce driver can work like that sql : select * \nfrom Account, so it is ok
String replacedString = NodeUtil.replaceCRLFInMEMO_SQL(value).trim();
// For the case when sql field ends with extra semicolon, it has to be removed to avoid compilation error.
return replacedString.endsWith(";")
? replacedString.substring(0, replacedString.length() -1)
: replacedString;
return NodeUtil.replaceCRLFInMEMO_SQL(value);
}
if (GenericTypeUtils.isSchemaType(property)) {
// Handles embedded escaped quotes which might occur

View File

@@ -15,7 +15,6 @@ package org.talend.designer.core.generic.model;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.lang.reflect.InvocationTargetException;
import java.net.ProxySelector;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -31,7 +30,6 @@ import org.eclipse.ui.PlatformUI;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.ui.gmf.util.DisplayUtils;
import org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea;
import org.talend.commons.utils.network.TalendProxySelector;
import org.talend.components.api.component.Connector;
import org.talend.components.api.properties.ComponentProperties;
import org.talend.components.api.service.ComponentService;
@@ -500,27 +498,11 @@ public class GenericElementParameter extends ElementParameter implements IGeneri
monitor.beginTask(taskName, IProgressMonitor.UNKNOWN);
try {
exceptionResult = null;
if (Boolean.getBoolean(TalendProxySelector.PROP_PRINT_LOGS)) {
ExceptionHandler.log(
"Before tcompv0 service call: ProxySelector.getDefault() -> " + ProxySelector.getDefault());
ExceptionHandler.log("http.proxyHost -> " + System.getProperty("http.proxyHost"));
}
toDo();
if (Boolean.getBoolean(TalendProxySelector.PROP_PRINT_LOGS)) {
ExceptionHandler.log(
"After tcompv0 service call: ProxySelector.getDefault() -> " + ProxySelector.getDefault());
ExceptionHandler.log("http.proxyHost -> " + System.getProperty("http.proxyHost"));
}
} catch (Throwable e) {
result.set(false);
exceptionResult = new InvocationTargetException(e);
throw exceptionResult;
} finally {
if (Boolean.getBoolean(TalendProxySelector.PROP_PRINT_LOGS)) {
ExceptionHandler.log(
"Finally tcompv0 service call: ProxySelector.getDefault() -> " + ProxySelector.getDefault());
ExceptionHandler.log("http.proxyHost -> " + System.getProperty("http.proxyHost"));
}
}
result.set(true);
}
@@ -586,7 +568,6 @@ public class GenericElementParameter extends ElementParameter implements IGeneri
this.drivedByForm = drivedByForm;
}
@Override
public Property getProperty() {
NamedThing content = widget.getContent();
if (content instanceof Property) {

View File

@@ -21,13 +21,11 @@ import java.util.Set;
import org.talend.components.api.component.ComponentDefinition;
import org.talend.components.api.properties.ComponentProperties;
import org.talend.components.api.properties.ComponentReferenceProperties;
import org.talend.core.model.components.IComponent;
import org.talend.core.model.process.EParameterFieldType;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.INode;
import org.talend.core.runtime.services.IGenericService;
import org.talend.daikon.properties.Properties;
import org.talend.designer.core.generic.model.Component;
import org.talend.designer.core.generic.model.GenericElementParameter;
import org.talend.designer.core.generic.utils.ComponentsUtils;
@@ -111,9 +109,4 @@ public class GenericService implements IGenericService {
return null;
}
@Override
public boolean isTcompv0(IComponent component) {
return Component.class.isInstance(component);
}
}

View File

@@ -736,7 +736,6 @@ PerformancePreferencePage.generateCode=Generate code when opening the job
PerformancePreferencePage.checkVersion=Check only the last version when updating jobs or joblets
PerformancePreferencePage.addOrDeleteVariable=Propagate add/delete variable changes in repository contexts
PerformancePreferencePage.ActivedTimeoutSetting=Activate the timeout for database connection.
PerformancePreferencePage.propagateContext=Propagate add context groups in repository contexts
PerformancePreferencePage.ConnectionTimeout=Connection timeout (seconds)
PerformancePreferencePage.HBaseOrMaprDBScanLimit=HBase/MapR-DB scan limit (for retrieving schema)
PerformancePreferencePage.HBaseOrMaprDBScanLimitTip=If set it by zero, will be same as deactiving the limit.

View File

@@ -99,7 +99,6 @@ import org.talend.designer.core.ui.views.jobsettings.JobSettings;
import org.talend.designer.core.ui.views.problems.Problems;
import org.talend.designer.core.ui.views.properties.ComponentSettings;
import org.talend.designer.core.ui.views.properties.ComponentSettingsView;
import org.talend.designer.core.utils.BigDataJobUtil;
import org.talend.designer.core.utils.JavaProcessUtil;
import org.talend.designer.core.utils.UnifiedComponentUtil;
import org.talend.designer.runprocess.ProcessorException;
@@ -875,9 +874,4 @@ public class DesignerCoreService implements IDesignerCoreService {
}
return false;
}
@Override
public boolean isNeedContextInJar(IProcess process) {
return new BigDataJobUtil(process).needsToHaveContextInsideJar();
}
}

View File

@@ -12,100 +12,106 @@
// ============================================================================
package org.talend.designer.core.build;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.IPath;
import org.talend.commons.CommonsPlugin;
import org.talend.core.model.process.INode;
import org.talend.core.model.process.IProcess2;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.properties.Property;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.repository.utils.ItemResourceUtil;
import org.talend.core.runtime.process.IBuildJobHandler;
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
import org.talend.core.runtime.repository.build.BuildType;
import org.talend.core.runtime.repository.build.IBuildExportHandler;
import org.talend.core.runtime.repository.build.IMavenPomCreator;
import org.talend.core.runtime.repository.build.RepositoryObjectTypeBuildProvider;
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
import org.talend.designer.maven.tools.creator.CreateMavenStandardJobOSGiPom;
import org.talend.designer.runprocess.IProcessor;
import org.talend.repository.constants.BuildJobConstants;
import org.talend.repository.ui.wizards.exportjob.handler.BuildOSGiBundleHandler;
import org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobScriptsManager.ExportChoice;
/**
* Build Provider for OSGI build type (ESB bundle)
* DOC ggu class global comment. Detailled comment
*/
public class StandardJobOSGiBundleBuildProvider extends RepositoryObjectTypeBuildProvider {
private static final String OSGI = "OSGI";
private static final List<String> ESB_COMPONENTS;
static {
final List<String> esbComponents = Arrays.asList("tRESTClient", "tRESTRequest", "tRESTResponse", "tESBConsumer",
"tESBProviderFault", "tESBProviderRequest", "tESBProviderResponse", "tRouteInput", "tREST");
ESB_COMPONENTS = Collections.unmodifiableList(esbComponents);
}
@Override
public boolean valid(Map<String, Object> parameters) {
if (parameters == null || parameters.isEmpty()) {
return false;
}
ERepositoryObjectType type = null;
Property property = null;
boolean containsEsbComponent = false;
Object object = parameters.get(PROCESS);
if (object != null && object instanceof IProcess2) {
Property property = ((IProcess2) object).getProperty();
if (isOsgiBuildType(property)) {
return true;
}
IProcess2 process = (IProcess2) object;
for (INode node : process.getGraphicalNodes()) {
if (node.isActivate() && BuildJobConstants.esbComponents.contains(node.getComponent().getName())) {
fixDefaultBuildType(property);
return true;
if (ESB_COMPONENTS.contains(node.getComponent().getName())) {
containsEsbComponent = true;
break;
}
}
property = ((IProcess2) object).getProperty();
if (property != null) {
type = ERepositoryObjectType.getType(property);
}
}
if (type == null) {
object = parameters.get(ITEM);
if (object != null && object instanceof ProcessItem) {
ProcessItem processItem = (ProcessItem) object;
ProcessType process = processItem.getProcess();
for (Object node : process.getNode()) {
NodeType nodeType = (NodeType) node;
if (ESB_COMPONENTS.contains(nodeType.getComponentName())) {
containsEsbComponent = true;
break;
}
}
property = ((Item) object).getProperty();
if (property != null) {
type = ERepositoryObjectType.getType(property);
}
}
}
object = parameters.get(ITEM);
if (object != null && object instanceof ProcessItem) {
Property property = ((Item) object).getProperty();
if (isOsgiBuildType(property)) {
return true;
}
ProcessItem processItem = (ProcessItem) object;
for (Object node : processItem.getProcess().getNode()) {
NodeType nodeType = (NodeType) node;
if (BuildJobConstants.esbComponents.contains(nodeType.getComponentName())) {
fixDefaultBuildType(property);
return true;
}
if (type == null) {
object = parameters.get(REPOSITORY_OBJECT);
if (object != null && object instanceof IRepositoryViewObject) {
type = ((IRepositoryViewObject) object).getRepositoryObjectType();
property = ((IRepositoryViewObject) object).getProperty();
}
}
// && !isServiceOperation(property)
if (containsEsbComponent) {
return true;
}
return false;
}
/**
* @param property
* @return true if the build type is OSGI
*/
private boolean isOsgiBuildType(Property property) {
return property != null && "OSGI".equals(property.getAdditionalProperties().get(TalendProcessArgumentConstant.ARG_BUILD_TYPE));
}
/**
* Fix the default build type if it is a ESB job
* @param property
*/
@SuppressWarnings("unchecked")
private void fixDefaultBuildType(Property property) {
if(CommonsPlugin.isHeadless() && property != null && property.getAdditionalProperties().get(TalendProcessArgumentConstant.ARG_BUILD_TYPE) == null) {
property.getAdditionalProperties().put(TalendProcessArgumentConstant.ARG_BUILD_TYPE, OSGI);
}
}
@Override
protected ERepositoryObjectType getObjectType() {
return ERepositoryObjectType.PROCESS;
@@ -198,4 +204,5 @@ public class StandardJobOSGiBundleBuildProvider extends RepositoryObjectTypeBuil
contextGroup.toString(), (Map<ExportChoice, Object>) choiceOption);
return buildHandler;
}
}

View File

@@ -45,8 +45,6 @@ import org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobScriptsManag
*/
public class StandardJobStandaloneBuildProvider extends RepositoryObjectTypeBuildProvider {
private static final String REST_REQUEST = "tRESTRequest";
/*
* (non-Javadoc)
*
@@ -76,7 +74,7 @@ public class StandardJobStandaloneBuildProvider extends RepositoryObjectTypeBuil
if (object != null && object instanceof IProcess2) {
for (INode node : ((IProcess2) object).getGraphicalNodes()) {
if (node.isActivate() && REST_REQUEST.equals(node.getComponent().getName())) {
if ("tRESTRequest".equals(node.getComponent().getName())) {
isRestServiceProvider = true;
break;
}
@@ -99,7 +97,7 @@ public class StandardJobStandaloneBuildProvider extends RepositoryObjectTypeBuil
ProcessItem processItem = (ProcessItem) object;
for (Object node : processItem.getProcess().getNode()) {
NodeType nodeType = (NodeType) node;
if (REST_REQUEST.equals(nodeType.getComponentName())) {
if ("tRESTRequest".equals(nodeType.getComponentName())) {
isRestServiceProvider = true;
break;
}

View File

@@ -379,8 +379,6 @@ public enum EParameterName {
ACTIVE_DATABASE_DELIMITED_IDENTIFIERS("Active database delimited identifiers"), //$NON-NLS-1$
USE_ALIAS_IN_OUTPUT_TABLE("Use alias in output table"), //$NON-NLS-1$
// for tDataprepRun
PREPARATION_ID("PREPARATION_ID");

View File

@@ -16,14 +16,11 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.oro.text.regex.MalformedPatternException;
import org.apache.oro.text.regex.Pattern;
import org.apache.oro.text.regex.Perl5Compiler;
import org.apache.oro.text.regex.Perl5Matcher;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.commons.utils.StringUtils;
import org.talend.commons.utils.system.EnvironmentUtils;
import org.talend.core.PluginChecker;
import org.talend.core.language.LanguageManager;
@@ -38,10 +35,10 @@ import org.talend.core.model.process.IConnectionCategory;
import org.talend.core.model.process.IElement;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.INode;
import org.talend.designer.core.ui.editor.process.Process;
import org.talend.hadoop.distribution.DistributionFactory;
import org.talend.hadoop.distribution.ESparkVersion;
import org.talend.hadoop.distribution.spark.SparkVersionUtil;
import org.talend.designer.core.ui.editor.process.Process;
/**
* This class will test an expression in the element parameters. <br>
@@ -77,36 +74,7 @@ public final class Expression {
private static final String LESS_THAN = "<"; //$NON-NLS-1$
private static final String isShowPrefix = "isShow"; //$NON-NLS-1$
private static final java.util.regex.Pattern isShowFuncPattern = java.util.regex.Pattern
.compile(isShowPrefix + "\\[(\\w+)(\\.\\w+)*\\]"); //$NON-NLS-1$
private static final String sparkVersionPrefix = "SPARK_"; //$NON-NLS-1$
private static final java.util.regex.Pattern sparkVersionPattern = java.util.regex.Pattern
.compile("(lt|le|gt|ge|eq|ne)\\s*'(" + sparkVersionPrefix + ".*)'"); //$NON-NLS-1$ //$NON-NLS-2$
private static Perl5Matcher conditionMatcher = new Perl5Matcher();
private static Pattern andPattern;
private static Pattern orPattern;
static {
Perl5Compiler compiler = new Perl5Compiler();
// example for the reg exp: (.*)[')][ ]*or[ ]*[\w(](.*)
String prefixReg = "(.*)[') ][ ]*"; //$NON-NLS-1$
String suffixReg = "[ ]*[ (](.*)"; //$NON-NLS-1$
try {
andPattern = compiler.compile(prefixReg + AND + suffixReg);
orPattern = compiler.compile(prefixReg + OR + suffixReg);
} catch (MalformedPatternException e) {
throw new RuntimeException(e);
}
}
private static final String CONTAINS = "CONTAINS"; //$NON-NLS-1$
private static final Pattern isShowFuncPattern = Pattern.compile("isShow\\[(\\w+)(\\.\\w+)*\\]"); //$NON-NLS-1$
private Expression(String expressionString) {
this.expressionString = expressionString;
@@ -177,15 +145,14 @@ public final class Expression {
}
protected static boolean isThereCondition(String expression, String condition) {
expression = expression.toLowerCase();
if (!expression.contains(condition)) {
return false;
}
if (AND.equals(condition) && conditionMatcher.matches(expression, andPattern)) {
public static boolean isThereCondition(String expression, String condition) {
// example for the reg exp: (.*)[')][ ]*or[ ]*[\w(](.*)
String refixReg = "(.*)[') ][ ]*"; //$NON-NLS-1$
String suffixReg = "[ ]*[ (](.*)"; //$NON-NLS-1$
if (expression.matches(refixReg + condition + suffixReg)) {
return true;
}
if (OR.equals(condition) && conditionMatcher.matches(expression, orPattern)) {
if (expression.matches(refixReg + condition.toUpperCase() + suffixReg)) {
return true;
}
return false;
@@ -307,10 +274,6 @@ public final class Expression {
if ((simpleExpression.contains("SPARK_VERSION["))) { //$NON-NLS-1$
return evaluateSparkVersion(simpleExpression, listParam, currentParam);
}
if ((simpleExpression.contains(CONTAINS))) { //$NON-NLS-1$
return evaluateContains(simpleExpression, listParam);
}
List<String> paraNames = getParaNamesFromIsShowFunc(simpleExpression);
if (paraNames.size() > 0) {
@@ -821,15 +784,13 @@ public final class Expression {
// should be private, but need to unitary tested
public static boolean evaluateSparkVersion(String simpleExpression, List<? extends IElementParameter> listParam,
ElementParameter currentParam) {
if (!simpleExpression.contains(sparkVersionPrefix)) {
return false;
}
INode node = retrieveNodeElementFromParameter(currentParam, listParam);
ESparkVersion version = SparkVersionUtil.getSparkVersion(node);
if (version == null) {
return false;
}
Matcher m = sparkVersionPattern.matcher(simpleExpression);
Pattern p = java.util.regex.Pattern.compile("(lt|le|gt|ge|eq|ne)\\s*'(SPARK_.*)'"); //$NON-NLS-1$
Matcher m = p.matcher(simpleExpression);
if (m.find()) {
ESparkVersion versionToTest = ESparkVersion.valueOf(m.group(2));
switch (m.group(1)) {
@@ -875,7 +836,7 @@ public final class Expression {
private static List<String> getParaNamesFromIsShowFunc(String expr) {
List<String> paraNames = new ArrayList<String>();
if (expr == null || !expr.contains(isShowPrefix)) {
if (expr == null) {
return paraNames;
}
Matcher matcher = isShowFuncPattern.matcher(expr);
@@ -1069,28 +1030,5 @@ public final class Expression {
}
return false;
}
public static boolean evaluateContains(String simpleExpression, List<? extends IElementParameter> listParam) {
//Split to get param name and param value to look after
String[] splitted = simpleExpression.split(CONTAINS);
if (splitted.length != 2) {
return false;
}
String paramName = splitted[0].trim();
String paramValue = splitted[1].trim();
//Look for the param name in list
IElementParameter param = listParam.stream()
.filter(p -> paramName.equals(p.getName()))
.findAny()
.orElse(null);
if (param == null || ! EParameterFieldType.TABLE.equals(param.getFieldType())) {
return false;
}
// Check if we can find paraValue among table lines
return ((List<Map<String, Object>>) param.getValue()).stream()
.anyMatch(line -> paramValue.equals(line.toString()));
}
}

View File

@@ -31,20 +31,9 @@ public class MultipleComponentConnection implements IMultipleComponentConnection
String connectionType;
String connectorName;
public MultipleComponentConnection(String cType, String targetName) {
connectionType = cType;
nameTarget = targetName;
connectorName = cType;
}
public String getConnectorName() {
return connectorName;
}
public void setConnectorName(String connectorName) {
this.connectorName = connectorName;
}
/*

View File

@@ -17,7 +17,6 @@ import java.util.List;
import org.talend.core.model.components.IMultipleComponentConnection;
import org.talend.core.model.components.IMultipleComponentItem;
import org.talend.core.model.process.INode;
/**
* DOC nrousseau class global comment. Detailled comment <br/>
@@ -68,10 +67,4 @@ public class MultipleComponentItem implements IMultipleComponentItem {
public void setComponent(String component) {
this.component = component;
}
@Override
public void updateNode(INode newNode, INode oldNode) {
// nothing to do
}
}

View File

@@ -77,36 +77,17 @@ public class MultipleComponentManager implements IMultipleComponentManager {
return currentItem;
}
public void addItem(IMultipleComponentItem currentItem) {
String name = currentItem.getName();
if (name.equals(inputName)) {
input = currentItem;
}
if (name.equals(outputName)) {
output = currentItem;
}
itemList.add(currentItem);
}
/*
* (non-Javadoc)
*
* @see org.talend.core.model.components.IMultipleComponentManager#addParam(java.lang.String, java.lang.String)
*/
public void addParam(String source, String target) {
paramList.add(createMultiCompParam(source, target));
paramList.add(new MultipleComponentParameter(source, target));
}
public void addValue(String target, String value) {
paramList.add(createMultiCompParamValue(target, value));
}
protected IMultipleComponentParameter createMultiCompParam(String target, String value) {
return new MultipleComponentParameter(target, value, getParamSeperator());
}
protected IMultipleComponentParameter createMultiCompParamValue(String target, String value) {
return new MultipleComponentParameterValue(target, value, getParamSeperator());
paramList.add(new MultipleComponentParameterValue(target, value));
}
public void validateItems() {
@@ -189,9 +170,4 @@ public class MultipleComponentManager implements IMultipleComponentManager {
return this.lookupMode;
}
@Override
public String getParamSeperator() {
return ".";
}
}

View File

@@ -33,15 +33,11 @@ public class MultipleComponentParameter implements IMultipleComponentParameter {
String targetValue;
public MultipleComponentParameter(String source, String target) {
this(source, target, ".");
}
public MultipleComponentParameter(String source, String target, String seperator) {
StringTokenizer token = new StringTokenizer(source, seperator);
StringTokenizer token = new StringTokenizer(source, "."); //$NON-NLS-1$
sourceComponent = token.nextToken();
sourceValue = token.nextToken();
token = new StringTokenizer(target, seperator);
token = new StringTokenizer(target, "."); //$NON-NLS-1$
targetComponent = token.nextToken();
targetValue = token.nextToken();
}

View File

@@ -33,11 +33,7 @@ public class MultipleComponentParameterValue implements IMultipleComponentParame
String targetValue;
public MultipleComponentParameterValue(String target, String value) {
this(target, value, ".");
}
public MultipleComponentParameterValue(String target, String value, String seperator) {
StringTokenizer token = new StringTokenizer(target, seperator);
StringTokenizer token = new StringTokenizer(target, "."); //$NON-NLS-1$
targetComponent = token.nextToken();
targetValue = token.nextToken();
@@ -45,7 +41,6 @@ public class MultipleComponentParameterValue implements IMultipleComponentParame
sourceValue = value;
}
/*
* (non-Javadoc)
*

View File

@@ -1,37 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.designer.core.model.components;
/**
* DOC hzhao class global comment. Detailled comment
*/
public class MultipleGenricComponentManager extends MultipleComponentManager {
public MultipleGenricComponentManager(boolean lookupMode) {
super(lookupMode);
}
public MultipleGenricComponentManager(String inputName, String outputName, String connector) {
super(inputName, outputName, connector);
}
public MultipleGenricComponentManager(String inputName, String outputName) {
super(inputName, outputName);
}
@Override
public String getParamSeperator() {
return "#";
}
}

View File

@@ -23,7 +23,6 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.gef.palette.PaletteEntry;
import org.eclipse.jface.resource.ImageDescriptor;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.model.components.IComponent;
import org.talend.core.model.process.INode;
import org.talend.core.model.process.IProcess;
@@ -32,7 +31,6 @@ import org.talend.core.model.process.IReplaceNodeInProcess;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.JobletProcessItem;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryEditorInput;
import org.talend.core.model.update.UpdateResult;
import org.talend.designer.core.ui.editor.process.Process;
@@ -145,7 +143,7 @@ public abstract class AbstractProcessProvider implements IReplaceNodeInProcess {
}
}
}
/**
* DOC qzhang Comment method "canDeleteNode".
*
@@ -259,10 +257,5 @@ public abstract class AbstractProcessProvider implements IReplaceNodeInProcess {
public boolean canHandleNode(INode node) {
return false;
}
public IRepositoryEditorInput createJobletEditorInput(JobletProcessItem processItem, boolean load, Boolean lastVersion, Boolean readonly,
Boolean openedInJob) throws PersistenceException{
return null;
}
}

View File

@@ -20,7 +20,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;
import org.apache.commons.collections.BidiMap;
@@ -37,7 +36,6 @@ import org.talend.components.api.properties.VirtualComponentProperties;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.PluginChecker;
import org.talend.core.database.EDatabaseTypeName;
import org.talend.core.hadoop.HadoopConfJarBean;
import org.talend.core.hadoop.IHadoopClusterService;
import org.talend.core.hadoop.repository.HadoopRepositoryUtil;
import org.talend.core.model.components.ComponentCategory;
@@ -514,7 +512,6 @@ public class DataProcess implements IGeneratingProcess {
((IExternalNode) dataNode).setInternalMapperModel(externalNode.getInternalMapperModel());
}
}
dataNode.setReplaceNodeHandler(graphicalNode.getReplaceNodeHandler());
dataNode.setActivate(graphicalNode.isActivate());
dataNode.setStart(graphicalNode.isStart());
@@ -781,7 +778,7 @@ public class DataProcess implements IGeneratingProcess {
DataConnection dataConnec = new DataConnection();
dataConnec.setActivate(graphicalNode.isActivate());
dataConnec.setLineStyle(EConnectionType.getTypeFromName(curConnec.getConnectionType()));
dataConnec.setConnectorName(curConnec.getConnectorName());
dataConnec.setConnectorName(curConnec.getConnectionType());
if (nodeSource.getMetadataList() != null) {
dataConnec.setMetadataTable(nodeSource.getMetadataList().get(0));
}
@@ -1014,7 +1011,6 @@ public class DataProcess implements IGeneratingProcess {
curNode.setActivate(false);
curNode.setStart(false);
}
curItem.updateNode(curNode, graphicalNode);
}
}
@@ -3253,8 +3249,8 @@ public class DataProcess implements IGeneratingProcess {
if (!hadoopClusterService.isUseDynamicConfJar(hadoopClusterItemId)) {
return null;
}
Optional<HadoopConfJarBean> confJarBean = hadoopClusterService.getCustomConfsJar(hadoopClusterItemId, false, false);
if (!confJarBean.isPresent()) {
String confsJarName = hadoopClusterService.getCustomConfsJarName(hadoopClusterItemId, false, false);
if (confsJarName == null) {
return null;
}
IComponent component = ComponentsFactoryProvider.getInstance().get(componentName, componentCategory.getName());
@@ -3270,21 +3266,7 @@ public class DataProcess implements IGeneratingProcess {
clusterIdParam.setValue(hadoopClusterItemId);
}
IElementParameter confLibParam = confNode.getElementParameter("CONF_LIB"); //$NON-NLS-1$
confLibParam.setValue(TalendTextUtils.addQuotes(confJarBean.get().getCustomConfJarName()));
IElementParameter setConfParam = confNode.getElementParameter("SET_HADOOP_CONF"); //$NON-NLS-1$
if (setConfParam != null) {
setConfParam.setValue(Boolean.valueOf(confJarBean.get().isOverrideCustomConf()));
}
IElementParameter confPathParam = confNode.getElementParameter("HADOOP_CONF_SPECIFIC_JAR"); //$NON-NLS-1$
if (confPathParam != null) {
String jarPath = null;
if (confJarBean.get().isContextMode()) {
jarPath = confJarBean.get().getOverrideCustomConfPath();
} else {
jarPath = TalendTextUtils.addQuotes(confJarBean.get().getOriginalOverrideCustomConfPath());
}
confPathParam.setValue(jarPath);
}
confLibParam.setValue(TalendTextUtils.addQuotes(confsJarName));
return confNode;
}
return null;

View File

@@ -15,25 +15,16 @@ package org.talend.designer.core.model.process.jobsettings;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.avro.Schema;
import org.apache.commons.lang.StringUtils;
import org.eclipse.emf.common.util.EList;
import org.eclipse.jface.resource.ImageDescriptor;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.utils.VersionUtils;
import org.talend.components.api.properties.ComponentProperties;
import org.talend.core.model.components.ComponentCategory;
import org.talend.core.model.components.EComponentType;
import org.talend.core.model.components.IComponent;
import org.talend.core.model.components.IMultipleComponentItem;
import org.talend.core.model.components.IMultipleComponentManager;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.metadata.IMetadataTable;
import org.talend.core.model.metadata.MetadataToolAvroHelper;
import org.talend.core.model.metadata.builder.ConvertionHelper;
import org.talend.core.model.param.EConnectionParameterName;
import org.talend.core.model.process.EConnectionType;
import org.talend.core.model.process.EParameterFieldType;
import org.talend.core.model.process.IElementParameter;
@@ -42,15 +33,11 @@ import org.talend.core.model.process.INodeConnector;
import org.talend.core.model.process.INodeReturn;
import org.talend.core.model.process.IProcess;
import org.talend.core.model.temp.ECodePart;
import org.talend.core.runtime.services.IGenericService;
import org.talend.core.ui.component.ComponentsFactoryProvider;
import org.talend.designer.core.model.components.EParameterName;
import org.talend.designer.core.model.components.ElementParameter;
import org.talend.designer.core.model.components.EmfComponent;
import org.talend.designer.core.model.components.MultipleComponentConnection;
import org.talend.designer.core.model.components.MultipleComponentItem;
import org.talend.designer.core.model.components.MultipleComponentManager;
import org.talend.designer.core.model.components.MultipleGenricComponentManager;
import org.talend.designer.core.model.process.jobsettings.JobSettingsConstants.ContextLoadInfo;
/**
@@ -78,22 +65,9 @@ public class JobContextLoadComponent implements IComponent {
private final boolean isFile;
private IComponent component;
public JobContextLoadComponent(boolean isFile, String dbComponent, String componentType) {
public JobContextLoadComponent(boolean isFile, String dbComponent) {
this.isFile = isFile;
this.dbComponent = dbComponent;
try {
String compType = componentType;
if (StringUtils.isBlank(componentType)) {
ExceptionHandler.log(
this.getClass().getName() + ": componentType is empty, will use DI type for component " + dbComponent);
compType = ComponentCategory.CATEGORY_4_DI.getName();
}
component = ComponentsFactoryProvider.getInstance().get(dbComponent, compType);
} catch (Throwable e) {
ExceptionHandler.process(e);
}
loadMultipleComponentManager();
}
@@ -113,46 +87,17 @@ public class JobContextLoadComponent implements IComponent {
if (dbComponent == null) {
return;
}
multipleComponentManager = new MultipleComponentManager(DB_INPUT, CONTEXT_LOAD);
MultipleComponentConnection multiCompConnection = new MultipleComponentConnection(EConnectionType.FLOW_MAIN.getName(),
CONTEXT_LOAD);
IMultipleComponentItem currentItem = null;
if (isTcompv0(component)) {
multipleComponentManager = new MultipleGenricComponentManager(DB_INPUT, CONTEXT_LOAD);
multiCompConnection.setConnectorName("MAIN");
currentItem = new MultipleComponentItem() {
public void updateNode(INode newNode, INode oldNode) {
super.updateNode(newNode, oldNode);
if (newNode != null) {
List<IMetadataTable> metadataList = newNode.getMetadataList();
if (0 < metadataList.size() && isTcompv0(newNode.getComponent())) {
IMetadataTable newMetadata = metadataList.get(0);
newMetadata.setAttachedConnector("MAIN");
ComponentProperties tcomp_properties = newNode.getComponentProperties();
Schema schema = MetadataToolAvroHelper.convertToAvro(ConvertionHelper.convert(newMetadata));
tcomp_properties.setValue("main.schema", schema);
}
}
};
};
currentItem.setName(DB_INPUT);
currentItem.setComponent(dbComponent);
((MultipleGenricComponentManager) multipleComponentManager).addItem(currentItem);
} else {
multipleComponentManager = new MultipleComponentManager(DB_INPUT, CONTEXT_LOAD);
currentItem = multipleComponentManager.addItem(DB_INPUT, dbComponent);
}
currentItem.getOutputConnections().add(multiCompConnection);
IMultipleComponentItem currentItem = multipleComponentManager.addItem(DB_INPUT, dbComponent);
currentItem.getOutputConnections().add(
new MultipleComponentConnection(EConnectionType.FLOW_MAIN.getName(), CONTEXT_LOAD));
currentItem = multipleComponentManager.addItem(CONTEXT_LOAD, CONTEXTLOAD_COMPONENT);
}
multipleComponentManager.validateItems();
multipleComponentManagers.add(multipleComponentManager);
createMultipleComponentsParameters();
}
@@ -236,11 +181,6 @@ public class JobContextLoadComponent implements IComponent {
return false;
}
private boolean isTcompv0(IComponent comp) {
return comp != null
&& Optional.ofNullable(IGenericService.getService()).map(s -> s.isTcompv0(comp)).orElse(Boolean.FALSE);
}
/*
* (non-Javadoc)
*
@@ -302,10 +242,10 @@ public class JobContextLoadComponent implements IComponent {
}
protected void createMultipleComponentsParameters() {
final String self = "self."; //$NON-NLS-1$
// create parameters
if ((multipleComponentManagers != null) && (multipleComponentManagers.size() > 0)) {
IMultipleComponentManager multipleComponentManager = multipleComponentManagers.get(0);
final String self = "self" + multipleComponentManager.getParamSeperator(); //$NON-NLS-1$
if (isFile) {
String source = self + EParameterName.IMPLICIT_TCONTEXTLOAD_FILE.getName();
multipleComponentManager.addParam(source, FILE_INPUT_REGEX + ".FILENAME"); //$NON-NLS-1$
@@ -317,140 +257,84 @@ public class JobContextLoadComponent implements IComponent {
multipleComponentManager.addParam(source, FILE_INPUT_REGEX + ".IGNORE_ERROR_MESSAGE"); //$NON-NLS-1$
} else {
boolean initDefault = true;
if (isTcompv0(component)) {
if ("tJDBCInput".equalsIgnoreCase(dbComponent)) {
initDefault = false;
initTcompv0ParamMapping(self, multipleComponentManager);
} else {
ExceptionHandler.log(this.getClass().getName()
+ ": MultipleComponentsParameters mapping is not prepared for tcompv0 " + dbComponent);
}
}
if (initDefault) {
initDefaultParameterMapping(self, multipleComponentManager);
}
String source = self + JobSettingsConstants.getExtraParameterName(EParameterName.URL.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".URL");
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DRIVER_JAR.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".DRIVER_JAR");
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DRIVER_CLASS.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".DRIVER_CLASS");
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.HOST.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".HOST"); //$NON-NLS-1$
multipleComponentManager.addParam(source, DB_INPUT + ".SERVER"); //$NON-NLS-1$
multipleComponentManager.addParam(source, DB_INPUT + ".DSN"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.PORT.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".PORT"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DBNAME.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".DBNAME"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DB_VERSION.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".DB_VERSION"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.PROPERTIES.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".PROPERTIES"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.SCHEMA_DB.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".SCHEMA_DB"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.USER.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".USER"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.PASS.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".PASS"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DBTABLE.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".DBTABLE"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DB_TYPE.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".DB_TYPE"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.CONNECTION_TYPE.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".CONNECTION_TYPE"); //$NON-NLS-1$
source = self + JobSettingsConstants.QUERY;
multipleComponentManager.addParam(source, DB_INPUT + "." + JobSettingsConstants.QUERY); //$NON-NLS-1$
}
// context parameter
final String context = CONTEXT_LOAD + "."; //$NON-NLS-1$
initContextParamMapping(self, multipleComponentManager);
String source = self + EParameterName.LOAD_NEW_VARIABLE.getName();
String target = context + EParameterName.LOAD_NEW_VARIABLE.getName();
multipleComponentManager.addParam(source, target);
source = self + EParameterName.NOT_LOAD_OLD_VARIABLE.getName();
target = context + EParameterName.NOT_LOAD_OLD_VARIABLE.getName();
multipleComponentManager.addParam(source, target);
source = self + EParameterName.PRINT_OPERATIONS.getName();
target = context + EParameterName.PRINT_OPERATIONS.getName();
multipleComponentManager.addParam(source, target);
source = self + EParameterName.DISABLE_ERROR.getName();
target = context + EParameterName.DISABLE_ERROR.getName();
multipleComponentManager.addParam(source, target);
source = self + EParameterName.DISABLE_INFO.getName();
target = context + EParameterName.DISABLE_INFO.getName();
multipleComponentManager.addParam(source, target);
source = self + EParameterName.DISABLE_WARNINGS.getName();
target = context + EParameterName.DISABLE_WARNINGS.getName();
multipleComponentManager.addParam(source, target);
}
}
private void initTcompv0ParamMapping(final String self, IMultipleComponentManager multipleComponentManager) {
final String seperator = multipleComponentManager.getParamSeperator();
String source = self + JobSettingsConstants.getExtraParameterName(EParameterName.URL.getName());
multipleComponentManager.addParam(source, DB_INPUT + seperator + EConnectionParameterName.GENERIC_URL.getDisplayName());
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DRIVER_JAR.getName());
multipleComponentManager.addParam(source,
DB_INPUT + seperator + EConnectionParameterName.GENERIC_DRIVER_JAR.getDisplayName());
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DRIVER_CLASS.getName());
multipleComponentManager.addParam(source,
DB_INPUT + seperator + EConnectionParameterName.GENERIC_DRIVER_CLASS.getDisplayName());
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DBNAME.getName());
multipleComponentManager.addParam(source,
DB_INPUT + seperator + EConnectionParameterName.GENERIC_TABLENAME.getDisplayName()); // $NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.USER.getName());
multipleComponentManager.addParam(source,
DB_INPUT + seperator + EConnectionParameterName.GENERIC_USERNAME.getDisplayName()); // $NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.PASS.getName());
multipleComponentManager.addParam(source,
DB_INPUT + seperator + EConnectionParameterName.GENERIC_PASSWORD.getDisplayName()); // $NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DBTABLE.getName());
multipleComponentManager.addParam(source,
DB_INPUT + seperator + EConnectionParameterName.GENERIC_TABLENAME.getDisplayName()); // $NON-NLS-1$
source = self + JobSettingsConstants.QUERY;
multipleComponentManager.addParam(source, DB_INPUT + seperator + "sql"); //$NON-NLS-1$
}
private void initContextParamMapping(final String self, IMultipleComponentManager multipleComponentManager) {
// context parameter
final String context = CONTEXT_LOAD + multipleComponentManager.getParamSeperator();
String source = self + EParameterName.LOAD_NEW_VARIABLE.getName();
String target = context + EParameterName.LOAD_NEW_VARIABLE.getName();
multipleComponentManager.addParam(source, target);
source = self + EParameterName.NOT_LOAD_OLD_VARIABLE.getName();
target = context + EParameterName.NOT_LOAD_OLD_VARIABLE.getName();
multipleComponentManager.addParam(source, target);
source = self + EParameterName.PRINT_OPERATIONS.getName();
target = context + EParameterName.PRINT_OPERATIONS.getName();
multipleComponentManager.addParam(source, target);
source = self + EParameterName.DISABLE_ERROR.getName();
target = context + EParameterName.DISABLE_ERROR.getName();
multipleComponentManager.addParam(source, target);
source = self + EParameterName.DISABLE_INFO.getName();
target = context + EParameterName.DISABLE_INFO.getName();
multipleComponentManager.addParam(source, target);
source = self + EParameterName.DISABLE_WARNINGS.getName();
target = context + EParameterName.DISABLE_WARNINGS.getName();
multipleComponentManager.addParam(source, target);
}
private void initDefaultParameterMapping(final String self, IMultipleComponentManager multipleComponentManager) {
String source = self + JobSettingsConstants.getExtraParameterName(EParameterName.URL.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".URL");
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DRIVER_JAR.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".DRIVER_JAR");
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DRIVER_CLASS.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".DRIVER_CLASS");
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.HOST.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".HOST"); //$NON-NLS-1$
multipleComponentManager.addParam(source, DB_INPUT + ".SERVER"); //$NON-NLS-1$
multipleComponentManager.addParam(source, DB_INPUT + ".DSN"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.PORT.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".PORT"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DBNAME.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".DBNAME"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DB_VERSION.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".DB_VERSION"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.PROPERTIES.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".PROPERTIES"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.SCHEMA_DB.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".SCHEMA_DB"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.USER.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".USER"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.PASS.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".PASS"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DBTABLE.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".DBTABLE"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DB_TYPE.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".DB_TYPE"); //$NON-NLS-1$
source = self + JobSettingsConstants.getExtraParameterName(EParameterName.CONNECTION_TYPE.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".CONNECTION_TYPE"); //$NON-NLS-1$
source = self + JobSettingsConstants.QUERY;
multipleComponentManager.addParam(source, DB_INPUT + "." + JobSettingsConstants.QUERY); //$NON-NLS-1$
}
@Override
public List<? extends IElementParameter> createElementParameters(INode node) {
@@ -496,17 +380,8 @@ public class JobContextLoadComponent implements IComponent {
IElementParameter newParam = new ElementParameter(node);
newParam.setName(JobSettingsConstants.getExtraParameterName(EParameterName.DRIVER_JAR.getName()));
newParam.setFieldType(EParameterFieldType.TABLE);
if (isTcompv0(component)) {
/**
* seems that tcompv0 will check the list using the display name when generating codes:
* GenericTableUtils#setTableValues
*/
newParam.setListItemsDisplayName(new String[0]);
newParam.setListItemsDisplayCodeName(new String[0]);
} else {
newParam.setListItemsDisplayName(new String[] { EmfComponent.TEXT_BUILTIN, EmfComponent.TEXT_REPOSITORY });
newParam.setListItemsDisplayCodeName(new String[] { EmfComponent.BUILTIN, EmfComponent.REPOSITORY });
}
newParam.setListItemsDisplayName(new String[] { EmfComponent.TEXT_BUILTIN, EmfComponent.TEXT_REPOSITORY });
newParam.setListItemsDisplayCodeName(new String[] { EmfComponent.BUILTIN, EmfComponent.REPOSITORY });
elemParamList.add(newParam);
newParam = new ElementParameter(node);

View File

@@ -928,7 +928,7 @@ public class JobSettingsManager {
return Collections.emptyList();
}
IComponent tContextLoadComponent = new JobContextLoadComponent(fileFlag, dbInput, process.getComponentsType());
IComponent tContextLoadComponent = new JobContextLoadComponent(fileFlag, dbInput);
final String uniqueName = "Implicit_Context"; //$NON-NLS-1$
DataNode tContextLoadNode = new DataNode(tContextLoadComponent, uniqueName);
@@ -1023,8 +1023,7 @@ public class JobSettingsManager {
String dbType = getDatabaseTypeFromParameter(process);
if (dbType != null) {
// TDI-18161:the SQL script's syntax is not right because of the implicit context of General JDBC.
if (dbType.equals(EDatabaseTypeName.GENERAL_JDBC.getDisplayName())
|| dbType.equals(EDatabaseTypeName.GENERAL_JDBC.getProduct())) {
if (dbType.equals(EDatabaseTypeName.GENERAL_JDBC.getDisplayName())) {
dbType = findRealDbTypeForJDBC(process, dbType);
}

View File

@@ -36,6 +36,7 @@ import org.talend.commons.exception.SystemException;
import org.talend.commons.ui.runtime.exception.MessageBoxExceptionHandler;
import org.talend.core.model.process.IContext;
import org.talend.core.model.process.IProcess;
import org.talend.core.model.process.IProcess2;
import org.talend.core.model.process.ITargetExecutionConfig;
import org.talend.core.model.runprocess.IEclipseProcessor;
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
@@ -43,6 +44,7 @@ import org.talend.core.runtime.process.TalendProcessOptionConstants;
import org.talend.designer.codegen.ICodeGenerator;
import org.talend.designer.core.ISyntaxCheckableEditor;
import org.talend.designer.core.i18n.Messages;
import org.talend.designer.maven.model.MavenSystemFolders;
import org.talend.designer.runprocess.IProcessMessageManager;
import org.talend.designer.runprocess.IProcessor;
import org.talend.designer.runprocess.ProcessorException;
@@ -359,7 +361,11 @@ public abstract class Processor implements IProcessor, IEclipseProcessor, Talend
protected Process exec(String[] cmd, String path) throws ProcessorException {
try {
if (path == null || !new File(path).exists()) {
return Runtime.getRuntime().exec(cmd);
if (getSpecialWorkingDir() != null) {
return Runtime.getRuntime().exec(cmd, null, getSpecialWorkingDir());
} else {
return Runtime.getRuntime().exec(cmd);
}
} else {
return Runtime.getRuntime().exec(cmd, null, new File(path));
}
@@ -368,6 +374,23 @@ public abstract class Processor implements IProcessor, IEclipseProcessor, Talend
}
}
/**
* (TUP-20459)For a job which dependencies resources need set the working dir DOC jding
* Comment method "getSpecialWorkingDir".
*
* @return
*/
private File getSpecialWorkingDir() {
if (!(process instanceof IProcess2)) {
return null;
}
File workingDir = project.getFile(MavenSystemFolders.EXT_RESOURCES.getPath()).getLocation().toFile();
if (workingDir.exists()) {
return workingDir;
}
return null;
}
public static Thread createProdConsThread(final InputStream input, final boolean isError, final int bufferSize,
final StringBuffer out, final StringBuffer err) {
Thread thread = new Thread() {
@@ -429,8 +452,6 @@ public abstract class Processor implements IProcessor, IEclipseProcessor, Talend
*/
@Override
public String getInterpreter() throws ProcessorException {
if (this.isLinuxTargetPlatform())
return "java";
return interpreter;
}
@@ -776,13 +797,6 @@ public abstract class Processor implements IProcessor, IEclipseProcessor, Talend
}
return false;
}
protected boolean isLinuxTargetPlatform() {
if (targetPlatform != null && Platform.OS_LINUX.equals(targetPlatform.toLowerCase())) {
return true;
}
return false;
}
public boolean shouldRunAsExport() {
return false; // by default, for standard job, run in .Java project

View File

@@ -313,11 +313,9 @@ public class GEFPasteAction extends SelectionAction {
(org.talend.designer.core.ui.editor.process.Process) editor.getProcess(), gefPoint);
mpc.setSelectedSubjobs(subjobParts);
mpc.setSelectedExpandedJoblet(expandedJobletNodes);
mpc.setCheckNodeExist(false);
execute(mpc);
} else if (nodeParts.size() != 0) {
NodesPasteCommand cmd = new NodesPasteCommand(nodeParts, editor.getProcess(), gefPoint);
cmd.setCheckNodeExist(false);
cmd.setSelectedSubjobs(subjobParts);
cmd.setSelectedExpandedJoblet(expandedJobletNodes);
execute(cmd);

View File

@@ -607,7 +607,7 @@ public final class TalendEditorPaletteFactory {
while (iter.hasNext()) {
IComponent xmlComponent = iter.next();
Matcher matcher = pattern.matcher(xmlComponent.getDisplayName().toLowerCase());
Matcher matcher = pattern.matcher(xmlComponent.getName().toLowerCase());
if (matcher.find()) {
resultByName.add(new ComponentHit(xmlComponent, matcher.start()));
continue;
@@ -643,7 +643,7 @@ public final class TalendEditorPaletteFactory {
private static void addDelegateComponents(IComponentsFactory compFac, Collection<IComponent> componentSet,
String lowerCasedKeyword) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IUnifiedComponentService.class)) {
IUnifiedComponentService service = GlobalServiceRegister.getDefault().getService(
IUnifiedComponentService service = (IUnifiedComponentService) GlobalServiceRegister.getDefault().getService(
IUnifiedComponentService.class);
service.filterUnifiedComponentForPalette(compFac, componentSet, lowerCasedKeyword);
@@ -730,12 +730,13 @@ public final class TalendEditorPaletteFactory {
return null;
}
IComponent delegateComponent = UnifiedComponentUtil.getDelegateComponent(component);
String name = component.getName();
String filter = null;
if (delegateComponent != component) {
// emf component name
filter = component.getName();
name = UnifiedComponentUtil.getComponentDisplayNameForPalette(delegateComponent, filter);
}
String name = UnifiedComponentUtil.getComponentDisplayNameForPalette(delegateComponent, filter);
ImageDescriptor imageSmall = delegateComponent.getIcon16();
IPreferenceStore store = DesignerPlugin.getDefault().getPreferenceStore();
ImageDescriptor imageLarge;

View File

@@ -19,21 +19,15 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor;
import org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer;
import org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy;
import org.eclipse.jdt.internal.ui.text.JavaReconciler;
import org.eclipse.jdt.ui.actions.IJavaEditorActionDefinitionIds;
import org.eclipse.jdt.ui.text.IJavaPartitions;
import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration;
import org.eclipse.jdt.ui.text.JavaTextTools;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.FindReplaceDocumentAdapter;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.source.IOverviewRuler;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.IVerticalRuler;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.FileEditorInput;
import org.talend.commons.exception.SystemException;
@@ -303,41 +297,5 @@ public class TalendJavaEditor extends CompilationUnitEditor implements ISyntaxCh
super.initializeDragAndDrop(viewer);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor#createJavaSourceViewer(org.eclipse.swt.widgets.
* Composite, org.eclipse.jface.text.source.IVerticalRuler, org.eclipse.jface.text.source.IOverviewRuler, boolean,
* int, org.eclipse.jface.preference.IPreferenceStore)
*/
@Override
protected ISourceViewer createJavaSourceViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler,
boolean isOverviewRulerVisible, int styles, IPreferenceStore store) {
return new TalendAdaptedSourceViewer(parent, verticalRuler, overviewRuler, isOverviewRulerVisible, styles, store);
}
@SuppressWarnings("restriction")
protected class TalendAdaptedSourceViewer extends AdaptedSourceViewer {
public TalendAdaptedSourceViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler,
boolean showAnnotationsOverview, int styles, IPreferenceStore store) {
super(parent, verticalRuler, overviewRuler, showAnnotationsOverview, styles, store);
}
@Override
public void configure(SourceViewerConfiguration configuration) {
super.configure(configuration);
if (fReconciler == null) {
JavaCompositeReconcilingStrategy strategy = new JavaCompositeReconcilingStrategy(this, TalendJavaEditor.this,
configuration.getConfiguredDocumentPartitioning(this));
JavaReconciler reconciler = new JavaReconciler(TalendJavaEditor.this, strategy, false);
reconciler.setIsAllowedToModifyDocument(false);
reconciler.setDelay(500);
fReconciler = reconciler;
fReconciler.install(this);
}
}
}
}

View File

@@ -12,15 +12,11 @@
// ============================================================================
package org.talend.designer.core.ui.editor.cmd;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.gef.commands.Command;
import org.talend.core.model.process.IConnection;
import org.talend.core.model.process.IConnectionCategory;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.IExternalNode;
import org.talend.core.model.process.INode;
import org.talend.core.model.utils.ContextParameterUtils;
import org.talend.core.model.utils.TalendTextUtils;
import org.talend.designer.core.i18n.Messages;
import org.talend.designer.core.model.components.EParameterName;
import org.talend.designer.core.ui.editor.process.Process;
@@ -95,8 +91,6 @@ public class ChangeConnTextCommand extends Command {
UpgradeElementHelper.renameData(connection.getTarget(), oldName, newName);
((Process) connection.getSource().getProcess()).checkProcess();
updateELTElementParameter(connection.getSource(), newName);
}
@Override
@@ -134,52 +128,4 @@ public class ChangeConnTextCommand extends Command {
((Process) connection.getSource().getProcess()).checkProcess();
}
public void updateELTElementParameter(INode iNode, String newName) {
// TUP-29072 Solution :if link name equals the schema.tablename,when edit on the link,should update the default
// schema/default table in the input component , then the table name will updated automatically in the sql.The
// solution will only work for simple cases. For complex case with java code and global map in link/default
// schema/default table , it won't work.
if (iNode != null && iNode.isELTComponent()) {
boolean update = false;
String defaultSchemaName = null;
String defaultTableName = null;
if (StringUtils.isNotBlank(newName)) {
String newNameTemp = newName;
int newNameLength = newNameTemp.length();
// Name cases:context.a.context.b /context.a.b /a.context.b /a.b /b
if (ContextParameterUtils.isContainContextParam(newNameTemp)) {
if (newNameTemp.startsWith(ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX)) {
int index = newNameTemp.indexOf(".", //$NON-NLS-1$
ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX.length());
defaultSchemaName = newNameTemp.substring(0, index);
defaultTableName = newNameTemp.substring(index + 1, newNameLength);
update = true;
} else {
int index = newNameTemp.indexOf(".");//$NON-NLS-1$
defaultSchemaName = newNameTemp.substring(0, index);
defaultTableName = newNameTemp.substring(index + 1, newNameLength);
update = true;
}
} else {
String[] names = newNameTemp.split("\\.");//$NON-NLS-1$
if (names.length == 2) {
defaultSchemaName = names[0];
defaultTableName = names[1];
update = true;
}
}
}
if (update) {
IElementParameter schemaParam = iNode.getElementParameter("ELT_SCHEMA_NAME");//$NON-NLS-1$
IElementParameter tableParam = iNode.getElementParameter("ELT_TABLE_NAME"); //$NON-NLS-1$
if (schemaParam != null && StringUtils.isNotBlank(defaultSchemaName)) {
schemaParam.setValue(TalendTextUtils.addQuotes(defaultSchemaName));
}
if (tableParam != null && StringUtils.isNotBlank(defaultTableName)) {
tableParam.setValue(TalendTextUtils.addQuotes(defaultTableName));
}
}
}
}
}

View File

@@ -557,12 +557,11 @@ public class ChangeMetadataCommand extends Command {
}
}
MetadataToolHelper.copyTable(newInputMetadata, currentInputMetadata);
currentOutputMetadata.setOriginalColumns(newOutputMetadata.getOriginalColumns());
}
}
if (!currentOutputMetadata.sameMetadataAs(newOutputMetadata, IMetadataColumn.OPTIONS_NONE, true)) {
if (!currentOutputMetadata.sameMetadataAs(newOutputMetadata, IMetadataColumn.OPTIONS_IGNORE_USED, true)) {
if (!currentOutputMetadata.sameMetadataAs(newOutputMetadata, IMetadataColumn.OPTIONS_NONE)) {
if (!currentOutputMetadata.sameMetadataAs(newOutputMetadata, IMetadataColumn.OPTIONS_IGNORE_USED)) {
String type = (String) node.getPropertyValue(EParameterName.SCHEMA_TYPE.getName());
if (type != null && type.equals(EmfComponent.REPOSITORY) && !repositoryMode) {
// for one node has several schema_type,set mode for the current one
@@ -574,7 +573,6 @@ public class ChangeMetadataCommand extends Command {
}
}
MetadataToolHelper.copyTable(newOutputMetadata, currentOutputMetadata);
currentOutputMetadata.setOriginalColumns(newOutputMetadata.getOriginalColumns());
}
if (inputSchemaParam != null
&& inputSchemaParam.getChildParameters().get(EParameterName.SCHEMA_TYPE.getName()) != null
@@ -626,10 +624,8 @@ public class ChangeMetadataCommand extends Command {
setTableMAPPING();
if (!internal) {
if (!oldOutputMetadata.sameMetadataAs(newOutputMetadata, IMetadataColumn.OPTIONS_NONE)) {
updateColumnList(oldOutputMetadata, newOutputMetadata);
((Process) node.getProcess()).checkProcess();
}
updateColumnList(oldOutputMetadata, newOutputMetadata);
((Process) node.getProcess()).checkProcess();
}
refreshMetadataChanged();
}

View File

@@ -42,8 +42,6 @@ public class MultiplePasteCommand extends CompoundCommand {
private NodesPasteCommand nodeCmd;
private NotesPasteCommand noteCmd;
private boolean isCheckNodeExist = true;
public MultiplePasteCommand(List<NodePart> nodeParts, List<NoteEditPart> noteParts, Process process, Point cursorLocation) {
// List<NodePart> nodePartList = new ArrayList<NodePart>();
@@ -69,8 +67,6 @@ public class MultiplePasteCommand extends CompoundCommand {
*/
@Override
public void execute() {
nodeCmd.setCheckNodeExist(isCheckNodeExist);
AbstractMultiPageTalendEditor multiPageTalendEditor = (AbstractMultiPageTalendEditor) PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage().getActiveEditor();
GraphicalViewer viewer = multiPageTalendEditor.getTalendEditor().getViewer();
@@ -89,7 +85,7 @@ public class MultiplePasteCommand extends CompoundCommand {
for (EditPart editPart : (List<EditPart>) processPart.getChildren()) {
if (editPart instanceof NodePart) {
Node currentNode = (Node) editPart.getModel();
if (nodeCmd.getNodeContainerList().contains(currentNode.getNodeContainer()) || !isCheckNodeExist) {
if (nodeCmd.getNodeContainerList().contains(currentNode.getNodeContainer())) {
sel.add(editPart);
}
} else if (editPart instanceof NoteEditPart) {
@@ -154,13 +150,4 @@ public class MultiplePasteCommand extends CompoundCommand {
nodeCmd.setSelectedExpandedJoblet(selectedExpandedJoblet);
}
public boolean isCheckNodeExist() {
return isCheckNodeExist;
}
public void setCheckNodeExist(boolean isCheckNodeExist) {
this.isCheckNodeExist = isCheckNodeExist;
}
}

View File

@@ -109,8 +109,6 @@ public class NodesPasteCommand extends Command {
private boolean isJobletRefactor = false;
private boolean isJunitCreate = false;
private boolean isCheckNodeExist = true;
/**
* Getter for isJunitCreate.
@@ -387,7 +385,7 @@ public class NodesPasteCommand extends Command {
// create the nodes
for (NodePart copiedNodePart : nodeParts) {
IGraphicalNode copiedNode = (IGraphicalNode) copiedNodePart.getModel();
if (this.isCheckNodeExist && !containNodeInProcess(copiedNode)) {
if (!containNodeInProcess(copiedNode)) {
continue;
}
IComponent component = ComponentsFactoryProvider.getInstance().get(copiedNode.getComponent().getName(),
@@ -1010,16 +1008,4 @@ public class NodesPasteCommand extends Command {
public void setSelectedExpandedJoblet(List<NodePart> selectedExpandedJoblet) {
this.selectedExpandedJoblet = selectedExpandedJoblet;
}
public boolean isCheckNodeExist() {
return isCheckNodeExist;
}
public void setCheckNodeExist(boolean isCheckNodeExist) {
this.isCheckNodeExist = isCheckNodeExist;
}
}

View File

@@ -302,14 +302,12 @@ public class PropertyChangeCommand extends Command {
List<? extends IConnection> connections = ((Node) elem).getOutgoingConnections();
for (IConnection connection : connections) {
if (!connection.getName().equals(oldELTValue)) {
// Update if use custom connection name.
ChangeConnTextCommand command = new ChangeConnTextCommand(connection, newELTValue);
command.execute();
// do nothing when custom connection name.
continue;
}
INode targetNode = connection.getTarget();
String componentName = targetNode.getComponent().getName();
if (componentName.matches("tELT.*Map")) { //$NON-NLS-1$
if (componentName.matches("tELT.+Map")) { //$NON-NLS-1$
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDbMapDesignerService.class)) {
IDbMapDesignerService service = GlobalServiceRegister.getDefault().getService(
IDbMapDesignerService.class);

View File

@@ -480,6 +480,13 @@ public class QueryGuessCommand extends Command {
String newQuery = null;
// Need update schema if table type as calculation view for SAP Hana Database
updateSchema(dbType, newOutputMetadataTable);
if (node != null && node instanceof INode) {
process = ((INode) node).getProcess();
boolean isContextMode = ContextParameterUtils.containContextVariables(schema);
if (isContextMode) {
schema = JavaProcessUtil.getContextOriginalValue(process, schema);
}
}
realTableName = QueryUtil.getTableName(node, newOutputMetadataTable, schema, dbType, realTableName);
if (realTableName.startsWith(TalendTextUtils.QUOTATION_MARK) && realTableName.endsWith(TalendTextUtils.QUOTATION_MARK)

View File

@@ -14,6 +14,7 @@ package org.talend.designer.core.ui.editor.dependencies;
import java.util.Collection;
import org.apache.commons.lang.StringUtils;
import org.eclipse.gef.commands.CommandStack;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -57,7 +58,6 @@ import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.Property;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.model.resources.ResourceItem;
import org.talend.core.model.utils.JavaResourcesHelper;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.ui.context.CustomDialogCellEditor;
import org.talend.core.ui.context.model.table.ContextTableTabChildModel;
@@ -256,8 +256,12 @@ public class ManageResourcePanel extends Composite {
}
JobResourceDependencyModel model = new JobResourceDependencyModel((ResourceItem) item);
Property property = process.getProperty();
String jobLabel = JavaResourcesHelper.getJobFolderName(property.getLabel(), property.getVersion());
model.setResourceDepPath(ResourceDependenciesUtil.getResourcePath(model, jobLabel, null));
StringBuffer joblabel = new StringBuffer();
if (StringUtils.isNotBlank(property.getItem().getState().getPath())) {
joblabel.append(property.getItem().getState().getPath() + "/");
}
joblabel.append(property.getLabel() + "_" + property.getVersion());
model.setResourceDepPath(ResourceDependenciesUtil.getResourcePath(model, joblabel.toString(), null));
getInput().add(model);
resourcesTV.refresh();
resourcesTV.setSelection(new StructuredSelection(model));
@@ -358,9 +362,13 @@ public class ManageResourcePanel extends Composite {
final JobResourceDependencyModel model = (JobResourceDependencyModel) element;
if (!model.getSelectedVersion().equals(value)) {
Property property = process.getProperty();
String jobLabel = JavaResourcesHelper.getJobFolderName(property.getLabel(), property.getVersion());
StringBuffer joblabel = new StringBuffer();
if (StringUtils.isNotBlank(property.getItem().getState().getPath())) {
joblabel.append(property.getItem().getState().getPath() + "/");
}
joblabel.append(property.getLabel() + "_" + property.getVersion());
model.setSelectedVersion((String) value);
model.setResourceDepPath(ResourceDependenciesUtil.getResourcePath(model, jobLabel, (String) value));
model.setResourceDepPath(ResourceDependenciesUtil.getResourcePath(model, joblabel.toString(), (String) value));
getViewer().update(element, null);
try {
IRepositoryViewObject repoObject = ProxyRepositoryFactory.getInstance()

View File

@@ -38,7 +38,6 @@ import org.talend.core.model.relationship.RelationshipItemBuilder;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.model.resources.ResourceItem;
import org.talend.core.model.utils.JavaResourcesHelper;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.service.IResourcesDependenciesService;
import org.talend.designer.core.ui.AbstractMultiPageTalendEditor;
@@ -46,7 +45,6 @@ import org.talend.designer.core.ui.editor.dependencies.dialog.DependenciesResour
import org.talend.designer.core.ui.editor.dependencies.model.JobResourceDependencyModel;
import org.talend.designer.core.ui.editor.dependencies.util.ResourceDependenciesUtil;
import org.talend.designer.maven.tools.BuildCacheManager;
import org.talend.designer.runprocess.ProcessorUtilities;
import org.talend.repository.ProjectManager;
public class ResourcesDependenciesService implements IResourcesDependenciesService {
@@ -91,12 +89,12 @@ public class ResourcesDependenciesService implements IResourcesDependenciesServi
if (repoObject != null) {
JobResourceDependencyModel model = new JobResourceDependencyModel(
(ResourceItem) repoObject.getProperty().getItem());
String jobLabel = JavaResourcesHelper.getJobFolderName(property.getLabel(), property.getVersion());
if (ProcessorUtilities.isExportConfig()) {
resPath = ResourceDependenciesUtil.getResourcePath(model, jobLabel, parts[1]);
}else {
resPath = ResourceDependenciesUtil.getJobExecuteResourceFilePath(model, property, jobLabel, parts[1]);
StringBuffer joblabel = new StringBuffer();
if (StringUtils.isNotBlank(property.getItem().getState().getPath())) {
joblabel.append(property.getItem().getState().getPath() + "/");
}
joblabel.append(property.getLabel() + "_" + property.getVersion());
resPath = ResourceDependenciesUtil.getResourcePath(model, joblabel.toString(), parts[1]);
// to check if file exist, if not copy it
ResourceDependenciesUtil.copyToExtResourceFolder(model, property.getId(), property.getVersion(), parts[1],
null);

View File

@@ -22,12 +22,10 @@ import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.ecore.EObject;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.commons.utils.io.FilesUtils;
import org.talend.commons.utils.workbench.resources.ResourceUtils;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.model.general.Project;
import org.talend.core.model.metadata.types.JavaTypesManager;
import org.talend.core.model.process.IContext;
@@ -37,11 +35,8 @@ import org.talend.core.model.properties.Property;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.model.resources.ResourceItem;
import org.talend.core.model.utils.JavaResourcesHelper;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.runtime.process.ITalendProcessJavaProject;
import org.talend.designer.core.ui.editor.dependencies.model.JobResourceDependencyModel;
import org.talend.designer.runprocess.IRunProcessService;
import org.talend.repository.ProjectManager;
public class ResourceDependenciesUtil {
@@ -69,8 +64,12 @@ public class ResourceDependenciesUtil {
public static Collection<JobResourceDependencyModel> getResourceDependencies(IProcess2 process) {
Property property = process.getProperty();
String jobLabel = JavaResourcesHelper.getJobFolderName(property.getLabel(), property.getVersion());
return getResourceDependencies((String) process.getAdditionalProperties().get(RESOURCES_PROP), jobLabel,
StringBuffer joblabel = new StringBuffer();
if (StringUtils.isNotBlank(property.getItem().getState().getPath())) {
joblabel.append(property.getItem().getState().getPath() + "/");
}
joblabel.append(property.getLabel() + "_" + property.getVersion());
return getResourceDependencies((String) process.getAdditionalProperties().get(RESOURCES_PROP), joblabel.toString(),
process);
}
@@ -241,14 +240,18 @@ public class ResourceDependenciesUtil {
Path p = new Path(item.getProperty().getLabel());
resourcePath.append(p.removeFileExtension().lastSegment());
resourcePath.append("_" + version + "." + item.getBindingExtension());
// for job testjob_0.2 => testjob_0_2
String checkversion = jobLabel.substring(jobLabel.lastIndexOf("_"));
if (checkversion.contains(".")) {
jobLabel = jobLabel.substring(0, jobLabel.lastIndexOf("_")) + checkversion.replace(".", "_");
}
// Local_Project/testjob_0_2/resources/test_0.1.txt
/*
* Local_Project project Label need to lower case avoid the exception of
* org.eclipse.core.internal.resources.ResourceException: A resource exists with a different case caused by
* ext-resources/local_project/testjob_0_2/contexts
*/
String newFilePath = JavaResourcesHelper.getProjectFolderName(currentProject.getTechnicalLabel()) + SEG_TAG + jobLabel
+ SEG_TAG + SRC_RESOURCES_FOLDER
String newFilePath = currentProject.getLabel().toLowerCase() + SEG_TAG + jobLabel + SEG_TAG + SRC_RESOURCES_FOLDER
+ SEG_TAG + resourcePath.toString();
return newFilePath;
}
@@ -265,7 +268,11 @@ public class ResourceDependenciesUtil {
return;
}
Property property = jobObject.getProperty();
String jobLabel = JavaResourcesHelper.getJobFolderName(property.getLabel(), property.getVersion());
StringBuffer joblabel = new StringBuffer();
if (StringUtils.isNotBlank(property.getItem().getState().getPath())) {
joblabel.append(property.getItem().getState().getPath() + "/");
}
joblabel.append(property.getLabel() + "_" + property.getVersion());
ResourceItem item = model.getItem();
Project currentProject = ProjectManager.getInstance().getCurrentProject();
@@ -287,7 +294,13 @@ public class ResourceDependenciesUtil {
String itemResPath = model.getPathUrl() + fileSuffix;
File resourceFile = project.getFile(new Path(RESOURCES_FOLDER + SEG_TAG + itemResPath)).getLocation().toFile();
if (resourceFile.exists()) {
File targetFile = new File(getJobExecuteResourceFilePath(model, property, jobLabel, newVersion));
String processJobLabel = joblabel.toString();
if (StringUtils.isNotBlank(rootJobLabel)) {
processJobLabel = rootJobLabel;
}
String extResPath = getProcessFolder(jobObject) + processJobLabel.toLowerCase() + SRC_EXTRESOURCE_FOLDER;
String newFilePath = getResourcePath(model, joblabel.toString(), newVersion);
File targetFile = project.getFile(new Path(extResPath + SEG_TAG + newFilePath)).getLocation().toFile();
try {
FilesUtils.copyFile(resourceFile, targetFile);
} catch (IOException e) {
@@ -296,21 +309,6 @@ public class ResourceDependenciesUtil {
}
}
public static String getJobExecuteResourceFilePath(JobResourceDependencyModel model, Property jobProperty,String jobLabel,String resourceVersion) {
String path = null;
IRunProcessService service = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
service = GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
}
if (service == null) {
return path;
}
String filePath = getResourcePath(model, jobLabel, resourceVersion);
ITalendProcessJavaProject talendJobJavaProject = service.getTalendJobJavaProject(jobProperty);
path = talendJobJavaProject.getExternalResourcesFolder().getFile(new Path(filePath)).getLocation().toOSString();
return path;
}
public static void deleteFromResourceFolder(JobResourceDependencyModel model, String jobId, String jobVersion) {
IRepositoryViewObject jobObject = null;
try {
@@ -369,7 +367,7 @@ public class ResourceDependenciesUtil {
}
}
public static String getProcessFolder(IRepositoryViewObject jobObject) {
private static String getProcessFolder(IRepositoryViewObject jobObject) {
String folder = jobObject.getRepositoryObjectType().getFolder();
return POMS_JOBS_FOLDER + folder + "/";
}

View File

@@ -14,7 +14,6 @@ import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.graphics.Image;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.ui.gmf.util.DisplayUtils;
import org.talend.commons.ui.runtime.image.ECoreImage;
import org.talend.commons.ui.runtime.image.ImageProvider;
@@ -29,7 +28,6 @@ import org.talend.core.model.process.INode;
import org.talend.core.model.process.INodeConnector;
import org.talend.core.model.process.IProcess;
import org.talend.core.model.process.IProcess2;
import org.talend.core.model.process.JobletReplaceNodeHandler;
import org.talend.core.model.properties.Project;
import org.talend.core.ui.IJobletProviderService;
import org.talend.designer.core.DesignerPlugin;
@@ -381,12 +379,6 @@ public class JobletContainer extends AbstractJobletContainer {
conns.addAll(temNode.getIncomingConnections());
conns.addAll(temNode.getOutgoingConnections());
Node jnode = util.cloneNode(temNode, this.node.getProcess(), paraMap, lockByOther);
try {
JobletReplaceNodeHandler replaceHandler = new JobletReplaceNodeHandler(node.getUniqueName() + "_");
jnode.setReplaceNodeHandler(replaceHandler);
} catch (Throwable e) {
ExceptionHandler.process(e);
}
if (!this.node.isActivate()) {
jnode.setActivate(this.node.isActivate());
}

View File

@@ -7,7 +7,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
@@ -30,7 +29,6 @@ import org.talend.components.api.properties.ComponentProperties;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.PluginChecker;
import org.talend.core.model.components.ComponentUtilities;
import org.talend.core.model.components.EComponentType;
import org.talend.core.model.components.IComponent;
import org.talend.core.model.process.EConnectionType;
import org.talend.core.model.process.EParameterFieldType;
@@ -47,9 +45,6 @@ import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.JobletProcessItem;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.repository.ui.editor.RepositoryEditorInput;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.core.runtime.projectsetting.IProjectSettingPreferenceConstants;
import org.talend.core.runtime.projectsetting.ProjectPreferenceManager;
import org.talend.core.services.ISVNProviderService;
import org.talend.core.ui.IJobletProviderService;
import org.talend.core.ui.component.ComponentsFactoryProvider;
@@ -102,15 +97,6 @@ public class JobletUtil {
}
return false;
}
public boolean isStrictJoblet() {
ProjectPreferenceManager projectPreferenceManager = CoreRuntimePlugin.getInstance()
.getProjectPreferenceManager();
if(projectPreferenceManager == null) {
return false;
}
return projectPreferenceManager.getBoolean(IProjectSettingPreferenceConstants.USE_STRICT_REFERENCE_JOBLET);
}
public List<INodeConnector> createConnectors(INode node, IProcess2 process) {
List<INodeConnector> listConnector = new ArrayList<INodeConnector>();
@@ -764,25 +750,4 @@ public class JobletUtil {
return false;
}
public Optional<IComponent> findComponentByName(Set<IComponent> components, String searchName, String paletteType) {
return components.stream().filter(p -> p.getComponentType() == EComponentType.JOBLET
&& paletteType.equals(p.getPaletteType()) && matchesName(p.getName(), searchName)).findFirst();
}
private boolean matchesName(String exist, String search) {
if (exist == null) {
return false;
}
if (exist.equals(search)) {
return true;
}
if (matchExpression(exist)) {
exist = StringUtils.substringAfterLast(exist, ":"); //$NON-NLS-1$
if (exist.equals(search)) {
return true;
}
}
return false;
}
}

View File

@@ -89,7 +89,6 @@ import org.talend.core.model.process.INodeReturn;
import org.talend.core.model.process.IPerformance;
import org.talend.core.model.process.IProcess;
import org.talend.core.model.process.IProcess2;
import org.talend.core.model.process.IReplaceNodeHandler;
import org.talend.core.model.process.Problem;
import org.talend.core.model.process.Problem.ProblemStatus;
import org.talend.core.model.properties.JobletProcessItem;
@@ -321,8 +320,6 @@ public class Node extends Element implements IGraphicalNode {
private List<String> previousCustomLibs = null;
private IReplaceNodeHandler replaceNodeHandler;
/**
* Getter for index.
*
@@ -519,7 +516,7 @@ public class Node extends Element implements IGraphicalNode {
private void init(IComponent newComponent) {
this.component = UnifiedComponentUtil.getEmfComponent(this, newComponent);
this.label = component.getDisplayName();
this.label = component.getName();
updateComponentStatusIfNeeded(true);
IPreferenceStore store = DesignerPlugin.getDefault().getPreferenceStore();
@@ -1182,12 +1179,6 @@ public class Node extends Element implements IGraphicalNode {
if (useConn != null) {
connParam = this.getElementParameter("CONNECTION"); //$NON-NLS-1$
}
boolean isGeneric = this.getComponent().getComponentType() == EComponentType.GENERIC;
if(isGeneric && labelToParse != null) {
labelToParse = labelToParse.replaceAll("__TABLE__", "__tableSelection.tablename__"); //$NON-NLS-1$ //$NON-NLS-2$
}
if (useConn != null && connParam != null && Boolean.TRUE.equals(useConn.getValue())) {
String connName = (String) connParam.getValue();
@@ -5633,13 +5624,4 @@ public class Node extends Element implements IGraphicalNode {
return this.delegateComponent;
}
@Override
public IReplaceNodeHandler getReplaceNodeHandler() {
return replaceNodeHandler;
}
public void setReplaceNodeHandler(IReplaceNodeHandler replaceNodeHandler) {
this.replaceNodeHandler = replaceNodeHandler;
}
}

View File

@@ -29,7 +29,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.ArrayUtils;
@@ -124,9 +123,7 @@ import org.talend.core.model.update.IUpdateManager;
import org.talend.core.model.utils.TalendTextUtils;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.repository.utils.ConvertJobsUtil;
import org.talend.core.repository.utils.ProjectHelper;
import org.talend.core.repository.utils.XmiResourceManager;
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
import org.talend.core.runtime.repository.item.ItemProductKeys;
import org.talend.core.runtime.util.ItemDateParser;
import org.talend.core.service.IScdComponentService;
@@ -187,6 +184,7 @@ import org.talend.designer.core.utils.DetectContextVarsUtils;
import org.talend.designer.core.utils.JavaProcessUtil;
import org.talend.designer.core.utils.JobSettingVersionUtil;
import org.talend.designer.core.utils.UnifiedComponentUtil;
import org.talend.designer.core.utils.UpdateParameterUtils;
import org.talend.designer.core.utils.ValidationRulesUtil;
import org.talend.designer.runprocess.IRunProcessService;
import org.talend.designer.runprocess.ItemCacheManager;
@@ -1081,7 +1079,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
ElementParameterType pType;
boolean isJoblet = false;
if (param.getElement() instanceof INode && PluginChecker.isJobLetPluginLoaded()) {
IJobletProviderService service = GlobalServiceRegister.getDefault().getService(
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(
IJobletProviderService.class);
if (service != null && service.isJobletComponent((INode) param.getElement())) {
isJoblet = true;
@@ -1372,8 +1370,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
} else {
boolean canAddElementParameter = false;
String paramName = pType.getName();
if (EParameterName.ACTIVE_DATABASE_DELIMITED_IDENTIFIERS.getName().equals(paramName)
|| EParameterName.USE_ALIAS_IN_OUTPUT_TABLE.getName().equals(paramName)) {
if (EParameterName.ACTIVE_DATABASE_DELIMITED_IDENTIFIERS.getName().equals(paramName)) {
canAddElementParameter = true;
}
if (canAddElementParameter) {
@@ -1402,6 +1399,11 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
}
}
for (IElementParameter param : elemParam.getElementParameters()) {
UpdateParameterUtils.setDefaultValues(param, elemParam);
}
}
protected boolean noNeedSetValue(IElementParameter param, String paraValue) {
@@ -1817,36 +1819,23 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
routinesDependencies = new ArrayList<RoutinesParameterType>();
}
try {
Project targetProject = new Project(ProjectManager.getInstance().getProject(getProperty()));
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
Set<IRepositoryViewObject> routines = new HashSet<>();
routines.addAll(factory.getAll(targetProject, ERepositoryObjectType.ROUTINES));
List<Project> referenceProjects = ProjectManager.getInstance().getAllReferencedProjects(targetProject, false);
referenceProjects.stream().forEach(p -> {
try {
routines.addAll(factory.getAll(p, ERepositoryObjectType.ROUTINES));
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
});
Map<String, String> allRoutinesMap = routines.stream()
.collect(Collectors.toMap(IRepositoryViewObject::getId, IRepositoryViewObject::getLabel));
Iterator<RoutinesParameterType> iterator = routinesDependencies.iterator();
while (iterator.hasNext()) {
RoutinesParameterType routine = iterator.next();
if (!allRoutinesMap.containsKey(routine.getId())) {
iterator.remove();
}
}
List<String> possibleRoutines = new ArrayList<String>();
List<String> routinesToAdd = new ArrayList<String>();
String additionalString = LanguageManager.getCurrentLanguage() == ECodeLanguage.JAVA ? "." : "";
List<String> routinesAlreadySetup = new ArrayList<String>();
for (RoutinesParameterType routine : routinesDependencies) {
routinesAlreadySetup.add(routine.getName());
}
for (Project project : referenceProjects) {
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
List<IRepositoryViewObject> routines = factory.getAll(ProjectManager.getInstance().getCurrentProject(),
ERepositoryObjectType.ROUTINES);
routines.addAll(factory.getAll(ProjectManager.getInstance().getCurrentProject(), ERepositoryObjectType.PIG_UDF));
for (Project project : ProjectManager.getInstance().getAllReferencedProjects()) {
List<IRepositoryViewObject> refRoutines = factory.getAll(project, ERepositoryObjectType.ROUTINES);
refRoutines.addAll(factory.getAll(project, ERepositoryObjectType.PIG_UDF));
for (IRepositoryViewObject object : refRoutines) {
if (!((RoutineItem) object.getProperty().getItem()).isBuiltIn()) {
if (!possibleRoutines.contains(object.getLabel()) && !routinesAlreadySetup.contains(object.getLabel())) {
@@ -1871,8 +1860,9 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
possibleRoutines.add(object.getLabel());
}
}
for (Project project : referenceProjects) {
for (Project project : ProjectManager.getInstance().getAllReferencedProjects()) {
List<IRepositoryViewObject> refRoutines = factory.getAll(project, ERepositoryObjectType.ROUTINES);
refRoutines.addAll(factory.getAll(project, ERepositoryObjectType.PIG_UDF));
for (IRepositoryViewObject object : refRoutines) {
if (!((RoutineItem) object.getProperty().getItem()).isBuiltIn()) {
if (!possibleRoutines.contains(object.getLabel()) && !routinesAlreadySetup.contains(object.getLabel())) {
@@ -1930,25 +1920,12 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
}
//
boolean isLimited = false;
org.talend.core.model.properties.Project currProject = getProject().getEmfProject();
org.talend.core.model.properties.Project project = ProjectManager.getInstance().getProject(this.property);
if (currProject != null && project != null && !currProject.equals(project)) {
int currOrdinal = ProjectHelper.getProjectTypeOrdinal(currProject);
int ordinal = ProjectHelper.getProjectTypeOrdinal(project);
if (currOrdinal > ordinal) {
isLimited = true;
}
}
if (!isLimited) {
for (IRepositoryViewObject object : routines) {
if (routinesToAdd.contains(object.getLabel()) && !routinesAlreadySetup.contains(object.getLabel())) {
RoutinesParameterType routinesParameterType = TalendFileFactory.eINSTANCE.createRoutinesParameterType();
routinesParameterType.setId(object.getId());
routinesParameterType.setName(object.getLabel());
routinesDependencies.add(routinesParameterType);
}
for (IRepositoryViewObject object : routines) {
if (routinesToAdd.contains(object.getLabel()) && !routinesAlreadySetup.contains(object.getLabel())) {
RoutinesParameterType routinesParameterType = TalendFileFactory.eINSTANCE.createRoutinesParameterType();
routinesParameterType.setId(object.getId());
routinesParameterType.setName(object.getLabel());
routinesDependencies.add(routinesParameterType);
}
}
} catch (PersistenceException e) {
@@ -2306,7 +2283,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
if (EParameterName.PROCESS_TYPE_VERSION.name().equals(pType.getName())) {
String jobletVersion = pType.getValue();
if (!RelationshipItemBuilder.LATEST_VERSION.equals(jobletVersion)) {
IJobletProviderService service = GlobalServiceRegister.getDefault()
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault()
.getService(IJobletProviderService.class);
if (service != null) {
Property jobletProperty = service.getJobletComponentItem(component);
@@ -2344,12 +2321,12 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
String componentName = unNode.getComponentName();
if (!isCurrentProject && !componentName.contains(":")) {
componentName = ProjectManager.getInstance().getProject(this.getProperty()).getLabel() + ":" + componentName; //$NON-NLS-1$
} else if (jobletUtil.matchExpression(componentName) && !jobletUtil.isStrictJoblet()) {
} else if (jobletUtil.matchExpression(componentName)) {
String[] names = componentName.split(":"); //$NON-NLS-1$
componentName = names[1];
}
IComponent component = ComponentsFactoryProvider.getInstance().get(componentName, componentsType);
if (component == null && jobletUtil.isJoblet(unNode) && !jobletUtil.isStrictJoblet()) {
if (component == null && jobletUtil.isJoblet(unNode)) {
component = ComponentsFactoryProvider.getInstance().getJobletComponent(componentName, componentsType);
}
if (component != null) {
@@ -2476,7 +2453,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
updateAllMappingTypes();
nc.setNeedLoadLib(false);
if (nc.isJoblet()) {
IJobletProviderService service = GlobalServiceRegister.getDefault().getService(
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(
IJobletProviderService.class);
if (service != null) {
// reload only for stuido ,because joblet can be changed in the job editor
@@ -2490,7 +2467,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
NodeContainer nodeContainer = null;
if (isJunitContainer) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerGEFService.class)) {
ITestContainerGEFService testContainerService = GlobalServiceRegister.getDefault()
ITestContainerGEFService testContainerService = (ITestContainerGEFService) GlobalServiceRegister.getDefault()
.getService(ITestContainerGEFService.class);
if (testContainerService != null) {
nodeContainer = testContainerService.createJunitContainer(node);
@@ -2692,7 +2669,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
}
if (GlobalServiceRegister.getDefault().isServiceRegistered(IScdComponentService.class)) {
IScdComponentService service = GlobalServiceRegister.getDefault().getService(
IScdComponentService service = (IScdComponentService) GlobalServiceRegister.getDefault().getService(
IScdComponentService.class);
service.updateOutputMetadata(nc, metadataTable);
}
@@ -2819,7 +2796,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
} else {
if (PluginChecker.isJobLetPluginLoaded()) { // bug 12764
IJobletProviderService service = GlobalServiceRegister.getDefault().getService(
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(
IJobletProviderService.class);
if (service != null && service.isJobletComponent(source)) {
continue;
@@ -3346,9 +3323,6 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
component = ((Node) node).getDelegateComponent();
}
String baseName = component.getOriginalName();
if (EComponentType.GENERIC.equals(component.getComponentType())) {
baseName = component.getDisplayName();
}
return UniqueNodeNameGenerator.generateUniqueNodeName(baseName, uniqueNodeNameList);
}
@@ -4458,18 +4432,6 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
private void loadAdditionalProperties() {
if (additionalProperties == null) {
additionalProperties = new HashMap<Object, Object>();
try {
if (property.getItem() != null && ERepositoryObjectType.getType(property) != null) {
boolean isRouteProcess = ERepositoryObjectType.getType(property).equals(ERepositoryObjectType.PROCESS_ROUTE);
if (!isRouteProcess && "ROUTE"
.equals(this.property.getAdditionalProperties().get(TalendProcessArgumentConstant.ARG_BUILD_TYPE))) {
this.property.getAdditionalProperties().remove(TalendProcessArgumentConstant.ARG_BUILD_TYPE);
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
for (Object key : this.property.getAdditionalProperties().keySet()) {
additionalProperties.put(key, this.property.getAdditionalProperties().get(key));
}
@@ -4601,9 +4563,6 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
private void saveJobletNode(AbstractJobletContainer jobletContainer) {
if (CommonsPlugin.isHeadless()) {
return;
}
INode jobletNode = jobletContainer.getNode();
IProcess jobletProcess = jobletNode.getComponent().getProcess();
if (jobletProcess == null) {
@@ -4613,7 +4572,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
Item item = ((IProcess2) jobletProcess).getProperty().getItem();
if (item instanceof JobletProcessItem) {
JobletProcessItem jobletItem = ((JobletProcessItem) item);
IJobletProviderService service = GlobalServiceRegister.getDefault().getService(
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(
IJobletProviderService.class);
if (service != null) {
service.saveJobletNode(jobletItem, jobletContainer);
@@ -4662,7 +4621,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
IJobletProviderService jobletService = null;
if (PluginChecker.isJobLetPluginLoaded()) {
jobletService = GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
jobletService = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
for (INode node : getGraphicalNodes()) {
if (jobletService.isJobletComponent(node)) {
listRoutines.addAll(getJobletRoutines(jobletService, node));

View File

@@ -115,7 +115,6 @@ import org.talend.core.ui.ICDCProviderService;
import org.talend.core.ui.IJobletProviderService;
import org.talend.core.ui.component.ComponentsFactoryProvider;
import org.talend.cwm.helper.SAPBWTableHelper;
import org.talend.designer.core.DesignerPlugin;
import org.talend.designer.core.i18n.Messages;
import org.talend.designer.core.model.components.EParameterName;
import org.talend.designer.core.model.components.ElementParameter;
@@ -127,7 +126,6 @@ import org.talend.designer.core.model.utils.emf.talendfile.impl.ContextTypeImpl;
import org.talend.designer.core.ui.editor.nodes.Node;
import org.talend.designer.core.ui.editor.update.UpdateCheckResult;
import org.talend.designer.core.ui.editor.update.UpdateManagerUtils;
import org.talend.designer.core.ui.preferences.TalendDesignerPrefConstants;
import org.talend.designer.core.utils.ConnectionUtil;
import org.talend.designer.core.utils.SAPParametersUtils;
import org.talend.metadata.managment.ui.utils.ConnectionContextHelper;
@@ -310,10 +308,6 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
}
}
} else {
Boolean propagate = DesignerPlugin.getDefault().getPreferenceStore().getBoolean(TalendDesignerPrefConstants.PROPAGATE_CONTEXT);
if(!propagate) {
return contextResults;
}
// only handle added groups
Set<String> contextSourceChecked = new HashSet<String>();
Set<String> processContextGroups = new HashSet<String>();
@@ -421,6 +415,8 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
Map<ContextItem, Set<String>> existedParams = new HashMap<ContextItem, Set<String>>();
List<String> contextItemGroupNames = new ArrayList<String>();
for (IContext context : contextManager.getListContext()) {
for (IContextParameter param : context.getContextParameterList()) {
if (!param.isBuiltIn()) {
@@ -444,6 +440,14 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
boolean builtin = true;
if (contextItem != null) {
if (contextItem instanceof ContextItem) {
contextItemGroupNames.clear();
EList<?> contextGroups = ((ContextItem) contextItem).getContext();
for (Object contextGroup : contextGroups) {
if (contextGroup instanceof ContextTypeImpl) {
String name = ((ContextTypeImpl) contextGroup).getName();
contextItemGroupNames.add(name);
}
}
final ContextType contextType = ContextUtils.getContextTypeByName((ContextItem) contextItem,
context.getName(), true);
if (contextType != null) {
@@ -455,8 +459,10 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
existedParams.put(repositoryContext, new HashSet<String>());
}
existedParams.get(repositoryContext).add(paramName);
if (onlySimpleShow || !ContextUtils.samePropertiesForContextParameter(param,
contextParameterType)) {
String jobContextGroupName = context.getName();
boolean contains = contextItemGroupNames.contains(jobContextGroupName);
if (contains && (onlySimpleShow || !ContextUtils.samePropertiesForContextParameter(param,
contextParameterType))) {
unsameMap.add(contextItem, paramName);
}
builtin = false;
@@ -590,14 +596,10 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
if (newParametersMap.get(contextItem) == null) {
newParametersMap.put(contextItem, new HashSet<String>());
}
// To avoid the case: serval contexts contain more than one same name parameters, but we only can add
// one of them
IContext processContext = ((JobContextManager) contextManager).getDefaultContext();
if (processContext.getContextParameter(parameterType.getName()) == null) {
newParametersMap.get(contextItem).add(parameterType.getName());
}
newParametersMap.get(contextItem).add(parameterType.getName());
}
}
}
}
@@ -1533,9 +1535,9 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
if (onlySimpleShow
|| !metadataTable.sameMetadataAs(copyOfrepositoryMetadata,
IMetadataColumn.OPTIONS_IGNORE_DBTYPE, true)
IMetadataColumn.OPTIONS_IGNORE_DBTYPE)
|| connectionItem instanceof GenericSchemaConnectionItem && !metadataTable
.sameMetadataAs(copyOfrepositoryMetadata, IMetadataColumn.OPTIONS_NONE, true)) {
.sameMetadataAs(copyOfrepositoryMetadata, IMetadataColumn.OPTIONS_NONE)) {
result = new UpdateCheckResult(node);
result.setResult(EUpdateItemType.NODE_SCHEMA, EUpdateResult.UPDATE,
copyOfrepositoryMetadata, source);

View File

@@ -247,7 +247,7 @@ public class TalendEditorDropTargetListener extends TemplateTransferDropTargetLi
if (obj instanceof RepositoryNode) {
RepositoryNode sourceNode = (RepositoryNode) obj;
if (PluginChecker.isCDCPluginLoaded()) {
ICDCProviderService service = GlobalServiceRegister.getDefault().getService(
ICDCProviderService service = (ICDCProviderService) GlobalServiceRegister.getDefault().getService(
ICDCProviderService.class);
if (service != null && (service.isSubscriberTableNode(sourceNode) || service.isSystemSubscriberTable(sourceNode))) {
@@ -260,7 +260,7 @@ public class TalendEditorDropTargetListener extends TemplateTransferDropTargetLi
}
IOozieService oozieService = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IOozieService.class)) {
oozieService = GlobalServiceRegister.getDefault().getService(IOozieService.class);
oozieService = (IOozieService) GlobalServiceRegister.getDefault().getService(IOozieService.class);
}
if (oozieService != null && oozieService.isOozieNode(sourceNode)) {
return false;
@@ -268,7 +268,7 @@ public class TalendEditorDropTargetListener extends TemplateTransferDropTargetLi
ISAPProviderService sapService = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ISAPProviderService.class)) {
sapService = GlobalServiceRegister.getDefault().getService(ISAPProviderService.class);
sapService = (ISAPProviderService) GlobalServiceRegister.getDefault().getService(ISAPProviderService.class);
}
if (sapService != null && sapService.isSAPNode(sourceNode)) {
return false;
@@ -1051,7 +1051,7 @@ public class TalendEditorDropTargetListener extends TemplateTransferDropTargetLi
Item item = sourceNode.getObject().getProperty().getItem();
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
ITestContainerProviderService testContainerService = GlobalServiceRegister
ITestContainerProviderService testContainerService = (ITestContainerProviderService) GlobalServiceRegister
.getDefault().getService(ITestContainerProviderService.class);
if (testContainerService != null && testContainerService.isTestContainerItem(item)) {
continue;
@@ -1971,7 +1971,7 @@ public class TalendEditorDropTargetListener extends TemplateTransferDropTargetLi
// special handle hbase to support tpigLoad
String hbaseName = EDatabaseTypeName.HBASE.getDisplayName().toUpperCase();
if (rcSetting != null && (hbaseName).equals(rcSetting.toString())) {
IComponentsService service = GlobalServiceRegister.getDefault().getService(
IComponentsService service = (IComponentsService) GlobalServiceRegister.getDefault().getService(
IComponentsService.class);
String componentProductname = null;
Collection<IComponent> components = service.getComponentsFactory().readComponents();
@@ -2125,7 +2125,7 @@ public class TalendEditorDropTargetListener extends TemplateTransferDropTargetLi
EConnectionType connectionType = EConnectionType.FLOW_MAIN;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICamelDesignerCoreService.class)) {
ICamelDesignerCoreService camelService = GlobalServiceRegister.getDefault()
ICamelDesignerCoreService camelService = (ICamelDesignerCoreService) GlobalServiceRegister.getDefault()
.getService(ICamelDesignerCoreService.class);
if (camelService.isRouteBuilderNode(node)) {
connectionType = camelService.getTargetConnectionType(node);
@@ -2143,7 +2143,7 @@ public class TalendEditorDropTargetListener extends TemplateTransferDropTargetLi
// FIXME perhaps, this is not good fix, need check it later
// bug 21411
if (PluginChecker.isJobLetPluginLoaded()) {
IJobletProviderService service = GlobalServiceRegister.getDefault().getService(
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(
IJobletProviderService.class);
if (service != null && service.isJobletComponent(targetConnection.getTarget())) {
if (targetConnection.getTarget() instanceof Node) {
@@ -2277,7 +2277,7 @@ public class TalendEditorDropTargetListener extends TemplateTransferDropTargetLi
private boolean isLock(JobletContainerPart part) {
INode jobletNode = ((JobletContainer) part.getModel()).getNode();
if (PluginChecker.isJobLetPluginLoaded()) {
IJobletProviderService service = GlobalServiceRegister.getDefault().getService(
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(
IJobletProviderService.class);
if (service != null) {
return service.isLock(jobletNode);
@@ -2292,7 +2292,7 @@ public class TalendEditorDropTargetListener extends TemplateTransferDropTargetLi
Node jobletNode = ((JobletContainer) part.getModel()).getNode();
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (PluginChecker.isJobLetPluginLoaded()) {
IJobletProviderService service = GlobalServiceRegister.getDefault().getService(
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(
IJobletProviderService.class);
if (service != null) {
openEditor = (AbstractMultiPageTalendEditor) service.openJobletEditor(jobletNode, page);
@@ -2332,7 +2332,7 @@ class ComponentChooseDialog extends ListDialog {
if (UnifiedComponentUtil.isDelegateComponent(component) && typeName != null) {
return component.getName() + "(" + typeName + ")";
}
return component.getDisplayName();
return component.getName();
}
/*

View File

@@ -24,7 +24,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.gef.commands.Command;
@@ -59,7 +58,6 @@ import org.talend.core.language.LanguageManager;
import org.talend.core.model.metadata.IMetadataColumn;
import org.talend.core.model.metadata.IMetadataConnection;
import org.talend.core.model.metadata.IMetadataTable;
import org.talend.core.model.metadata.MappingTypeRetriever;
import org.talend.core.model.metadata.MetadataColumn;
import org.talend.core.model.metadata.MetadataTable;
import org.talend.core.model.metadata.MetadataTalendType;
@@ -357,14 +355,6 @@ public class GuessSchemaController extends AbstractElementPropertySectionControl
columns.clear();
}
if (!schemaContent.isEmpty()) {
MappingTypeRetriever mappingTypeRetriever = MetadataTalendType.getMappingTypeRetriever(dbmsId);
if (mappingTypeRetriever == null) {
@SuppressWarnings("null")
EDatabaseTypeName dbType = EDatabaseTypeName.getTypeFromDbType(connt.getDatabaseType(), false);
if (dbType != null) {
mappingTypeRetriever = MetadataTalendType.getMappingTypeRetrieverByProduct(dbType.getProduct());
}
}
int numbOfColumn = schemaContent.get(0).length;
for (int i = 1; i <= numbOfColumn; i++) {
@@ -435,21 +425,6 @@ public class GuessSchemaController extends AbstractElementPropertySectionControl
dbType = TypesManager.getDBTypeFromTalendType(dbmsId, oneColum.getTalendType());
}
oneColum.setType(dbType);
if (oneColum.getTalendType() != null) {
if (oneColum.getTalendType().equals(JavaTypesManager.DATE.getId())
|| oneColum.getTalendType().equals(PerlTypesManager.DATE)) {
if ("".equals(oneColum.getPattern())) { //$NON-NLS-1$
if (mappingTypeRetriever != null) {
String pattern = mappingTypeRetriever.getDefaultPattern(dbmsId,
oneColum.getType());
oneColum.setPattern(StringUtils.isNotBlank(pattern) ? TalendQuoteUtils.addQuotes(pattern)
: TalendQuoteUtils.addQuotes("dd-MM-yyyy"));//$NON-NLS-1$
} else {
oneColum.setPattern(TalendQuoteUtils.addQuotes("dd-MM-yyyy")); //$NON-NLS-1$
}
}
}
}
}
}
// oneColum.setTalendType(JavaTypesManager.STRING.getId());

View File

@@ -19,7 +19,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.emf.common.util.EList;
import org.eclipse.gef.commands.Command;
import org.eclipse.swt.widgets.Display;
@@ -37,7 +36,6 @@ import org.talend.core.model.process.IContextManager;
import org.talend.core.model.process.IContextParameter;
import org.talend.core.model.process.IProcess2;
import org.talend.core.model.properties.ContextItem;
import org.talend.core.model.properties.Item;
import org.talend.core.model.update.EUpdateItemType;
import org.talend.core.model.update.EUpdateResult;
import org.talend.core.model.update.UpdateResult;
@@ -88,16 +86,15 @@ public class UpdateContextParameterCommand extends Command {
if (result == null) {
return;
}
Map<String, ContextType> repoContextMap = new HashMap<String, ContextType>();
String repoDefaultContextName = null;
List<String> contextItemGroupNames = new ArrayList<String>();
if (result.getParameter() != null) {
if (result.getParameter() instanceof ContextItem) {
contextItemGroupNames.clear();
EList<?> contextGroups = ((ContextItem) result.getParameter()).getContext();
repoDefaultContextName = ((ContextItem) result.getParameter()).getDefaultContext();
for (Object contextGroup : contextGroups) {
for (Object contextGroup : contextGroups) {
if (contextGroup instanceof ContextTypeImpl) {
String name = ((ContextTypeImpl) contextGroup).getName();
repoContextMap.put(name, ((ContextTypeImpl) contextGroup));
contextItemGroupNames.add(name);
}
}
}
@@ -140,19 +137,13 @@ public class UpdateContextParameterCommand extends Command {
}
break;
case UPDATE:
String sourceContextName = null;
if (repoContextMap.containsKey(context.getName())) {
sourceContextName = context.getName();
} else {
sourceContextName = repoDefaultContextName;
}
if (sourceContextName != null) {
if (contextItemGroupNames.contains(context.getName())) {
item = (ContextItem) result.getParameter();
if (item != null && item.getProperty().getId().equals(param.getSource())
&& result.isChecked()) {
ContextUtils.updateParameterFromRepository(item, param, sourceContextName);
ContextUtils.updateParameterFromRepository(item, param, context.getName());
} else {
param.setSource(IContextParameter.BUILT_IN);
}
@@ -210,30 +201,6 @@ public class UpdateContextParameterCommand extends Command {
continue;
}
param = (JobContextParameter) contextParam.clone();
final Item contextItem = ContextUtils.getRepositoryContextItemById(param.getSource());
if (contextItem != null) {
if (contextItem instanceof ContextItem) {
String defaultContextName = ((ContextItem) contextItem).getDefaultContext();
ContextTypeImpl defaultContext = null;
EList<?> contextGroups = ((ContextItem) contextItem).getContext();
for (Object contextGroup : contextGroups) {
if (contextGroup instanceof ContextTypeImpl) {
String conName = ((ContextTypeImpl) contextGroup).getName();
if (StringUtils.equals(defaultContextName, conName)) {
defaultContext = ((ContextTypeImpl) contextGroup);
break;
}
}
}
if (defaultContext != null) {
final ContextParameterType conParamType = ContextUtils
.getContextParameterTypeByName(defaultContext, param.getName());
if (conParamType != null) {
ContextUtils.updateParameter(conParamType, param);
}
}
}
}
param.setContext(newContext);
newParamList.add(param);
}

View File

@@ -133,7 +133,7 @@ public class DesignerPreferencePage extends FieldEditorPreferencePage implements
Messages.getString("DesignerPreferencePage.duplicateTestCases"), getFieldEditorParent()); //$NON-NLS-1$
addField(duplicateTestCases);
}
DirectoryFieldEditor compDefaultFileDir = new DirectoryFieldEditor(TalendDesignerPrefConstants.COMP_DEFAULT_FILE_DIR,
Messages.getString("DesignerPreferencePage.defaultFilePathDirectory"), getFieldEditorParent()) {

View File

@@ -65,9 +65,6 @@ public class PerformancePreferencePage extends FieldEditorPreferencePage impleme
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.CHECK_ONLY_LAST_VERSION,
Messages.getString("PerformancePreferencePage.checkVersion"), //$NON-NLS-1$
getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.PROPAGATE_CONTEXT,
Messages.getString("PerformancePreferencePage.propagateContext"), //$NON-NLS-1$
getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.PROPAGATE_CONTEXT_VARIABLE,
Messages.getString("PerformancePreferencePage.addOrDeleteVariable"), //$NON-NLS-1$
getFieldEditorParent()));
@@ -104,9 +101,6 @@ public class PerformancePreferencePage extends FieldEditorPreferencePage impleme
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.CHECK_ONLY_LAST_VERSION,
Messages.getString("PerformancePreferencePage.checkVersion"), //$NON-NLS-1$
getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.PROPAGATE_CONTEXT,
Messages.getString("PerformancePreferencePage.propagateContext"), //$NON-NLS-1$
getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.PROPAGATE_CONTEXT_VARIABLE,
Messages.getString("PerformancePreferencePage.addOrDeleteVariable"), //$NON-NLS-1$
getFieldEditorParent()));

View File

@@ -175,8 +175,6 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
store.setDefault(ITalendCorePrefConstants.NEXUS_TIMEOUT, 20000);
store.setDefault(ITalendCorePrefConstants.NEXUS_REFRESH_FREQUENCY, 0);
store.setDefault(ITalendCorePrefConstants.NEXUS_SHARE_LIBS, true);
if (!CommonUIPlugin.isFullyHeadless()) {
Display display = Display.getDefault();
if (display == null) {

View File

@@ -67,8 +67,6 @@ public class TalendDesignerPrefConstants {
public static final String EDITOR_LINESTYLE = "editorLineStyle "; //$NON-NLS-1$
public static final String DUPLICATE_TESTCASE = "duplicateTestCases "; //$NON-NLS-1$
public static final String PROPAGATE_CONTEXT = "propagateContext"; //$NON-NLS-1$
public static final String SCHEMA_OPTIONS = "schemaOptions"; //$NON-NLS-1$

View File

@@ -114,8 +114,6 @@ public class DeploymentComposite extends AbstractTabComposite {
private boolean isServiceItem;
private boolean isDataServiceJob; // Is ESB SOAP Service Job
private boolean isChildJob;
public DeploymentComposite(Composite parent, int style, TabbedPropertySheetWidgetFactory widgetFactory,
IRepositoryViewObject repositoryViewObject) {
@@ -141,7 +139,6 @@ public class DeploymentComposite extends AbstractTabComposite {
defaultVersion = getDefaultVersion(process.getVersion());
isDataServiceJob = false;
isChildJob = false;
// Disable widgests in case of the job is for ESB data service
if (!process.getComponentsType().equals(ComponentCategory.CATEGORY_4_CAMEL.getName())) {
List<INode> nodes = (List<INode>) process.getGraphicalNodes();
@@ -152,13 +149,6 @@ public class DeploymentComposite extends AbstractTabComposite {
break;
}
}
for (INode node : nodes) {
if ("tRouteInput".equals(node.getComponent().getName())) {
isChildJob = true;
break;
}
}
}
} else {
IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
@@ -221,17 +211,6 @@ public class DeploymentComposite extends AbstractTabComposite {
widgetFactory.createLabel(messageComposite,
"SOAP data service cannot be published, deployment setting is \naccording to the defined service.");
}
if (isChildJob) {
Composite messageComposite = new Composite(this, SWT.NONE);
GridLayout layout = new GridLayout(1, false);
layout.horizontalSpacing = 10;
layout.verticalSpacing = 10;
messageComposite.setLayout(layout);
messageComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
widgetFactory.createLabel(messageComposite,
"Deployment parameters will be inherited from parent route during publishing from Studio and Command Line");
}
Composite composite = new Composite(this, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
layout.horizontalSpacing = 10;
@@ -318,7 +297,7 @@ public class DeploymentComposite extends AbstractTabComposite {
final Control buildTypeControl = buildTypeCombo.getControl();
buildTypeControl.setVisible(showBuildType);
buildTypeLabel.setVisible(showBuildType);
if (showBuildType) {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put(getObjectType(), getObject());

View File

@@ -151,12 +151,7 @@ public class BigDataJobUtil {
for (IElementParameter pt : parameters) {
if (pt.getName().equals("DISTRIBUTION")) { //$NON-NLS-1$
String value = String.valueOf(pt.getValue());
if ("MICROSOFT_HD_INSIGHT".equals(value) //$NON-NLS-1$
|| "GOOGLE_CLOUD_DATAPROC".equals(value) //$NON-NLS-1$
|| "CLOUDERA_ALTUS".equals(value) || "DATABRICKS".equals(value) || "QUBOLE".equals(value)) { //$NON-NLS-1$
return true;
}
return true;
}
}
if (isSparkWithYarnClusterMode()) {

View File

@@ -436,9 +436,7 @@ public class JavaProcessUtil {
if (var.equals(contextPara.getName())) {
String value =
context.getContextParameter(contextPara.getName()).getValue();
if (StringUtils.isBlank(value)) {
continue;
}
if (curParam.getName().equals(EParameterName.DRIVER_JAR.getName())
&& value.contains(";")) { //$NON-NLS-1$
String[] jars = value.split(";"); //$NON-NLS-1$
@@ -490,8 +488,7 @@ public class JavaProcessUtil {
mn = getModuleValue(process, moduleName);
}
String nexusJarVersion = (String) line.get("JAR_NEXUS_VERSION");
if (StringUtils.isNotBlank(nexusJarVersion)) {
if (line.get("JAR_NEXUS_VERSION") != null) {
String a = moduleName.replaceFirst("[.][^.]+$", "");
mn.setMavenUri("mvn:org.talend.libraries/" + a + "/"
+ line.get("JAR_NEXUS_VERSION") + "/jar");

View File

@@ -49,7 +49,8 @@ public class UnifiedComponentUtil {
if (elementParameter != null && elementParameter.getValue() != null) {
String emfCompName = String.valueOf(elementParameter.getValue());
String paletteType = component.getPaletteType();
IComponentsService compService = GlobalServiceRegister.getDefault().getService(IComponentsService.class);
IComponentsService compService = (IComponentsService) GlobalServiceRegister.getDefault()
.getService(IComponentsService.class);
IComponent emfComponent = compService.getComponentsFactory().get(emfCompName, paletteType);
if (emfComponent != null) {
return emfComponent;
@@ -63,7 +64,8 @@ public class UnifiedComponentUtil {
public static boolean isDelegateComponent(IComponent component) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IUnifiedComponentService.class)) {
IUnifiedComponentService service = GlobalServiceRegister.getDefault().getService(IUnifiedComponentService.class);
IUnifiedComponentService service = (IUnifiedComponentService) GlobalServiceRegister.getDefault()
.getService(IUnifiedComponentService.class);
if (service.isDelegateComponent(component)) {
return true;
}
@@ -73,7 +75,8 @@ public class UnifiedComponentUtil {
public static IComponent getDelegateComponent(IComponent component) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IUnifiedComponentService.class)) {
IUnifiedComponentService service = GlobalServiceRegister.getDefault().getService(IUnifiedComponentService.class);
IUnifiedComponentService service = (IUnifiedComponentService) GlobalServiceRegister.getDefault()
.getService(IUnifiedComponentService.class);
return service.getDelegateComponent(component);
}
return component;
@@ -81,7 +84,8 @@ public class UnifiedComponentUtil {
public static IComponent getDelegateComponent(String componentName, String paletteType) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IUnifiedComponentService.class)) {
IUnifiedComponentService service = GlobalServiceRegister.getDefault().getService(IUnifiedComponentService.class);
IUnifiedComponentService service = (IUnifiedComponentService) GlobalServiceRegister.getDefault()
.getService(IUnifiedComponentService.class);
return service.getDelegateComponent(componentName, paletteType);
}
return null;
@@ -90,7 +94,8 @@ public class UnifiedComponentUtil {
public static void createParameters(INode node, List<IElementParameter> listParams, IComponent delegateComp,
IComponent emfComp) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IUnifiedComponentService.class)) {
IUnifiedComponentService service = GlobalServiceRegister.getDefault().getService(IUnifiedComponentService.class);
IUnifiedComponentService service = (IUnifiedComponentService) GlobalServiceRegister.getDefault()
.getService(IUnifiedComponentService.class);
service.createParameters(node, listParams, delegateComp, emfComp);
}
}
@@ -99,7 +104,8 @@ public class UnifiedComponentUtil {
List<? extends IElementParameter> oldParms, List<IMetadataTable> oldMetadataTables,
List<INodeConnector> oldConnectors) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IUnifiedComponentService.class)) {
IUnifiedComponentService service = GlobalServiceRegister.getDefault().getService(IUnifiedComponentService.class);
IUnifiedComponentService service = (IUnifiedComponentService) GlobalServiceRegister.getDefault()
.getService(IUnifiedComponentService.class);
service.switchComponent(node, delegateComponent, oldEmfComponent, oldParms, oldMetadataTables, oldConnectors);
}
@@ -108,7 +114,8 @@ public class UnifiedComponentUtil {
public static List<IComponent> filterUnifiedComponent(RepositoryComponentSetting setting, List<IComponent> componentList) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IUnifiedComponentService.class)) {
List<IComponent> filtedList = new ArrayList<IComponent>();
IUnifiedComponentService service = GlobalServiceRegister.getDefault().getService(IUnifiedComponentService.class);
IUnifiedComponentService service = (IUnifiedComponentService) GlobalServiceRegister.getDefault()
.getService(IUnifiedComponentService.class);
IComponentsHandler componentsHandler = ComponentsFactoryProvider.getInstance().getComponentsHandler();
filtedList.addAll(componentList);
for (IComponent component : componentList) {
@@ -142,10 +149,12 @@ public class UnifiedComponentUtil {
public static IComponent getEmfComponent(IComponentName setting, IComponent selectedComponent) {
if (isDelegateComponent(selectedComponent)) {
IUnifiedComponentService service = GlobalServiceRegister.getDefault().getService(IUnifiedComponentService.class);
IUnifiedComponentService service = (IUnifiedComponentService) GlobalServiceRegister.getDefault()
.getService(IUnifiedComponentService.class);
String paletteType = selectedComponent.getPaletteType();
String emfCompName = service.getUnifiedComponetName4DndFromRepository(setting, selectedComponent);
IComponentsService compService = GlobalServiceRegister.getDefault().getService(IComponentsService.class);
IComponentsService compService = (IComponentsService) GlobalServiceRegister.getDefault()
.getService(IComponentsService.class);
IComponent emfComponent = compService.getComponentsFactory().get(emfCompName, paletteType);
if (emfComponent != null) {
return emfComponent;
@@ -158,7 +167,8 @@ public class UnifiedComponentUtil {
public static String getUnifiedComponentDisplayName(IComponent delegateComponent, String emfComponent) {
if (isDelegateComponent(delegateComponent)) {
IUnifiedComponentService service = GlobalServiceRegister.getDefault().getService(IUnifiedComponentService.class);
IUnifiedComponentService service = (IUnifiedComponentService) GlobalServiceRegister.getDefault()
.getService(IUnifiedComponentService.class);
return service.getUnifiedCompDisplayName(delegateComponent, emfComponent);
}
return delegateComponent.getName();
@@ -184,15 +194,17 @@ public class UnifiedComponentUtil {
public static String getComponentDisplayNameForPalette(IComponent delegateComponent, String keyWord) {
if (isDelegateComponent(delegateComponent)) {
IUnifiedComponentService service = GlobalServiceRegister.getDefault().getService(IUnifiedComponentService.class);
IUnifiedComponentService service = (IUnifiedComponentService) GlobalServiceRegister.getDefault()
.getService(IUnifiedComponentService.class);
return service.getComponentDisplayNameForPalette(delegateComponent, keyWord);
}
return delegateComponent.getDisplayName();
return delegateComponent.getName();
}
public static IComponent getUnifiedComponentByFilter(IComponent delegateComponent, String filter) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IUnifiedComponentService.class)) {
IUnifiedComponentService service = GlobalServiceRegister.getDefault().getService(IUnifiedComponentService.class);
IUnifiedComponentService service = (IUnifiedComponentService) GlobalServiceRegister.getDefault()
.getService(IUnifiedComponentService.class);
return service.getUnifiedComponentByFilter(delegateComponent, filter);
}
return null;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -68,7 +68,9 @@ ToolbarInputZone.widgetTooltip.removeAlias=Remove alias
ToolbarOutputZone.widgetTooltip.addOutputTable=Add output table
ToolbarOutputZone.widgetTooltip.removeOutputTable=Remove selected output table
ToolbarOutputZone.widgetTooltip.mapInputAndOutput=Map automatically inputs and outputs (for empty expressions only)
ToolbarOutputZone.widgetTooltip.delimitedIdentifiers=Active me to add double quotes for schemas to support delimited identifiers.
ToolbarOutputZone.widgetText.autoMap=Auto map\!
ToolbarOutputZone.widgetText.delimitedIdentifiers=Delimited identifiers
EntryContentProposal.metadataColumn=Metadata column
EntryContentProposal.properties=properties :
@@ -157,7 +159,3 @@ HTMLDocGenerator.value=Value
HTMLDocGenerator.values=Values
HTMLDocGenerator.version=Version
ProblemsAnalyser.needAlias.error1=The '{0}' linked table name '{1}' is too complex ,please use alias to generate sql!
PropertySetDialog.title=Property Settings
PropertySetDialog.delimitedIdentifiers.title=Delimited identifiers
PropertySetDialog.useAlias.oracle.title=Automatic alias

View File

@@ -54,7 +54,6 @@ import org.talend.designer.dbmap.i18n.Messages;
import org.talend.designer.dbmap.language.generation.DbGenerationManager;
import org.talend.designer.dbmap.language.generation.GenericDbGenerationManager;
import org.talend.designer.dbmap.language.hive.HiveGenerationManager;
import org.talend.designer.dbmap.language.mssql.MssqlGenerationManager;
import org.talend.designer.dbmap.language.mysql.MysqlGenerationManager;
import org.talend.designer.dbmap.language.oracle.OracleGenerationManager;
import org.talend.designer.dbmap.language.postgres.PostgresGenerationManager;
@@ -181,29 +180,6 @@ public class DbMapComponent extends AbstractMapComponent {
elemParams.add(activeDelimitedIdentifiersEP);
}
activeDelimitedIdentifiersEP.setValue(getGenerationManager().isUseDelimitedIdentifiers());
//
IElementParameter useAliasInOutputTableEP = origNode
.getElementParameter(EParameterName.USE_ALIAS_IN_OUTPUT_TABLE.getName());
if (useAliasInOutputTableEP == null) {
useAliasInOutputTableEP = new ElementParameter(origNode);
useAliasInOutputTableEP.setShow(false);
useAliasInOutputTableEP.setFieldType(EParameterFieldType.CHECK);
useAliasInOutputTableEP.setName(EParameterName.USE_ALIAS_IN_OUTPUT_TABLE.getName());
useAliasInOutputTableEP.setCategory(EComponentCategory.TECHNICAL);
useAliasInOutputTableEP.setNumRow(99);
useAliasInOutputTableEP.setReadOnly(false);
if (getGenerationManager() instanceof OracleGenerationManager) {
boolean disableAlias = Boolean
.valueOf(System.getProperty("elt.oracle.disableColumnAlias", Boolean.FALSE.toString())); //$NON-NLS-1$
if (!disableAlias) {
getGenerationManager().setUseAliasInOutputTable(true);
}
}
List<IElementParameter> elemParams = (List<IElementParameter>) origNode.getElementParameters();
elemParams.add(useAliasInOutputTableEP);
}
useAliasInOutputTableEP.setValue(getGenerationManager().isUseAliasInOutputTable());
}
mapperMain.loadModelFromInternalData();
metadataListOut = mapperMain.getMetadataListOut();
@@ -489,9 +465,7 @@ public class DbMapComponent extends AbstractMapComponent {
}
if (externalData != null) {
// rename metadata column name
List<ExternalDbMapTable> tables = new ArrayList<ExternalDbMapTable>();
List<ExternalDbMapTable> inputTables = new ArrayList<ExternalDbMapTable>(externalData.getInputTables());
tables.addAll(inputTables);
List<ExternalDbMapTable> tables = new ArrayList<ExternalDbMapTable>(externalData.getInputTables());
tables.addAll(externalData.getOutputTables());
ExternalDbMapTable tableFound = null;
for (ExternalDbMapTable table : tables) {
@@ -508,23 +482,11 @@ public class DbMapComponent extends AbstractMapComponent {
}
}
List<String> alias = new ArrayList<String>();
alias.add(conectionName);
for(ExternalDbMapTable table : inputTables) {
if (table.getTableName().equals(conectionName)) {
if(table.getAlias() != null) {
alias.add(table.getAlias());
}
}
}
// it is necessary to update expressions only if renamed column come from input table
for(String connName : alias) {
if (tableFound != null && externalData.getInputTables().indexOf(tableFound) != -1) {
TableEntryLocation oldLocation = new TableEntryLocation(connName, oldColumnName);
TableEntryLocation newLocation = new TableEntryLocation(connName, newColumnName);
replaceLocationsInAllExpressions(oldLocation, newLocation, false);
}
if (tableFound != null && externalData.getInputTables().indexOf(tableFound) != -1) {
TableEntryLocation oldLocation = new TableEntryLocation(conectionName, oldColumnName);
TableEntryLocation newLocation = new TableEntryLocation(conectionName, newColumnName);
replaceLocationsInAllExpressions(oldLocation, newLocation, false);
}
}
@@ -626,8 +588,6 @@ public class DbMapComponent extends AbstractMapComponent {
generationManager = new PostgresGenerationManager();
} else if (value.contains("tELTHiveMap")) { //$NON-NLS-1$
generationManager = new HiveGenerationManager();
} else if (value.contains("tELTMSSqlMap")) {
generationManager = new MssqlGenerationManager();
} else if (value.startsWith("tELT") && value.endsWith("Map")) //$NON-NLS-1$ //$NON-NLS-2$
{
generationManager = new GenericDbGenerationManager();
@@ -635,7 +595,6 @@ public class DbMapComponent extends AbstractMapComponent {
throw new IllegalArgumentException(Messages.getString("DbMapComponent.unknowValue") + value); //$NON-NLS-1$
}
updateUseDelimitedIdentifiersStatus();
updateUseAliasInOutputTableStatus();
}
return generationManager;
@@ -645,7 +604,6 @@ public class DbMapComponent extends AbstractMapComponent {
public void setOriginalNode(INode originalNode) {
super.setOriginalNode(originalNode);
updateUseDelimitedIdentifiersStatus();
updateUseAliasInOutputTableStatus();
}
private void updateUseDelimitedIdentifiersStatus() {
@@ -667,25 +625,6 @@ public class DbMapComponent extends AbstractMapComponent {
}
}
private void updateUseAliasInOutputTableStatus() {
if (generationManager == null) {
return;
}
INode oriNode = getOriginalNode();
if (oriNode != null) {
IElementParameter useAliasInOutputTableEP = oriNode
.getElementParameter(EParameterName.USE_ALIAS_IN_OUTPUT_TABLE.getName());
boolean useAliasInOutputTable = false;
if (useAliasInOutputTableEP != null) {
Object value = useAliasInOutputTableEP.getValue();
if (value != null) {
useAliasInOutputTable = Boolean.valueOf(value.toString());
}
}
generationManager.setUseAliasInOutputTable(useAliasInOutputTable);
}
}
/*
* (non-Javadoc)
*

View File

@@ -12,11 +12,7 @@
// ============================================================================
package org.talend.designer.dbmap.language.generation;
import static java.util.Optional.*;
import static java.util.stream.Collectors.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -83,8 +79,6 @@ public abstract class DbGenerationManager {
protected String tabSpaceString = DEFAULT_TAB_SPACE_STRING;
private final String DOT_STR = "."; //$NON-NLS-1$
protected static final String DEFAULT_TAB_SPACE_STRING = ""; //$NON-NLS-1$
protected List<String> queryColumnsSegments = new ArrayList<String>();
@@ -95,14 +89,10 @@ public abstract class DbGenerationManager {
private Boolean useDelimitedIdentifiers;
private Boolean useAliasInOutputTable;
protected Set<String> subQueryTable = new HashSet<String>();
protected INode source;
protected Set<String> inputSchemaContextSet = new HashSet<String>();
/**
* DOC amaumont GenerationManager constructor comment.
*
@@ -278,9 +268,6 @@ public abstract class DbGenerationManager {
return tableName;
}
protected String addQuotes(String name) {
return name;
}
/**
*
* ggu Comment method "buildSqlSelect".
@@ -296,7 +283,6 @@ public abstract class DbGenerationManager {
queryColumnsSegments.clear();
querySegments.clear();
subQueryTable.clear();
inputSchemaContextSet.clear();
this.tabSpaceString = tabString;
DbMapComponent component = getDbMapComponent(dbMapComponent);
@@ -309,9 +295,7 @@ public abstract class DbGenerationManager {
}
ExternalDbMapData data = component.getExternalData();
List<ExternalDbMapTable> inputTables = data.getInputTables();
List<String> contextList = getContextList(component);
collectSchemaContextParam(dbMapComponent, inputTables, contextList);
StringBuilder sb = new StringBuilder();
List<ExternalDbMapTable> outputTables = data.getOutputTables();
@@ -384,6 +368,8 @@ public abstract class DbGenerationManager {
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.FROM);
List<ExternalDbMapTable> inputTables = data.getInputTables();
// load input table in hash
boolean explicitJoin = false;
int lstSizeInputTables = inputTables.size();
@@ -572,40 +558,6 @@ public abstract class DbGenerationManager {
return sqlQuery;
}
protected void collectSchemaContextParam(DbMapComponent dbMapComponent, List<ExternalDbMapTable> inputTables,
List<String> contextList) {
List<IConnection> incomingConnections = (List<IConnection>) dbMapComponent.getIncomingConnections();
if (incomingConnections != null) {
for (IConnection connection : incomingConnections) {
INode input = connection.getSource();
if (input != null) {
IElementParameter eltSchemaNameParam = input.getElementParameter("ELT_SCHEMA_NAME"); //$NON-NLS-1$
if (eltSchemaNameParam != null && eltSchemaNameParam.getValue() != null) {
String schema = String.valueOf(eltSchemaNameParam.getValue());
if (schema != null && !inputSchemaContextSet.contains(schema) && contextList.contains(schema)) {
inputSchemaContextSet.add(schema);
}
}
IElementParameter eltTableNameParam = input.getElementParameter("ELT_TABLE_NAME"); //$NON-NLS-1$
if (eltTableNameParam != null && eltTableNameParam.getValue() != null) {
String table = String.valueOf(eltTableNameParam.getValue());
if (table != null && !inputSchemaContextSet.contains(table) && contextList.contains(table)) {
inputSchemaContextSet.add(table);
}
}
}
}
}
if (inputTables != null) {
for (ExternalDbMapTable table : inputTables) {
if (table.getAlias() != null && !inputSchemaContextSet.contains(table.getAlias())
&& contextList.contains(table.getAlias())) {
inputSchemaContextSet.add(table.getAlias());
}
}
}
}
public String buildSqlSelect(DbMapComponent dbMapComponent, String outputTableName, String tabString,
boolean checkUseUpdateStatement) {
queryColumnsName = "\""; //$NON-NLS-1$
@@ -613,7 +565,6 @@ public abstract class DbGenerationManager {
queryColumnsSegments.clear();
querySegments.clear();
subQueryTable.clear();
inputSchemaContextSet.clear();
this.tabSpaceString = tabString;
DbMapComponent component = getDbMapComponent(dbMapComponent);
@@ -650,15 +601,12 @@ public abstract class DbGenerationManager {
}
}
// Update
String targetSchemaTable = getDifferentTable(dbMapComponent, outputTableName);
if (targetSchemaTable == null) {
targetSchemaTable = outTableName;
}
String targetSchemaTable = outTableName;
IElementParameter eltSchemaNameParam = source.getElementParameter("ELT_SCHEMA_NAME"); //$NON-NLS-1$
if (eltSchemaNameParam != null && eltSchemaNameParam.getValue() != null) {
String schema = TalendQuoteUtils.removeQuotesIfExist(String.valueOf(eltSchemaNameParam.getValue()));
if (org.apache.commons.lang.StringUtils.isNotEmpty(schema)) {
targetSchemaTable = schema + DbMapSqlConstants.DOT + targetSchemaTable;
targetSchemaTable = schema + DbMapSqlConstants.DOT + outTableName;
}
}
@@ -679,7 +627,7 @@ public abstract class DbGenerationManager {
int lstSizeOutTableEntries = metadataTableEntries.size();
for (int i = 0; i < lstSizeOutTableEntries; i++) {
ExternalDbMapEntry dbMapEntry = metadataTableEntries.get(i);
String columnEntry = dbMapEntry.getName();
String columnEntry = outTableName + DbMapSqlConstants.DOT + dbMapEntry.getName();
String expression = dbMapEntry.getExpression();
expression = initExpression(component, dbMapEntry);
expression = addQuoteForSpecialChar(expression, component);
@@ -726,6 +674,13 @@ public abstract class DbGenerationManager {
// From
appendSqlQuery(sb, tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.FROM);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, targetSchemaTable);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
// Inner Join
appendSqlQuery(sb, tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.INNER_JOIN);
List<ExternalDbMapTable> inputTables = data.getInputTables();
// load input table in hash
@@ -744,17 +699,35 @@ public abstract class DbGenerationManager {
for (int i = 0; i < lstSizeInputTables; i++) {
ExternalDbMapTable inputTable = inputTables.get(i);
boolean commaCouldBeAdded = i > 0;
buildTableDeclaration(component, sb, inputTable, commaCouldBeAdded, false, false);
IJoinType joinType = null;
if (i == 0) {
joinType = AbstractDbLanguage.JOIN.NO_JOIN;
} else {
joinType = language.getJoin(inputTable.getJoinType());
}
if (language.unuseWithExplicitJoin().contains(joinType) && !explicitJoin) {
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, inputTable.getTableName());
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, inputTable.getAlias());
}
}
// On
if (org.apache.commons.lang.StringUtils.isNotEmpty(keyColumn)) {
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.ON);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, keyColumn);
}
// where
StringBuilder sbWhere = new StringBuilder();
this.tabSpaceString = DEFAULT_TAB_SPACE_STRING;
boolean isFirstClause = true;
for (int i = 0; i < lstSizeInputTables; i++) {
ExternalDbMapTable inputTable = inputTables.get(i);
if (buildConditions4WhereClause(isFirstClause, component, sbWhere, inputTable, false)) {
if (buildConditions(component, sbWhere, inputTable, false, isFirstClause, false)) {
isFirstClause = false;
}
}
@@ -863,7 +836,7 @@ public abstract class DbGenerationManager {
}
protected void checkParameters(DbMapComponent component) {
checkSpecialParameters(component);
checkUseDelimitedIdentifiers(component);
}
protected boolean checkUseUpdateStatement(DbMapComponent dbMapComponent, String outputTableName) {
@@ -882,68 +855,7 @@ public abstract class DbGenerationManager {
return false;
}
protected String getDifferentTable(DbMapComponent dbMapComponent, String outputTableName) {
if (!"Snowflake".equalsIgnoreCase(getDbType(dbMapComponent))) {//$NON-NLS-1$
return null;
}
List<IConnection> outputConnections = (List<IConnection>) dbMapComponent.getOutgoingConnections();
if (outputConnections != null) {
IConnection iconn = this.getConnectonByMetadataName(outputConnections, outputTableName);
if (iconn != null && iconn.getTarget() != null) {
source = iconn.getTarget();
IElementParameter useDifferentTable = source.getElementParameter("USE_DIFFERENT_TABLE"); //$NON-NLS-1$
if (useDifferentTable != null && useDifferentTable.isShow(source.getElementParameters())
&& useDifferentTable.getValue() != null) {
if (Boolean.valueOf(useDifferentTable.getValue().toString())) {
IElementParameter differentTable = source.getElementParameter("DIFFERENT_TABLE_NAME"); //$NON-NLS-1$
if (differentTable != null && differentTable.getValue() != null) {
String table = TalendTextUtils.removeQuotes(String.valueOf(differentTable.getValue()));
if (org.apache.commons.lang.StringUtils.isNotBlank(table)) {
return table;
}
}
}
}
}
}
return null;
}
protected String getDbType(DbMapComponent component) {
IElementParameter mappingPara = component.getElementParameter(EParameterName.MAPPING.getName());
if (mappingPara == null) {
return null;
}
String mapping = (String) mappingPara.getValue();
if (mapping == null) {
return null;
}
MappingTypeRetriever mappingTypeRetriever = MetadataTalendType.getMappingTypeRetriever(mapping);
if (mappingTypeRetriever == null) {
return null;
}
Dbms dbms = mappingTypeRetriever.getDbms();
if (dbms == null) {
return null;
}
return dbms.getProduct();
}
/**
* This piece regulates which columns are going to be skipped in UPDATE QUERY generation in SET section if
* <b>SET_COLUMN</b> property exists. This enhancement is needed for tELTOutput component in case of
* <b>USE_UPDATE_STATEMENT</b>
*
* @return List of columns that going to be skipped, if no <b>SET_COLUMN</b> specified then return empty list.
*/
protected List<Boolean> getSetColumnsForUpdateQuery() {
return ofNullable(source.getElementParameter("SET_COLUMN")).filter(iep -> iep.isShow(source.getElementParameters()))
.flatMap(iep -> ofNullable((List<Map<String, ? extends Object>>) iep.getValue()))
.orElseGet(Collections::emptyList).stream().map(m -> !Boolean.valueOf(m.get("UPDATE_COLUMN").toString()))
.collect(toList());
}
protected void checkSpecialParameters(DbMapComponent component) {
protected void checkUseDelimitedIdentifiers(DbMapComponent component) {
/**
* in elt related component javajets(like tELTMSSqlMap_main.javajet), they don't get DbGenerationManager by
* DbMapComponent#getGenerationManager() while they construct a new manager manually, so some parameters may not
@@ -960,18 +872,6 @@ public abstract class DbGenerationManager {
}
}
}
if (this.useAliasInOutputTable == null) {
this.useAliasInOutputTable = false;
IElementParameter useAliasInOutputTableEP = component
.getElementParameter(EParameterName.USE_ALIAS_IN_OUTPUT_TABLE.getName());
if (useAliasInOutputTableEP != null) {
Object value = useAliasInOutputTableEP.getValue();
if (value != null) {
setUseAliasInOutputTable(Boolean.valueOf(value.toString()));
}
}
}
}
/**
@@ -985,34 +885,29 @@ public abstract class DbGenerationManager {
if (expression == null) {
return null;
}
List<String> contextList = getContextList(component);
boolean haveReplace = false;
for (String context : contextList) {
if (expression.contains(context)) {
expression = expression.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
haveReplace = true;
}
}
if (!haveReplace) {
List<String> connContextList = getConnectionContextList(component);
for (String context : connContextList) {
if (DEFAULT_TAB_SPACE_STRING.equals(tabSpaceString)) {
List<String> contextList = getContextList(component);
boolean haveReplace = false;
for (String context : contextList) {
if (expression.contains(context)) {
expression = expression.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
haveReplace = true;
}
}
}
Set<String> globalMapList = getGlobalMapList(component, expression);
if (globalMapList.size() > 0) {
String tempExpression = expression.trim();
if ((tempExpression.startsWith("\"+") && tempExpression.endsWith("+\"")) //$NON-NLS-1$//$NON-NLS-2$
|| (tempExpression.startsWith("\" +") && tempExpression.endsWith("+ \""))) {//$NON-NLS-1$ //$NON-NLS-2$
return expression;
if (!haveReplace) {
List<String> connContextList = getConnectionContextList(component);
for (String context : connContextList) {
if (expression.contains(context)) {
expression = expression.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
}
Set<String> globalMapList = getGlobalMapList(component, expression);
for (String globalMapStr : globalMapList) {
String regex = parser.getGlobalMapExpressionRegex(globalMapStr);
String replacement = parser.getGlobalMapReplacement(globalMapStr);
expression = expression.replaceAll(regex, "\" +" + replacement + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$
}
}
for (String globalMapStr : globalMapList) {
String regex = parser.getGlobalMapExpressionRegex(globalMapStr);
String replacement = parser.getGlobalMapReplacement(globalMapStr);
expression = expression.replaceAll(regex, "\" +" + replacement + "+ \"");//$NON-NLS-1$ //$NON-NLS-2$
}
return expression;
}
@@ -1040,10 +935,6 @@ public abstract class DbGenerationManager {
}
}
protected boolean needAlias(List<IMetadataColumn> columns, ExternalDbMapEntry dbMapEntry, String expression) {
return false;
}
protected void appendSqlQuery(StringBuilder sb, String value) {
appendSqlQuery(sb, value, true);
}
@@ -1073,11 +964,7 @@ public abstract class DbGenerationManager {
query = query + " \""; //$NON-NLS-1$
} else {
if (query.trim().endsWith("+ \"")) { //$NON-NLS-1$
if (DEFAULT_TAB_SPACE_STRING.equals(this.tabSpaceString)) {
query = query.substring(0, query.lastIndexOf("+ \"")); //$NON-NLS-1$
} else {
query = query + "\""; //$NON-NLS-1$
}
query = query.substring(0, query.lastIndexOf("+ \"")); //$NON-NLS-1$
}
}
}
@@ -1112,7 +999,7 @@ public abstract class DbGenerationManager {
return contextList;
}
protected Set<String> getGlobalMapList(DbMapComponent component, String sqlQuery) {
return parser.getGlobalMapSet(sqlQuery);
}
@@ -1127,7 +1014,7 @@ public abstract class DbGenerationManager {
*/
protected boolean buildConditions(DbMapComponent component, StringBuilder sb, ExternalDbMapTable inputTable,
boolean writeForJoin, boolean isFirstClause) {
return buildConditions(component, sb, inputTable, writeForJoin, isFirstClause, false);
return buildConditions(component, sb, inputTable, writeForJoin, isFirstClause, false);
}
/**
@@ -1159,35 +1046,6 @@ public abstract class DbGenerationManager {
return atLeastOneConditionWritten;
}
/**
* build conditions for update case only DOC hzhao Comment method "buildConditions".
*
* @param isFirstClause
* @param component
* @param sb
* @param inputTable
* @param isSqlQuert
* @return
*/
protected boolean buildConditions4WhereClause(boolean isFirstClause, DbMapComponent component, StringBuilder sb,
ExternalDbMapTable inputTable,
boolean isSqlQuert) {
List<ExternalDbMapEntry> inputEntries = inputTable.getMetadataTableEntries();
int lstSizeEntries = inputEntries.size();
boolean atLeastOneConditionWritten = false;
for (int j = 0; j < lstSizeEntries; j++) {
ExternalDbMapEntry dbMapEntry = inputEntries.get(j);
boolean conditionWritten = buildCondition(component, sb, inputTable, isFirstClause, dbMapEntry, true, isSqlQuert);
if (conditionWritten) {
atLeastOneConditionWritten = true;
}
if (isFirstClause && conditionWritten) {
isFirstClause = false;
}
}
return atLeastOneConditionWritten;
}
/**
* DOC amaumont Comment method "buildCondition".
*
@@ -1213,7 +1071,8 @@ public abstract class DbGenerationManager {
*/
private boolean buildCondition(DbMapComponent component, StringBuilder sbWhere, ExternalDbMapTable table,
boolean isFirstClause, ExternalDbMapEntry dbMapEntry, boolean writeCr, boolean isSqlQuery) {
String expression = initExpression(component, dbMapEntry);
String expression = dbMapEntry.getExpression();
expression = initExpression(component, dbMapEntry);
IDbOperator dbOperator = getOperatorsManager().getOperatorFromValue(dbMapEntry.getOperator());
boolean operatorIsSet = dbOperator != null;
boolean expressionIsSet = expression != null && expression.trim().length() > 0;
@@ -1465,8 +1324,8 @@ public abstract class DbGenerationManager {
}
protected String initExpression(DbMapComponent component, ExternalDbMapEntry dbMapEntry) {
String quote = getQuote(component);
String quto_mark = TalendQuoteUtils.QUOTATION_MARK;
String quote = getQuote(component);
String quto_mark = TalendQuoteUtils.QUOTATION_MARK;
String expression = dbMapEntry.getExpression();
if (expression != null) {
List<Map<String, String>> itemNameList = null;
@@ -1575,8 +1434,8 @@ public abstract class DbGenerationManager {
oriName = oriName.replaceAll("\\$", "\\\\\\$"); //$NON-NLS-1$ //$NON-NLS-2$
}
expression = expression.replaceFirst(tableValue + "\\." + co.getLabel(), //$NON-NLS-1$
tableValue + "\\." + oriName); //$NON-NLS-1$
expression = replaceAuotes(component, expression, quto_markParser, quto_mark);
tableValue + "\\." + oriName); //$NON-NLS-1$
expression = replaceAuotes(expression, quto_markParser, quto_mark);
}
}
@@ -1591,14 +1450,11 @@ public abstract class DbGenerationManager {
return expression;
}
protected String replaceAuotes(DbMapComponent component, String expression, String quoParser, String quote) {
if (isComplexExpression(component, expression)) {
return expression;
}
protected String replaceAuotes(String expression, String quoParser, String quote){
if(!expression.contains("'")){
return expression.replaceAll(quoParser,"\\\\" +quote); //$NON-NLS-1$;
return expression.replaceAll(quoParser,"\\\\" +quote); //$NON-NLS-1$
}
List<Integer> indexs = new ArrayList<>();
for(int i=0;i<expression.length();i++){
if("'".equals(String.valueOf(expression.charAt(i)))){
@@ -1630,32 +1486,25 @@ public abstract class DbGenerationManager {
}
return result.toString();
}
protected boolean isComplexExpression(DbMapComponent component, String expression) {
if (parser.isContainsGlobalMapExpression(expression)) {
return true;
}
return false;
}
private String getQuote(DbMapComponent component){
String quote = TalendQuoteUtils.QUOTATION_MARK;
IElementParameter mappingPara = component.getElementParameter(EParameterName.MAPPING.getName());
if(mappingPara == null){
return quote;
}
String mapping = (String) mappingPara.getValue();
if(mapping == null){
return quote;
}
MappingTypeRetriever mappingTypeRetriever = MetadataTalendType.getMappingTypeRetriever(mapping);
if (mappingTypeRetriever == null) {
return quote;
}
Dbms dbms = mappingTypeRetriever.getDbms();
String product = dbms.getProduct();
EDatabaseTypeName type = EDatabaseTypeName.getTypeFromProductName(product);
return TalendQuoteUtils.getQuoteByDBType(type);
String quote = TalendQuoteUtils.QUOTATION_MARK;
IElementParameter mappingPara = component.getElementParameter(EParameterName.MAPPING.getName());
if(mappingPara == null){
return quote;
}
String mapping = (String) mappingPara.getValue();
if(mapping == null){
return quote;
}
MappingTypeRetriever mappingTypeRetriever = MetadataTalendType.getMappingTypeRetriever(mapping);
if (mappingTypeRetriever == null) {
return quote;
}
Dbms dbms = mappingTypeRetriever.getDbms();
String product = dbms.getProduct();
EDatabaseTypeName type = EDatabaseTypeName.getTypeFromProductName(product);
return TalendQuoteUtils.getQuoteByDBType(type);
}
private String getOriginalColumnName(String entryName, DbMapComponent component, ExternalDbMapTable table) {
@@ -1812,337 +1661,4 @@ public abstract class DbGenerationManager {
this.useDelimitedIdentifiers = useDelimitedIdentifiers;
}
public boolean isUseAliasInOutputTable() {
return Boolean.TRUE.equals(this.useAliasInOutputTable);
}
public void setUseAliasInOutputTable(boolean useAliasInOutputTable) {
this.useAliasInOutputTable = useAliasInOutputTable;
}
public boolean isConditionChecked(DbMapComponent component, ExternalDbMapTable inputTable) {
List<ExternalDbMapEntry> inputEntries = inputTable.getMetadataTableEntries();
boolean atLeastOneConditionIsChecked = false;
for (ExternalDbMapEntry dbMapEntry : inputEntries) {
if (dbMapEntry.isJoin()) {
if (org.apache.commons.lang.StringUtils.isNotEmpty(dbMapEntry.getExpression())
&& org.apache.commons.lang.StringUtils.isNotEmpty(dbMapEntry.getOperator())) {
atLeastOneConditionIsChecked = true;
break;
}
}
}
return atLeastOneConditionIsChecked;
}
public String buildSqlUpdate(DbMapComponent dbMapComponent, String outputTableName, String tabString) {
queryColumnsName = "\""; //$NON-NLS-1$
aliasAlreadyDeclared.clear();
queryColumnsSegments.clear();
querySegments.clear();
subQueryTable.clear();
inputSchemaContextSet.clear();
this.tabSpaceString = tabString;
DbMapComponent component = getDbMapComponent(dbMapComponent);
List<IConnection> outputConnections = (List<IConnection>) component.getOutgoingConnections();
Map<String, IConnection> nameToOutputConnection = new HashMap<String, IConnection>();
for (IConnection connection : outputConnections) {
nameToOutputConnection.put(connection.getUniqueName(), connection);
}
ExternalDbMapData data = component.getExternalData();
StringBuilder sb = new StringBuilder();
List<ExternalDbMapTable> outputTables = data.getOutputTables();
int lstOutputTablesSize = outputTables.size();
ExternalDbMapTable outputTable = null;
for (int i = 0; i < lstOutputTablesSize; i++) {
ExternalDbMapTable temp = outputTables.get(i);
if (outputTableName.equals(temp.getName())) {
outputTable = temp;
break;
}
}
if (outputTable != null) {
String outTableName = outputTable.getTableName();
IConnection connection = nameToOutputConnection.get(outputTable.getName());
List<IMetadataColumn> columns = new ArrayList<IMetadataColumn>();
if (connection != null) {
IMetadataTable metadataTable = connection.getMetadataTable();
if (metadataTable != null) {
columns.addAll(metadataTable.getListColumns());
}
}
// Update
String targetSchemaTable = outTableName;
IElementParameter eltSchemaNameParam = source.getElementParameter("ELT_SCHEMA_NAME"); //$NON-NLS-1$
if (eltSchemaNameParam != null && eltSchemaNameParam.getValue() != null) {
String schema = TalendQuoteUtils.removeQuotesIfExist(String.valueOf(eltSchemaNameParam.getValue()));
if (org.apache.commons.lang.StringUtils.isNotEmpty(schema)) {
targetSchemaTable = addQuotes(schema) + DbMapSqlConstants.DOT + addQuotes(outTableName);
}
}
appendSqlQuery(sb, "\"", false); //$NON-NLS-1$
appendSqlQuery(sb, DbMapSqlConstants.UPDATE);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, targetSchemaTable);
appendSqlQuery(sb, tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
// Set
String keyColumn = DbMapSqlConstants.EMPTY;
List<ExternalDbMapEntry> metadataTableEntries = outputTable.getMetadataTableEntries();
if (metadataTableEntries != null) {
appendSqlQuery(sb, "SET"); //$NON-NLS-1$
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
boolean isKey = false;
int lstSizeOutTableEntries = metadataTableEntries.size();
List<Boolean> setColumns = getSetColumnsForUpdateQuery();
final boolean hasDeactivatedColumns = !setColumns.isEmpty();
boolean isFirstColumn = true;
for (int i = 0; i < lstSizeOutTableEntries; i++) {
if (hasDeactivatedColumns && setColumns.get(i)) {
continue;
}
ExternalDbMapEntry dbMapEntry = metadataTableEntries.get(i);
String columnEntry = dbMapEntry.getName();
String expression = dbMapEntry.getExpression();
expression = initExpression(component, dbMapEntry);
expression = addQuoteForSpecialChar(expression, component);
//
if (!DEFAULT_TAB_SPACE_STRING.equals(this.tabSpaceString)) {
expression += DbMapSqlConstants.SPACE + DbMapSqlConstants.AS + DbMapSqlConstants.SPACE
+ getAliasOf(dbMapEntry.getName());
}
String exp = replaceVariablesForExpression(component, expression);
String columnSegment = exp;
// Added isFirstColumn to conform old behaior if first column is skipped
if (i > 0 && !isFirstColumn) {
queryColumnsName += DbMapSqlConstants.COMMA + DbMapSqlConstants.SPACE;
columnSegment = DbMapSqlConstants.COMMA + DbMapSqlConstants.SPACE + columnSegment;
}
if (expression != null && expression.trim().length() > 0) {
queryColumnsName += exp;
queryColumnsSegments.add(columnSegment);
}
//
if (!isKey) {
for (IMetadataColumn column : columns) {
String columnName = column.getLabel();
if (columnName.equals(dbMapEntry.getName()) && column.isKey()) {
isKey = column.isKey();
keyColumn = addQuotes(columnEntry) + " = " + expression;//$NON-NLS-1$
break;
}
}
if (isKey) {
continue;
}
}
if (expression != null && expression.trim().length() > 0) {
// Append COMMA and NEW_LINE for all columns except FIRST.
if (!isFirstColumn) {
appendSqlQuery(sb, DbMapSqlConstants.COMMA);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
} else {
isFirstColumn = false;
}
appendSqlQuery(sb, addQuotes(columnEntry) + " = " + expression); //$NON-NLS-1$
}
}
}
if ("\"".equals(queryColumnsName)) {
throw new IllegalArgumentException("Specify at least 1 column for UPDATE QUERY in SET section");
}
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
// From
appendSqlQuery(sb, tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.FROM);
// load input table in hash
List<ExternalDbMapTable> inputTables = data.getInputTables();
// load input table in hash
boolean explicitJoin = false;
int lstSizeInputTables = inputTables.size();
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
IJoinType previousJoinType = null;
for (int i = 0; i < lstSizeInputTables; i++) {
ExternalDbMapTable inputTable = inputTables.get(i);
IJoinType joinType = language.getJoin(inputTable.getJoinType());
if (!language.unuseWithExplicitJoin().contains(joinType) && i > 0) {
explicitJoin = true;
} else {
explicitJoin = false;
}
if (i == 0) {
joinType = AbstractDbLanguage.JOIN.NO_JOIN;
previousJoinType = joinType;
} else {
joinType = language.getJoin(inputTable.getJoinType());
}
boolean commaCouldBeAdded = !explicitJoin && i > 0;
boolean crCouldBeAdded = false;
if (language.unuseWithExplicitJoin().contains(joinType) && !explicitJoin) {
buildTableDeclaration(component, sb, inputTable, commaCouldBeAdded, crCouldBeAdded, false);
} else if (!language.unuseWithExplicitJoin().contains(joinType) && explicitJoin) {
if (i > 0) {
if (previousJoinType == null) {
buildTableDeclaration(component, sb, inputTables.get(i - 1), commaCouldBeAdded, crCouldBeAdded, true);
previousJoinType = joinType;
} else {
// appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
}
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
}
String labelJoinType = joinType.getLabel();
if (joinType == AbstractDbLanguage.JOIN.CROSS_JOIN) {
ExternalDbMapTable nextTable = null;
if (i < lstSizeInputTables) {
nextTable = inputTables.get(i);
appendSqlQuery(sb, labelJoinType);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
buildTableDeclaration(component, sb, nextTable, false, true, true);
}
} else {
if (isConditionChecked(component, inputTable)) {
appendSqlQuery(sb, labelJoinType);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
buildTableDeclaration(component, sb, inputTable, false, false, true);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, DbMapSqlConstants.ON);
appendSqlQuery(sb, DbMapSqlConstants.LEFT_BRACKET);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
buildConditions(component, sb, inputTable, true, true, true);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, DbMapSqlConstants.RIGHT_BRACKET);
} else {
commaCouldBeAdded = true;
buildTableDeclaration(component, sb, inputTable, commaCouldBeAdded, crCouldBeAdded, false);
}
}
}
}
// where
StringBuilder sbWhere = new StringBuilder();
this.tabSpaceString = DEFAULT_TAB_SPACE_STRING;
boolean isFirstClause = true;
for (int i = 0; i < lstSizeInputTables; i++) {
ExternalDbMapTable inputTable = inputTables.get(i);
IJoinType joinType = language.getJoin(inputTable.getJoinType());
if (joinType == AbstractDbLanguage.JOIN.CROSS_JOIN) {
// if join type is CROSS JOIN the condition will only in where clause no matter explicit join
// checked or not
if (buildConditions4WhereClause(isFirstClause, component, sbWhere, inputTable, false)) {
isFirstClause = false;
}
} else {
if (buildConditions(component, sbWhere, inputTable, false, isFirstClause, false)) {
isFirstClause = false;
}
}
}
/*
* for addition conditions
*/
// like as input.newcolumn1>100
List<String> whereAddition = new ArrayList<String>();
// olny pure start with group or order, like as order/group by input.newcolumn1
// List<String> byAddition = new ArrayList<String>();
// like as input.newcolumn1>100 group/oder by input.newcolumn1
// List<String> containWhereAddition = new ArrayList<String>();
// like as "OR/AND input.newcolumn1", will keep original
List<String> originalWhereAddition = new ArrayList<String>();
List<String> otherAddition = new ArrayList<String>();
if (outputTable != null) {
List<ExternalDbMapEntry> customWhereConditionsEntries = outputTable.getCustomWhereConditionsEntries();
if (customWhereConditionsEntries != null) {
for (ExternalDbMapEntry entry : customWhereConditionsEntries) {
String exp = initExpression(component, entry);
if (exp != null && !DbMapSqlConstants.EMPTY.equals(exp.trim())) {
if (containWith(exp, DbMapSqlConstants.OR, true) || containWith(exp, DbMapSqlConstants.AND, true)) {
exp = replaceVariablesForExpression(component, exp);
originalWhereAddition.add(exp);
} else {
exp = replaceVariablesForExpression(component, exp);
whereAddition.add(exp);
}
}
}
}
List<ExternalDbMapEntry> customOtherConditionsEntries = outputTable.getCustomOtherConditionsEntries();
if (customOtherConditionsEntries != null) {
for (ExternalDbMapEntry entry : customOtherConditionsEntries) {
String exp = initExpression(component, entry);
if (exp != null && !DbMapSqlConstants.EMPTY.equals(exp.trim())) {
exp = replaceVariablesForExpression(component, exp);
otherAddition.add(exp);
}
}
}
}
this.tabSpaceString = tabString;
String whereClauses = sbWhere.toString();
boolean whereFlag = whereClauses.trim().length() > 0;
boolean whereAddFlag = !whereAddition.isEmpty();
boolean whereOriginalFlag = !originalWhereAddition.isEmpty();
if (whereFlag || whereAddFlag || whereOriginalFlag) {
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.WHERE);
}
if (whereFlag) {
appendSqlQuery(sb, whereClauses);
}
if (whereAddFlag) {
for (int i = 0; i < whereAddition.size(); i++) {
if (i == 0 && whereFlag || i > 0) {
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, DbMapSqlConstants.AND);
}
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, whereAddition.get(i));
}
}
if (whereOriginalFlag) {
for (String s : originalWhereAddition) {
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, s);
}
}
if (!otherAddition.isEmpty()) {
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
for (String s : otherAddition) {
appendSqlQuery(sb, s);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
}
}
}
String sqlQuery = sb.toString();
sqlQuery = handleQuery(sqlQuery);
queryColumnsName = handleQuery(queryColumnsName);
return sqlQuery;
}
}

View File

@@ -12,12 +12,8 @@
// ============================================================================
package org.talend.designer.dbmap.language.generation;
import java.util.Optional;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.designer.dbmap.DbMapComponent;
import org.talend.designer.dbmap.language.GenericDbLanguage;
import org.talend.designer.dbmap.language.mssql.MssqlGenerationManager;
/**
* wzhang class global comment. Detailled comment
@@ -30,17 +26,6 @@ public class GenericDbGenerationManager extends DbGenerationManager {
@Override
public String buildSqlSelect(DbMapComponent component, String outputTableName) {
try {
if (Optional.ofNullable(component).map(c -> c.getComponent()).map(c -> "tELTMSSqlMap".equals(c.getName()))
.orElse(false)) {
MssqlGenerationManager genManager = new MssqlGenerationManager();
String result = genManager.buildSqlSelect(component, outputTableName);
this.queryColumnsName = genManager.getQueryColumnsName();
return result;
}
} catch (Throwable e) {
ExceptionHandler.process(e);
}
return super.buildSqlSelect(component, outputTableName);
}
}

View File

@@ -1,34 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.designer.dbmap.language.mssql;
import org.talend.designer.dbmap.DbMapComponent;
import org.talend.designer.dbmap.language.GenericDbLanguage;
import org.talend.designer.dbmap.language.generation.DbGenerationManager;
public class MssqlGenerationManager extends DbGenerationManager {
public MssqlGenerationManager() {
super(new GenericDbLanguage());
}
@Override
public String buildSqlSelect(DbMapComponent component, String outputTableName) {
boolean checkUseUpdateStatement = checkUseUpdateStatement(component, outputTableName);
if (checkUseUpdateStatement) {
return buildSqlUpdate(component, outputTableName, DEFAULT_TAB_SPACE_STRING);
} else {
return super.buildSqlSelect(component, outputTableName, DEFAULT_TAB_SPACE_STRING);
}
}
}

View File

@@ -140,8 +140,24 @@ public class OracleGenerationManager extends DbGenerationManager {
if (expression != null && expression.trim().length() > 0) {
String exp = replaceVariablesForExpression(component, expression);
appendSqlQuery(sb, exp);
boolean needAlias = needAlias(columns, dbMapEntry, expression);
if (!added && needAlias && isUseAliasInOutputTable()) {
DataMapExpressionParser dataMapExpressionParser = new DataMapExpressionParser(language);
TableEntryLocation[] tableEntriesLocationsSources = dataMapExpressionParser
.parseTableEntryLocations(expression);
boolean columnChanged = false;
if (tableEntriesLocationsSources.length > 1) {
columnChanged = true;
} else {
for (TableEntryLocation tableEntriesLocationsSource : tableEntriesLocationsSources) {
TableEntryLocation location = tableEntriesLocationsSource;
String entryName = getAliasOf(dbMapEntry.getName());
if (location != null && entryName != null
&& !entryName.startsWith("_") && !entryName.equals(location.columnName)) {//$NON-NLS-1$
columnChanged = true;
}
}
}
if (!added && columnChanged) {
String name = DbMapSqlConstants.SPACE + DbMapSqlConstants.AS + DbMapSqlConstants.SPACE
+ getAliasOf(dbMapEntry.getName());
appendSqlQuery(sb, name);
@@ -427,22 +443,4 @@ public class OracleGenerationManager extends DbGenerationManager {
return expression;
}
@Override
protected boolean needAlias(List<IMetadataColumn> columns, ExternalDbMapEntry dbMapEntry, String expression) {
DataMapExpressionParser dataMapExpressionParser = new DataMapExpressionParser(language);
TableEntryLocation[] tableEntriesLocationsSources = dataMapExpressionParser.parseTableEntryLocations(expression);
if (tableEntriesLocationsSources.length > 1) {
return true;
} else {
for (TableEntryLocation tableEntriesLocationsSource : tableEntriesLocationsSources) {
TableEntryLocation location = tableEntriesLocationsSource;
String entryName = getAliasOf(dbMapEntry.getName());
if (location != null && entryName != null && !entryName.startsWith("_") //$NON-NLS-1$
&& !entryName.equals(location.columnName)) {
return true;
}
}
}
return false;
}
}

View File

@@ -236,8 +236,8 @@ public class PostgresGenerationManager extends DbGenerationManager {
}
tableAndSchema = tableAndSchema + getHandledField(tableNoQuote);
if (isVariable(schemaNoQuote) || isVariable(tableNoQuote)) {
tableAndSchema = replaceVariablesForExpression(component, tableAndSchema);
if (isVariable(schemaNoQuote) || isVariable(tableNoQuote)) {
tableAndSchema = replaceVariablesForExpression(component, tableAndSchema);
}
sb.append(tableAndSchema);
} else {
@@ -290,39 +290,32 @@ public class PostgresGenerationManager extends DbGenerationManager {
if (expression == null) {
return null;
}
List<String> contextList = getContextList(component);
boolean haveReplace = false;
for (String context : contextList) {
if (expression.contains(context)) {
expression = replaceContextValue(expression, context);
haveReplace = true;
}
}
if (!haveReplace) {
List<String> connContextList = getConnectionContextList(component);
for (String context : connContextList) {
if (DEFAULT_TAB_SPACE_STRING.equals(tabSpaceString)) {
List<String> contextList = getContextList(component);
boolean haveReplace = false;
for (String context : contextList) {
if (expression.contains(context)) {
expression = replaceContextValue(expression, context);
expression = expression.replaceAll("\\b" + context + "\\b", "\\\\\"\"+" + context + "+\"\\\\\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
haveReplace = true;
}
}
}
Set<String> globalMapList = getGlobalMapList(component, expression);
for (String globalMapStr : globalMapList) {
String replacement = globalMapStr;
if (globalMapStr.contains("\\\\")) {
replacement = globalMapStr.replaceAll("\\\\", "\\\\\\\\");
if (!haveReplace) {
List<String> connContextList = getConnectionContextList(component);
for (String context : connContextList) {
if (expression.contains(context)) {
expression = expression.replaceAll("\\b" + context + "\\b", "\\\\\"\"+" + context + "+\"\\\\\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
}
Set<String> globalMapList = getGlobalMapList(component, expression);
for (String globalMapStr : globalMapList) {
String replacement = globalMapStr;
if (globalMapStr.contains("\\\\")) {
replacement = globalMapStr.replaceAll("\\\\", "\\\\\\\\");
}
String regex = parser.getGlobalMapExpressionRegex(globalMapStr);
expression = expression.replaceAll(regex, "\\\\\"\"+" + replacement + "+\"\\\\\""); //$NON-NLS-1$ //$NON-NLS-2$
}
String regex = parser.getGlobalMapExpressionRegex(globalMapStr);
expression = expression.replaceAll(regex, "\\\\\"\"+" + replacement + "+\"\\\\\""); //$NON-NLS-1$ //$NON-NLS-2$
}
return expression;
}
private String replaceContextValue(String expression, String context) {
if (inputSchemaContextSet.contains(context)) {
expression = expression.replaceAll("\\b" + context + "\\b", "\\\\\"\"+" + context + "+\"\\\\\"");
} else {
expression = expression.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \"");
}
return expression;
}

View File

@@ -781,11 +781,6 @@ public class MapperManager extends AbstractMapperManager {
uiManager.refreshSqlExpression();
}
public void useAliasInOutputTable(boolean useAliasInOutputTable) {
getComponent().getGenerationManager().setUseAliasInOutputTable(useAliasInOutputTable);
uiManager.refreshSqlExpression();
}
/**
* Getter for problemsManager.
*
@@ -795,15 +790,6 @@ public class MapperManager extends AbstractMapperManager {
return this.problemsManager;
}
public boolean componentIsReadOnly() {
if (getAbstractMapComponent().getOriginalNode().getJobletNode() != null) {
return getAbstractMapComponent().isReadOnly() || getAbstractMapComponent().getOriginalNode().isReadOnly();
}
return getAbstractMapComponent().isReadOnly() || getAbstractMapComponent().getProcess().isReadOnly()
|| getAbstractMapComponent().getOriginalNode().isReadOnly();
}
/**
* DOC amaumont Comment method "addAlias".
*/
@@ -906,4 +892,4 @@ public class MapperManager extends AbstractMapperManager {
return false;
}
}
}

View File

@@ -86,7 +86,6 @@ import org.talend.designer.dbmap.model.tableentry.OutputColumnTableEntry;
import org.talend.designer.dbmap.model.tableentry.TableEntryLocation;
import org.talend.designer.dbmap.ui.MapperUI;
import org.talend.designer.dbmap.ui.commands.DataMapTableViewSelectedCommand;
import org.talend.designer.dbmap.ui.dialog.PropertySetDialog;
import org.talend.designer.dbmap.ui.tabs.TabFolderEditors;
import org.talend.designer.dbmap.ui.visualmap.TableEntryProperties;
import org.talend.designer.dbmap.ui.visualmap.link.Link;
@@ -1368,11 +1367,6 @@ public class UIManager extends AbstractUIManager {
return getMapperContainer().getDisplay();
}
@Override
public void openPropertySetDialog() {
new PropertySetDialog(getShell(), mapperManager).open();
}
/**
*
* DOC amaumont Comment method "moveSelectedTable".

View File

@@ -12,6 +12,7 @@
// ============================================================================
package org.talend.designer.dbmap.model.table;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -100,6 +101,7 @@ public class InputTable extends AbstractInOutTable {
}
}
ArrayList<IMetadataColumn> columnsToRemove = new ArrayList<IMetadataColumn>();
for (IMetadataColumn column : columns) {
InputColumnTableEntry inputEntry = (InputColumnTableEntry) getNewTableEntry(column);
ExternalDbMapEntry externalMapperTableEntry = nameToPerTabEntry.get(inputEntry.getMetadataColumn().getLabel());
@@ -108,8 +110,13 @@ public class InputTable extends AbstractInOutTable {
fillInputEntry(inputEntry, externalMapperTableEntry);
nameToPerTabEntry.remove(externalMapperTableEntry.getName());
}
dataMapTableEntries.add(inputEntry);
if (externalMapperTableEntry != null || !isAliasTable) {
dataMapTableEntries.add(inputEntry);
} else {
columnsToRemove.add(column);
}
}
columns.removeAll(columnsToRemove);
// create unmatching entries
for (ExternalDbMapEntry perTableEntry : nameToPerTabEntry.values()) {

View File

@@ -45,7 +45,6 @@ import org.talend.commons.ui.runtime.ws.WindowSystem;
import org.talend.commons.ui.swt.drawing.background.BackgroundRefresher;
import org.talend.commons.ui.swt.linking.BgDrawableComposite;
import org.talend.commons.utils.threading.ExecutionLimiter;
import org.talend.core.model.process.IConnection;
import org.talend.designer.abstractmap.model.table.IDataMapTable;
import org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup;
import org.talend.designer.abstractmap.ui.listener.DropTargetOperationListener;
@@ -231,20 +230,6 @@ public class MapperUI {
dbmsId = input.getMetadataTable().getDbms();
}
}
if(dbmsId == null && mapperModel.getOutputDataMapTables() != null && !mapperModel.getOutputDataMapTables().isEmpty()) {
OutputTable output = mapperModel.getOutputDataMapTables().get(0);
if (output.getMetadataTable() != null) {
dbmsId = output.getMetadataTable().getDbms();
}
}
if(dbmsId == null && mapperManager.getAbstractMapComponent() != null
&& !mapperManager.getAbstractMapComponent().getIncomingConnections().isEmpty()){
IConnection conn = mapperManager.getAbstractMapComponent().getIncomingConnections().get(0);
if(conn.getMetadataTable() != null) {
dbmsId = conn.getMetadataTable().getDbms();
}
}
tabFolderEditors = new TabFolderEditors(mainSashForm, SWT.BORDER, mapperManager, dbmsId);
createInputZoneWithTables(mapperModel, uiManager, display);
@@ -315,10 +300,6 @@ public class MapperUI {
if (outputsTablesView.size() > 0) {
uiManager.selectDataMapTableView(outputsTablesView.get(0), true, false);
}
for (DataMapTableView view : outputsTablesView) {
view.getTableViewerCreatorForColumns().getTableViewer().refresh();
}
}
private void resizeNotMinimizedTablesAtExpandedSize(final Display display) {

View File

@@ -1,144 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2020 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.designer.dbmap.ui.dialog;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.talend.core.model.components.IComponent;
import org.talend.designer.dbmap.i18n.Messages;
import org.talend.designer.dbmap.language.generation.DbGenerationManager;
import org.talend.designer.dbmap.managers.MapperManager;
/**
*
* created by hcyi on Nov 24, 2020 Detailled comment
*
*/
public class PropertySetDialog extends Dialog {
private MapperManager mapperManager;
private DbGenerationManager generationManager;
private Button delimitedIdentifiersButton;
private Button useAliasButton;
private final Color color = new Color(Display.getDefault(), 238, 238, 0);
public PropertySetDialog(Shell parentShell, MapperManager mapperManager) {
super(parentShell);
this.mapperManager = mapperManager;
generationManager = mapperManager.getComponent().getGenerationManager();
}
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
final GridLayout gridLayout = new GridLayout();
gridLayout.marginLeft = 10;
gridLayout.marginTop = 20;
gridLayout.marginHeight = 0;
container.setLayout(gridLayout);
delimitedIdentifiersButton = new Button(container, SWT.CHECK);
delimitedIdentifiersButton.setText(Messages.getString("PropertySetDialog.delimitedIdentifiers.title")); //$NON-NLS-1$
useAliasButton = new Button(container, SWT.CHECK);
useAliasButton.setText(Messages.getString("PropertySetDialog.useAlias.oracle.title")); //$NON-NLS-1$
init();
addListener();
updateStatus();
return container;
}
private void init() {
delimitedIdentifiersButton.setSelection(generationManager.isUseDelimitedIdentifiers());
useAliasButton.setSelection(generationManager.isUseAliasInOutputTable());
// Implement the column alias only for tELTOracleMap now.
boolean enabled = false;
IComponent component = mapperManager.getComponent().getComponent();
if (component != null && "tELTOracleMap".equals(component.getName())) { //$NON-NLS-1$
enabled = true;
}
useAliasButton.setVisible(enabled);
}
private void addListener() {
delimitedIdentifiersButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
mapperManager.useDelimitedIdentifiers(delimitedIdentifiersButton.getSelection());
updateStatus();
}
});
useAliasButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
mapperManager.useAliasInOutputTable(useAliasButton.getSelection());
updateStatus();
}
});
}
private void updateStatus() {
if (generationManager.isUseDelimitedIdentifiers() == delimitedIdentifiersButton.getSelection()) {
delimitedIdentifiersButton.setBackground(null);
} else {
delimitedIdentifiersButton.setBackground(color);
}
if (generationManager.isUseAliasInOutputTable() == useAliasButton.getSelection()) {
useAliasButton.setBackground(null);
} else {
useAliasButton.setBackground(color);
}
}
@Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}
@Override
protected Point getInitialSize() {
return new Point(500, 300);
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText(Messages.getString("PropertySetDialog.title")); //$NON-NLS-1$
}
@Override
protected void okPressed() {
mapperManager.useDelimitedIdentifiers(delimitedIdentifiersButton.getSelection());
mapperManager.useAliasInOutputTable(useAliasButton.getSelection());
super.okPressed();
}
}

View File

@@ -28,7 +28,6 @@ public enum ImageInfo {
CHECKED_ICON("/icons/checked.png"), //$NON-NLS-1$
UNCHECKED_ICON("/icons/unchecked.png"), //$NON-NLS-1$
ADD_FILTER_ICON("/icons/addfilter.png"), //$NON-NLS-1$
PROPERTY_TOOL_ICON("/icons/property.png"), //$NON-NLS-1$
;
private String path;

View File

@@ -12,8 +12,6 @@
// ============================================================================
package org.talend.designer.dbmap.ui.tabs;
import java.util.List;
import org.eclipse.gef.commands.CommandStack;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.SWT;
@@ -25,19 +23,12 @@ import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton;
import org.talend.commons.ui.swt.colorstyledtext.UnnotifiableColorStyledText;
import org.talend.commons.ui.swt.extended.table.ExtendedButtonEvent;
import org.talend.commons.ui.swt.extended.table.IExtendedButtonListener;
import org.talend.core.CorePlugin;
import org.talend.core.ui.metadata.editor.MetadataTableEditorView;
import org.talend.core.ui.metadata.editor.MetadataToolbarEditorView;
import org.talend.designer.dbmap.MapperMain;
import org.talend.designer.dbmap.i18n.Messages;
import org.talend.designer.dbmap.managers.MapperManager;
import org.talend.designer.dbmap.model.table.InputTable;
import org.talend.designer.dbmap.model.table.OutputTable;
import org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView;
/**
* DOC amaumont class global comment. Detailled comment <br/>
@@ -67,10 +58,6 @@ public class TabFolderEditors extends CTabFolder {
private String dbmsId;
private List<ExtendedPushButton> inputToolBarButtons;
private List<ExtendedPushButton> outputToolBarButtons;
public TabFolderEditors(Composite parent, int style, MapperManager mapperManager, String dbmsId) {
super(parent, style);
tabFolderEditors = this;
@@ -157,8 +144,6 @@ public class TabFolderEditors extends CTabFolder {
inputMetaEditor.initGraphicComponents();
inputMetaEditor.getExtendedTableViewer().setCommandStack(commandStack);
addListenersToInputButtons();
outputMetaEditor = new MetadataTableEditorView(inOutMetaEditorContainer, SWT.BORDER);
outputMetaEditor.setCurrentDbms(dbmsId);
outputMetaEditor.setShowDbTypeColumn(true, false, true);
@@ -167,46 +152,6 @@ public class TabFolderEditors extends CTabFolder {
outputMetaEditor.setShowPatternColumn(false);
outputMetaEditor.initGraphicComponents();
outputMetaEditor.getExtendedTableViewer().setCommandStack(commandStack);
addListenersToOutputButtons();
}
private void addListenersToInputButtons() {
MetadataToolbarEditorView toolBar = inputMetaEditor.getToolBar();
inputToolBarButtons = toolBar.getButtons();
IExtendedButtonListener afterCommandListener = new IExtendedButtonListener() {
public void handleEvent(ExtendedButtonEvent event) {
List<InputTable> inputTablesList = mapperManager.getInputTables();
for (InputTable inputTable : inputTablesList) {
DataMapTableView view = mapperManager.retrieveIDataMapTableView(inputTable);
view.getTableViewerCreatorForColumns().getTableViewer().refresh();
}
}
};
for (ExtendedPushButton extendedPushButton : inputToolBarButtons) {
extendedPushButton.addListener(afterCommandListener, false);
}
}
private void addListenersToOutputButtons() {
MetadataToolbarEditorView toolBar = outputMetaEditor.getToolBar();
outputToolBarButtons = toolBar.getButtons();
IExtendedButtonListener afterCommandListener = new IExtendedButtonListener() {
public void handleEvent(ExtendedButtonEvent event) {
List<OutputTable> outputTablesList = mapperManager.getOutputTables();
for (OutputTable outputTable : outputTablesList) {
DataMapTableView view = mapperManager.retrieveIDataMapTableView(outputTable);
view.getTableViewerCreatorForColumns().getTableViewer().refresh();
}
}
};
for (ExtendedPushButton extendedPushButton : outputToolBarButtons) {
extendedPushButton.addListener(afterCommandListener, false);
}
}
private StyledText createStyledText(CTabItem item) {

View File

@@ -36,6 +36,8 @@ public class ToolbarOutputZone extends ToolbarZone {
private ToolItem guessItem;
private ToolItem delimitedIdentifiersItem;
public static final String MINIMIZE_TOOLTIP = Messages.getString("ToolbarOutputZone.minimizeTooltip"); //$NON-NLS-1$
public static final String RESTORE_TOOLTIP = Messages.getString("ToolbarOutputZone.restorTooltip"); //$NON-NLS-1$
@@ -82,6 +84,11 @@ public class ToolbarOutputZone extends ToolbarZone {
guessItem.setToolTipText(Messages.getString("ToolbarOutputZone.widgetTooltip.mapInputAndOutput")); //$NON-NLS-1$
guessItem.setText(Messages.getString("ToolbarOutputZone.widgetText.autoMap")); //$NON-NLS-1$
delimitedIdentifiersItem = new ToolItem(getToolBarActions(), SWT.CHECK);
delimitedIdentifiersItem.setToolTipText(Messages.getString("ToolbarOutputZone.widgetTooltip.delimitedIdentifiers")); //$NON-NLS-1$
delimitedIdentifiersItem.setText(Messages.getString("ToolbarOutputZone.widgetText.delimitedIdentifiers")); //$NON-NLS-1$
delimitedIdentifiersItem
.setSelection(getMapperManager().getComponent().getGenerationManager().isUseDelimitedIdentifiers());
}
/**
@@ -116,6 +123,15 @@ public class ToolbarOutputZone extends ToolbarZone {
});
delimitedIdentifiersItem.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
getMapperManager().useDelimitedIdentifiers(delimitedIdentifiersItem.getSelection());
}
});
}
@Override

View File

@@ -45,8 +45,6 @@ public abstract class ToolbarZone {
private ToolItem downTableButton;
private ToolItem propertyButton;
private ToolItem minimizeButton;
protected boolean minimized;
@@ -74,6 +72,9 @@ public abstract class ToolbarZone {
}
}
/**
* DOC amaumont Comment method "createComponents".
*/
public void addCommonsComponents() {
upTableButton = new ToolItem(toolBarActions, SWT.PUSH);
@@ -90,13 +91,6 @@ public abstract class ToolbarZone {
new ToolItem(getToolBarActions(), SWT.SEPARATOR);
if (this instanceof ToolbarInputZone) {
propertyButton = new ToolItem(toolBarActions, SWT.PUSH);
propertyButton.setImage(ImageProviderMapper.getImage(ImageInfo.PROPERTY_TOOL_ICON));
propertyButton.setToolTipText("Setup the configurations of elt map"); //$NON-NLS-1$
propertyButton.setEnabled(!getMapperManager().componentIsReadOnly());
}
minimizeButton = new ToolItem(toolBarActions, SWT.PUSH);
minimizeButton.setEnabled(false);
@@ -133,14 +127,6 @@ public abstract class ToolbarZone {
});
if (propertyButton != null) {
propertyButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
uiManager.openPropertySetDialog();
}
});
}
}
public Composite getComposite() {

View File

@@ -47,10 +47,6 @@ public class DataMapExpressionParser {
private static final String GLOBALMAP_PATTERN = "\\s*(\\(\\s*\\(\\s*String\\s*\\)\\s*globalMap\\s*\\.\\s*get\\s*\\(\\s*\\\"(.+?)\\\"\\s*\\)\\s*\\))\\s*";
private static final String GLOBALMAP_PATTERN2 = "\\s*(\\(\\s*\\(\\s*[a-zA-Z]+\\s*\\)\\s*globalMap\\s*\\.\\s*get\\s*\\(\\s*\\\"(.+?)\\\"\\s*\\)\\s*\\))\\s*";
private static final String GLOBALMAP_PATTERN_ALL = "\\s*\\+\\s*(\\(\\w*\\))?globalMap.get\\s*\\(\\s*\\\"(.+?)\\\"\\s*\\)\\s*\\+\\s*";
private static final String GLOBALMAP_TABLE_EXPRESSION = "(" + GLOBALMAP_PATTERN + "\\." + GLOBALMAP_PATTERN + ")|("
+ TABLE_PATTERN + GLOBALMAP_PATTERN + ")|(" + GLOBALMAP_PATTERN + COLUMN_PATTERN + ")|" + GLOBALMAP_PATTERN;;
@@ -151,7 +147,7 @@ public class DataMapExpressionParser {
location = new TableEntryLocation(matchResult.group(36), matchResult.group(38));
}else if (matchResult.group(39) != null) {
// table.\"column\"
// Case NVL(Keys.\"ORG_SCD_ID\",-99) When -99 Then 'N' Else 'Y' End
// Case NVL(Keys.\"ORG_SCD_ID\",-99) When -99 Then 'N' Else 'Y' End
location = new TableEntryLocation(matchResult.group(40), matchResult.group(41));
}
if (location != null) {
@@ -219,7 +215,7 @@ public class DataMapExpressionParser {
} else {
patternMatcherInput.setInput(sqlQuery);
}
recompilePatternIfNecessary(GLOBALMAP_PATTERN2);
recompilePatternIfNecessary(GLOBALMAP_PATTERN);
while (matcher.contains(patternMatcherInput, pattern)) {
MatchResult matchResult = matcher.getMatch();
if (matchResult.group(1) != null) {
@@ -230,20 +226,6 @@ public class DataMapExpressionParser {
}
return resultList;
}
public boolean isContainsGlobalMapExpression(String sqlQuery) {
if (sqlQuery != null) {
recompilePatternIfNecessary(GLOBALMAP_PATTERN_ALL);
while (matcher.contains(sqlQuery, pattern)) {
return true;
}
recompilePatternIfNecessary(GLOBALMAP_PATTERN);
while (matcher.contains(sqlQuery, pattern)) {
return true;
}
}
return false;
}
public String getGlobalMapExpressionRegex(String expression) {
String[] specialChars = new String[] { "\\", "$", "(", ")", "*", "+", ".", "[", "]", "?", "^", "{", "}", "|" };

View File

@@ -165,7 +165,7 @@ public class FOXUI {
xmlToSchemaSash = new SashForm(mainComposite, SWT.HORIZONTAL | SWT.SMOOTH);
xmlToSchemaSash.setLayoutData(new GridData(GridData.FILL_BOTH));
xmlToSchemaSash.setBackgroundMode(SWT.INHERIT_FORCE);
if (Platform.OS_MACOSX.equals(Platform.getOS()) || Platform.OS_LINUX.equals(Platform.getOS())) {
if (Platform.OS_MACOSX.equals(Platform.getOS())) {
xmlToSchemaSash.setSashWidth((mainComposite.getShell().getBounds().width) / 5);
}
canModify = externalNode.getProcess().isReadOnly();
@@ -190,7 +190,7 @@ public class FOXUI {
footerComp = new FooterComposite(mainComposite, SWT.NONE, foxManager);
xmlViewer.expandToLevel(3);
linker.createLinks();
if (Platform.OS_MACOSX.equals(Platform.getOS()) || Platform.OS_LINUX.equals(Platform.getOS())) {
if (Platform.OS_MACOSX.equals(Platform.getOS())) {
mainComposite.getShell().addControlListener(new ControlListener() {
@Override

View File

@@ -2427,9 +2427,7 @@ public abstract class DataMapTableView extends Composite implements IDataMapTabl
private void parseExpression(ModifiedBeanEvent event, TableViewerCreator tableViewerCreator, ITableEntry tableEntry) {
if (event.column == tableViewerCreator.getColumn(DataMapTableView.ID_EXPRESSION_COLUMN)) {
mapperManager.getUiManager().parseExpression(tableEntry.getExpression(), tableEntry, false, false, false);
if (headerComposite != null && !headerComposite.isDisposed()) {
mapperManager.getUiManager().refreshBackground(false, false);
}
mapperManager.getUiManager().refreshBackground(false, false);
}
}

View File

@@ -826,13 +826,8 @@ public class InputDataMapTableView extends DataMapTableView {
previousStateAtLeastOneHashKey = stateAtLeastOneHashKey;
}
// if user didn't trigger save mapper action ,and click ok to close the window diretly, then it will cause
// closeMapper first then here checkChangementsAfterEntryModifiedOrAdded , the Composite will be disposed.
// so when try to checkLookupTableProblems on a disposed Widget , will cause org.eclipse.swt.SWTException:
// Widget is disposed
if (headerComposite != null && !headerComposite.isDisposed()) {
checkLookupTableProblems(stateAtLeastOneHashKey);
}
checkLookupTableProblems(stateAtLeastOneHashKey);
mapSettingViewerCreator.refresh();
}

View File

@@ -14,7 +14,6 @@
<outputDirectory>${file.separator}</outputDirectory>
<includes>
<include>${talend.job.path}/**/*.class</include>
<include>${talend.job.path}/**/*.wsdl</include>
<include>__tdm/**</include>
</includes>
</fileSet>
@@ -23,8 +22,6 @@
<outputDirectory>${file.separator}</outputDirectory>
<includes>
<include>OSGI-INF/**</include>
<include>TALEND-INF/**</include>
<include>MAVEN-INF/**</include>
</includes>
</fileSet>
<fileSet> <!-- add resources -->
@@ -47,8 +44,8 @@
<includes>
<include>**</include>
</includes>
</fileSet>
</fileSet>
<fileSet> <!-- add metadata -->
<directory>${basedir}/src/main/resources</directory>
<outputDirectory>${file.separator}</outputDirectory>
@@ -56,7 +53,7 @@
<include>metadata/**</include>
</includes>
</fileSet>
<fileSet>
<directory>${current.resources.dir}</directory>
<outputDirectory>${file.separator}</outputDirectory>

View File

@@ -1,68 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>jar-with-dependencies</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>jar</format>
</formats>
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>jar-with-dependencies</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>jar</format>
</formats>
<fileSets>
<fileSets>
<fileSet> <!-- add java classes -->
<directory>${project.build.outputDirectory}</directory>
<outputDirectory>${file.separator}</outputDirectory>
<includes>
<include>${talend.job.path}/**/*.class</include>
<include>${talend.job.path}/**/*.wsdl</include>
<include>__tdm/**</include>
</includes>
</fileSet>
<fileSet> <!-- add java classes -->
<directory>${project.build.outputDirectory}</directory>
<outputDirectory>${file.separator}</outputDirectory>
<includes>
<include>${talend.job.path}/**/*.class</include>
<include>__tdm/**</include>
</includes>
</fileSet>
<fileSet> <!-- add osgi resources -->
<directory>${current.bundle.resources.dir}</directory>
<outputDirectory>${file.separator}</outputDirectory>
<includes>
<include>OSGI-INF/**</include>
</includes>
</fileSet>
<fileSet> <!-- add osgi resources -->
<directory>${current.bundle.resources.dir}</directory>
<outputDirectory>${file.separator}</outputDirectory>
<includes>
<include>OSGI-INF/**</include>
<include>TALEND-INF/**</include>
<include>MAVEN-INF/**</include>
</includes>
</fileSet>
<fileSet> <!-- add route resources -->
<directory>${current.bundle.resources.dir}/resources</directory>
<outputDirectory>${file.separator}</outputDirectory>
<includes>
<include>**</include>
</includes>
</fileSet>
<fileSet> <!-- add route resources -->
<directory>${current.bundle.resources.dir}/resources</directory>
<outputDirectory>${file.separator}</outputDirectory>
<includes>
<include>**</include>
</includes>
</fileSet>
<fileSet> <!-- add route lib -->
<directory>${current.bundle.resources.dir}/lib</directory>
<outputDirectory>lib</outputDirectory>
<includes>
<include>**</include>
</includes>
</fileSet>
<fileSet> <!-- add context resources -->
<directory>${current.resources.dir}</directory>
<outputDirectory>${file.separator}</outputDirectory>
<includes>
<include>${talend.job.path}/**</include>
</includes>
</fileSet>
<fileSet> <!-- add context resources -->
<directory>${resources.path}</directory>
<outputDirectory>${file.separator}</outputDirectory>
<includes>
<include>${talend.job.path}/**</include>
</includes>
</fileSet>
<fileSet> <!-- add route lib -->
<directory>${current.bundle.resources.dir}/lib</directory>
<outputDirectory>lib</outputDirectory>
<includes>
<include>**</include>
</includes>
</fileSet>
<fileSet><!-- add context resources -->
<directory>${current.resources.dir}</directory>
<outputDirectory>${file.separator}</outputDirectory>
<includes>
<include>${talend.job.path}/**</include>
</includes>
</fileSet>
<fileSet> <!-- add provided-lib -->
<directory>${current.bundle.resources.dir}/provided-lib</directory>
<outputDirectory>lib</outputDirectory>
@@ -70,17 +59,17 @@
<include>**</include>
</includes>
</fileSet>
</fileSets>
<!-- <dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
<includes>
<include>${routines.binaries.includes.set}</include>
</includes>
without version for talend libraries
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
<useProjectArtifact>false</useProjectArtifact>
</dependencySet>
</dependencySets> -->
</fileSets>
<!-- <dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
<includes>
<include>${routines.binaries.includes.set}</include>
</includes>
without version for talend libraries
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
<useProjectArtifact>false</useProjectArtifact>
</dependencySet>
</dependencySets> -->
</assembly>

Some files were not shown because too many files have changed in this diff Show More