Skip to content

Commit

Permalink
Release 13.0
Browse files Browse the repository at this point in the history
Additional keywords implemented
  • Loading branch information
jlolling committed Nov 28, 2022
1 parent 28c0ed3 commit 8472b49
Show file tree
Hide file tree
Showing 24 changed files with 92 additions and 57 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.jlo.talendcomp</groupId>
<artifactId>jlo-talendcomp-tabletransfer</artifactId>
<version>12.1</version>
<version>13.0</version>
<name>Table Transfer Components</name>
<organization>
<name>Jan Lolling</name>
Expand All @@ -25,7 +25,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.4.2</version>
<version>42.5.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
19 changes: 17 additions & 2 deletions src/main/java/de/jlo/datamodel/generator/SQLCodeGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,26 @@ public SQLCodeGenerator() {
keywordList.add("database");
keywordList.add("table");
keywordList.add("schema");
keywordList.add("order");
keywordList.add("limit");
keywordList.add("length");
keywordList.add("from");
keywordList.add("where");
keywordList.add("insert");
keywordList.add("update");
keywordList.add("delete");
keywordList.add("having");
keywordList.add("group");
keywordList.add("with");
keywordList.add("column");
}

public void addKeyword(String word) {
if (keywordList.contains(word) == false) {
keywordList.add(word);
if (word != null && word.trim().isEmpty() == false) {
word = word.trim();
if (keywordList.contains(word) == false) {
keywordList.add(word);
}
}
}

Expand Down
16 changes: 13 additions & 3 deletions src/main/java/de/jlo/talendcomp/tabletransfer/TableTransfer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1994,21 +1994,31 @@ protected void setupKeywords(Connection conn, SQLCodeGenerator codeGen) throws S
if (numKeyWords != null && numKeyWords.trim().isEmpty() == false) {
String[] words = numKeyWords.split(",");
for (String w : words) {
codeGen.addKeyword(w.trim());
codeGen.addKeyword(w);
}
}
String sqlKeyWords = dbmd.getSQLKeywords();
if (sqlKeyWords != null && sqlKeyWords.trim().isEmpty() == false) {
String[] words = sqlKeyWords.split(",");
for (String w : words) {
codeGen.addKeyword(w.trim());
codeGen.addKeyword(w);
}
}
String stringKeyWords = dbmd.getStringFunctions();
if (stringKeyWords != null && stringKeyWords.trim().isEmpty() == false) {
String[] words = sqlKeyWords.split(",");
for (String w : words) {
codeGen.addKeyword(w.trim());
codeGen.addKeyword(w);
}
}
}

