Compare commits
91 Commits
patch/TPS-
...
patch/TPS-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77a75994bc | ||
|
|
08266054c0 | ||
|
|
4d944f0910 | ||
|
|
c001e4245e | ||
|
|
c7c5c410db | ||
|
|
8712fc8845 | ||
|
|
268697b578 | ||
|
|
aa4bfa79f7 | ||
|
|
ca527877e2 | ||
|
|
4c4e091b14 | ||
|
|
1d40c1d03f | ||
|
|
d32e660ed5 | ||
|
|
62e6776a9d | ||
|
|
0fd6e2a5ae | ||
|
|
1dea872eca | ||
|
|
dd3d7aab1e | ||
|
|
39d9ecb7ae | ||
|
|
ffd480faf6 | ||
|
|
d769a705f9 | ||
|
|
b1e8227987 | ||
|
|
3729ca4734 | ||
|
|
f1f0e3b3fa | ||
|
|
751e157764 | ||
|
|
d8d591f985 | ||
|
|
0d52d35d65 | ||
|
|
14bb82b680 | ||
|
|
875273246b | ||
|
|
9b7e750f26 | ||
|
|
cfc470383e | ||
|
|
90ed0e0146 | ||
|
|
8b09f8c12c | ||
|
|
4e6719fea2 | ||
|
|
a76b533335 | ||
|
|
4ce30defb8 | ||
|
|
f297c329c9 | ||
|
|
ac087dd899 | ||
|
|
8d6aac4487 | ||
|
|
f78773ba76 | ||
|
|
bff58f3865 | ||
|
|
d60cbe30c9 | ||
|
|
bfbf8d37cc | ||
|
|
17338305be | ||
|
|
99375c5886 | ||
|
|
e77b4a347c | ||
|
|
069c169de5 | ||
|
|
339af1f06b | ||
|
|
c6d2e700a3 | ||
|
|
8efc0df5fa | ||
|
|
0cf7abbc1b | ||
|
|
1cca5a725f | ||
|
|
51c17366b3 | ||
|
|
2efd0a576b | ||
|
|
0d1feddcdc | ||
|
|
b63eda5b00 | ||
|
|
62076c3dde | ||
|
|
be32d236ce | ||
|
|
784eddb637 | ||
|
|
fceb75306c | ||
|
|
18f58c3227 | ||
|
|
be9e3c5f7b | ||
|
|
1f22ba1d95 | ||
|
|
ad128e1de4 | ||
|
|
0255fe7ab2 | ||
|
|
a773b349c9 | ||
|
|
185223d211 | ||
|
|
5ee921c424 | ||
|
|
31ef759a19 | ||
|
|
7d27951987 | ||
|
|
65de33bbe0 | ||
|
|
c7c49f64d3 | ||
|
|
5c85ca8901 | ||
|
|
205ba4a34b | ||
|
|
a56e6a9f87 | ||
|
|
bd47c35822 | ||
|
|
18dfd7c0eb | ||
|
|
82b3293fa1 | ||
|
|
1b063578fb | ||
|
|
288b8630b1 | ||
|
|
010e5ca7f7 | ||
|
|
87e4186271 | ||
|
|
0595e5008f | ||
|
|
093d44312b | ||
|
|
970e8b623f | ||
|
|
f6bddbf553 | ||
|
|
4a4c9ea1b1 | ||
|
|
a879db668b | ||
|
|
d61cf31fc7 | ||
|
|
f1962c39a9 | ||
|
|
9230e47ee4 | ||
|
|
ed172de48d | ||
|
|
0f579c6e72 |
@@ -3,17 +3,15 @@ version: 7.2.1
|
||||
module: https://talend.poolparty.biz/coretaxonomy/42
|
||||
product:
|
||||
- https://talend.poolparty.biz/coretaxonomy/23
|
||||
- https://talend.poolparty.biz/coretaxonomy/26
|
||||
- https://talend.poolparty.biz/coretaxonomy/24
|
||||
---
|
||||
|
||||
# TPS-3403
|
||||
# TPS-3348
|
||||
|
||||
| Info | Value |
|
||||
| ---------------- | ---------------- |
|
||||
| Patch Name | Patch\_20190907\_TPS-3403\_v1-7.2.1 |
|
||||
| Release Date | 2019-09-07 |
|
||||
| Target Version | 20190620\_1446-V7.2.1 |
|
||||
| Patch Name | Patch\_20200129_TPS-3743\_v1-7.2.1 |
|
||||
| Release Date | 2020-01-29 |
|
||||
| Target Version | Talend-Studio-20190620\_1446-V7.2.1 |
|
||||
| Product affected | Talend Studio |
|
||||
|
||||
## Introduction
|
||||
@@ -23,21 +21,22 @@ 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 this following fixe:
|
||||
|
||||
- TPS-3403 filecopy fail with java11 (TDI-42230)
|
||||
This patch contains the following fixes:
|
||||
|
||||
- TPS-3743 [7.2.1] Log4j object(log) in tJava will not show any result after tRedshiftClose (TDI-43602)
|
||||
|
||||
## 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
|
||||
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.
|
||||
|
||||
@@ -53,14 +52,18 @@ Consider the following requirements for your system:
|
||||
|
||||
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}
|
||||
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:
|
||||
|
||||
- plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tFileCopy/tFileCopy\_java.xml
|
||||
- plugins/org.talend.libraries.custom\_7.2.1.20181114\_0551/lib/filecopy-2.0.0.jar
|
||||
|
||||
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftClose/tRedshiftClose\_main.javajet
|
||||
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftConnection/tRedshiftConnection\_begin.javajet
|
||||
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftInput/tRedshiftInput\_begin.javajet
|
||||
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tRedshiftInput/tRedshiftInput\_end.javajet
|
||||
|
||||
@@ -445,6 +445,7 @@
|
||||
lastStr = "";
|
||||
}
|
||||
}
|
||||
enableLogStash = "true".equalsIgnoreCase(System.getProperty("monitoring"));
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
if(!"".equals(log4jLevel)){
|
||||
@@ -493,7 +494,11 @@
|
||||
properties_<%=jobCatcherNode.getUniqueName()%>.setProperty("appender.file.maxsize", "52428800");
|
||||
properties_<%=jobCatcherNode.getUniqueName()%>.setProperty("appender.file.maxbackup", "20");
|
||||
properties_<%=jobCatcherNode.getUniqueName()%>.setProperty("host", "false");
|
||||
|
||||
|
||||
System.getProperties().stringPropertyNames().stream()
|
||||
.filter(it -> it.startsWith("monitoring.audit.logger.properties."))
|
||||
.forEach(key -> properties_<%=jobCatcherNode.getUniqueName()%>.setProperty(key.substring("monitoring.audit.logger.properties.".length()), System.getProperty(key)));
|
||||
|
||||
auditLogger_<%=jobCatcherNode.getUniqueName()%> = org.talend.job.audit.JobEventAuditLoggerFactory.createJobAuditLogger(properties_<%=jobCatcherNode.getUniqueName()%>);
|
||||
}
|
||||
<%
|
||||
@@ -1509,12 +1514,10 @@ if (execStat) {
|
||||
}
|
||||
} else if (arg.startsWith("--log4jLevel=")) {
|
||||
log4jLevel = arg.substring(13);
|
||||
} else if (arg.startsWith("--monitoring=")) {//for trunjob call
|
||||
enableLogStash = "true".equalsIgnoreCase(arg.substring(13));
|
||||
}
|
||||
|
||||
if(!enableLogStash) {
|
||||
enableLogStash = "true".equalsIgnoreCase(System.getProperty("monitoring"));
|
||||
} else if (arg.startsWith("--monitoring") && arg.contains("=")) {//for trunjob call
|
||||
final int equal = arg.indexOf('=');
|
||||
final String key = arg.substring("--".length(), equal);
|
||||
System.setProperty(key, arg.substring(equal + 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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, true, forceUpdate);
|
||||
syncRoutine(routineItem, true, forceUpdate);
|
||||
}
|
||||
syncSystemRoutine(ProjectManager.getInstance().getCurrentProject());
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.10</version>
|
||||
</dependency>
|
||||
<version>1.19</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<resources>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<groupId>net.sf.json-lib</groupId>
|
||||
<artifactId>json-lib</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>2.4.2-talend</version>
|
||||
<version>2.4.3-talend</version>
|
||||
<name>json-lib</name>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -163,6 +163,11 @@ public class XMLSerializer {
|
||||
*/
|
||||
private boolean useLongDecimals;
|
||||
|
||||
/**
|
||||
* flag for if parse empty elements as empty strings
|
||||
*/
|
||||
private boolean useEmptyStrings;
|
||||
|
||||
/**
|
||||
* Creates a new XMLSerializer with default options.<br>
|
||||
* <ul>
|
||||
@@ -803,6 +808,8 @@ public class XMLSerializer {
|
||||
clazz = JSONTypes.OBJECT;
|
||||
}else if( JSONTypes.ARRAY.compareToIgnoreCase( clazzText ) == 0 ){
|
||||
clazz = JSONTypes.ARRAY;
|
||||
} else if(JSONTypes.STRING.equalsIgnoreCase(clazzText)) {
|
||||
clazz = JSONTypes.STRING;
|
||||
}
|
||||
}
|
||||
return clazz;
|
||||
@@ -1414,6 +1421,8 @@ public class XMLSerializer {
|
||||
String text = element.getValue();
|
||||
params = StringUtils.split( paramsAttribute.getValue(), "," );
|
||||
setOrAccumulate( jsonObject, key, new JSONFunction( params, text ) );
|
||||
} else if( useEmptyStrings && clazz != null && clazz.equalsIgnoreCase(JSONTypes.STRING) ) {
|
||||
setTextValue(jsonObject, key, element);
|
||||
}else{
|
||||
if( isArray( element, false ) ){
|
||||
setOrAccumulate( jsonObject, key, processArrayElement( element, defaultType ) );
|
||||
@@ -1421,19 +1430,23 @@ public class XMLSerializer {
|
||||
setOrAccumulate( jsonObject, key, simplifyValue( jsonObject,
|
||||
processObjectElement( element, defaultType ) ) );
|
||||
}else{
|
||||
String value;
|
||||
if( isKeepCData && isCData( element ) ){
|
||||
value = "<![CDATA[" + element.getValue() + "]]>";
|
||||
}else{
|
||||
value = element.getValue();
|
||||
}
|
||||
setOrAccumulate( jsonObject, key, trimSpaceFromValue( value ) );
|
||||
setTextValue(jsonObject, key, element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setTextValue(final JSONObject jsonObject, final String key, final Element element) {
|
||||
String value;
|
||||
if( isKeepCData && isCData( element ) ){
|
||||
value = "<![CDATA[" + element.getValue() + "]]>";
|
||||
}else{
|
||||
value = element.getValue();
|
||||
}
|
||||
setOrAccumulate( jsonObject, key, trimSpaceFromValue( value ) );
|
||||
}
|
||||
|
||||
private boolean isCData( Element element ) {
|
||||
if( element.getChildCount() == 1 ){
|
||||
final Node child = element.getChild( 0 );
|
||||
@@ -1493,6 +1506,14 @@ public class XMLSerializer {
|
||||
return str;
|
||||
}
|
||||
|
||||
public void setUseEmptyStrings(boolean useEmptyStrings) {
|
||||
this.useEmptyStrings = useEmptyStrings;
|
||||
}
|
||||
|
||||
public boolean isUseEmptyStrings() {
|
||||
return this.useEmptyStrings;
|
||||
}
|
||||
|
||||
private static class CustomElement extends Element {
|
||||
private static String getName( String name ) {
|
||||
int colon = name.indexOf( ':' );
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<groupId>org.talend.components.lib</groupId>
|
||||
<artifactId>talendsap</artifactId>
|
||||
<name>talendsap</name>
|
||||
<version>1.0.1</version>
|
||||
<version>1.0.2</version>
|
||||
|
||||
<properties>
|
||||
<talend.nexus.url>https://artifacts-oss.talend.com</talend.nexus.url>
|
||||
|
||||
@@ -90,6 +90,7 @@ public class DocumentExtractor {
|
||||
List<Element> tablesAndChangingElements = new ArrayList<Element>(3);
|
||||
tablesAndChangingElements.add(functionElement.element("TABLES"));
|
||||
tablesAndChangingElements.add(functionElement.element("CHANGING"));
|
||||
tablesAndChangingElements.add(functionElement.element("OUTPUT"));
|
||||
|
||||
for(Element tablesOrChangingElement : tablesAndChangingElements) {
|
||||
if (tablesOrChangingElement == null) {
|
||||
@@ -121,6 +122,10 @@ public class DocumentExtractor {
|
||||
}
|
||||
result.add(row);
|
||||
}
|
||||
|
||||
if(!result.isEmpty()) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -49,11 +49,11 @@ public class DocumentHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public void addSingleParameter(String name, String value, boolean isChanging) {
|
||||
public void addSingleParameter(String name, String value, SAPParameterType parameter_type) {
|
||||
if(value == null) {
|
||||
value = "";
|
||||
}
|
||||
if (isChanging) {
|
||||
if (parameter_type == SAPParameterType.CHANGING) {
|
||||
correctChanging();
|
||||
changing.addElement(name).setText(value);
|
||||
} else {
|
||||
@@ -62,8 +62,8 @@ public class DocumentHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public void addStructParameter(String name, boolean isChanging) {
|
||||
if (isChanging) {
|
||||
public void addStructParameter(String name, SAPParameterType parameter_type) {
|
||||
if (parameter_type == SAPParameterType.CHANGING) {
|
||||
correctChanging();
|
||||
currentStruct = changing.addElement(name);
|
||||
} else {
|
||||
@@ -79,13 +79,16 @@ public class DocumentHelper {
|
||||
currentStruct.addElement(name).setText(value);
|
||||
}
|
||||
|
||||
public void addTableParameter(String name, boolean isChanging) {
|
||||
if (isChanging) {
|
||||
public void addTableParameter(String name, SAPParameterType parameter_type) {
|
||||
if (parameter_type == SAPParameterType.CHANGING) {
|
||||
correctChanging();
|
||||
currentTable = changing.addElement(name);
|
||||
} else {
|
||||
} else if(parameter_type == SAPParameterType.TABLES) {
|
||||
correctTables();
|
||||
currentTable = tables.addElement(name);
|
||||
} else {
|
||||
correctInput();
|
||||
currentTable = input.addElement(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,18 +111,18 @@ public class DocumentHelper {
|
||||
DocumentHelper helper = new DocumentHelper();
|
||||
helper.setFunctionName("READ_TABLE_FUNCTION");
|
||||
|
||||
helper.addSingleParameter("ID", "1", true);
|
||||
helper.addSingleParameter("NAME", "gaoyan", false);
|
||||
helper.addSingleParameter("ID", "1", SAPParameterType.CHANGING);
|
||||
helper.addSingleParameter("NAME", "gaoyan", SAPParameterType.IMPORT);
|
||||
|
||||
helper.addStructParameter("INFO", true);
|
||||
helper.addStructParameter("INFO", SAPParameterType.CHANGING);
|
||||
helper.addStructChildParameter("ID", "2");
|
||||
helper.addStructChildParameter("NAME", "wangwei");
|
||||
|
||||
helper.addStructParameter("INFO1", false);
|
||||
helper.addStructParameter("INFO1", SAPParameterType.IMPORT);
|
||||
helper.addStructChildParameter("ID1", "4");
|
||||
helper.addStructChildParameter("NAME1", "momo");
|
||||
|
||||
helper.addTableParameter("TABLE1", false);
|
||||
helper.addTableParameter("TABLE1", SAPParameterType.TABLES);
|
||||
for (int i = 0; i < 200000; i++) {
|
||||
helper.addTableRow();
|
||||
helper.addTableRowChildParameter("c1", i + "");
|
||||
@@ -132,7 +135,7 @@ public class DocumentHelper {
|
||||
helper.addTableRowChildParameter("c8", "wangwei" + i);
|
||||
}
|
||||
|
||||
helper.addTableParameter("TABLE2", false);
|
||||
helper.addTableParameter("TABLE2", SAPParameterType.TABLES);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
helper.addTableRow();
|
||||
helper.addTableRowChildParameter("ID4", i + "");
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.talend.sap;
|
||||
|
||||
public enum SAPParameterType {
|
||||
IMPORT,
|
||||
CHANGING,
|
||||
TABLES,
|
||||
EXPORT
|
||||
}
|
||||
@@ -46,7 +46,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.10</version>
|
||||
<version>1.19</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -55,4 +55,4 @@
|
||||
<version>6.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
</project>
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<groupId>org.talend.components.lib</groupId>
|
||||
<artifactId>thashfile</artifactId>
|
||||
<version>3.0-20170711</version>
|
||||
<version>3.1-20190910</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>thashfile</name>
|
||||
@@ -45,8 +45,8 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
||||
@@ -9,45 +9,44 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import org.talend.designer.components.hashfile.memory.AdvancedMemoryHashFile;
|
||||
|
||||
public class MapHashFile {
|
||||
//use this map instead of globalMap
|
||||
// use this map instead of globalMap
|
||||
private Map<String, AdvancedMemoryHashFile> resourceMap = new ConcurrentHashMap<>();
|
||||
//keep the present key of AdvancedMemoryHashFile as key and the previous key as value
|
||||
// keep the present key of AdvancedMemoryHashFile as key and the previous key as
|
||||
// value
|
||||
private Map<String, String> keyMap = new ConcurrentHashMap<>();
|
||||
//singleton
|
||||
// singleton
|
||||
private static final MapHashFile mhf = new MapHashFile();
|
||||
|
||||
public static TalendMultiThreadLockMap resourceLockMap = new TalendMultiThreadLockMap();
|
||||
public static TalendMultiThreadLockMap resourceLockMap = new TalendMultiThreadLockMap();
|
||||
|
||||
public static class TalendMultiThreadLockMap {
|
||||
public static class TalendMultiThreadLockMap {
|
||||
|
||||
private Map<Object, Object> tMultiTheadLockMap = new HashMap<Object, Object>();
|
||||
private Map<Object, Object> tMultiTheadLockMap = new ConcurrentHashMap<>();
|
||||
|
||||
public Object get(Object key) {
|
||||
return tMultiTheadLockMap.computeIfAbsent(key, k -> new Object());
|
||||
}
|
||||
|
||||
public void remove(Object key) {
|
||||
tMultiTheadLockMap.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized Object get(Object key) {
|
||||
if (tMultiTheadLockMap.get(key) == null) {
|
||||
tMultiTheadLockMap.put(key, new Object());
|
||||
}
|
||||
return tMultiTheadLockMap.get(key);
|
||||
}
|
||||
|
||||
public synchronized void remove(Object key){
|
||||
tMultiTheadLockMap.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
private MapHashFile() {
|
||||
}
|
||||
|
||||
public static MapHashFile getMapHashFile() {
|
||||
return mhf;
|
||||
}
|
||||
|
||||
//get the linked AdvancedMemoryHashFile
|
||||
|
||||
// get the linked AdvancedMemoryHashFile
|
||||
public AdvancedMemoryHashFile getAdvancedMemoryHashFile(String key) {
|
||||
AdvancedMemoryHashFile amhf = resourceMap.get(key);
|
||||
String prekey = keyMap.get(key);
|
||||
//if present AdvancedMemoryHashFile is null get the AdvancedMemoryHashFile before present.
|
||||
// if present AdvancedMemoryHashFile is null get the AdvancedMemoryHashFile
|
||||
// before present.
|
||||
int size = keyMap.size();
|
||||
while(amhf==null && (size--)>0){
|
||||
while (amhf == null && (size--) > 0) {
|
||||
amhf = resourceMap.get(prekey);
|
||||
prekey = keyMap.get(prekey);
|
||||
}
|
||||
@@ -61,16 +60,18 @@ public class MapHashFile {
|
||||
public Map<String, String> getKeyMap() {
|
||||
return keyMap;
|
||||
}
|
||||
public void clearCache(String key){
|
||||
|
||||
public void clearCache(String key) {
|
||||
clearChildCache(getRootCache(key));
|
||||
}
|
||||
public void clearChildCache(String root){
|
||||
|
||||
public void clearChildCache(String root) {
|
||||
Set<String> set = keyMap.keySet();
|
||||
synchronized(keyMap) {
|
||||
synchronized (keyMap) {
|
||||
Iterator<String> it = set.iterator();
|
||||
while(it.hasNext()){
|
||||
while (it.hasNext()) {
|
||||
String key = it.next();
|
||||
if(root.equals(keyMap.get(key))){
|
||||
if (root.equals(keyMap.get(key))) {
|
||||
this.resourceMap.remove(key);
|
||||
this.keyMap.remove(key);
|
||||
clearChildCache(key);
|
||||
@@ -79,11 +80,11 @@ public class MapHashFile {
|
||||
}
|
||||
this.resourceMap.remove(root);
|
||||
}
|
||||
|
||||
public String getRootCache(String cache){
|
||||
|
||||
public String getRootCache(String cache) {
|
||||
String root;
|
||||
while((root = keyMap.get(cache))!=null){
|
||||
cache=root;
|
||||
while ((root = keyMap.get(cache)) != null) {
|
||||
cache = root;
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
@@ -573,14 +573,15 @@
|
||||
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__"))) {
|
||||
%>
|
||||
loadJobBuilder_<%=cid%>.setFormatOptions(csvOptions_<%=cid%>.setFieldDelimiter(<%=fieldDelimiter%>).build());
|
||||
csvOptions_<%=cid%>.setFieldDelimiter(<%=fieldDelimiter%>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
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)));
|
||||
|
||||
@@ -21,7 +21,7 @@ class BigQueryUtil_<%=cid%> {
|
||||
private String genTempName(String prefix){
|
||||
return "temp_" + prefix + 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());
|
||||
}
|
||||
|
||||
|
||||
public void cleanup() throws Exception{
|
||||
if(useLargeResult){
|
||||
bigqueryclient.tables().delete(projectId, tempDataset, tempTable).execute();
|
||||
@@ -38,11 +38,11 @@ class BigQueryUtil_<%=cid%> {
|
||||
job.setConfiguration(config);
|
||||
List<com.google.api.services.bigquery.model.TableReference> referencedTables = bigqueryclient.jobs().insert(projectId, job).execute().getStatistics().getQuery().getReferencedTables();
|
||||
if(referencedTables != null && !referencedTables.isEmpty()) {
|
||||
location = bigqueryclient.tables().get(projectId, referencedTables.get(0).getDatasetId(), referencedTables.get(0).getTableId()).execute().getLocation();
|
||||
location = bigqueryclient.tables().get(referencedTables.get(0).getProjectId(), referencedTables.get(0).getDatasetId(), referencedTables.get(0).getTableId()).execute().getLocation();
|
||||
}
|
||||
return location;
|
||||
}
|
||||
|
||||
|
||||
private void createDataset(String location) throws Exception {
|
||||
com.google.api.services.bigquery.model.Dataset dataset = new com.google.api.services.bigquery.model.Dataset().setDatasetReference(new com.google.api.services.bigquery.model.DatasetReference().setProjectId(projectId).setDatasetId(tempDataset));
|
||||
if(location != null) {
|
||||
@@ -53,11 +53,11 @@ class BigQueryUtil_<%=cid%> {
|
||||
dataset.setDescription(description);
|
||||
bigqueryclient.datasets().insert(projectId, dataset).execute();
|
||||
}
|
||||
|
||||
|
||||
public com.google.api.services.bigquery.model.Job executeQuery(String query, boolean useLargeResult) throws Exception{
|
||||
return executeQuery(query, useLargeResult, true);
|
||||
}
|
||||
|
||||
|
||||
public com.google.api.services.bigquery.model.Job executeQuery(String query, boolean useLargeResult, boolean useLegacySql) throws Exception{
|
||||
com.google.api.services.bigquery.model.JobConfigurationQuery queryConfig = new com.google.api.services.bigquery.model.JobConfigurationQuery();
|
||||
queryConfig.setQuery(query);
|
||||
@@ -74,13 +74,13 @@ class BigQueryUtil_<%=cid%> {
|
||||
.setDatasetId(tempDataset)
|
||||
.setTableId(tempTable));
|
||||
}
|
||||
|
||||
|
||||
com.google.api.services.bigquery.model.JobConfiguration config = new com.google.api.services.bigquery.model.JobConfiguration();
|
||||
config.setQuery(queryConfig);
|
||||
|
||||
|
||||
com.google.api.services.bigquery.model.Job job = new com.google.api.services.bigquery.model.Job();
|
||||
job.setConfiguration(config);
|
||||
|
||||
|
||||
com.google.api.services.bigquery.model.Job insert = null;
|
||||
com.google.api.services.bigquery.model.JobReference jobId = null;
|
||||
try {
|
||||
@@ -122,7 +122,7 @@ class BigQueryUtil_<%=cid%> {
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
@@ -146,7 +146,7 @@ class BigQueryUtil_<%=cid%> {
|
||||
<%
|
||||
}
|
||||
%>
|
||||
return executeQuery(query, true);
|
||||
return executeQuery(query, true, useLegacySql);
|
||||
}
|
||||
<%}%>
|
||||
// Do not throw exception to avoid behavior changed(because it may throw "duplicate" exception which do not throw before);
|
||||
@@ -164,13 +164,13 @@ class BigQueryUtil_<%=cid%> {
|
||||
}// else job successful
|
||||
break;
|
||||
}
|
||||
// Pause execution for one second before polling job status again, to
|
||||
// Pause execution for one second before polling job status again, to
|
||||
// reduce unnecessary calls to the BigQUery API and lower overall
|
||||
// application bandwidth.
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
|
||||
|
||||
return insert;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,10 +221,9 @@
|
||||
}
|
||||
|
||||
String query_<%=cid%> = <%=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());
|
||||
<% if(isLog4jEnabled) { %>
|
||||
log.info("<%=cid%> - query " + <%=query%>);
|
||||
<% } %>
|
||||
|
||||
com.google.cloud.bigquery.BigQuery bigquery_<%=cid%> = com.google.cloud.bigquery.BigQueryOptions.newBuilder()
|
||||
.setCredentials(credentials_<%=cid%>)
|
||||
@@ -233,25 +232,55 @@
|
||||
.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(isLog4jEnabled){
|
||||
%>
|
||||
<%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) { %>
|
||||
log.info("<%=cid%> - Sending job " + jobId_<%=cid%> + " with query: " + <%=query%>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<% } %>
|
||||
|
||||
job_<%=cid%> = job_<%=cid%>.waitFor();
|
||||
|
||||
if (job_<%=cid%> == null) {
|
||||
@@ -260,13 +289,9 @@
|
||||
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;
|
||||
<%
|
||||
|
||||
@@ -10,7 +10,10 @@ imports="
|
||||
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
|
||||
INode node = (INode)codeGenArgument.getArgument();
|
||||
String cid = node.getUniqueName();
|
||||
String authMode = ElementParameterParser.getValue(node,"__AUTH_MODE__");
|
||||
String authMode = ElementParameterParser.getValue(node,"__AUTH_MODE__");
|
||||
String projectId = ElementParameterParser.getValue(node,"__PROJECT_ID__");
|
||||
String resultSizeType = ElementParameterParser.getValue(node,"__RESULT_SIZE__");
|
||||
|
||||
if (authMode.equals("OAUTH")) {
|
||||
%>
|
||||
}
|
||||
@@ -24,7 +27,10 @@ imports="
|
||||
} else if (authMode.equals("SERVICEACCOUNT")) {
|
||||
%>
|
||||
}
|
||||
bigquery_<%=cid%>.delete(com.google.cloud.bigquery.TableId.of(dataset, temp_table));
|
||||
<% 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());
|
||||
<% }%>
|
||||
<%
|
||||
} else {
|
||||
throw new IllegalArgumentException("authentication mode should be either \"SERVICEACCOUNT\" or \"OAUTH\", but it is " + authMode);
|
||||
|
||||
@@ -898,7 +898,7 @@
|
||||
<IMPORT NAME="Driver-VERTICA_7.0.1" MODULE="vertica-jdbc-7.0.1-0.jar" MVN="mvn:org.talend.libraries/vertica-jdbc-7.0.1-0/6.0.0" REQUIRED_IF="(DBTYPE=='VERTICA') and (USE_EXISTING_CONNECTION == 'false') and (DB_VERTICA_VERSION=='VERTICA_7_0_X')" />
|
||||
<IMPORT NAME="Driver-VERTICA_7.1.2" MODULE="vertica-jdbc-7.1.2-0.jar" MVN="mvn:org.talend.libraries/vertica-jdbc-7.1.2-0/6.0.0" REQUIRED_IF="(DBTYPE=='VERTICA') and (USE_EXISTING_CONNECTION == 'false') and (DB_VERTICA_VERSION=='VERTICA_7_1_X')" />
|
||||
<IMPORT NAME="Driver-EXASolution" MODULE="exajdbc-6.0.9302.jar" MVN="mvn:org.talend.libraries/exajdbc-6.0.9302/6.3.0" REQUIRED_IF="(DBTYPE=='EXASOL') and (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Driver-Redshift" MODULE="redshift-jdbc42-no-awssdk-1.2.20.1043.jar" MVN="mvn:com.amazon.redshift/redshift-jdbc42-no-awssdk/1.2.20.1043" REQUIRED_IF="(DBTYPE=='REDSHIFT') and (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Driver-Redshift" MODULE="redshift-jdbc42-no-awssdk-1.2.32.1056.jar" MVN="mvn:com.amazon.redshift/redshift-jdbc42-no-awssdk/1.2.32.1056" REQUIRED_IF="(DBTYPE=='REDSHIFT') and (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Driver-Snowflake" MODULE="snowflake-jdbc-3.5.3.jar" MVN="mvn:net.snowflake/snowflake-jdbc/3.5.3" REQUIRED_IF="(DBTYPE=='SNOWFLAKE') and (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Driver-VERTICA_9.0" MODULE="vertica-jdbc-9.0.0-0.jar" MVN="mvn:org.talend.libraries/vertica-jdbc-9.0.0-0/6.0.0" REQUIRED_IF="(DBTYPE=='VERTICA') and (USE_EXISTING_CONNECTION == 'false') and (DB_VERTICA_VERSION=='VERTICA_9_0')"/>
|
||||
</IMPORTS>
|
||||
|
||||
@@ -45,8 +45,8 @@ String xmlfile = ElementParameterParser.getValue(node, "__XMLFILE__");
|
||||
java.lang.StringBuilder sb<%=cid %>=new java.lang.StringBuilder("");
|
||||
|
||||
try{
|
||||
br<%=cid %> = new java.io.BufferedReader(new java.io.InputStreamReader(url<%=cid %>.openStream()));
|
||||
|
||||
br<%=cid %> = new java.io.BufferedReader(new UnicodeReader(url<%=cid %>.openStream(), null));
|
||||
|
||||
char[] buffer<%=cid %> = new char[1024];
|
||||
int length<%=cid %> = -1;
|
||||
while ((length<%=cid %> = br<%=cid %>.read(buffer<%=cid %>)) != -1)
|
||||
@@ -66,7 +66,9 @@ String xmlfile = ElementParameterParser.getValue(node, "__XMLFILE__");
|
||||
dbf<%=cid %> = javax.xml.parsers.DocumentBuilderFactory.newInstance();
|
||||
dbf<%=cid %>.setValidating(false);
|
||||
db<%=cid %> = dbf<%=cid %>.newDocumentBuilder();
|
||||
org.w3c.dom.Document doc<%=cid %> = db<%=cid %>.parse(new java.io.StringBufferInputStream(sb<%=cid%>.toString()));
|
||||
org.w3c.dom.Document doc<%=cid %> = db<%=cid %>.parse(
|
||||
new java.io.ByteArrayInputStream(sb<%=cid%>.toString().getBytes("UTF-8")));
|
||||
|
||||
String rootnode<%=cid %>=doc<%=cid %>.getDocumentElement().getNodeName();
|
||||
|
||||
String encoding=null;
|
||||
@@ -89,8 +91,8 @@ String xmlfile = ElementParameterParser.getValue(node, "__XMLFILE__");
|
||||
|
||||
int offsetRoot<%=cid %>=sb<%=cid %>.indexOf("<"+rootnode<%=cid %>);
|
||||
sb<%=cid%>.replace(0, offsetRoot<%=cid %>, reference<%=cid %>);
|
||||
is<%=cid %>=new java.io.StringBufferInputStream(sb<%=cid %>.toString());
|
||||
|
||||
is<%=cid %> = new java.io.ByteArrayInputStream(sb<%=cid%>.toString().getBytes("UTF-8"));
|
||||
|
||||
class MyHandler<%=cid %> extends org.xml.sax.helpers.DefaultHandler{
|
||||
String errorMessage = null;
|
||||
public void error(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException {
|
||||
|
||||
@@ -305,48 +305,54 @@ 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)) {
|
||||
%>
|
||||
+" WHERE " + <%=CodeGenerationUtils.replaceAllCrBySpace(whereClause)%>
|
||||
+" AND " + <%=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;
|
||||
|
||||
@@ -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
|
||||
USE_UPDATE_STATEMENT.NAME=Use update statement without subqueries
|
||||
@@ -181,6 +181,17 @@
|
||||
</PARAMETER>
|
||||
|
||||
</PARAMETERS>
|
||||
|
||||
<ADVANCED_PARAMETERS>
|
||||
<PARAMETER
|
||||
NAME="PROPERTIES"
|
||||
FIELD="TEXT"
|
||||
NUM_ROW="1"
|
||||
REPOSITORY_VALUE="PROPERTIES_STRING"
|
||||
SHOW_IF="(#LINK@CONNECTOR.OUT.TABLE_REF == '0') AND (USE_EXISTING_CONNECTION == 'false')">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
</ADVANCED_PARAMETERS>
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
|
||||
@@ -48,4 +48,5 @@ DB_VERSION.ITEM.MYSQL_5=Mysql 5
|
||||
DB_VERSION.ITEM.MYSQL_8=Mysql 8
|
||||
DB_VERSION.ITEM.MARIADB=MariaDB
|
||||
|
||||
PROPERTIES.NAME=Additional JDBC Parameters
|
||||
CONNECTION.NAME=Component List
|
||||
@@ -52,6 +52,7 @@ imports="
|
||||
String dbuser = null;
|
||||
String dbVersion = "";
|
||||
boolean useExistingConn = false;
|
||||
String dbproperties = null;
|
||||
if(previousNode != null) {
|
||||
dbhost = ElementParameterParser.getValue(previousNode, "__HOST__");
|
||||
dbport = ElementParameterParser.getValue(previousNode, "__PORT__");
|
||||
@@ -59,6 +60,7 @@ imports="
|
||||
dbuser = ElementParameterParser.getValue(previousNode, "__USER__");
|
||||
useExistingConn = ("true").equals(ElementParameterParser.getValue(previousNode, "__USE_EXISTING_CONNECTION__"));
|
||||
dbVersion = ElementParameterParser.getValue(previousNode, "__DB_VERSION__");
|
||||
dbproperties = ElementParameterParser.getValue(previousNode, "__PROPERTIES__");
|
||||
}
|
||||
|
||||
String differenttable = ElementParameterParser.getValue(node, "__DIFFERENT_TABLE_NAME__");
|
||||
@@ -96,7 +98,11 @@ imports="
|
||||
%>
|
||||
String driverClass_<%=cid%> = "<%=drverClass%>";
|
||||
java.lang.Class.forName(driverClass_<%=cid%>);
|
||||
<%if(dbproperties == null || ("\"\"").equals(dbproperties) || ("").equals(dbproperties)) {%>
|
||||
String url_<%=cid %> = "<%=jdbcURL%>://"+<%=dbhost%>+":"+<%=dbport%>+"/"+<%=dbname%>;
|
||||
<%} else {%>
|
||||
String url_<%=cid %> = "<%=jdbcURL%>://"+<%=dbhost%>+":"+<%=dbport%>+"/"+<%=dbname%>+"?"+<%=dbproperties%>;
|
||||
<%}%>
|
||||
String dbUser_<%=cid%> = <%=dbuser%>;
|
||||
|
||||
<%
|
||||
|
||||
@@ -140,7 +140,15 @@
|
||||
|
||||
</PARAMETERS>
|
||||
|
||||
<ADVANCED_PARAMETERS>
|
||||
<ADVANCED_PARAMETERS>
|
||||
<PARAMETER
|
||||
NAME="USE_UPDATE_STATEMENT"
|
||||
FIELD="CHECK"
|
||||
NUM_ROW="10"
|
||||
SHOW_IF="DATA_ACTION=='UPDATE'"
|
||||
>
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
</ADVANCED_PARAMETERS>
|
||||
|
||||
<CODEGENERATION>
|
||||
|
||||
@@ -35,6 +35,7 @@ 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;
|
||||
@@ -156,21 +157,36 @@ 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)){
|
||||
%>
|
||||
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)){
|
||||
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)%>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
;
|
||||
<%
|
||||
}
|
||||
} else if (("DELETE").equals(dataAction)){
|
||||
%>
|
||||
String deleteQuery_<%=cid %> = "DELETE FROM "+ tableName_<%=cid%>+" WHERE EXISTS ("+select_query_<%=cid %>+") "
|
||||
|
||||
@@ -40,4 +40,6 @@ 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
|
||||
TABLE_ACTION.NAME=Action on table
|
||||
|
||||
USE_UPDATE_STATEMENT.NAME=Use update statement without subqueries
|
||||
@@ -178,7 +178,7 @@
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Java_DOM4J1.6" MODULE="dom4j-1.6.1.jar" MVN="mvn:dom4j/dom4j/1.6.1" UrlPath="platform:/plugin/org.talend.libraries.dom4j-jaxen/lib/dom4j-1.6.1.jar" REQUIRED_IF="READ_BY == 'XPATH'" BundleID="" />
|
||||
<IMPORT NAME="Java_JAXEN1.1" MODULE="jaxen-1.1.1.jar" MVN="mvn:org.talend.libraries/jaxen-1.1.1/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.dom4j-jaxen/lib/jaxen-1.1.1.jar" REQUIRED_IF="READ_BY == 'XPATH'" BundleID="" />
|
||||
<IMPORT NAME="json-lib" MODULE="json-lib-2.4.2-talend.jar" MVN="mvn:net.sf.json-lib/json-lib/2.4.2-talend" REQUIRED_IF="READ_BY == 'XPATH'" />
|
||||
<IMPORT NAME="json-lib" MODULE="json-lib-2.4.3-talend.jar" MVN="mvn:net.sf.json-lib/json-lib/2.4.3-talend" REQUIRED_IF="READ_BY == 'XPATH'" />
|
||||
<IMPORT NAME="commons_lang" MODULE="commons-lang-2.6.jar" MVN="mvn:commons-lang/commons-lang/2.6" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-lang-2.6.jar" REQUIRED_IF="READ_BY == 'XPATH'" />
|
||||
<IMPORT NAME="commons_logging" MODULE="commons-logging-1.1.1.jar" MVN="mvn:org.talend.libraries/commons-logging-1.1.1/6.0.0" UrlPath="platform:/base/plugins/org.apache.commons.logging_1.1.1.v201101211721.jar" REQUIRED_IF="READ_BY == 'XPATH'" />
|
||||
<IMPORT NAME="ezmorph" MODULE="ezmorph-1.0.6.jar" MVN="mvn:org.talend.libraries/ezmorph-1.0.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/ezmorph-1.0.6.jar" REQUIRED_IF="READ_BY == 'XPATH'" />
|
||||
|
||||
@@ -433,8 +433,8 @@ if (sftp) {// *** sftp *** //
|
||||
<%}%>
|
||||
String remotedir_<%=cid %> = (<%=remotedir%>).replaceAll("\\\\","/");
|
||||
ftp_<%=cid %>.chdir(remotedir_<%=cid %>);
|
||||
String[] fileList_<%=cid %> = ftp_<%=cid %>.dir(null, true);
|
||||
String[] fileListwithNames_<%=cid %> = ftp_<%=cid %>.dir(null, false);
|
||||
com.enterprisedt.net.ftp.FTPFile[] fileList_<%=cid %> = ftp_<%=cid %>.dirDetails(null);
|
||||
String[] arrayWithNames_<%=cid %> = ftp_<%=cid %>.dir(null, false);
|
||||
<%
|
||||
if (("true").equals(useExistingConn)) {
|
||||
if(!moveToCurrentDir){
|
||||
@@ -445,17 +445,22 @@ if (sftp) {// *** sftp *** //
|
||||
}
|
||||
%>
|
||||
List<String> fileListTemp_<%=cid %> = new java.util.ArrayList<String>();
|
||||
List<String> fileListTempWithNames_<%=cid %> = new java.util.ArrayList<String>();
|
||||
List<String> fileListTempWithNames_<%=cid %> = new java.util.ArrayList<String>();
|
||||
|
||||
for (String filemask_<%=cid %> : maskList_<%=cid %>) {
|
||||
java.util.regex.Pattern fileNamePattern_<%=cid %> = java.util.regex.Pattern.compile(filemask_<%=cid %>.replaceAll("\\.", "\\\\.").replaceAll("\\*", ".*"));
|
||||
for (int i_<%=cid%> = 0; i_<%=cid%> < fileList_<%=cid%>.length; i_<%=cid%>++){
|
||||
String filemaskTemp_<%=cid%> = fileList_<%=cid%>[i_<%=cid%>];
|
||||
String filemaskTempName_<%=cid%> = fileListwithNames_<%=cid%>[i_<%=cid%>];
|
||||
|
||||
if (fileNamePattern_<%=cid %>.matcher(filemaskTempName_<%=cid %>).matches()) {
|
||||
fileListTemp_<%=cid %>.add(filemaskTemp_<%=cid %>);
|
||||
fileListTempWithNames_<%=cid%>.add(fileListwithNames_<%=cid%>[i_<%=cid%>]);
|
||||
|
||||
java.util.Set<String> setWithNames_<%=cid %> = new java.util.HashSet<>(java.util.Arrays.asList(arrayWithNames_<%=cid %>));
|
||||
for (com.enterprisedt.net.ftp.FTPFile ftpFile : fileList_<%=cid %>){
|
||||
String filemaskTemp_<%=cid%> = "";
|
||||
String filemaskTempName_<%=cid%> = "";
|
||||
if (setWithNames_<%=cid %>.contains(ftpFile.getName())){
|
||||
filemaskTemp_<%=cid%> = ftpFile.getRaw();
|
||||
filemaskTempName_<%=cid%> = ftpFile.getName();
|
||||
if (fileNamePattern_<%=cid %>.matcher(filemaskTempName_<%=cid %>).matches()) {
|
||||
fileListTemp_<%=cid %>.add(filemaskTemp_<%=cid %>);
|
||||
fileListTempWithNames_<%=cid%>.add(filemaskTempName_<%=cid%>);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="COMMONS-COMPRESS-1.10" MODULE="commons-compress-1.10.jar" MVN="mvn:org.talend.libraries/commons-compress-1.10/6.1.0" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-compress-1.10.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="commons-compress" MODULE="commons-compress-1.19.jar" MVN="mvn:org.apache.commons/commons-compress/1.19" REQUIRED="true" />
|
||||
<IMPORT NAME="Encrypt-Zip" MODULE="checkArchive-1.1-20181130.jar" MVN="mvn:org.talend.libraries/checkArchive-1.1-20181130/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/checkArchive-1.1-20181130.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="zip4j_1.3.1.jar" MODULE="zip4j_1.3.1.jar" MVN="mvn:org.talend.libraries/zip4j_1.3.1/6.0.0" REQUIRED="true" />
|
||||
<IMPORT NAME="talendzip-1.0-20190527.jar" MODULE="talendzip-1.0-20190527.jar" MVN="mvn:org.talend.libraries/talendzip/1.0-20190527" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talendzip-1.0-20190527.jar" REQUIRED="true" />
|
||||
|
||||
@@ -185,7 +185,7 @@
|
||||
<IMPORT NAME="simpleexcel" MODULE="simpleexcel-2.1-20190507.jar" MVN="mvn:org.talend.libraries/simpleexcel-2.1-20190507/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/simpleexcel-2.1-20190507.jar" REQUIRED_IF="(VERSION_2007 == 'true') AND GENERATION_MODE == 'EVENT_MODE')" />
|
||||
<IMPORT NAME="commons-collections4" MODULE="commons-collections4-4.1.jar" MVN="mvn:org.talend.libraries/commons-collections4-4.1/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/commons-collections4-4.1.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
|
||||
<IMPORT NAME="commons-compress" MODULE="commons-compress-1.18.jar" MVN="mvn:org.apache.commons/commons-compress/1.18" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="commons-compress" MODULE="commons-compress-1.19.jar" MVN="mvn:org.apache.commons/commons-compress/1.19" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="commons-math3" MODULE="commons-math3-3.6.1.jar" MVN="mvn:org.apache.commons/commons-math3/3.6.1" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -165,7 +165,7 @@
|
||||
REQUIRED_IF="(READ_BY == 'XPATH')" BundleID="" />
|
||||
<IMPORT NAME="Java_JAXEN1.1" MODULE="jaxen-1.1.1.jar" MVN="mvn:org.talend.libraries/jaxen-1.1.1/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.dom4j-jaxen/lib/jaxen-1.1.1.jar"
|
||||
REQUIRED_IF="(READ_BY == 'XPATH')" BundleID="" />
|
||||
<IMPORT NAME="json-lib" MODULE="json-lib-2.4.2-talend.jar" MVN="mvn:net.sf.json-lib/json-lib/2.4.2-talend" REQUIRED_IF="(READ_BY == 'XPATH')" />
|
||||
<IMPORT NAME="json-lib" MODULE="json-lib-2.4.3-talend.jar" MVN="mvn:net.sf.json-lib/json-lib/2.4.3-talend" REQUIRED_IF="(READ_BY == 'XPATH')" />
|
||||
<IMPORT NAME="commons_lang" MODULE="commons-lang-2.6.jar" MVN="mvn:commons-lang/commons-lang/2.6" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-lang-2.6.jar"
|
||||
REQUIRED_IF="(READ_BY == 'XPATH')" />
|
||||
<IMPORT NAME="commons_logging" MODULE="commons-logging-1.1.1.jar" MVN="mvn:org.talend.libraries/commons-logging-1.1.1/6.0.0" UrlPath="platform:/base/plugins/org.apache.commons.logging_1.1.1.v201101211721.jar"
|
||||
|
||||
@@ -76,8 +76,10 @@
|
||||
String part_<%=cid %> = mailParts_<%=cid %>[i_<%=cid %>];
|
||||
String sep_<%=cid%>= mailSeparator_<%=cid %>[i_<%=cid %>];
|
||||
if(part_<%=cid %>.equalsIgnoreCase("body")) {
|
||||
boolean multiValueBody_<%=cid%> = ("true").equals(mailChecked_<%=cid %>[i_<%=cid%>]);
|
||||
if(msg_<%=cid %>.isMimeType("multipart/*")) {
|
||||
javax.mail.Multipart mp<%=cid%> = (javax.mail.Multipart) msg_<%=cid %>.getContent();
|
||||
StringBuilder body_<%=cid %> = new StringBuilder();
|
||||
for (int i = 0; i < mp<%=cid%>.getCount(); i++) {
|
||||
javax.mail.BodyPart mpart<%=cid%> = mp<%=cid%>.getBodyPart(i);
|
||||
String disposition<%=cid%> = mpart<%=cid%>.getDisposition();
|
||||
@@ -99,26 +101,42 @@
|
||||
for(int j_<%=cid %>_body = 0; j_<%=cid %>_body < mimeMultipart_<%=cid %>_body.getCount(); j_<%=cid %>_body++){
|
||||
javax.mail.BodyPart bodyPart_<%=cid %>_body = mimeMultipart_<%=cid %>_body.getBodyPart(j_<%=cid %>_body);
|
||||
if (bodyPart_<%=cid %>_body.isMimeType("text/*")) {
|
||||
list_<%=cid %>.add(bodyPart_<%=cid %>_body.getContent().toString());
|
||||
if(multiValueBody_<%=cid%>) {
|
||||
body_<%=cid %>.append(bodyPart_<%=cid %>_body.getContent().toString()).append(sep_<%=cid%>);
|
||||
} else {
|
||||
list_<%=cid %>.add(bodyPart_<%=cid %>_body.getContent().toString());
|
||||
}
|
||||
} else {
|
||||
System.out.println("Ignore the part " + bodyPart_<%=cid %>_body.getContentType());
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if (bodyPart_<%=cid %>.isMimeType("text/*")) {
|
||||
list_<%=cid %>.add(bodyPart_<%=cid %>.getContent().toString());
|
||||
if(multiValueBody_<%=cid%>) {
|
||||
body_<%=cid %>.append(bodyPart_<%=cid %>.getContent().toString()).append(sep_<%=cid%>);
|
||||
} else {
|
||||
list_<%=cid %>.add(bodyPart_<%=cid %>.getContent().toString());
|
||||
}
|
||||
} else {
|
||||
System.out.println("Ignore the part " + bodyPart_<%=cid %>.getContentType());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
list_<%=cid %>.add(mpart<%=cid%>.getContent().toString());
|
||||
if(multiValueBody_<%=cid%>) {
|
||||
body_<%=cid %>.append(mpart<%=cid%>.getContent().toString()).append(sep_<%=cid%>);
|
||||
} else {
|
||||
list_<%=cid %>.add(mpart<%=cid%>.getContent().toString());
|
||||
}
|
||||
}
|
||||
}catch (java.io.UnsupportedEncodingException e){
|
||||
java.io.ByteArrayOutputStream bao_<%=cid%> = new java.io.ByteArrayOutputStream();
|
||||
mpart<%=cid %>.writeTo(bao_<%=cid%>);
|
||||
list_<%=cid %>.add(bao_<%=cid%>.toString());
|
||||
if(multiValueBody_<%=cid%>) {
|
||||
body_<%=cid %>.append(bao_<%=cid%>.toString()).append(sep_<%=cid%>);
|
||||
} else {
|
||||
list_<%=cid %>.add(bao_<%=cid%>.toString());
|
||||
}
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.warn("<%=cid%> - " + bao_<%=cid%>.toString());
|
||||
<%}%>
|
||||
@@ -127,9 +145,16 @@
|
||||
//both attachment and message context in the email,bug TDI-19065
|
||||
%>
|
||||
}else if(disposition<%=cid%> != null && disposition<%=cid%>.equals(javax.mail.Part.INLINE)){
|
||||
list_<%=cid %>.add(mpart<%=cid%>.getContent().toString());
|
||||
if(multiValueBody_<%=cid%>) {
|
||||
body_<%=cid %>.append(mpart<%=cid%>.getContent().toString()).append(sep_<%=cid%>);
|
||||
} else {
|
||||
list_<%=cid %>.add(mpart<%=cid%>.getContent().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
if(multiValueBody_<%=cid%>) {
|
||||
list_<%=cid %>.add(body_<%=cid %>.toString());
|
||||
}
|
||||
} else {
|
||||
java.io.InputStream in_<%=cid %> = msg_<%=cid %>.getInputStream();
|
||||
byte[] buffer_<%=cid %> = new byte[1024];
|
||||
|
||||
@@ -232,7 +232,7 @@
|
||||
<IMPORT NAME="xmlbeans" MODULE="xmlbeans-3.1.0.jar" MVN="mvn:org.apache.xmlbeans/xmlbeans/3.1.0" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="commons-collections4" MODULE="commons-collections4-4.1.jar" MVN="mvn:org.talend.libraries/commons-collections4-4.1/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/commons-collections4-4.1.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
|
||||
<IMPORT NAME="commons-compress" MODULE="commons-compress-1.18.jar" MVN="mvn:org.apache.commons/commons-compress/1.18" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="commons-compress" MODULE="commons-compress-1.19.jar" MVN="mvn:org.apache.commons/commons-compress/1.19" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="commons-math3" MODULE="commons-math3-3.6.1.jar" MVN="mvn:org.apache.commons/commons-math3/3.6.1" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="COMMONS-COMPRESS-1.10" MODULE="commons-compress-1.10.jar" MVN="mvn:org.talend.libraries/commons-compress-1.10/6.1.0" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-compress-1.10.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="commons-compress" MODULE="commons-compress-1.19.jar" MVN="mvn:org.apache.commons/commons-compress/1.19" REQUIRED="true" />
|
||||
<IMPORT NAME="Ant-Zip" MODULE="ant-1.10.1.jar" MVN="mvn:org.apache.ant/ant/1.10.1" REQUIRED="true" />
|
||||
<IMPORT NAME="Check-Archive" MODULE="checkArchive-1.1-20181130.jar" MVN="mvn:org.talend.libraries/checkArchive-1.1-20181130/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/checkArchive-1.1-20181130.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="zip4j_1.3.1.jar" MODULE="zip4j_1.3.1.jar" MVN="mvn:org.talend.libraries/zip4j_1.3.1/6.0.0" REQUIRED="true" />
|
||||
|
||||
@@ -13,9 +13,22 @@
|
||||
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){%>
|
||||
<% if((confLib != null && confLib.length() > 0) || setHadoopConf){%>
|
||||
|
||||
String libPath_<%=cid %> = "";
|
||||
|
||||
<% if (setHadoopConf) { %>
|
||||
|
||||
libPath_<%=cid %> = <%=customHadoopConfPath %>;
|
||||
|
||||
<% } else { %>
|
||||
|
||||
class DealJobLibrary_<%=cid%> {
|
||||
|
||||
@@ -75,14 +88,9 @@ 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 {
|
||||
@@ -90,6 +98,11 @@ String libPath_<%=cid %> = "";
|
||||
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() });
|
||||
|
||||
<%}%>
|
||||
|
||||
@@ -42,6 +42,12 @@
|
||||
>
|
||||
<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>
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="thashfile-3.0-20170711" MODULE="thashfile-3.0-20170711.jar" MVN="mvn:org.talend.libraries/thashfile-3.0-20170711/6.0.0" REQUIRED="true" />
|
||||
<IMPORT NAME="thashfile-3.1-20190910" MODULE="thashfile-3.1-20190910.jar" MVN="mvn:org.talend.components.lib/thashfile/3.1-20190910" REQUIRED="true" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="thashfile-3.0-20170711" MODULE="thashfile-3.0-20170711.jar" MVN="mvn:org.talend.libraries/thashfile-3.0-20170711/6.0.0" REQUIRED="true" />
|
||||
<IMPORT NAME="thashfile-3.1-20190910" MODULE="thashfile-3.1-20190910.jar" MVN="mvn:org.talend.components.lib/thashfile/3.1-20190910" REQUIRED="true" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -17,17 +17,20 @@
|
||||
|
||||
<% 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 %>);
|
||||
<%}%>
|
||||
|
||||
|
||||
@@ -454,8 +454,15 @@ for (int iInputTable = 0; iInputTable < sizeInputTables - 1; iInputTable++) { //
|
||||
IMetadataTable table = connection.getMetadataTable();
|
||||
List<IMetadataColumn> listColumns = table.getListColumns();
|
||||
for (IMetadataColumn column : listColumns) {
|
||||
%>this.<%= connection.getName() %>__<%= column.getLabel() %> = <%= connection.getName() %>.<%= column.getLabel() %>;
|
||||
if ("Dynamic".equals(JavaTypesManager.getTypeToGenerate(column.getTalendType(), column.isNullable()))) {
|
||||
%>
|
||||
this.<%= connection.getName() %>__<%= column.getLabel() %> = (routines.system.Dynamic) <%= connection.getName() %>.<%= column.getLabel() %>.clone();
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
this.<%= connection.getName() %>__<%= column.getLabel() %> = <%= connection.getName() %>.<%= column.getLabel() %>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
@@ -463,10 +470,15 @@ for (int iInputTable = 0; iInputTable < sizeInputTables - 1; iInputTable++) { //
|
||||
sizeNextColumns = nextColumnsKeys.size();
|
||||
for (int iColumn = 0; iColumn < sizeNextColumns; iColumn++) { // T_TM_B_104
|
||||
IMetadataColumn column = nextColumnsKeys.get(iColumn);
|
||||
|
||||
%>this.exprKey_<%= nextInputTable.getName() %>__<%=column.getLabel() %> = exprKey_<%= nextInputTable.getName() %>__<%=column.getLabel() %>;
|
||||
if ("Dynamic".equals(JavaTypesManager.getTypeToGenerate(column.getTalendType(), column.isNullable()))) {
|
||||
%>
|
||||
this.exprKey_<%= nextInputTable.getName() %>__<%=column.getLabel() %> = (routines.system.Dynamic) exprKey_<%= nextInputTable.getName() %>__<%=column.getLabel() %>.clone();
|
||||
<%
|
||||
|
||||
} else {
|
||||
%>
|
||||
this.exprKey_<%= nextInputTable.getName() %>__<%=column.getLabel() %> = exprKey_<%= nextInputTable.getName() %>__<%=column.getLabel() %>;
|
||||
<%
|
||||
}
|
||||
} // T_TM_B_104
|
||||
%>
|
||||
}
|
||||
@@ -653,14 +665,25 @@ for (int iInputTable = 0; iInputTable < sizeInputTables - 1; iInputTable++) { //
|
||||
|
||||
<%
|
||||
} else {
|
||||
typeToGenerate =JavaTypesManager.getTypeToGenerate(column.getTalendType(), false);
|
||||
typeToGenerate=typeToGenerate.substring(0,1).toUpperCase()+typeToGenerate.substring(1);
|
||||
typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getTalendType(), false);
|
||||
typeToGenerate = typeToGenerate.substring(0,1).toUpperCase()+typeToGenerate.substring(1);
|
||||
%>
|
||||
length = dis.readByte();
|
||||
if (length == -1) {
|
||||
this.<%= connection.getName() %>__<%= column.getLabel() %> = null;
|
||||
} else {
|
||||
this.<%= connection.getName() %>__<%= column.getLabel() %> = dis.read<%= typeToGenerate %>();
|
||||
<%
|
||||
if ("Dynamic".equals(typeToGenerate)) {
|
||||
hasAtLeastOneObjectType = true;
|
||||
%>
|
||||
this.<%= connection.getName() %>__<%= column.getLabel() %> = (<%= typeToGenerate %>) dis.readObject();
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
this.<%= connection.getName() %>__<%= column.getLabel() %> = dis.read<%= typeToGenerate %>();
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
}
|
||||
@@ -727,14 +750,25 @@ for (int iInputTable = 0; iInputTable < sizeInputTables - 1; iInputTable++) { //
|
||||
|
||||
<%
|
||||
} else {
|
||||
typeToGenerate =JavaTypesManager.getTypeToGenerate(column.getTalendType(), false);
|
||||
typeToGenerate=typeToGenerate.substring(0,1).toUpperCase()+typeToGenerate.substring(1);
|
||||
typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getTalendType(), false);
|
||||
typeToGenerate = typeToGenerate.substring(0,1).toUpperCase()+typeToGenerate.substring(1);
|
||||
%>
|
||||
length = dis.readByte();
|
||||
if (length == -1) {
|
||||
this.exprKey_<%= nextInputTable.getName() %>__<%= column.getLabel() %> = null;
|
||||
} else {
|
||||
this.exprKey_<%= nextInputTable.getName() %>__<%= column.getLabel() %> = dis.read<%= typeToGenerate %>();
|
||||
<%
|
||||
if ("Dynamic".equals(typeToGenerate)) {
|
||||
hasAtLeastOneObjectType = true;
|
||||
%>
|
||||
this.exprKey_<%= nextInputTable.getName() %>__<%= column.getLabel() %> = (<%= typeToGenerate %>) dis.readObject();
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
this.exprKey_<%= nextInputTable.getName() %>__<%= column.getLabel() %> = dis.read<%= typeToGenerate %>();
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
}
|
||||
@@ -832,7 +866,17 @@ for (int iInputTable = 0; iInputTable < sizeInputTables - 1; iInputTable++) { //
|
||||
dos.writeByte(-1);
|
||||
} else {
|
||||
dos.writeByte(0);
|
||||
dos.write<%= typeToGenerate %>(this.<%= connection.getName() %>__<%= column.getLabel() %>);
|
||||
<%
|
||||
if ("Dynamic".equals(typeToGenerate)) {
|
||||
%>
|
||||
dos.writeObject(this.<%= connection.getName() %>__<%= column.getLabel() %>);
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
dos.write<%= typeToGenerate %>(this.<%= connection.getName() %>__<%= column.getLabel() %>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
|
||||
@@ -893,7 +937,17 @@ for (int iInputTable = 0; iInputTable < sizeInputTables - 1; iInputTable++) { //
|
||||
dos.writeByte(-1);
|
||||
} else {
|
||||
dos.writeByte(0);
|
||||
dos.write<%= typeToGenerate %>(this.exprKey_<%= nextInputTable.getName() %>__<%= column.getLabel() %>);
|
||||
<%
|
||||
if ("Dynamic".equals(typeToGenerate)) {
|
||||
%>
|
||||
dos.writeObject(this.exprKey_<%= nextInputTable.getName() %>__<%= column.getLabel() %>);
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
dos.write<%= typeToGenerate %>(this.exprKey_<%= nextInputTable.getName() %>__<%= column.getLabel() %>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
|
||||
|
||||
@@ -751,7 +751,7 @@
|
||||
boolean javaPrimitiveKeyColumn = JavaTypesManager.isJavaPrimitiveType(typeToGenerate);
|
||||
|
||||
aKeysValues[iKeyName] = getExpressionWithAutoConvertFunction(aKeysValues[iKeyName], keysEntries.get(iKeyName), keysColumns.get(iKeyName), expressionParser, locationMap4Entry, locationMap4Column, autoConverterMap, enable_auto_convert_type);
|
||||
|
||||
|
||||
if(isPersistentSortedTable) {
|
||||
|
||||
|
||||
@@ -768,9 +768,14 @@
|
||||
}
|
||||
<%
|
||||
} else {
|
||||
if("java.util.Date".equals(typeToGenerate)) {%>
|
||||
<%= tableName %>HashKey.<%= aKeysNames[iKeyName] %> = rsc_<%=componentNameForKeyProblem%>_<%=currentJoinedTableIndex%>.exprKey_<%= tableName %>__<%= aKeysNames[iKeyName] %> == null ? null : new java.util.Date(rsc_<%=componentNameForKeyProblem%>_<%=currentJoinedTableIndex%>.exprKey_<%= tableName %>__<%= aKeysNames[iKeyName] %>.getTime());
|
||||
<%
|
||||
}else {
|
||||
%>
|
||||
<%= tableName %>HashKey.<%= aKeysNames[iKeyName] %> = rsc_<%=componentNameForKeyProblem%>_<%=currentJoinedTableIndex%>.exprKey_<%= tableName %>__<%= aKeysNames[iKeyName] %>;
|
||||
<%= tableName %>HashKey.<%= aKeysNames[iKeyName] %> = rsc_<%=componentNameForKeyProblem%>_<%=currentJoinedTableIndex%>.exprKey_<%= tableName %>__<%= aKeysNames[iKeyName] %>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -788,9 +793,14 @@
|
||||
}
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
<%= tableName %>HashKey.<%= aKeysNames[iKeyName] %> = <%= aKeysValues[iKeyName] %>;
|
||||
if("java.util.Date".equals(typeToGenerate)) {%>
|
||||
<%= tableName %>HashKey.<%= aKeysNames[iKeyName] %> = <%= aKeysValues[iKeyName] %> == null ? null : new java.util.Date(<%= aKeysValues[iKeyName] %>.getTime());
|
||||
<%
|
||||
}else {
|
||||
%>
|
||||
<%= tableName %>HashKey.<%= aKeysNames[iKeyName] %> = <%= aKeysValues[iKeyName] %>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
}
|
||||
if (checkingSyntax) {
|
||||
|
||||
@@ -26,6 +26,7 @@ imports="
|
||||
}
|
||||
}
|
||||
%>
|
||||
int lastNoEmptyIndex_<%=cid%> = 0;
|
||||
int nb_line_<%=cid%> = 0;
|
||||
<%
|
||||
if(metadataColumns != null && metadataColumns.size() > 0) {
|
||||
|
||||
@@ -90,7 +90,7 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {//1
|
||||
if(!outIterate.isEmpty()||outgoingConnName != null){
|
||||
if(useCSV && isDiscardTrailingEmptyStr){
|
||||
%>
|
||||
int lastNoEmptyIndex_<%=cid%>=0;
|
||||
lastNoEmptyIndex_<%=cid%>=0;
|
||||
for(int i_<%=cid%>=normalizeRecord_<%=cid%>.length;i_<%=cid%> > 0;i_<%=cid%>--){
|
||||
if(!"".equals(normalizeRecord_<%=cid%>[i_<%=cid%> - 1])){
|
||||
lastNoEmptyIndex_<%=cid%>=i_<%=cid%>;
|
||||
@@ -100,7 +100,7 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {//1
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
int lastNoEmptyIndex_<%=cid%>=normalizeRecord_<%=cid%>.length;
|
||||
lastNoEmptyIndex_<%=cid%>=normalizeRecord_<%=cid%>.length;
|
||||
<%if(isDiscardTrailingEmptyStr){%>
|
||||
if(lastNoEmptyIndex_<%=cid%> == 1 && "".equals(normalizeRecord_<%=cid%>[0])){
|
||||
lastNoEmptyIndex_<%=cid%> = 0;
|
||||
|
||||
@@ -62,16 +62,7 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
%>
|
||||
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%
|
||||
//Retrieve connection node and check if SSO was used for correct logging
|
||||
List< ? extends INode> nodes = node.getProcess().getNodesOfType("tRedshiftConnection");
|
||||
String connectionRedShift = ElementParameterParser.getValue(node,"__CONNECTION__");
|
||||
for (INode ne : nodes) {
|
||||
if (connectionRedShift.equals(ne.getUniqueName())) {
|
||||
jdbcUrl = ElementParameterParser.getValue(ne, "__JDBC_URL__");
|
||||
}
|
||||
}
|
||||
boolean needUserAndPassword = !"SSO".equals(jdbcUrl);
|
||||
log4jCodeGenerateUtil.useExistConnection(node, needUserAndPassword);
|
||||
log4jCodeGenerateUtil.useExistConnection(node);
|
||||
} else {
|
||||
%>
|
||||
String driverClass_<%=cid%> = "com.amazon.redshift.jdbc42.Driver";
|
||||
@@ -99,17 +90,17 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
}
|
||||
%>
|
||||
String url_<%=cid%> = sbuilder_<%=cid%>.toString();
|
||||
<% if (!"SSO".equals(jdbcUrl)){
|
||||
String passwordFieldName = "__PASS__";
|
||||
|
||||
if (ElementParameterParser.canEncrypt(node, passwordFieldName)) {%>
|
||||
final String decryptedPass_<%=cid%> = routines.system.PasswordEncryptUtil.decryptPassword(<%=ElementParameterParser.getEncryptedValue(node, passwordFieldName)%>);
|
||||
<%} else {%>
|
||||
final String decryptedPass_<%=cid%> = <%= ElementParameterParser.getValue(node, passwordFieldName)%>;
|
||||
<%}%>
|
||||
String dbUser_<%=cid %> = <%=userName%>;
|
||||
String dbPwd_<%=cid %> = decryptedPass_<%=cid%>;
|
||||
<% }
|
||||
<%
|
||||
String passwordFieldName = "__PASS__";
|
||||
|
||||
if (ElementParameterParser.canEncrypt(node, passwordFieldName)) {%>
|
||||
final String decryptedPass_<%=cid%> = routines.system.PasswordEncryptUtil.decryptPassword(<%=ElementParameterParser.getEncryptedValue(node, passwordFieldName)%>);
|
||||
<%} else {%>
|
||||
final String decryptedPass_<%=cid%> = <%= ElementParameterParser.getValue(node, passwordFieldName)%>;
|
||||
<%}%>
|
||||
String dbUser_<%=cid %> = <%=userName%>;
|
||||
String dbPwd_<%=cid %> = decryptedPass_<%=cid%>;
|
||||
<%
|
||||
|
||||
log4jCodeGenerateUtil.connect(node);
|
||||
}
|
||||
|
||||
@@ -70,13 +70,13 @@
|
||||
|
||||
<PARAMETER NAME="USER" FIELD="TEXT" NUM_ROW="5"
|
||||
REPOSITORY_VALUE="USERNAME" REQUIRED="true"
|
||||
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')" GROUP="DB_CONFIG">
|
||||
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') " GROUP="DB_CONFIG">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="PASS" FIELD="PASSWORD" NUM_ROW="5"
|
||||
REPOSITORY_VALUE="PASSWORD" REQUIRED="true"
|
||||
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')" GROUP="DB_CONFIG">
|
||||
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') " GROUP="DB_CONFIG">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
@@ -392,7 +392,9 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Driver-Redshift" MODULE="redshift-jdbc42-no-awssdk-1.2.20.1043.jar" MVN="mvn:com.amazon.redshift/redshift-jdbc42-no-awssdk/1.2.20.1043" REQUIRED="true" />
|
||||
<IMPORT NAME="Driver-Redshift" MODULE="redshift-jdbc42-no-awssdk-1.2.32.1056.jar"
|
||||
MVN="mvn:com.amazon.redshift/redshift-jdbc42-no-awssdk/1.2.32.1056"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="aws-java-sdk-1.11.406.jar" MODULE="aws-java-sdk-1.11.406.jar"
|
||||
MVN="mvn:com.amazonaws/aws-java-sdk/1.11.406"
|
||||
REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
<%@ include file="../templates/DB/Close/AbstractDBClose.javajet"%>
|
||||
|
||||
if (null != java.sql.DriverManager.getLogWriter()) {
|
||||
java.sql.DriverManager.getLogWriter().close();
|
||||
}
|
||||
|
||||
<%
|
||||
<%
|
||||
String connectionComponent = ElementParameterParser.getValue(node,"__CONNECTION__");
|
||||
%>
|
||||
java.io.PrintWriter logWriter_<%=cid %> = (java.io.PrintWriter) globalMap.get("logWriter_<%=connectionComponent %>");
|
||||
if (logWriter_<%=cid %> != null) {
|
||||
logWriter_<%=cid %>.close();
|
||||
java.io.PrintWriter fileLogWriter_<%=cid %> = (java.io.PrintWriter) globalMap.get("fileLogWriter_<%=connectionComponent %>");
|
||||
if (fileLogWriter_<%=cid %> != null) {
|
||||
fileLogWriter_<%=cid %>.close();
|
||||
}
|
||||
@@ -22,14 +22,13 @@ imports="
|
||||
%>
|
||||
java.io.Writer output_<%=cid %> = new java.io.FileWriter(<%= logFile %>, true);
|
||||
java.io.PrintWriter logWriter_<%=cid %> = new java.io.PrintWriter(output_<%=cid %>,true);
|
||||
|
||||
globalMap.put("fileLogWriter_<%=cid %>", logWriter_<%=cid %>);
|
||||
<%
|
||||
}else{%>
|
||||
java.io.PrintWriter logWriter_<%=cid %> = new java.io.PrintWriter(System.out,true);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
globalMap.put("logWriter_<%=cid %>", logWriter_<%=cid %>);
|
||||
java.sql.DriverManager.setLogWriter(logWriter_<%=cid %>);
|
||||
<%}%>
|
||||
StringBuilder sbuilder_<%=cid%> = new StringBuilder();
|
||||
|
||||
@@ -99,7 +99,6 @@
|
||||
NUM_ROW="4"
|
||||
REPOSITORY_VALUE="USERNAME"
|
||||
REQUIRED="true"
|
||||
SHOW_IF="JDBC_URL=='STANDARD'"
|
||||
>
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
@@ -110,7 +109,6 @@
|
||||
NUM_ROW="4"
|
||||
REPOSITORY_VALUE="PASSWORD"
|
||||
REQUIRED="true"
|
||||
SHOW_IF="JDBC_URL=='STANDARD'"
|
||||
>
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
@@ -198,7 +196,7 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Driver-Redshift" MODULE="redshift-jdbc42-no-awssdk-1.2.20.1043.jar" MVN="mvn:com.amazon.redshift/redshift-jdbc42-no-awssdk/1.2.20.1043" REQUIRED="true" />
|
||||
<IMPORT NAME="Driver-Redshift" MODULE="redshift-jdbc42-no-awssdk-1.2.32.1056.jar" MVN="mvn:com.amazon.redshift/redshift-jdbc42-no-awssdk/1.2.32.1056" REQUIRED="true" />
|
||||
<IMPORT NAME="aws-java-sdk-1.11.406.jar" MODULE="aws-java-sdk-1.11.406.jar" MVN="mvn:com.amazonaws/aws-java-sdk/1.11.406" REQUIRED_IF="(JDBC_URL == 'SSO')" />
|
||||
<IMPORT NAME="commons-logging-1.1.3.jar" MODULE="commons-logging-1.1.3.jar" MVN="mvn:commons-logging/commons-logging/1.1.3" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.3.jar" REQUIRED_IF="(JDBC_URL == 'SSO')" />
|
||||
<IMPORT NAME="jackson-databind-2.9.9.jar" MODULE="jackson-databind-2.9.9.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.9.9" REQUIRED_IF="(JDBC_URL == 'SSO')" />
|
||||
|
||||
@@ -17,8 +17,6 @@ imports="
|
||||
|
||||
class DBInputBeginUtil extends DefaultDBInputUtil{
|
||||
|
||||
private boolean needUserAndPassword = true;
|
||||
|
||||
public void setURL(INode node) {
|
||||
|
||||
boolean useLogFile= "true".equals(ElementParameterParser.getValue(node, "__USE_LOG_FILE__"));
|
||||
@@ -31,6 +29,7 @@ imports="
|
||||
%>
|
||||
java.io.Writer output_<%=cid %> = new java.io.FileWriter(<%= logFile %>, true);
|
||||
java.io.PrintWriter logWriter_<%=cid %> = new java.io.PrintWriter(output_<%=cid %>,true);
|
||||
globalMap.put("fileLogWriter_<%=cid %>", logWriter_<%=cid %>);
|
||||
|
||||
<%
|
||||
}else{%>
|
||||
@@ -38,7 +37,6 @@ imports="
|
||||
<%
|
||||
}
|
||||
%>
|
||||
globalMap.put("logWriter_<%=cid %>", logWriter_<%=cid %>);
|
||||
java.sql.DriverManager.setLogWriter(logWriter_<%=cid %>);
|
||||
<%}%>
|
||||
|
||||
@@ -76,8 +74,7 @@ imports="
|
||||
|
||||
public void createConnection(INode node) {
|
||||
String jdbcUrl = ElementParameterParser.getValue(node, "__JDBC_URL__");
|
||||
if ("SSO".equals(jdbcUrl)) needUserAndPassword = false;
|
||||
super.createConnection(node, needUserAndPassword);
|
||||
super.createConnection(node);
|
||||
String useCursor= ElementParameterParser.getValue(node, "__USE_CURSOR__");
|
||||
if(("true").equals(useCursor)) {
|
||||
log4jCodeGenerateUtil.autoCommit(node,false);
|
||||
|
||||
@@ -2,10 +2,18 @@
|
||||
|
||||
<%
|
||||
String logLevel= ElementParameterParser.getValue(node, "__LOG_LEVEL__");
|
||||
if ("false".equalsIgnoreCase(ElementParameterParser.getValue(node, "__USE_EXISTING_CONNECTION__"))
|
||||
boolean useLogFile= "true".equals(ElementParameterParser.getValue(node, "__USE_LOG_FILE__"));
|
||||
if (useLogFile){
|
||||
if ("false".equalsIgnoreCase(ElementParameterParser.getValue(node, "__USE_EXISTING_CONNECTION__"))
|
||||
&& !logLevel.equals("0")) {
|
||||
%>
|
||||
logWriter_<%=cid %>.close();
|
||||
|
||||
java.io.PrintWriter fileLogWriter_<%=cid %> = (java.io.PrintWriter) globalMap.get("fileLogWriter_<%=cid %>");
|
||||
if (fileLogWriter_<%=cid %> != null) {
|
||||
fileLogWriter_<%=cid %>.close();
|
||||
}
|
||||
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
@@ -120,7 +120,7 @@
|
||||
NUM_ROW="5"
|
||||
REPOSITORY_VALUE="USERNAME"
|
||||
REQUIRED="true"
|
||||
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
|
||||
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
|
||||
>
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
@@ -131,7 +131,7 @@
|
||||
NUM_ROW="5"
|
||||
REPOSITORY_VALUE="PASSWORD"
|
||||
REQUIRED="true"
|
||||
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
|
||||
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
|
||||
>
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
@@ -279,7 +279,7 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Driver-Redshift" MODULE="redshift-jdbc42-no-awssdk-1.2.20.1043.jar" MVN="mvn:com.amazon.redshift/redshift-jdbc42-no-awssdk/1.2.20.1043" REQUIRED="true" />
|
||||
<IMPORT NAME="Driver-Redshift" MODULE="redshift-jdbc42-no-awssdk-1.2.32.1056.jar" MVN="mvn:com.amazon.redshift/redshift-jdbc42-no-awssdk/1.2.32.1056" REQUIRED="true" />
|
||||
<IMPORT NAME="aws-java-sdk-1.11.406.jar" MODULE="aws-java-sdk-1.11.406.jar" MVN="mvn:com.amazonaws/aws-java-sdk/1.11.406" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="commons-logging-1.1.3.jar" MODULE="commons-logging-1.1.3.jar" MVN="mvn:commons-logging/commons-logging/1.1.3" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.3.jar" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="jackson-databind-2.9.9.jar" MODULE="jackson-databind-2.9.9.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.9.9" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
|
||||
@@ -211,21 +211,8 @@ if(("true").equals(useExistingConn)) {
|
||||
String conn = "conn_" + connection;
|
||||
%>
|
||||
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
|
||||
<%
|
||||
//Retrieve connection node and check if SSO was used for correct logging
|
||||
List< ? extends INode> nodes = node.getProcess().getNodesOfType("tRedshiftConnection");
|
||||
String connectionRedShift = ElementParameterParser.getValue(node,"__CONNECTION__");
|
||||
for (INode ne : nodes) {
|
||||
if (connectionRedShift.equals(ne.getUniqueName())) {
|
||||
jdbcUrl = ElementParameterParser.getValue(ne, "__JDBC_URL__");
|
||||
}
|
||||
}
|
||||
if ("SSO".equals(jdbcUrl)){
|
||||
dbLog.conn().useExistConn("conn_"+cid+".getMetaData().getURL()", null);
|
||||
} else {
|
||||
dbLog.conn().useExistConn("conn_"+cid+".getMetaData().getURL()", "conn_"+cid+".getMetaData().getUserName()");
|
||||
}
|
||||
dbLog.conn().useExistConn("conn_"+cid+".getMetaData().getURL()", "conn_"+cid+".getMetaData().getUserName()");
|
||||
%>
|
||||
<%
|
||||
} else {
|
||||
@@ -254,30 +241,19 @@ if(("true").equals(useExistingConn)) {
|
||||
<%
|
||||
}
|
||||
%>
|
||||
String url_<%=cid%> = sbuilder_<%=cid%>.toString();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<% if ("SSO".equals(jdbcUrl)){%>
|
||||
conn_<%=cid%> = java.sql.DriverManager.getConnection(url_<%=cid %>);
|
||||
<%dbLog.conn().connTry(dbLog.var("url"), null);%>
|
||||
<%dbLog.conn().connDone(dbLog.var("url"));%>
|
||||
<% } else {%>
|
||||
String dbUser_<%=cid %> = <%=dbuser%>;
|
||||
<%
|
||||
String passwordFieldName = "__PASS__";
|
||||
%>
|
||||
String url_<%=cid%> = sbuilder_<%=cid%>.toString();
|
||||
String dbUser_<%=cid %> = <%=dbuser%>;
|
||||
<%
|
||||
String passwordFieldName = "__PASS__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
String dbPwd_<%=cid %> = decryptedPassword_<%=cid%>;
|
||||
conn_<%=cid%> = java.sql.DriverManager.getConnection(url_<%=cid %>,dbUser_<%=cid%>,dbPwd_<%=cid%>);
|
||||
<%dbLog.conn().connTry(dbLog.var("url"), dbLog.var("dbUser"));%>
|
||||
<%dbLog.conn().connDone(dbLog.var("url"));%>
|
||||
<% }%>
|
||||
String dbPwd_<%=cid %> = decryptedPassword_<%=cid%>;
|
||||
conn_<%=cid%> = java.sql.DriverManager.getConnection(url_<%=cid %>,dbUser_<%=cid%>,dbPwd_<%=cid%>);
|
||||
<%dbLog.conn().connTry(dbLog.var("url"), dbLog.var("dbUser"));%>
|
||||
<%dbLog.conn().connDone(dbLog.var("url"));%>
|
||||
|
||||
resourceMap.put("conn_<%=cid%>", conn_<%=cid%>);
|
||||
conn_<%=cid%>.setAutoCommit(false);
|
||||
<%
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
NUM_ROW="5"
|
||||
REPOSITORY_VALUE="USERNAME"
|
||||
REQUIRED="true"
|
||||
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
|
||||
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
|
||||
>
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
@@ -135,7 +135,7 @@
|
||||
NUM_ROW="5"
|
||||
REPOSITORY_VALUE="PASSWORD"
|
||||
REQUIRED="true"
|
||||
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
|
||||
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
|
||||
>
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
@@ -369,7 +369,7 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Driver-Redshift" MODULE="redshift-jdbc42-no-awssdk-1.2.20.1043.jar" MVN="mvn:com.amazon.redshift/redshift-jdbc42-no-awssdk/1.2.20.1043" REQUIRED="true" />
|
||||
<IMPORT NAME="Driver-Redshift" MODULE="redshift-jdbc42-no-awssdk-1.2.32.1056.jar" MVN="mvn:com.amazon.redshift/redshift-jdbc42-no-awssdk/1.2.32.1056" REQUIRED="true" />
|
||||
<IMPORT NAME="aws-java-sdk-1.11.406.jar" MODULE="aws-java-sdk-1.11.406.jar" MVN="mvn:com.amazonaws/aws-java-sdk/1.11.406" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="commons-logging-1.1.3.jar" MODULE="commons-logging-1.1.3.jar" MVN="mvn:commons-logging/commons-logging/1.1.3" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.3.jar" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="jackson-databind-2.9.9.jar" MODULE="jackson-databind-2.9.9.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.9.9" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
|
||||
@@ -63,12 +63,12 @@
|
||||
<DEFAULT>Redshift</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="USER" FIELD="TEXT" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
|
||||
<PARAMETER NAME="USER" FIELD="TEXT" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
|
||||
REPOSITORY_VALUE="USERNAME" REQUIRED="true" GROUP="DB_CONFIG">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="PASS" FIELD="PASSWORD" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
|
||||
<PARAMETER NAME="PASS" FIELD="PASSWORD" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
|
||||
REPOSITORY_VALUE="PASSWORD" REQUIRED="true" GROUP="DB_CONFIG">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
@@ -511,7 +511,9 @@
|
||||
</TEMPLATES>
|
||||
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Driver-Redshift" MODULE="redshift-jdbc42-no-awssdk-1.2.20.1043.jar" MVN="mvn:com.amazon.redshift/redshift-jdbc42-no-awssdk/1.2.20.1043" REQUIRED="true" />
|
||||
<IMPORT NAME="Driver-Redshift" MODULE="redshift-jdbc42-no-awssdk-1.2.32.1056.jar"
|
||||
MVN="mvn:com.amazon.redshift/redshift-jdbc42-no-awssdk/1.2.32.1056"
|
||||
REQUIRED="true" />
|
||||
<IMPORT NAME="aws-java-sdk-1.11.406.jar" MODULE="aws-java-sdk-1.11.406.jar"
|
||||
MVN="mvn:com.amazonaws/aws-java-sdk/1.11.406"
|
||||
REQUIRED="true" />
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
NUM_ROW="5"
|
||||
REPOSITORY_VALUE="USERNAME"
|
||||
REQUIRED="true"
|
||||
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
|
||||
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
|
||||
>
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
@@ -133,7 +133,7 @@
|
||||
NUM_ROW="5"
|
||||
REPOSITORY_VALUE="PASSWORD"
|
||||
REQUIRED="true"
|
||||
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
|
||||
SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
|
||||
>
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
@@ -297,7 +297,7 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Driver-Redshift" MODULE="redshift-jdbc42-no-awssdk-1.2.20.1043.jar" MVN="mvn:com.amazon.redshift/redshift-jdbc42-no-awssdk/1.2.20.1043" REQUIRED="true" />
|
||||
<IMPORT NAME="Driver-Redshift" MODULE="redshift-jdbc42-no-awssdk-1.2.32.1056.jar" MVN="mvn:com.amazon.redshift/redshift-jdbc42-no-awssdk/1.2.32.1056" REQUIRED="true" />
|
||||
<IMPORT NAME="aws-java-sdk-1.11.406.jar" MODULE="aws-java-sdk-1.11.406.jar" MVN="mvn:com.amazonaws/aws-java-sdk/1.11.406" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="commons-logging-1.1.3.jar" MODULE="commons-logging-1.1.3.jar" MVN="mvn:commons-logging/commons-logging/1.1.3" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.3.jar" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="jackson-databind-2.9.9.jar" MODULE="jackson-databind-2.9.9.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.9.9" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
|
||||
@@ -40,16 +40,7 @@ imports="
|
||||
%>
|
||||
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%
|
||||
//Retrieve connection node and check if SSO was used for correct logging
|
||||
List< ? extends INode> nodes = node.getProcess().getNodesOfType("tRedshiftConnection");
|
||||
String connectionRedShift = ElementParameterParser.getValue(node,"__CONNECTION__");
|
||||
for (INode ne : nodes) {
|
||||
if (connectionRedShift.equals(ne.getUniqueName())) {
|
||||
jdbcUrl = ElementParameterParser.getValue(ne, "__JDBC_URL__");
|
||||
}
|
||||
}
|
||||
boolean needUserAndPassword = !"SSO".equals(jdbcUrl);
|
||||
log4jCodeGenerateUtil.useExistConnection(node, needUserAndPassword);
|
||||
log4jCodeGenerateUtil.useExistConnection(node);
|
||||
} else {
|
||||
%>
|
||||
String driverClass_<%=cid%> = "com.amazon.redshift.jdbc42.Driver";
|
||||
@@ -78,17 +69,16 @@ imports="
|
||||
%>
|
||||
String url_<%=cid%> = sbuilder_<%=cid%>.toString();
|
||||
<%
|
||||
if (!"SSO".equals(jdbcUrl)){
|
||||
String passwordFieldName = "__PASS__";
|
||||
%>
|
||||
<%if (ElementParameterParser.canEncrypt(node, passwordFieldName)) {%>
|
||||
final String decryptedPass_<%=cid%> = routines.system.PasswordEncryptUtil.decryptPassword(<%=ElementParameterParser.getEncryptedValue(node, passwordFieldName)%>);
|
||||
<%} else {%>
|
||||
final String decryptedPass_<%=cid%> = <%= ElementParameterParser.getValue(node, passwordFieldName)%>;
|
||||
<%}%>
|
||||
String dbUser_<%=cid %> = <%=userName%>;
|
||||
String dbPwd_<%=cid %> = decryptedPass_<%=cid%>;
|
||||
<% }
|
||||
String passwordFieldName = "__PASS__";
|
||||
%>
|
||||
<%if (ElementParameterParser.canEncrypt(node, passwordFieldName)) {%>
|
||||
final String decryptedPass_<%=cid%> = routines.system.PasswordEncryptUtil.decryptPassword(<%=ElementParameterParser.getEncryptedValue(node, passwordFieldName)%>);
|
||||
<%} else {%>
|
||||
final String decryptedPass_<%=cid%> = <%= ElementParameterParser.getValue(node, passwordFieldName)%>;
|
||||
<%}%>
|
||||
String dbUser_<%=cid %> = <%=userName%>;
|
||||
String dbPwd_<%=cid %> = decryptedPass_<%=cid%>;
|
||||
<%
|
||||
log4jCodeGenerateUtil.connect(node);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,12 +62,12 @@
|
||||
<DEFAULT>Redshift</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="USER" FIELD="TEXT" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
|
||||
<PARAMETER NAME="USER" FIELD="TEXT" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
|
||||
REPOSITORY_VALUE="USERNAME" REQUIRED="true" GROUP="DB_CONFIG">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="PASS" FIELD="PASSWORD" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (JDBC_URL=='STANDARD')"
|
||||
<PARAMETER NAME="PASS" FIELD="PASSWORD" NUM_ROW="5" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') "
|
||||
REPOSITORY_VALUE="PASSWORD" REQUIRED="true" GROUP="DB_CONFIG">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
@@ -272,7 +272,7 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Driver-Redshift" MODULE="redshift-jdbc42-no-awssdk-1.2.20.1043.jar" MVN="mvn:com.amazon.redshift/redshift-jdbc42-no-awssdk/1.2.20.1043" REQUIRED="true" />
|
||||
<IMPORT NAME="Driver-Redshift" MODULE="redshift-jdbc42-no-awssdk-1.2.32.1056.jar" MVN="mvn:com.amazon.redshift/redshift-jdbc42-no-awssdk/1.2.32.1056" REQUIRED="true" />
|
||||
<IMPORT NAME="aws-java-sdk-1.11.406.jar" MODULE="aws-java-sdk-1.11.406.jar" MVN="mvn:com.amazonaws/aws-java-sdk/1.11.406" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="commons-logging-1.1.3.jar" MODULE="commons-logging-1.1.3.jar" MVN="mvn:commons-logging/commons-logging/1.1.3" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.3.jar" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="jackson-databind-2.9.9.jar" MODULE="jackson-databind-2.9.9.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-databind/2.9.9" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
|
||||
@@ -32,6 +32,13 @@ imports="
|
||||
String key_<%=cid%> = <%=key%>;
|
||||
|
||||
int partSizeInBytes_<%=cid%> = <%=partSizeMb%> * 1024 * 1024;
|
||||
if(partSizeInBytes_<%=cid%> < 5 << 20 ) {
|
||||
<%if(isLog4jEnabled) {%>
|
||||
log.info("Set part size as 5MB, as it is the recommended minimun value.");
|
||||
<%}%>
|
||||
partSizeInBytes_<%=cid%> = 5 << 20;
|
||||
}
|
||||
|
||||
|
||||
Object fileOrStream_<%=cid%> = <%=file%>;
|
||||
|
||||
|
||||
@@ -208,6 +208,8 @@ 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){
|
||||
|
||||
@@ -98,6 +98,10 @@
|
||||
<PARAMETER NAME="QUOTE_ALL_VALUES" FIELD="CHECK" REQUIRED="true" NUM_ROW="20">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="ALLOW_EMPTY_STRINGS" FIELD="CHECK" NUM_ROW="21"
|
||||
REQUIRED="false">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
</ADVANCED_PARAMETERS>
|
||||
|
||||
<CODEGENERATION>
|
||||
@@ -124,6 +128,8 @@
|
||||
<TEMPLATE_PARAM SOURCE="self.REMOVE_ROOT" TARGET="In.REMOVE_ROOT" />
|
||||
<TEMPLATE_PARAM SOURCE="self.UNIQUE_NAME" TARGET="In.DESTINATION" />
|
||||
<TEMPLATE_PARAM SOURCE="self.UNIQUE_NAME" TARGET="Out.DESTINATION" />
|
||||
<TEMPLATE_PARAM SOURCE="self.ALLOW_EMPTY_STRINGS" TARGET="Out.ALLOW_EMPTY_STRINGS" />
|
||||
<TEMPLATE_PARAM SOURCE="self.ALLOW_EMPTY_STRINGS" TARGET="In.ALLOW_EMPTY_STRINGS" />
|
||||
|
||||
</TEMPLATES>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -29,4 +29,5 @@ SCHEMA.NAME=Schema
|
||||
JSONFIELD.NAME=Output Column
|
||||
COMPACT_FORMAT.NAME = Compact Format
|
||||
REMOVE_ROOT.NAME=Remove root node.
|
||||
QUOTE_ALL_VALUES.NAME=Quote all values
|
||||
QUOTE_ALL_VALUES.NAME=Quote all values
|
||||
ALLOW_EMPTY_STRINGS.NAME=Pass null values and empty strings explicitly
|
||||
@@ -16,6 +16,7 @@ imports="
|
||||
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
|
||||
INode node = (INode)codeGenArgument.getArgument();
|
||||
String cid = node.getUniqueName();
|
||||
final boolean allowEmptyStrings = ("true").equals(ElementParameterParser.getValue(node, "__ALLOW_EMPTY_STRINGS__"));
|
||||
|
||||
List<IMetadataTable> metadatas = node.getMetadataList();
|
||||
if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
@@ -33,6 +34,7 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
xmlSerializer_<%=cid%>.clearNamespaces();
|
||||
xmlSerializer_<%=cid%>.setSkipNamespaces(true);
|
||||
xmlSerializer_<%=cid%>.setForceTopLevelObject(<%=(removeRoot?false:true)%>);
|
||||
xmlSerializer_<%=cid%>.setUseEmptyStrings(<%=allowEmptyStrings%>);
|
||||
<%
|
||||
INode sourceNode = node.getIncomingConnections(EConnectionType.ON_COMPONENT_OK).get(0).getSource();
|
||||
String virtualSourceCid = sourceNode.getUniqueName();
|
||||
@@ -69,6 +71,7 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
%>
|
||||
java.util.List<java.util.Map<String,String>> flows;
|
||||
java.lang.Exception lastException;
|
||||
java.lang.Error lastError;
|
||||
String currentComponent;
|
||||
|
||||
ThreadXMLField_<%=cid%>(java.util.Queue q) {
|
||||
@@ -88,6 +91,11 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
public java.lang.Exception getLastException() {
|
||||
return this.lastException;
|
||||
}
|
||||
|
||||
public java.lang.Error getLastError() {
|
||||
return this.lastError;
|
||||
}
|
||||
|
||||
public String getCurrentComponent() {
|
||||
return this.currentComponent;
|
||||
}
|
||||
@@ -100,6 +108,9 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
this.lastException = te.getException();
|
||||
this.currentComponent = te.getCurrentComponent();
|
||||
globalMap.put("<%=cid%>_FINISH"+(this.queue==null?"":this.queue.hashCode()), "true");
|
||||
} catch (java.lang.Error error) {
|
||||
this.lastError = error;
|
||||
globalMap.put("<%=cid%>_FINISH"+(this.queue==null?"":this.queue.hashCode()), "true");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,9 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
currentComponent = txf_<%=cid%>.getCurrentComponent();
|
||||
throw txf_<%=cid%>.getLastException();
|
||||
}
|
||||
if(txf_<%=cid%>.getLastError()!=null) {
|
||||
throw txf_<%=cid%>.getLastError();
|
||||
}
|
||||
globalMap.remove("queue_<%=virtualSourceCid%>");
|
||||
<%
|
||||
}else{
|
||||
|
||||
@@ -59,6 +59,13 @@
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
</PARAMETERS>
|
||||
|
||||
<ADVANCED_PARAMETERS>
|
||||
<PARAMETER NAME="ALLOW_EMPTY_STRINGS" FIELD="CHECK" NUM_ROW="21"
|
||||
REQUIRED="false">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
</ADVANCED_PARAMETERS>
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
@@ -68,7 +75,7 @@
|
||||
<IMPORT NAME="commons_lang" MODULE="commons-lang-2.6.jar" MVN="mvn:commons-lang/commons-lang/2.6" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-lang-2.6.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="commons_logging" MODULE="commons-logging-1.1.1.jar" MVN="mvn:org.talend.libraries/commons-logging-1.1.1/6.0.0" UrlPath="platform:/base/plugins/org.apache.commons.logging_1.1.1.v201101211721.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="ezmorph" MODULE="ezmorph-1.0.6.jar" MVN="mvn:org.talend.libraries/ezmorph-1.0.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/ezmorph-1.0.6.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="json-lib" MODULE="json-lib-2.4.2-talend.jar" MVN="mvn:net.sf.json-lib/json-lib/2.4.2-talend" REQUIRED="true" />
|
||||
<IMPORT NAME="json-lib" MODULE="json-lib-2.4.3-talend.jar" MVN="mvn:net.sf.json-lib/json-lib/2.4.3-talend" REQUIRED="true" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
java.util.Queue<String> queue;
|
||||
java.util.List<java.util.Map<String,String>> flows;
|
||||
java.lang.Exception lastException;
|
||||
java.lang.Error lastError;
|
||||
String currentComponent;
|
||||
|
||||
ThreadXMLField_<%=cid%>(java.util.Queue q) {
|
||||
@@ -63,6 +64,11 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
public java.lang.Exception getLastException() {
|
||||
return this.lastException;
|
||||
}
|
||||
|
||||
public java.lang.Error getLastError() {
|
||||
return this.lastError;
|
||||
}
|
||||
|
||||
public String getCurrentComponent() {
|
||||
return this.currentComponent;
|
||||
}
|
||||
@@ -75,6 +81,9 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
this.lastException = te.getException();
|
||||
this.currentComponent = te.getCurrentComponent();
|
||||
globalMap.put("<%=cid%>_FINISH" + (this.queue==null?"":this.queue.hashCode()), "true");
|
||||
} catch (java.lang.Error error) {
|
||||
this.lastError = error;
|
||||
globalMap.put("<%=cid%>_FINISH" + (this.queue==null?"":this.queue.hashCode()), "true");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,10 +41,16 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
if(nextMergeConn != null && nextMergeConn.getInputId()>1 && startNodeCid != null){
|
||||
%>
|
||||
txf_<%=cid%>.join();
|
||||
|
||||
if(txf_<%=cid%>.getLastException()!=null) {
|
||||
currentComponent = txf_<%=cid%>.getCurrentComponent();
|
||||
throw txf_<%=cid%>.getLastException();
|
||||
}
|
||||
|
||||
if(txf_<%=cid%>.getLastError()!=null) {
|
||||
throw txf_<%=cid%>.getLastError();
|
||||
}
|
||||
|
||||
globalMap.remove("queue_<%=virtualSourceCid%>");
|
||||
<%
|
||||
}else{
|
||||
|
||||
@@ -119,6 +119,7 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
%>
|
||||
java.util.List<java.util.Map<String,String>> flows;
|
||||
java.lang.Exception lastException;
|
||||
java.lang.Error lastError;
|
||||
String currentComponent;
|
||||
|
||||
ThreadXMLField_<%=cid%>(java.util.Queue q) {
|
||||
@@ -138,6 +139,11 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
public java.lang.Exception getLastException() {
|
||||
return this.lastException;
|
||||
}
|
||||
|
||||
public java.lang.Error getLastError() {
|
||||
return this.lastError;
|
||||
}
|
||||
|
||||
public String getCurrentComponent() {
|
||||
return this.currentComponent;
|
||||
}
|
||||
@@ -149,6 +155,8 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
} catch (TalendException te) {
|
||||
this.lastException = te.getException();
|
||||
this.currentComponent = te.getCurrentComponent();
|
||||
} catch (java.lang.Error error) {
|
||||
this.lastError = error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,10 +353,15 @@ globalMap.put("<%=virtualTargetCid%>_FINISH" + (listGroupby_<%=cid%>==null?"":li
|
||||
if(nextMergeConn == null || nextMergeConn.getInputId()==1){
|
||||
%>
|
||||
txf_<%=cid%>.join();
|
||||
|
||||
if(txf_<%=cid%>.getLastException()!=null) {
|
||||
currentComponent = txf_<%=cid%>.getCurrentComponent();
|
||||
throw txf_<%=cid%>.getLastException();
|
||||
}
|
||||
|
||||
if(txf_<%=cid%>.getLastError()!=null) {
|
||||
throw txf_<%=cid%>.getLastError();
|
||||
}
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,6 +103,11 @@
|
||||
SHOW_IF="CREATE_EMPTY_ELEMENT=='true'">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="ALLOW_EMPTY_STRINGS" FIELD="CHECK" NUM_ROW="12"
|
||||
REQUIRED="false">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="OUTPUT_AS_XSD" FIELD="CHECK"
|
||||
REQUIRED="false" NUM_ROW="15">
|
||||
|
||||
@@ -29,6 +29,7 @@ String destination4JSON = ElementParameterParser.getValue(node, "__DESTINATION__
|
||||
boolean istWriteJSONField = destination4JSON == null ? false : destination4JSON.contains("tWriteJSONField_");
|
||||
boolean isQuoteAllValues = ("true").equals(ElementParameterParser.getValue(node, "__QUOTE_ALL_VALUES__"));
|
||||
boolean isCompactFormat = ("true").equals(ElementParameterParser.getValue(node, "__COMPACT_FORMAT__"));
|
||||
final boolean allowEmptyStrings = ("true").equals(ElementParameterParser.getValue(node, "__ALLOW_EMPTY_STRINGS__"));
|
||||
final String whiteSpace;
|
||||
final String rowSeparator;
|
||||
if(!isCompactFormat) { // pretty format
|
||||
@@ -262,6 +263,14 @@ class GenerateToolByDom4j{
|
||||
if(<%tool.getValue(node);%>!=null){
|
||||
nestXMLTool_<%=cid%> .setText(<%=currEleName%>_<%=cid%>,<%tool.getValue(node);%>);
|
||||
<%
|
||||
if(istWriteJSONField && allowEmptyStrings) {
|
||||
if (javaType == JavaTypesManager.STRING) {
|
||||
%>
|
||||
<%=currEleName%>_<%=cid%>.addAttribute("type", "string");
|
||||
<%=currEleName%>_<%=cid%>.addAttribute("class", "string");
|
||||
<%
|
||||
}
|
||||
}
|
||||
boolean hasCustomAttrs = false;
|
||||
for (XMLNode attribute : node.attributes) {
|
||||
if (!"type".equals(attribute.name) && !"class".equals(attribute.name)) {
|
||||
@@ -283,7 +292,13 @@ class GenerateToolByDom4j{
|
||||
}
|
||||
%>
|
||||
}
|
||||
<% if(istWriteJSONField && allowEmptyStrings) { %>
|
||||
else {
|
||||
nestXMLTool_<%=cid%>.setText(<%=currEleName%>_<%=cid%>,"null");
|
||||
<%=currEleName%>_<%=cid%>.addAttribute("null", "true");
|
||||
}
|
||||
<%
|
||||
}
|
||||
if(outputAsXSD){
|
||||
%>
|
||||
else{
|
||||
@@ -624,6 +639,10 @@ if (inConn != null) {
|
||||
currentComponent = txf_<%=cid%>.getCurrentComponent();
|
||||
throw txf_<%=cid%>.getLastException();
|
||||
}
|
||||
|
||||
if(txf_<%=cid%>.getLastError()!=null) {
|
||||
throw txf_<%=cid%>.getLastError();
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
@@ -26,22 +26,17 @@ imports="
|
||||
connUtil.beforeComponentProcess(node);
|
||||
connUtil.createURL(node);
|
||||
%>
|
||||
<%
|
||||
if (!"SSO".equals(ElementParameterParser.getValue(node, "__JDBC_URL__"))){
|
||||
%>
|
||||
String dbUser_<%=cid%> = <%=(dbuser != null && dbuser.trim().length() == 0)? "null":dbuser%>;<%//the tSQLiteConnection component not contain user and pass return null%>
|
||||
|
||||
<%if(dbpass != null && dbpass.trim().length() == 0) {%>
|
||||
String dbPwd_<%=cid%> = null;
|
||||
<%} else {
|
||||
String passwordFieldName = "__PASS__";
|
||||
%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
String dbPwd_<%=cid%> = decryptedPassword_<%=cid%>;
|
||||
<%}%>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
String dbUser_<%=cid%> = <%=(dbuser != null && dbuser.trim().length() == 0)? "null":dbuser%>;<%//the tSQLiteConnection component not contain user and pass return null%>
|
||||
|
||||
<%if(dbpass != null && dbpass.trim().length() == 0) {%>
|
||||
String dbPwd_<%=cid%> = null;
|
||||
<%} else {
|
||||
String passwordFieldName = "__PASS__";
|
||||
%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
String dbPwd_<%=cid%> = decryptedPassword_<%=cid%>;
|
||||
<%}%>
|
||||
|
||||
java.sql.Connection conn_<%=cid%> = null;
|
||||
<%@ include file="../Log4j/Log4jDBConnUtil.javajet"%>
|
||||
<%
|
||||
@@ -63,13 +58,8 @@ imports="
|
||||
<%connUtil.classForName(node);%>
|
||||
<%
|
||||
log4jCodeGenerateUtil.debugConnectionParams(node);
|
||||
if ("SSO".equals(ElementParameterParser.getValue(node, "__JDBC_URL__"))){
|
||||
log4jCodeGenerateUtil.connect_begin_noUser();
|
||||
connUtil.createConnection(node, false);
|
||||
} else {
|
||||
log4jCodeGenerateUtil.connect_begin();
|
||||
connUtil.createConnection(node);
|
||||
}
|
||||
log4jCodeGenerateUtil.connect_begin();
|
||||
connUtil.createConnection(node);
|
||||
|
||||
log4jCodeGenerateUtil.connect_end();
|
||||
%>
|
||||
|
||||
@@ -67,17 +67,10 @@ imports="
|
||||
}
|
||||
|
||||
public void createConnection(INode node) {
|
||||
this.createConnection(node, true);
|
||||
%>
|
||||
conn_<%=cid%> = java.sql.DriverManager.getConnection(url_<%=cid%>,dbUser_<%=cid%>,dbPwd_<%=cid%>);
|
||||
<%
|
||||
}
|
||||
|
||||
public void createConnection(INode node, boolean needUserAndPassword) {%>
|
||||
<% if(needUserAndPassword){%>
|
||||
conn_<%=cid%> = java.sql.DriverManager.getConnection(url_<%=cid%>,dbUser_<%=cid%>,dbPwd_<%=cid%>);
|
||||
<% } else {%>
|
||||
conn_<%=cid%> = java.sql.DriverManager.getConnection(url_<%=cid%>);
|
||||
<% }
|
||||
}
|
||||
|
||||
public void setAutoCommit(INode node) {
|
||||
boolean setAutoCommit = "true".equals(ElementParameterParser.getValue(node, "__AUTO_COMMIT__"));
|
||||
if(isLog4jEnabled){
|
||||
|
||||
@@ -61,24 +61,8 @@ imports="
|
||||
conn += "_in";
|
||||
}
|
||||
%>
|
||||
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%
|
||||
if ("REDSHIFT".equals(type)){
|
||||
String jdbcUrl = "";
|
||||
//Retrieve connection node and check if SSO was used for correct logging
|
||||
List< ? extends INode> nodes = node.getProcess().getNodesOfType("tRedshiftConnection");
|
||||
String connectionRedShift = ElementParameterParser.getValue(node,"__CONNECTION__");
|
||||
for (INode ne : nodes) {
|
||||
if (connectionRedShift.equals(ne.getUniqueName())) {
|
||||
jdbcUrl = ElementParameterParser.getValue(ne, "__JDBC_URL__");
|
||||
}
|
||||
}
|
||||
boolean needUserAndPassword = !"SSO".equals(jdbcUrl);
|
||||
log4jCodeGenerateUtil.useExistConnection(node, needUserAndPassword);
|
||||
} else {
|
||||
log4jCodeGenerateUtil.useExistConnection(node);
|
||||
}
|
||||
%>
|
||||
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%log4jCodeGenerateUtil.useExistConnection(node);%>
|
||||
<%
|
||||
dbInputBeginUtil.afterUseExistConnection(node);
|
||||
} else {
|
||||
|
||||
@@ -79,21 +79,18 @@ imports="
|
||||
java.lang.Class jdbcclazz_<%=cid%> = java.lang.Class.forName(driverClass_<%=cid%>);
|
||||
<%
|
||||
newInstance(node);
|
||||
%>
|
||||
String dbUser_<%=cid %> = <%=dbuser%>;
|
||||
<%
|
||||
String passwordFieldName = "__PASS__";
|
||||
%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
if (needUserAndPassword){%>
|
||||
String dbUser_<%=cid %> = <%=dbuser%>;
|
||||
<%
|
||||
String passwordFieldName = "__PASS__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
String dbPwd_<%=cid %> = decryptedPassword_<%=cid%>;
|
||||
<% }%>
|
||||
String dbPwd_<%=cid %> = decryptedPassword_<%=cid%>;
|
||||
<%this.setURL(node);%>
|
||||
<%
|
||||
log4jCodeGenerateUtil.debugConnectionParams(node);
|
||||
if ("SSO".equals(ElementParameterParser.getValue(node, "__JDBC_URL__")) || !needUserAndPassword){
|
||||
if (!needUserAndPassword){
|
||||
log4jCodeGenerateUtil.connect_begin_noUser();
|
||||
} else {
|
||||
log4jCodeGenerateUtil.connect_begin();
|
||||
|
||||
@@ -27,11 +27,7 @@ imports="
|
||||
String query_<%=cid %> = "";
|
||||
boolean whetherReject_<%=cid%> = false;
|
||||
<%
|
||||
if ("SSO".equals(ElementParameterParser.getValue(node, "__JDBC_URL__"))){
|
||||
dbRowBeginUtil.createConnection(node, false);
|
||||
} else {
|
||||
dbRowBeginUtil.createConnection(node);
|
||||
}
|
||||
dbRowBeginUtil.createConnection(node);
|
||||
%>
|
||||
resourceMap.put("conn_<%=cid%>", conn_<%=cid%>);
|
||||
<%
|
||||
|
||||
@@ -28,10 +28,6 @@
|
||||
log4jCodeGenerateUtil.useExistConnection(node);
|
||||
}
|
||||
|
||||
public void afterUseExistConnection(INode node, boolean needUserAndPassword) {
|
||||
log4jCodeGenerateUtil.useExistConnection(node, needUserAndPassword);
|
||||
}
|
||||
|
||||
public String getDirverClassName(INode node){
|
||||
return "";
|
||||
}
|
||||
@@ -69,23 +65,8 @@
|
||||
String conn = "conn_" + connection;;
|
||||
%>
|
||||
conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
<%
|
||||
String type = ElementParameterParser.getValue(node, "__TYPE__");
|
||||
if ("REDSHIFT".equals(type)){
|
||||
String jdbcUrl = "";
|
||||
//Retrieve connection node and check if SSO was used for correct logging
|
||||
java.util.List< ? extends INode> nodes = node.getProcess().getNodesOfType("tRedshiftConnection");
|
||||
String connectionRedShift = ElementParameterParser.getValue(node,"__CONNECTION__");
|
||||
for (INode ne : nodes) {
|
||||
if (connectionRedShift.equals(ne.getUniqueName())) {
|
||||
jdbcUrl = ElementParameterParser.getValue(ne, "__JDBC_URL__");
|
||||
}
|
||||
}
|
||||
needUserAndPassword = !"SSO".equals(jdbcUrl);
|
||||
this.afterUseExistConnection(node, needUserAndPassword);
|
||||
} else {
|
||||
<%
|
||||
this.afterUseExistConnection(node);
|
||||
}
|
||||
} else {
|
||||
boolean specify_alias = "true".equals(ElementParameterParser.getValue(node, "__SPECIFY_DATASOURCE_ALIAS__"));
|
||||
if(specify_alias){
|
||||
|
||||
@@ -64,10 +64,6 @@ imports="
|
||||
}
|
||||
|
||||
public void useExistConnection(INode node){
|
||||
useExistConnection(node, true);
|
||||
}
|
||||
|
||||
public void useExistConnection(INode node, boolean needUserAndPassword){
|
||||
beforeComponentProcess(node);
|
||||
if(isLog4jEnabled) {
|
||||
%>
|
||||
@@ -75,8 +71,6 @@ imports="
|
||||
if(conn_<%=cid%>.getMetaData() != null) {
|
||||
<%if (cid.contains("tImpala") || cid.contains("tHive")) {%>
|
||||
log.debug("<%=cid%> - Uses an existing connection <%=connection %>.");
|
||||
<%} else if (!needUserAndPassword){%>
|
||||
log.debug("<%=cid%> - Uses an existing connection. Connection URL: " + conn_<%=cid%>.getMetaData().getURL() + ".");
|
||||
<%} else {%>
|
||||
log.debug("<%=cid%> - Uses an existing connection with username '" + conn_<%=cid%>.getMetaData().getUserName() + "'. Connection URL: " + conn_<%=cid%>.getMetaData().getURL() + ".");
|
||||
<%}%>
|
||||
@@ -88,11 +82,7 @@ imports="
|
||||
|
||||
public void connect(INode node){
|
||||
beforeComponentProcess(node);
|
||||
if ("SSO".equals(ElementParameterParser.getValue(node, "__JDBC_URL__"))){
|
||||
connectWithSSO();
|
||||
} else {
|
||||
connect();
|
||||
}
|
||||
connect();
|
||||
}
|
||||
|
||||
public void connect(){
|
||||
@@ -103,14 +93,6 @@ imports="
|
||||
connect_end();
|
||||
}
|
||||
|
||||
public void connectWithSSO(){
|
||||
connect_begin_noUser();
|
||||
%>
|
||||
conn_<%=cid%> = java.sql.DriverManager.getConnection(url_<%=cid %>);
|
||||
<%
|
||||
connect_end();
|
||||
}
|
||||
|
||||
public void connect_begin(){
|
||||
logInfo(node,"debug",cid+" - Connection attempt to '\" + url_"+cid+" + \"' with the username '\" + dbUser_"+cid+" + \"'.");
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<webservice.dir>${project.basedir}/components/tWebServiceInput</webservice.dir>
|
||||
<webservicecore.dir>${project.basedir}/components/tWebService</webservicecore.dir>
|
||||
<thashfile.dir>${project.basedir}/components/tHashInput</thashfile.dir>
|
||||
<thashfile.version>3.0-20170711</thashfile.version>
|
||||
<thashfile.version>3.1-20190910</thashfile.version>
|
||||
<ftpProxy.dir>${project.basedir}/components/tFTPConnection</ftpProxy.dir>
|
||||
<ftpProxy.version>3.6.1-talend-20190819</ftpProxy.version>
|
||||
<talendMQRFH2.dir>${project.basedir}/components/tMomInput</talendMQRFH2.dir>
|
||||
@@ -117,7 +117,7 @@
|
||||
<outputDirectory>${webservicecore.dir}</outputDirectory>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<groupId>org.talend.components.lib</groupId>
|
||||
<artifactId>thashfile</artifactId>
|
||||
<version>${thashfile.version}</version>
|
||||
<type>jar</type>
|
||||
|
||||
@@ -100,15 +100,20 @@ 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 && (boolean) ((ElementParameter) propertyParameter)
|
||||
.getTaggedValue(IGenericConstants.IS_PROPERTY_SHOW)) {
|
||||
if (j == 0) {
|
||||
// The first item in the combo is
|
||||
// this component
|
||||
props.referenceType
|
||||
.setValue(ComponentReferenceProperties.ReferenceType.THIS_COMPONENT);
|
||||
props.componentInstanceId.setValue(null);
|
||||
props.setReference(null);
|
||||
propertyParameter.setShow(true);
|
||||
boolean isPropertyShow = true;
|
||||
Object isPropertyShowObj = ((ElementParameter) propertyParameter)
|
||||
.getTaggedValue(IGenericConstants.IS_PROPERTY_SHOW);
|
||||
if (isPropertyShowObj != null) {
|
||||
isPropertyShow = Boolean.valueOf(isPropertyShowObj.toString());
|
||||
}
|
||||
propertyParameter.setShow(isPropertyShow);
|
||||
} else {
|
||||
props.referenceType
|
||||
.setValue(ComponentReferenceProperties.ReferenceType.COMPONENT_INSTANCE);
|
||||
|
||||
@@ -1473,7 +1473,12 @@ 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
|
||||
return NodeUtil.replaceCRLFInMEMO_SQL(value);
|
||||
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;
|
||||
}
|
||||
if (GenericTypeUtils.isSchemaType(property)) {
|
||||
// Handles embedded escaped quotes which might occur
|
||||
|
||||
@@ -764,6 +764,15 @@
|
||||
name="ChangeOracleVersionForProjectSetting"
|
||||
version="5.2.1">
|
||||
</projecttask>
|
||||
<projecttask
|
||||
beforeLogon="false"
|
||||
breaks="7.1.0"
|
||||
class="org.talend.designer.core.utils.FillTRunJobReferenceParametersMigrationTask"
|
||||
description="Fix empty process id parameters for tRunjob node."
|
||||
id="org.talend.designer.core.utils.FillTRunJobReferenceParametersMigrationTask"
|
||||
name="Fix empty process id parameters for tRunjob node"
|
||||
version="7.1.1">
|
||||
</projecttask>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.talend.repository.projectsetting_page">
|
||||
|
||||
@@ -272,6 +272,7 @@ EParameterName.FunName=Function name
|
||||
EParameterName.IDocName=IDoc name
|
||||
EParameterName.fromDatabaseFlag=From Database
|
||||
EParameterName.fromFileFlag=From File
|
||||
EParameterName.OverrideEncodingFlag=Override Encoding
|
||||
EParameterName.generateCode=Generate Code
|
||||
EParameterName.help=Help
|
||||
EParameterName.host=Host
|
||||
@@ -736,6 +737,7 @@ 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 contexts added in repository context groups
|
||||
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.
|
||||
|
||||
@@ -226,6 +226,9 @@ public enum EParameterName {
|
||||
FIELDSEPARATOR(Messages.getString("EParameterName.FieldSeparator")), //$NON-NLS-1$
|
||||
ROWSEPARATOR(Messages.getString("EParameterName.RowSeparator")), //$NON-NLS-1$
|
||||
FROM_FILE_FLAG(Messages.getString("EParameterName.fromFileFlag")), //$NON-NLS-1$
|
||||
OVERRIDE_ENCODING_FLAG(Messages.getString("EParameterName.OverrideEncodingFlag")), //$NON-NLS-1$
|
||||
// for override encoding (name should be diff from the encoding of Stats&Logs)
|
||||
OVERRIDE_ENCODING_IN_EXTRA("OVERRIDE_ENCODING_IN_EXTRA"), //$NON-NLS-1$
|
||||
FROM_DATABASE_FLAG(Messages.getString("EParameterName.fromDatabaseFlag")), //$NON-NLS-1$
|
||||
// implict tConextLoad parameters.
|
||||
LOAD_NEW_VARIABLE(Messages.getString("EParameterName.LoadNewVariableLabel")), //$NON-NLS-1$
|
||||
|
||||
@@ -23,6 +23,7 @@ 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;
|
||||
@@ -31,6 +32,7 @@ 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;
|
||||
|
||||
@@ -143,7 +145,7 @@ public abstract class AbstractProcessProvider implements IReplaceNodeInProcess {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DOC qzhang Comment method "canDeleteNode".
|
||||
*
|
||||
@@ -257,5 +259,10 @@ 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ 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;
|
||||
@@ -36,6 +37,7 @@ 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;
|
||||
@@ -3249,8 +3251,8 @@ public class DataProcess implements IGeneratingProcess {
|
||||
if (!hadoopClusterService.isUseDynamicConfJar(hadoopClusterItemId)) {
|
||||
return null;
|
||||
}
|
||||
String confsJarName = hadoopClusterService.getCustomConfsJarName(hadoopClusterItemId, false, false);
|
||||
if (confsJarName == null) {
|
||||
Optional<HadoopConfJarBean> confJarBean = hadoopClusterService.getCustomConfsJar(hadoopClusterItemId, false, false);
|
||||
if (!confJarBean.isPresent()) {
|
||||
return null;
|
||||
}
|
||||
IComponent component = ComponentsFactoryProvider.getInstance().get(componentName, componentCategory.getName());
|
||||
@@ -3266,7 +3268,21 @@ public class DataProcess implements IGeneratingProcess {
|
||||
clusterIdParam.setValue(hadoopClusterItemId);
|
||||
}
|
||||
IElementParameter confLibParam = confNode.getElementParameter("CONF_LIB"); //$NON-NLS-1$
|
||||
confLibParam.setValue(TalendTextUtils.addQuotes(confsJarName));
|
||||
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);
|
||||
}
|
||||
return confNode;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -256,6 +256,9 @@ public class JobContextLoadComponent implements IComponent {
|
||||
source = self + "IGNORE_ERROR_MESSAGE"; //$NON-NLS-1$
|
||||
multipleComponentManager.addParam(source, FILE_INPUT_REGEX + ".IGNORE_ERROR_MESSAGE"); //$NON-NLS-1$
|
||||
|
||||
source = self + "ENCODING";
|
||||
multipleComponentManager.addParam(source, FILE_INPUT_REGEX + ".ENCODING"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
} else {
|
||||
String source = self + JobSettingsConstants.getExtraParameterName(EParameterName.URL.getName());
|
||||
multipleComponentManager.addParam(source, DB_INPUT + ".URL");
|
||||
|
||||
@@ -96,6 +96,12 @@ public class JobSettingsManager {
|
||||
|
||||
private static final String CONNECTOR = TalendTextUtils.getStringConnect();
|
||||
|
||||
private static final String ENCODING_TYPE_UTF_8 = "UTF-8"; //$NON-NLS-1$
|
||||
|
||||
private static final String ENCODING_TYPE_ISO_8859_15 = "ISO-8859-15"; //$NON-NLS-1$
|
||||
|
||||
private static final String ENCODING_TYPE_CUSTOM = "CUSTOM"; //$NON-NLS-1$
|
||||
|
||||
private static List<IElementParameter> getHeaderFooterParameters(IProcess process) {
|
||||
// for headerFooter Code
|
||||
ElementParameter param;
|
||||
@@ -384,6 +390,51 @@ public class JobSettingsManager {
|
||||
param.setShowIf(condition);
|
||||
paramList.add(param);
|
||||
|
||||
// begin Override encoding checkbox
|
||||
param = new ElementParameter(process);
|
||||
param.setName(EParameterName.OVERRIDE_ENCODING_FLAG.getName());
|
||||
param.setDisplayName(EParameterName.OVERRIDE_ENCODING_FLAG.getDisplayName());
|
||||
param.setFieldType(EParameterFieldType.CHECK);
|
||||
param.setCategory(EComponentCategory.EXTRA);
|
||||
param.setGroup(IMPLICIT_GROUP);
|
||||
param.setNumRow(33);
|
||||
param.setValue(false);
|
||||
param.setShowIf(condition);
|
||||
paramList.add(param);
|
||||
// end Override encoding checkbox
|
||||
|
||||
// begin encoding select
|
||||
ElementParameter encodingParam = new ElementParameter(process);
|
||||
encodingParam.setName(EParameterName.OVERRIDE_ENCODING_IN_EXTRA.getName());
|
||||
encodingParam.setDisplayName(EParameterName.OVERRIDE_ENCODING_IN_EXTRA.getDisplayName());
|
||||
encodingParam.setCategory(EComponentCategory.EXTRA);
|
||||
encodingParam.setGroup(IMPLICIT_GROUP);
|
||||
encodingParam.setFieldType(EParameterFieldType.ENCODING_TYPE);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(JobSettingsConstants.getExtraParameterName(EParameterName.FROM_FILE_FLAG.getName())).append(" == 'true' and ")
|
||||
.append(EParameterName.OVERRIDE_ENCODING_FLAG.getName()).append(" == 'true' and ").append(CONTEXTLOAD_CONDITION);
|
||||
condition = JobSettingsConstants.addBrackets(sb.toString());
|
||||
encodingParam.setShowIf(condition); // $NON-NLS-1$
|
||||
encodingParam.setValue(ENCODING_TYPE_ISO_8859_15);
|
||||
encodingParam.setNumRow(34);
|
||||
paramList.add(encodingParam);
|
||||
|
||||
ElementParameter childParam = new ElementParameter(process);
|
||||
childParam.setName(EParameterName.ENCODING_TYPE.getName());
|
||||
childParam.setDisplayName(EParameterName.ENCODING_TYPE.getDisplayName());
|
||||
childParam.setFieldType(EParameterFieldType.TECHNICAL);
|
||||
childParam.setCategory(EComponentCategory.EXTRA);
|
||||
childParam.setGroup(IMPLICIT_GROUP);
|
||||
childParam.setListItemsDisplayName(new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
|
||||
childParam.setListItemsDisplayCodeName(
|
||||
new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
|
||||
childParam.setListItemsValue(new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
|
||||
childParam.setValue(ENCODING_TYPE_ISO_8859_15);
|
||||
childParam.setNumRow(34);
|
||||
childParam.setShow(true);
|
||||
childParam.setShowIf(condition); // $NON-NLS-1$
|
||||
childParam.setParentParameter(encodingParam);
|
||||
// end encoding select
|
||||
return paramList;
|
||||
}
|
||||
|
||||
@@ -952,6 +1003,25 @@ public class JobSettingsManager {
|
||||
tContextLoadNode.getElementParameter(EParameterName.IMPLICIT_TCONTEXTLOAD_FILE.getName()).setValue(inputFile);
|
||||
String regex = FileSeparator.getSeparatorsRegexp(fileSparator);
|
||||
tContextLoadNode.getElementParameter(JobSettingsConstants.IMPLICIT_TCONTEXTLOAD_REGEX).setValue(regex);
|
||||
|
||||
String encoding = (String) process.getElementParameter(EParameterName.OVERRIDE_ENCODING_IN_EXTRA.getName())
|
||||
.getValue();
|
||||
if (StringUtils.isNotEmpty(encoding) && !encoding.startsWith(TalendTextUtils.getQuoteChar())) {
|
||||
encoding = TalendTextUtils.addQuotes(encoding);
|
||||
}
|
||||
|
||||
// override encoding
|
||||
paramName = EParameterName.OVERRIDE_ENCODING_FLAG.getName();
|
||||
boolean overrideFlag = ((Boolean) process.getElementParameter(paramName).getValue())
|
||||
&& process.getElementParameter(paramName).isShow(process.getElementParameters());
|
||||
if (overrideFlag) {
|
||||
IElementParameter encodingParam = new ElementParameter(tContextLoadNode);
|
||||
encodingParam.setName(EParameterName.ENCODING.getName());
|
||||
encodingParam.setDisplayName(EParameterName.ENCODING.getDisplayName());
|
||||
encodingParam.setFieldType(EParameterFieldType.ENCODING_TYPE);
|
||||
encodingParam.setValue(encoding);
|
||||
tContextLoadNode.addElementParameter(encodingParam);
|
||||
}
|
||||
} else {
|
||||
// is db
|
||||
paramName = JobSettingsConstants.getExtraParameterName(EParameterName.URL.getName());
|
||||
|
||||
@@ -607,7 +607,7 @@ public final class TalendEditorPaletteFactory {
|
||||
while (iter.hasNext()) {
|
||||
IComponent xmlComponent = iter.next();
|
||||
|
||||
Matcher matcher = pattern.matcher(xmlComponent.getName().toLowerCase());
|
||||
Matcher matcher = pattern.matcher(xmlComponent.getDisplayName().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 = (IUnifiedComponentService) GlobalServiceRegister.getDefault().getService(
|
||||
IUnifiedComponentService service = GlobalServiceRegister.getDefault().getService(
|
||||
IUnifiedComponentService.class);
|
||||
service.filterUnifiedComponentForPalette(compFac, componentSet, lowerCasedKeyword);
|
||||
|
||||
@@ -730,13 +730,12 @@ 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;
|
||||
|
||||
@@ -19,15 +19,21 @@ 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;
|
||||
@@ -297,5 +303,41 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -480,13 +480,6 @@ 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)
|
||||
|
||||
@@ -516,7 +516,7 @@ public class Node extends Element implements IGraphicalNode {
|
||||
|
||||
private void init(IComponent newComponent) {
|
||||
this.component = UnifiedComponentUtil.getEmfComponent(this, newComponent);
|
||||
this.label = component.getName();
|
||||
this.label = component.getDisplayName();
|
||||
updateComponentStatusIfNeeded(true);
|
||||
IPreferenceStore store = DesignerPlugin.getDefault().getPreferenceStore();
|
||||
|
||||
@@ -1179,6 +1179,12 @@ 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();
|
||||
|
||||
@@ -29,6 +29,7 @@ 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;
|
||||
@@ -125,6 +126,7 @@ 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;
|
||||
@@ -185,7 +187,6 @@ 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;
|
||||
@@ -1074,6 +1075,20 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
|
||||
listParamType.add(pType);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isDefaultValue(IElementParameter param) {
|
||||
if (param != null && param.getName().equals(EParameterName.JOB_RUN_VM_ARGUMENTS.getName())) {
|
||||
if(param.getElement() instanceof Process) {
|
||||
IElementParameter jvmOptParam = ((Process)param.getElement()).getElementParameter(EParameterName.JOB_RUN_VM_ARGUMENTS_OPTION.getName());
|
||||
if(jvmOptParam != null && param.isValueSetToDefault() && jvmOptParam.isValueSetToDefault()) {
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return param.isValueSetToDefault();
|
||||
}
|
||||
|
||||
private void saveElementParameter(IElementParameter param, ProcessType process, TalendFileFactory fileFact,
|
||||
List<? extends IElementParameter> paramList, EList listParamType) {
|
||||
@@ -1086,8 +1101,8 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
|
||||
isJoblet = true;
|
||||
}
|
||||
}
|
||||
if (param.isValueSetToDefault()) {
|
||||
return;
|
||||
if (isDefaultValue(param)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (param.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE)
|
||||
@@ -1400,11 +1415,6 @@ 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) {
|
||||
@@ -1820,23 +1830,36 @@ 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).stream()
|
||||
.filter(o -> !((RoutineItem) o.getProperty().getItem()).isBuiltIn()).collect(Collectors.toList()));
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
});
|
||||
Set<String> allRoutinesSet = routines.stream().map(o -> o.getProperty().getLabel()).collect(Collectors.toSet());
|
||||
Iterator<RoutinesParameterType> iterator = routinesDependencies.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
RoutinesParameterType routine = iterator.next();
|
||||
if (!allRoutinesSet.contains(routine.getName())) {
|
||||
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());
|
||||
}
|
||||
|
||||
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()) {
|
||||
for (Project project : referenceProjects) {
|
||||
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())) {
|
||||
@@ -1861,9 +1884,8 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
|
||||
possibleRoutines.add(object.getLabel());
|
||||
}
|
||||
}
|
||||
for (Project project : ProjectManager.getInstance().getAllReferencedProjects()) {
|
||||
for (Project project : referenceProjects) {
|
||||
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())) {
|
||||
@@ -3337,6 +3359,9 @@ 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);
|
||||
}
|
||||
|
||||
@@ -4446,6 +4471,18 @@ 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));
|
||||
}
|
||||
@@ -4577,6 +4614,9 @@ 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) {
|
||||
|
||||
@@ -115,6 +115,7 @@ 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;
|
||||
@@ -126,6 +127,7 @@ 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;
|
||||
@@ -308,6 +310,10 @@ 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>();
|
||||
@@ -415,8 +421,6 @@ 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()) {
|
||||
@@ -440,14 +444,6 @@ 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) {
|
||||
@@ -459,10 +455,8 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
|
||||
existedParams.put(repositoryContext, new HashSet<String>());
|
||||
}
|
||||
existedParams.get(repositoryContext).add(paramName);
|
||||
String jobContextGroupName = context.getName();
|
||||
boolean contains = contextItemGroupNames.contains(jobContextGroupName);
|
||||
if (contains && (onlySimpleShow || !ContextUtils.samePropertiesForContextParameter(param,
|
||||
contextParameterType))) {
|
||||
if (onlySimpleShow || !ContextUtils.samePropertiesForContextParameter(param,
|
||||
contextParameterType)) {
|
||||
unsameMap.add(contextItem, paramName);
|
||||
}
|
||||
builtin = false;
|
||||
@@ -596,10 +590,14 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
|
||||
if (newParametersMap.get(contextItem) == null) {
|
||||
newParametersMap.put(contextItem, new HashSet<String>());
|
||||
}
|
||||
newParametersMap.get(contextItem).add(parameterType.getName());
|
||||
// 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -247,7 +247,7 @@ public class TalendEditorDropTargetListener extends TemplateTransferDropTargetLi
|
||||
if (obj instanceof RepositoryNode) {
|
||||
RepositoryNode sourceNode = (RepositoryNode) obj;
|
||||
if (PluginChecker.isCDCPluginLoaded()) {
|
||||
ICDCProviderService service = (ICDCProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ICDCProviderService service = 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 = (IOozieService) GlobalServiceRegister.getDefault().getService(IOozieService.class);
|
||||
oozieService = 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 = (ISAPProviderService) GlobalServiceRegister.getDefault().getService(ISAPProviderService.class);
|
||||
sapService = 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 = (ITestContainerProviderService) GlobalServiceRegister
|
||||
ITestContainerProviderService testContainerService = 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 = (IComponentsService) GlobalServiceRegister.getDefault().getService(
|
||||
IComponentsService service = 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 = (ICamelDesignerCoreService) GlobalServiceRegister.getDefault()
|
||||
ICamelDesignerCoreService camelService = 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 = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
IJobletProviderService service = 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 = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
IJobletProviderService service = 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 = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
IJobletProviderService service = 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.getName();
|
||||
return component.getDisplayName();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -19,6 +19,7 @@ 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;
|
||||
@@ -36,6 +37,7 @@ 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;
|
||||
@@ -86,15 +88,16 @@ public class UpdateContextParameterCommand extends Command {
|
||||
if (result == null) {
|
||||
return;
|
||||
}
|
||||
List<String> contextItemGroupNames = new ArrayList<String>();
|
||||
Map<String, ContextType> repoContextMap = new HashMap<String, ContextType>();
|
||||
String repoDefaultContextName = null;
|
||||
if (result.getParameter() != null) {
|
||||
if (result.getParameter() instanceof ContextItem) {
|
||||
contextItemGroupNames.clear();
|
||||
EList<?> contextGroups = ((ContextItem) result.getParameter()).getContext();
|
||||
for (Object contextGroup : contextGroups) {
|
||||
repoDefaultContextName = ((ContextItem) result.getParameter()).getDefaultContext();
|
||||
for (Object contextGroup : contextGroups) {
|
||||
if (contextGroup instanceof ContextTypeImpl) {
|
||||
String name = ((ContextTypeImpl) contextGroup).getName();
|
||||
contextItemGroupNames.add(name);
|
||||
repoContextMap.put(name, ((ContextTypeImpl) contextGroup));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,13 +140,19 @@ public class UpdateContextParameterCommand extends Command {
|
||||
}
|
||||
break;
|
||||
case UPDATE:
|
||||
if (contextItemGroupNames.contains(context.getName())) {
|
||||
String sourceContextName = null;
|
||||
if (repoContextMap.containsKey(context.getName())) {
|
||||
sourceContextName = context.getName();
|
||||
} else {
|
||||
sourceContextName = repoDefaultContextName;
|
||||
}
|
||||
if (sourceContextName != null) {
|
||||
item = (ContextItem) result.getParameter();
|
||||
|
||||
if (item != null && item.getProperty().getId().equals(param.getSource())
|
||||
&& result.isChecked()) {
|
||||
|
||||
ContextUtils.updateParameterFromRepository(item, param, context.getName());
|
||||
ContextUtils.updateParameterFromRepository(item, param, sourceContextName);
|
||||
} else {
|
||||
param.setSource(IContextParameter.BUILT_IN);
|
||||
}
|
||||
@@ -201,6 +210,30 @@ 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);
|
||||
}
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
|
||||
@@ -65,6 +65,9 @@ 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()));
|
||||
@@ -101,6 +104,9 @@ 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()));
|
||||
|
||||
@@ -67,6 +67,8 @@ 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$
|
||||
|
||||
|
||||
@@ -85,6 +85,12 @@ public class ProjectSettingManager extends Utils {
|
||||
|
||||
private static String languagePrefix = LanguageManager.getCurrentLanguage().toString() + "_"; //$NON-NLS-1$
|
||||
|
||||
private static final String ENCODING_TYPE_UTF_8 = "UTF-8"; //$NON-NLS-1$
|
||||
|
||||
private static final String ENCODING_TYPE_ISO_8859_15 = "ISO-8859-15"; //$NON-NLS-1$
|
||||
|
||||
private static final String ENCODING_TYPE_CUSTOM = "CUSTOM"; //$NON-NLS-1$
|
||||
|
||||
public static void saveProject() {
|
||||
RepositoryContext repositoryContext = (RepositoryContext) CorePlugin.getContext().getProperty(
|
||||
Context.REPOSITORY_CONTEXT_KEY);
|
||||
@@ -448,6 +454,51 @@ public class ProjectSettingManager extends Utils {
|
||||
param.setShowIf(condition);
|
||||
paramList.add(param);
|
||||
|
||||
// begin Override encoding checkbox
|
||||
param = new ElementParameter(elem);
|
||||
param.setName(EParameterName.OVERRIDE_ENCODING_FLAG.getName());
|
||||
param.setDisplayName(EParameterName.OVERRIDE_ENCODING_FLAG.getDisplayName());
|
||||
param.setFieldType(EParameterFieldType.CHECK);
|
||||
param.setCategory(EComponentCategory.EXTRA);
|
||||
param.setGroup(IMPLICIT_GROUP);
|
||||
param.setNumRow(33);
|
||||
param.setValue(false);
|
||||
param.setShowIf(condition);
|
||||
paramList.add(param);
|
||||
// end Override encoding checkbox
|
||||
|
||||
// begin encoding select
|
||||
ElementParameter encodingParam = new ElementParameter(elem);
|
||||
encodingParam.setName(EParameterName.OVERRIDE_ENCODING_IN_EXTRA.getName());
|
||||
encodingParam.setDisplayName(EParameterName.OVERRIDE_ENCODING_IN_EXTRA.getDisplayName());
|
||||
encodingParam.setCategory(EComponentCategory.EXTRA);
|
||||
encodingParam.setGroup(IMPLICIT_GROUP);
|
||||
encodingParam.setFieldType(EParameterFieldType.ENCODING_TYPE);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(JobSettingsConstants.getExtraParameterName(EParameterName.FROM_FILE_FLAG.getName())).append(" == 'true' and ")
|
||||
.append(EParameterName.OVERRIDE_ENCODING_FLAG.getName()).append(" == 'true' and ").append(CONTEXTLOAD_CONDITION);
|
||||
condition = JobSettingsConstants.addBrackets(sb.toString());
|
||||
encodingParam.setShowIf(condition); // $NON-NLS-1$
|
||||
encodingParam.setValue(ENCODING_TYPE_ISO_8859_15);
|
||||
encodingParam.setNumRow(34);
|
||||
paramList.add(encodingParam);
|
||||
|
||||
ElementParameter childParam = new ElementParameter(elem);
|
||||
childParam.setName(EParameterName.ENCODING_TYPE.getName());
|
||||
childParam.setDisplayName(EParameterName.ENCODING_TYPE.getDisplayName());
|
||||
childParam.setFieldType(EParameterFieldType.TECHNICAL);
|
||||
childParam.setCategory(EComponentCategory.EXTRA);
|
||||
childParam.setGroup(IMPLICIT_GROUP);
|
||||
childParam.setListItemsDisplayName(new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
|
||||
childParam.setListItemsDisplayCodeName(
|
||||
new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
|
||||
childParam.setListItemsValue(new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
|
||||
childParam.setValue(ENCODING_TYPE_ISO_8859_15);
|
||||
childParam.setNumRow(34);
|
||||
childParam.setShow(true);
|
||||
childParam.setShowIf(condition); // $NON-NLS-1$
|
||||
childParam.setParentParameter(encodingParam);
|
||||
// end encoding select
|
||||
}
|
||||
|
||||
private static void createExtraOnDBParameters(Element elem) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user