public void setKeywords(String keywords) throws SQLException {
if (keywords != null && keywords.trim().isEmpty() == false) {
String[] array = keywords.split(",;|");
for (String keyword : array) {
getTargetCodeGenerator().addKeyword(keyword);
getSourceCodeGenerator().addKeyword(keyword);
}
}
}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,13 @@
valueRangeColumn = "null";
}
boolean onlyUpdate = "true".equals(ElementParameterParser.getValue(node, "__ONLY_UPDATE_NO_INSERT__"));
boolean log4jEnabled = "true".equals(org.talend.core.model.process.ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__")) &&
"JOBLET".equals(node.getComponent().getComponentType().toString()) == false;
String keywordList = ElementParameterParser.getObjectValue(node, "__ADDITIONAL_KEYWORDS__");
if (keywordList == null && keywordList.trim().isEmpty()) {
keywordList = "null";
}
%>

de.jlo.talendcomp.tabletransfer.TableTransfer <%=cid%> = new de.jlo.talendcomp.tabletransfer.TableTransfer();
<% if (log4jEnabled) { %>
<%=cid%>.setLogger(log);
<% } %>
<%=cid%>.setDoCommit(<%=doCommit%>);
<%=cid%>.setRunOnlyUpdates(<%=onlyUpdate%>);
<% if (typeMap != null) {
Expand Down Expand Up @@ -114,6 +113,7 @@
<% } %>
<%=cid%>.setKeepDataModels(<%=reuseModel%>, jobName + "_" + <%=cid%>);
<%=cid%>.setupDataModels();
<%=cid%>.setKeywords(<%=keywordList%>);
<% if (useQuery) { %>
// use our own query as source
String <%=cid%>_query = <%=sourceQuery%>;
Expand Down
9 changes: 5 additions & 4 deletions talend_component/tDB2TableTransfer/tDB2TableTransfer_java.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<COMPONENT>
<HEADER PLATEFORM="ALL" SERIAL="" VERSION="12.1" STATUS="ALPHA" COMPATIBILITY="ALL" AUTHOR="Jan Lolling" RELEASE_DATE="20220822" STARTABLE="true" HAS_CONDITIONAL_OUTPUTS="false">
<HEADER PLATEFORM="ALL" SERIAL="" VERSION="13.0" STATUS="ALPHA" COMPATIBILITY="ALL" AUTHOR="Jan Lolling" RELEASE_DATE="20221128" STARTABLE="true" HAS_CONDITIONAL_OUTPUTS="false">
<SIGNATURE/>
</HEADER>
<FAMILIES>
Expand Down Expand Up @@ -157,16 +157,17 @@
</ITEM>
</ITEMS>
</PARAMETER>
<PARAMETER NAME="ADDITIONAL_KEYWORDS" FIELD="TEXT" NUM_ROW="65"/>
<PARAMETER NAME="REUSE_DATA_MODEL" FIELD="CHECK" NUM_ROW="70">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="RELEASE_LABEL_20220822" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 12.1 build at: 20220822</DEFAULT>
<PARAMETER NAME="RELEASE_LABEL_20221128" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.0 build at: 20221128</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="jlo-talendcomp-tabletransfer" MODULE="jlo-talendcomp-tabletransfer-12.1.jar" MVN="mvn:org.talend.libraries/jlo-talendcomp-tabletransfer-12.1/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="jlo-talendcomp-tabletransfer" MODULE="jlo-talendcomp-tabletransfer-13.0.jar" MVN="mvn:org.talend.libraries/jlo-talendcomp-tabletransfer-13.0/6.0.0-SNAPSHOT" REQUIRED="true"/>
</IMPORTS>
</CODEGENERATION>
<RETURNS>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,5 @@ TRIM_TEXT_VALUES.NAME=Trim text values
ENABLE_CHECK_CONNECTION.NAME=Enable check target connection while idle
CHECK_CONNECTION_STATEMENT.NAME=Statement to simply test the connection (must be something very cheap!)
ONLY_UPDATE_NO_INSERT.NAME=Only Update, No Insert
REMOVE_NONE_UTF8_CHARACTERS.NAME=Remove none-UTF8 characters in char typed field content read from source
REMOVE_NONE_UTF8_CHARACTERS.NAME=Remove none-UTF8 characters in char typed field content read from source
ADDITIONAL_KEYWORDS.NAME=Additional SQL Keywords (comma separated list)
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,12 @@
valueRangeColumn = "null";
}
boolean onlyUpdate = "true".equals(ElementParameterParser.getValue(node, "__ONLY_UPDATE_NO_INSERT__"));
boolean log4jEnabled = "true".equals(org.talend.core.model.process.ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__")) &&
"JOBLET".equals(node.getComponent().getComponentType().toString()) == false;
String keywordList = ElementParameterParser.getObjectValue(node, "__ADDITIONAL_KEYWORDS__");
if (keywordList == null && keywordList.trim().isEmpty()) {
keywordList = "null";
}
%>
de.jlo.talendcomp.tabletransfer.TableTransfer <%=cid%> = new de.jlo.talendcomp.tabletransfer.TableTransfer();
<% if (log4jEnabled) { %>
<%=cid%>.setLogger(log);
<% } %>
<%=cid%>.setDoCommit(<%=doCommit%>);
<%=cid%>.setRunOnlyUpdates(<%=onlyUpdate%>);
<% if (typeMap != null) {
Expand Down Expand Up @@ -106,6 +105,7 @@
<% } %>
<%=cid%>.setKeepDataModels(<%=reuseModel%>, jobName + "_" + <%=cid%>);
<%=cid%>.setupDataModels();
<%=cid%>.setKeywords(<%=keywordList%>);
<% if (useQuery) { %>
// use our own query as source
String <%=cid%>_query = <%=sourceQuery%>;
Expand Down
9 changes: 5 additions & 4 deletions talend_component/tEXATableTransfer/tEXATableTransfer_java.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<COMPONENT>
<HEADER PLATEFORM="ALL" SERIAL="" VERSION="12.1" STATUS="ALPHA" COMPATIBILITY="ALL" AUTHOR="Jan Lolling" RELEASE_DATE="20220822" STARTABLE="true" HAS_CONDITIONAL_OUTPUTS="false">
<HEADER PLATEFORM="ALL" SERIAL="" VERSION="13.0" STATUS="ALPHA" COMPATIBILITY="ALL" AUTHOR="Jan Lolling" RELEASE_DATE="20221128" STARTABLE="true" HAS_CONDITIONAL_OUTPUTS="false">
<SIGNATURE/>
</HEADER>
<FAMILIES>
Expand Down Expand Up @@ -151,16 +151,17 @@
</ITEM>
</ITEMS>
</PARAMETER>
<PARAMETER NAME="ADDITIONAL_KEYWORDS" FIELD="TEXT" NUM_ROW="65"/>
<PARAMETER NAME="REUSE_DATA_MODEL" FIELD="CHECK" NUM_ROW="70">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="RELEASE_LABEL_20220822" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 12.1 build at: 20220822</DEFAULT>
<PARAMETER NAME="RELEASE_LABEL_20221128" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.0 build at: 20221128</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="jlo-talendcomp-tabletransfer" MODULE="jlo-talendcomp-tabletransfer-12.1.jar" MVN="mvn:org.talend.libraries/jlo-talendcomp-tabletransfer-12.1/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="jlo-talendcomp-tabletransfer" MODULE="jlo-talendcomp-tabletransfer-13.0.jar" MVN="mvn:org.talend.libraries/jlo-talendcomp-tabletransfer-13.0/6.0.0-SNAPSHOT" REQUIRED="true"/>
</IMPORTS>
</CODEGENERATION>
<RETURNS>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ TRIM_TEXT_VALUES.NAME=Trim text values
ENABLE_CHECK_CONNECTION.NAME=Enable check target connection while idle
CHECK_CONNECTION_STATEMENT.NAME=Statement to simply test the connection (must be something very cheap!)
ONLY_UPDATE_NO_INSERT.NAME=Only Update, No Insert
REMOVE_NONE_UTF8_CHARACTERS.NAME=Remove none-UTF8 characters in char typed field content read from source
REMOVE_NONE_UTF8_CHARACTERS.NAME=Remove none-UTF8 characters in char typed field content read from source
ADDITIONAL_KEYWORDS.NAME=Additional SQL Keywords (comma separated list)
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,13 @@
}
boolean onlyUpdate = "true".equals(ElementParameterParser.getValue(node, "__ONLY_UPDATE_NO_INSERT__"));
String onConflict = ElementParameterParser.getValue(node, "__ON_CONFLICT__");
boolean log4jEnabled = "true".equals(org.talend.core.model.process.ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__")) &&
"JOBLET".equals(node.getComponent().getComponentType().toString()) == false;
String keywordList = ElementParameterParser.getObjectValue(node, "__ADDITIONAL_KEYWORDS__");
if (keywordList == null && keywordList.trim().isEmpty()) {
keywordList = "null";
}
%>

de.jlo.talendcomp.tabletransfer.MysqlTableTransfer <%=cid%> = new de.jlo.talendcomp.tabletransfer.MysqlTableTransfer();
<% if (log4jEnabled) { %>
<%=cid%>.setLogger(log);
<% } %>
<%=cid%>.setDoCommit(<%=doCommit%>);
<%=cid%>.setRunOnlyUpdates(<%=onlyUpdate%>);
<% if (onlyUpdate == false) {
Expand Down Expand Up @@ -115,6 +114,7 @@
<% } %>
<%=cid%>.setKeepDataModels(<%=reuseModel%>, jobName + "_" + <%=cid%>);
<%=cid%>.setupDataModels();
<%=cid%>.setKeywords(<%=keywordList%>);
<% if (useQuery) { %>
// use our own query as source
String <%=cid%>_query = <%=sourceQuery%>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<COMPONENT>
<HEADER PLATEFORM="ALL" SERIAL="" VERSION="12.1" STATUS="ALPHA" COMPATIBILITY="ALL" AUTHOR="Jan Lolling" RELEASE_DATE="20220822" STARTABLE="true" HAS_CONDITIONAL_OUTPUTS="false">
<HEADER PLATEFORM="ALL" SERIAL="" VERSION="13.0" STATUS="ALPHA" COMPATIBILITY="ALL" AUTHOR="Jan Lolling" RELEASE_DATE="20221128" STARTABLE="true" HAS_CONDITIONAL_OUTPUTS="false">
<SIGNATURE/>
</HEADER>
<FAMILIES>
Expand Down Expand Up @@ -162,16 +162,17 @@
</ITEM>
</ITEMS>
</PARAMETER>
<PARAMETER NAME="ADDITIONAL_KEYWORDS" FIELD="TEXT" NUM_ROW="65"/>
<PARAMETER NAME="REUSE_DATA_MODEL" FIELD="CHECK" NUM_ROW="70">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="RELEASE_LABEL_20220822" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 12.1 build at: 20220822</DEFAULT>
<PARAMETER NAME="RELEASE_LABEL_20221128" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.0 build at: 20221128</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="jlo-talendcomp-tabletransfer" MODULE="jlo-talendcomp-tabletransfer-12.1.jar" MVN="mvn:org.talend.libraries/jlo-talendcomp-tabletransfer-12.1/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="jlo-talendcomp-tabletransfer" MODULE="jlo-talendcomp-tabletransfer-13.0.jar" MVN="mvn:org.talend.libraries/jlo-talendcomp-tabletransfer-13.0/6.0.0-SNAPSHOT" REQUIRED="true"/>
</IMPORTS>
</CODEGENERATION>
<RETURNS>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,5 @@ STRICT_SOURCE_FIELD_MAPPING.NAME=Strict field mapping for source fields
TRIM_TEXT_VALUES.NAME=Trim text values
ENABLE_CHECK_CONNECTION.NAME=Enable check target connection while idle
CHECK_CONNECTION_STATEMENT.NAME=Statement to simply test the connection (must be something very cheap!)
REMOVE_NONE_UTF8_CHARACTERS.NAME=Remove none-UTF8 characters in char typed field content read from source
REMOVE_NONE_UTF8_CHARACTERS.NAME=Remove none-UTF8 characters in char typed field content read from source
ADDITIONAL_KEYWORDS.NAME=Additional SQL Keywords (comma separated list)
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,13 @@
valueRangeColumn = "null";
}
boolean onlyUpdate = "true".equals(ElementParameterParser.getValue(node, "__ONLY_UPDATE_NO_INSERT__"));
boolean log4jEnabled = "true".equals(org.talend.core.model.process.ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__")) &&
"JOBLET".equals(node.getComponent().getComponentType().toString()) == false;
String keywordList = ElementParameterParser.getObjectValue(node, "__ADDITIONAL_KEYWORDS__");
if (keywordList == null && keywordList.trim().isEmpty()) {
keywordList = "null";
}
%>

de.jlo.talendcomp.tabletransfer.TableTransfer <%=cid%> = new de.jlo.talendcomp.tabletransfer.TableTransfer();
<% if (log4jEnabled) { %>
<%=cid%>.setLogger(log);
<% } %>
<%=cid%>.setDoCommit(<%=doCommit%>);
<%=cid%>.setRunOnlyUpdates(<%=onlyUpdate%>);
<% if (typeMap != null) {
Expand Down Expand Up @@ -105,6 +104,7 @@
<% } %>
<%=cid%>.setKeepDataModels(<%=reuseModel%>, jobName + "_" + <%=cid%>);
<%=cid%>.setupDataModels();
<%=cid%>.setKeywords(<%=keywordList%>);
<% if (useQuery) { %>
// use our own query as source
String <%=cid%>_query = <%=sourceQuery%>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<COMPONENT>
<HEADER PLATEFORM="ALL" SERIAL="" VERSION="12.1" STATUS="ALPHA" COMPATIBILITY="ALL" AUTHOR="Jan Lolling" RELEASE_DATE="20220822" STARTABLE="true" HAS_CONDITIONAL_OUTPUTS="false">
<HEADER PLATEFORM="ALL" SERIAL="" VERSION="13.0" STATUS="ALPHA" COMPATIBILITY="ALL" AUTHOR="Jan Lolling" RELEASE_DATE="20221128" STARTABLE="true" HAS_CONDITIONAL_OUTPUTS="false">
<SIGNATURE/>
</HEADER>
<FAMILIES>
Expand Down Expand Up @@ -151,16 +151,17 @@
</ITEM>
</ITEMS>
</PARAMETER>
<PARAMETER NAME="ADDITIONAL_KEYWORDS" FIELD="TEXT" NUM_ROW="65"/>
<PARAMETER NAME="REUSE_DATA_MODEL" FIELD="CHECK" NUM_ROW="70">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="RELEASE_LABEL_20220822" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 12.1 build at: 20220822</DEFAULT>
<PARAMETER NAME="RELEASE_LABEL_20221128" FIELD="LABEL" COLOR="0;0;0" NUM_ROW="900">
<DEFAULT>Release: 13.0 build at: 20221128</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="jlo-talendcomp-tabletransfer" MODULE="jlo-talendcomp-tabletransfer-12.1.jar" MVN="mvn:org.talend.libraries/jlo-talendcomp-tabletransfer-12.1/6.0.0-SNAPSHOT" REQUIRED="true"/>
<IMPORT NAME="jlo-talendcomp-tabletransfer" MODULE="jlo-talendcomp-tabletransfer-13.0.jar" MVN="mvn:org.talend.libraries/jlo-talendcomp-tabletransfer-13.0/6.0.0-SNAPSHOT" REQUIRED="true"/>
</IMPORTS>
</CODEGENERATION>
<RETURNS>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,5 @@ TRIM_TEXT_VALUES.NAME=Trim text values
ENABLE_CHECK_CONNECTION.NAME=Enable check target connection while idle
CHECK_CONNECTION_STATEMENT.NAME=Statement to simply test the connection (must be something very cheap!)
ONLY_UPDATE_NO_INSERT.NAME=Only Update, No Insert
REMOVE_NONE_UTF8_CHARACTERS.NAME=Remove none-UTF8 characters in char typed field content read from source
REMOVE_NONE_UTF8_CHARACTERS.NAME=Remove none-UTF8 characters in char typed field content read from source
ADDITIONAL_KEYWORDS.NAME=Additional SQL Keywords (comma separated list)
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,13 @@
}
boolean onlyUpdate = "true".equals(ElementParameterParser.getValue(node, "__ONLY_UPDATE_NO_INSERT__"));
String onConflict = ElementParameterParser.getValue(node, "__ON_CONFLICT__");
boolean log4jEnabled = "true".equals(org.talend.core.model.process.ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__")) &&
"JOBLET".equals(node.getComponent().getComponentType().toString()) == false;
String keywordList = ElementParameterParser.getObjectValue(node, "__ADDITIONAL_KEYWORDS__");
if (keywordList == null && keywordList.trim().isEmpty()) {
keywordList = "null";
}
%>

de.jlo.talendcomp.tabletransfer.PostgresqlTableTransfer <%=cid%> = new de.jlo.talendcomp.tabletransfer.PostgresqlTableTransfer();
<% if (log4jEnabled) { %>
<%=cid%>.setLogger(log);
<% } %>
<%=cid%>.setDoCommit(<%=doCommit%>);
<%=cid%>.setRunOnlyUpdates(<%=onlyUpdate%>);
<% if (onlyUpdate == false) {
Expand Down Expand Up @@ -114,6 +113,7 @@
<% } %>
<%=cid%>.setKeepDataModels(<%=reuseModel%>, jobName + "_" + <%=cid%>);
<%=cid%>.setupDataModels();
<%=cid%>.setKeywords(<%=keywordList%>);
<% if (useQuery) { %>
// use our own query as source
String <%=cid%>_query = <%=sourceQuery%>;
Expand Down
Loading

0 comments on commit 8472b49

Please sign in to comment.