Compare commits
129 Commits
patch/TPS-
...
patch/TPS-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c981e68725 | ||
|
|
c465e337e1 | ||
|
|
2f21627cc6 | ||
|
|
f8c9ce00ba | ||
|
|
05c00a1152 | ||
|
|
16fcf7d1c9 | ||
|
|
42c51a8624 | ||
|
|
7c625d9201 | ||
|
|
39042a308b | ||
|
|
65f229036c | ||
|
|
26b45c6f3e | ||
|
|
dc14b124c8 | ||
|
|
a7ae3334f8 | ||
|
|
e21710c699 | ||
|
|
7ac71ac864 | ||
|
|
fd37124ecd | ||
|
|
8cefa89ecd | ||
|
|
56120b75bb | ||
|
|
aafe501e22 | ||
|
|
5f14941414 | ||
|
|
d2ff4a74ac | ||
|
|
aed787a905 | ||
|
|
c5dfff2320 | ||
|
|
6e6d11bf5a | ||
|
|
3eaf12697f | ||
|
|
ca4b013c76 | ||
|
|
754b49bf37 | ||
|
|
7804c32c0c | ||
|
|
1ea3d2e8c8 | ||
|
|
d34ed648a7 | ||
|
|
ec4847911c | ||
|
|
5dfc5caeaa | ||
|
|
d08835d811 | ||
|
|
e8d6bff08d | ||
|
|
e6bcd0b81a | ||
|
|
58243b216a | ||
|
|
5cfa7b3b98 | ||
|
|
1d1f782cd0 | ||
|
|
e3e9c9b401 | ||
|
|
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 |
64
PATCH_RELEASE_NOTE.md
Normal file
64
PATCH_RELEASE_NOTE.md
Normal file
@@ -0,0 +1,64 @@
|
||||
---
|
||||
version: 7.2.1
|
||||
module: https://talend.poolparty.biz/coretaxonomy/42
|
||||
product:
|
||||
- https://talend.poolparty.biz/coretaxonomy/23
|
||||
---
|
||||
|
||||
# TPS-3928
|
||||
|
||||
| Info | Value |
|
||||
| ---------------- | ---------------- |
|
||||
| Patch Name | Patch\_20200418\_TPS-3928\_v1-7.2.1 |
|
||||
| Release Date | 2020-04-18 |
|
||||
| Target Version | Talend-Studio-20190620\_1446-V7.2.1 |
|
||||
| Product affected | Talend Studio |
|
||||
|
||||
## Introduction
|
||||
|
||||
This is a self-contained patch.
|
||||
|
||||
**NOTE**: For information on how to obtain this patch, reach out to your Support contact at Talend.
|
||||
|
||||
## Fixed issues
|
||||
|
||||
This patch contains the following fixes:
|
||||
|
||||
- TPS-3928 [7.2.1] Exceptions thrown by tDotNETRow crash the JVM (TDI-43929)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Consider the following requirements for your system:
|
||||
|
||||
- Talend Studio 7.2.1 must be installed.
|
||||
|
||||
## Installation
|
||||
|
||||
### Manual installation
|
||||
It needs manual installation because the file janet-win64.dll needs to be updated.
|
||||
1) Unpack "plugins" folder from the archive into studio's root folder. So that the files
|
||||
"tDotNETInstantiate\_java.xml", "tDotNETRow\_java.xml", "tMSAXInput\_java.xml", "tMSAXOutput\_java.xml", "tOleDbInput\_java.xml", "tOleDbOutput\_java.xml", "tOleDbRow\_java.xml"
|
||||
will be replaced.
|
||||
2) Find the local file "janet-win64.dll".
|
||||
It should be in:
|
||||
a) the folder where "java.library.path" variable points out
|
||||
b) or in the %WINDIR%\System32 folder (e.g. "C:\Windows\System32")
|
||||
|
||||
Replace the file with one of the files either from "janet-dlls_35" or "janet-dlls_40" folder. The folders are in the patch's root.
|
||||
Use "janet-dlls_35" for .NET 3.5 or "janet-dlls_40" for .NET 4.0 and higher.
|
||||
|
||||
## Uninstallation
|
||||
Backup the Affected files list below. Uninstall the patch by restore the backup files.
|
||||
|
||||
## Affected files for this patch
|
||||
|
||||
The following files are installed by this patch:
|
||||
|
||||
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tDotNETInstantiate/tDotNETInstantiate\_java.xml
|
||||
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tDotNETRow/tDotNETRow\_java.xml
|
||||
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tMSAXInput/tMSAXInput\_java.xml
|
||||
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tMSAXOutput/tMSAXOutput\_java.xml
|
||||
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tOleDbInput/tOleDbInput\_java.xml
|
||||
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tOleDbOutput/tOleDbOutput\_java.xml
|
||||
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tOleDbRow/tOleDbRow\_java.xml
|
||||
- janet-win64.dll (the file is in the place where java.library.path variable points out)
|
||||
@@ -106,6 +106,21 @@
|
||||
exist_tSQLDB = true;
|
||||
}
|
||||
|
||||
|
||||
String[] tcompV0Components = new String[] {
|
||||
"tAzureStorageConnection",
|
||||
"tGoogleDriveConnection",
|
||||
"tMarketoConnection",
|
||||
"tSnowflakeConnection",
|
||||
"tSalesforceConnection",
|
||||
"tNetsuiteConnection",
|
||||
"tMarkLogicConnection"
|
||||
};
|
||||
List<INode> tcompV0ComponentsList = new ArrayList<INode>();
|
||||
for (String tcompV0Component : tcompV0Components) {
|
||||
tcompV0ComponentsList.addAll((List<INode>)process.getNodesOfType(tcompV0Component));
|
||||
}
|
||||
|
||||
boolean exist_tSCP = false;
|
||||
List<INode> scpComponentsList = (List<INode>)process.getNodesOfType("tSCPConnection");
|
||||
if (scpComponentsList.size() > 0) {
|
||||
@@ -165,6 +180,8 @@
|
||||
exist_tSalesforce = true;
|
||||
}
|
||||
|
||||
List<INode> snowflakeComponentsList = (List<INode>)process.getNodesOfType("tSnowflakeConnection");
|
||||
|
||||
boolean exist_tSAP= false;
|
||||
List<INode> sapComponentsList = (List<INode>)process.getNodesOfType("tSAPConnection");
|
||||
if (sapComponentsList.size() > 0) {
|
||||
@@ -445,6 +462,7 @@
|
||||
lastStr = "";
|
||||
}
|
||||
}
|
||||
enableLogStash = "true".equalsIgnoreCase(System.getProperty("monitoring"));
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
if(!"".equals(log4jLevel)){
|
||||
@@ -493,7 +511,13 @@
|
||||
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)));
|
||||
|
||||
org.apache.log4j.Logger.getLogger("audit").setLevel(org.apache.log4j.Level.DEBUG);
|
||||
|
||||
auditLogger_<%=jobCatcherNode.getUniqueName()%> = org.talend.job.audit.JobEventAuditLoggerFactory.createJobAuditLogger(properties_<%=jobCatcherNode.getUniqueName()%>);
|
||||
}
|
||||
<%
|
||||
@@ -584,7 +608,16 @@
|
||||
} //endIf
|
||||
%>
|
||||
context.setContextType("<%=ctxParam.getName()%>", "<%=ctxParam.getType()%>");
|
||||
if(context.getStringValue("<%=ctxParam.getName()%>") == null) {
|
||||
context.<%=ctxParam.getName()%> = null;
|
||||
} else {
|
||||
<%//}B1 block%>
|
||||
<%
|
||||
String typeToGenerate ="String";
|
||||
if( !(ctxParam.getType().equals("id_File") || ctxParam.getType().equals("id_Directory") ||ctxParam.getType().equals("id_List Of Value"))) {
|
||||
typeToGenerate=JavaTypesManager.getTypeToGenerate(ctxParam.getType(),true);
|
||||
}
|
||||
|
||||
if (ctxParam.getType().equals("id_Password")) {
|
||||
%>
|
||||
String pwd_<%=ctxParam.getName()%>_value = context.getProperty("<%=ctxParam.getName()%>");
|
||||
@@ -602,13 +635,7 @@
|
||||
}
|
||||
}
|
||||
<%
|
||||
continue;
|
||||
}
|
||||
String typeToGenerate ="String";
|
||||
if( !(ctxParam.getType().equals("id_File") || ctxParam.getType().equals("id_Directory") ||ctxParam.getType().equals("id_List Of Value"))) {
|
||||
typeToGenerate=JavaTypesManager.getTypeToGenerate(ctxParam.getType(),true);
|
||||
}
|
||||
if(typeToGenerate.equals("java.util.Date")) {
|
||||
} else if(typeToGenerate.equals("java.util.Date")) {
|
||||
%>
|
||||
try{
|
||||
String context_<%=ctxParam.getName()%>_value = context.getProperty("<%=ctxParam.getName()%>");
|
||||
@@ -667,6 +694,10 @@
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<%//{B1 block%>
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} <%/*close last method*/%>
|
||||
@@ -1440,12 +1471,14 @@ if (execStat) {
|
||||
<% } %>
|
||||
<% for (INode existNode : existComponentsList) { %>
|
||||
connections.put("col_<%=existNode.getUniqueName()%>", globalMap.get("col_<%=existNode.getUniqueName()%>"));
|
||||
<% } %>
|
||||
<% }
|
||||
|
||||
<% for (INode salesforceNode : salesforceComponentsList) { %>
|
||||
connections.put("conn_<%=salesforceNode.getUniqueName()%>", globalMap.get("conn_<%=salesforceNode.getUniqueName()%>"));
|
||||
<% } %>
|
||||
<% for (INode sapNode : sapComponentsList) { %>
|
||||
for (INode tcompV0ConnectionNode : tcompV0ComponentsList) { %>
|
||||
connections.put("<%=tcompV0ConnectionNode.getUniqueName()%>_connection", globalMap.get("<%=tcompV0ConnectionNode.getUniqueName()%>_connection"));
|
||||
connections.put("<%=tcompV0ConnectionNode.getUniqueName()%>_COMPONENT_RUNTIME_PROPERTIES", globalMap.get("<%=tcompV0ConnectionNode.getUniqueName()%>_COMPONENT_RUNTIME_PROPERTIES"));
|
||||
<% }
|
||||
|
||||
for (INode sapNode : sapComponentsList) { %>
|
||||
connections.put("conn_<%=sapNode.getUniqueName()%>", globalMap.get("conn_<%=sapNode.getUniqueName()%>"));
|
||||
<% } %>
|
||||
<% for (INode gsNode : gsComponentsList) { %>
|
||||
@@ -1509,12 +1542,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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -289,6 +289,15 @@ if(isRunInMultiThread){
|
||||
}
|
||||
<% } %>
|
||||
}
|
||||
|
||||
//if the stored or passed value is "<TALEND_NULL>" string, it mean null
|
||||
public String getStringValue(String key) {
|
||||
String origin_value = this.getProperty(key);
|
||||
if(NULL_VALUE_EXPRESSION_IN_COMMAND_STRING_FOR_CHILD_JOB_ONLY.equals(origin_value)) {
|
||||
return null;
|
||||
}
|
||||
return origin_value;
|
||||
}
|
||||
|
||||
<%
|
||||
for (IContextParameter ctxParam :params)
|
||||
|
||||
@@ -66,6 +66,7 @@ import org.talend.designer.codegen.model.CodeGeneratorEmittersPoolFactory;
|
||||
import org.talend.designer.codegen.model.CodeGeneratorInternalTemplatesFactoryProvider;
|
||||
import org.talend.designer.codegen.proxy.JetProxy;
|
||||
import org.talend.designer.core.generic.model.Component;
|
||||
import org.talend.designer.runprocess.ProcessorUtilities;
|
||||
|
||||
/**
|
||||
* CodeGenerator.
|
||||
@@ -353,8 +354,12 @@ public class CodeGenerator implements ICodeGenerator {
|
||||
.getDefault().getService(IResourcesDependenciesService.class);
|
||||
String resourcePathForContext = null;
|
||||
if (process instanceof IProcess2) {
|
||||
resourcePathForContext = resourceService.getResourcePathForContext(process,
|
||||
contextPar.getValue());
|
||||
String value = contextPar.getValue();
|
||||
// for runtime
|
||||
if (!ProcessorUtilities.isExportConfig()) {
|
||||
contextPar.setType(JavaTypesManager.FILE.getId());
|
||||
}
|
||||
resourcePathForContext = resourceService.getResourcePathForContext(process, value);
|
||||
} else {
|
||||
// for PreviewFileInputContentDataProcess run
|
||||
resourcePathForContext = resourceService.getResourceItemFilePath(contextPar.getValue());
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
@@ -70,7 +70,6 @@ import org.talend.core.model.components.ComponentCategory;
|
||||
import org.talend.core.model.components.ComponentManager;
|
||||
import org.talend.core.model.components.ComponentProviderInfo;
|
||||
import org.talend.core.model.components.ComponentUtilities;
|
||||
import org.talend.core.model.components.EComponentType;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.components.IComponentsFactory;
|
||||
import org.talend.core.model.components.IComponentsHandler;
|
||||
@@ -838,23 +837,21 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
init(false);
|
||||
}
|
||||
|
||||
for (IComponent comp : componentList) {
|
||||
if (comp.getComponentType() != EComponentType.JOBLET) {
|
||||
continue;
|
||||
}
|
||||
String comName = comp.getName();
|
||||
if (comp != null && paletteType.equals(comp.getPaletteType())) {
|
||||
if (comName.equals(name)) {
|
||||
return comp;
|
||||
} else if (new JobletUtil().matchExpression(comName)) {
|
||||
String[] names = comName.split(":"); //$NON-NLS-1$
|
||||
comName = names[1];
|
||||
if (comName.equals(name)) {
|
||||
return comp;
|
||||
}
|
||||
// check if reference joblet component presents
|
||||
JobletUtil jobletUtils = new JobletUtil();
|
||||
Optional<IComponent> result = jobletUtils.findComponentByName(componentList, name, paletteType);
|
||||
if (!result.isPresent()) {
|
||||
// check if any name matching joblet component presents
|
||||
if (jobletUtils.matchExpression(name)) {
|
||||
name = StringUtils.substringAfterLast(name, ":"); //$NON-NLS-1$
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
result = jobletUtils.findComponentByName(componentList, name, paletteType);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result.isPresent()) {
|
||||
return result.get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.5-talend</version>
|
||||
<name>json-lib</name>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -104,16 +104,17 @@ public final class JSONUtils {
|
||||
return "null";
|
||||
}
|
||||
|
||||
// Shave off trailing zeros and decimal point, if possible.
|
||||
// Shave off trailing zeros. Keep decimal to keep type double
|
||||
|
||||
String s = Double.toString( d );
|
||||
if( s.indexOf( '.' ) > 0 && s.indexOf( 'e' ) < 0 && s.indexOf( 'E' ) < 0 ){
|
||||
while( s.endsWith( "0" ) ){
|
||||
while(s.charAt(s.length() - 1) == '0'){
|
||||
if(s.endsWith(".0")){
|
||||
break;
|
||||
}
|
||||
|
||||
s = s.substring( 0, s.length() - 1 );
|
||||
}
|
||||
if( s.endsWith( "." ) ){
|
||||
s = s.substring( 0, s.length() - 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
@@ -440,17 +441,19 @@ public final class JSONUtils {
|
||||
}
|
||||
testValidity( n );
|
||||
|
||||
// Shave off trailing zeros and decimal point, if possible.
|
||||
// Shave off trailing zeros. Keep decimal to keep type double
|
||||
|
||||
String s = n.toString();
|
||||
if( s.indexOf( '.' ) > 0 && s.indexOf( 'e' ) < 0 && s.indexOf( 'E' ) < 0 ){
|
||||
while( s.endsWith( "0" ) ){
|
||||
s = s.substring( 0, s.length() - 1 );
|
||||
}
|
||||
if( s.endsWith( "." ) ){
|
||||
while(s.charAt(s.length() - 1) == '0'){
|
||||
if(s.endsWith(".0")){
|
||||
break;
|
||||
}
|
||||
|
||||
s = s.substring( 0, s.length() - 1 );
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
@@ -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( ':' );
|
||||
|
||||
@@ -44,7 +44,25 @@ public class TestJSONUtils extends TestCase {
|
||||
}
|
||||
|
||||
public void testDoubleToString_trailingZeros() {
|
||||
assertEquals( "200", JSONUtils.doubleToString( 200.00000 ) );
|
||||
assertEquals( "200.0", JSONUtils.doubleToString( 200.00000 ) );
|
||||
}
|
||||
|
||||
public void testDoubleToString() {
|
||||
Map<String, Double> expected = new HashMap<>();
|
||||
expected.put("200.0", 200.0d);
|
||||
expected.put("200.0", 200.000d);
|
||||
expected.put("200.1", 200.1d);
|
||||
expected.put("200.1", 200.10d);
|
||||
expected.put("200.1", 200.1000d);
|
||||
expected.put("200.12345", 200.12345d);
|
||||
expected.put("200.12345", 200.123450000d);
|
||||
expected.put("200.101", 200.101d);
|
||||
expected.put("1.0E-8", 1.0E-8);
|
||||
expected.put("200.0", 200d);
|
||||
|
||||
for(String key : expected.keySet()){
|
||||
assertEquals(key,JSONUtils.doubleToString(expected.get(key)));
|
||||
}
|
||||
}
|
||||
|
||||
public void testGetFunctionParams() {
|
||||
@@ -101,6 +119,28 @@ public class TestJSONUtils extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testNumberToString() {
|
||||
Map<String, Number> expected = new HashMap<>();
|
||||
|
||||
expected.put("0", Integer.valueOf("00000"));
|
||||
expected.put("123", Integer.valueOf("123"));
|
||||
expected.put("-123", Integer.valueOf("-123"));
|
||||
|
||||
expected.put("0.0", Double.valueOf("0"));
|
||||
expected.put("0.0", Double.valueOf("0.00000"));
|
||||
expected.put("120.0001", Double.valueOf("120.0001000"));
|
||||
expected.put("-120.0001", Double.valueOf("-120.0001000"));
|
||||
|
||||
expected.put("0.0", Float.valueOf("0"));
|
||||
expected.put("0.0", Float.valueOf("0.00000"));
|
||||
expected.put("120.0001", Float.valueOf("120.0001000"));
|
||||
expected.put("-120.0001", Float.valueOf("-120.0001000"));
|
||||
|
||||
for(String key : expected.keySet()) {
|
||||
assertEquals(key, JSONUtils.numberToString(expected.get(key)));
|
||||
}
|
||||
}
|
||||
|
||||
public void testQuote_emptyString() {
|
||||
assertEquals( "\"\"", JSONUtils.quote( "" ) );
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>
|
||||
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>
|
||||
<artifactId>job-audit</artifactId>
|
||||
<version>1.0.1</version>
|
||||
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<artifactId>job-audit</artifactId>
|
||||
<version>1.0</version>
|
||||
|
||||
<properties>
|
||||
<talend.nexus.url>https://artifacts-oss.talend.com</talend.nexus.url>
|
||||
</properties>
|
||||
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>talend_nexus</id>
|
||||
@@ -23,7 +23,7 @@
|
||||
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceRelease/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>talend_nexus_deployment</id>
|
||||
@@ -46,32 +46,36 @@
|
||||
</releases>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.talend.daikon</groupId>
|
||||
<artifactId>daikon-audit</artifactId>
|
||||
<version>0.31.8</version>
|
||||
</dependency>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.talend.daikon</groupId>
|
||||
<artifactId>audit-logback</artifactId>
|
||||
<version>0.31.8</version>
|
||||
<groupId>org.talend.daikon</groupId>
|
||||
<artifactId>audit-common</artifactId>
|
||||
<version>1.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.3.0-alpha4</version>
|
||||
<groupId>org.talend.daikon</groupId>
|
||||
<artifactId>audit-log4j1</artifactId>
|
||||
<version>1.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>2.12.1</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.12.1</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -18,13 +18,30 @@ public class JobEventAuditLoggerFactory {
|
||||
final AuditConfigurationMap config = AuditConfiguration.loadFromProperties(properties);
|
||||
|
||||
AbstractBackend logger = null;
|
||||
String loggerClass = "org.talend.logging.audit.logback.LogbackBackend";
|
||||
|
||||
//load log4j2 implement firstly
|
||||
String loggerClass = "org.talend.logging.audit.log4j2.Log4j2Backend";
|
||||
try {
|
||||
final Class<?> clz = Class.forName(loggerClass);
|
||||
logger = (AbstractBackend) clz.getConstructor(AuditConfigurationMap.class).newInstance(config);
|
||||
} catch (ReflectiveOperationException e) {
|
||||
throw new RuntimeException("Unable to load backend " + loggerClass, e);
|
||||
}
|
||||
final Class<?> clz = Class.forName(loggerClass);
|
||||
logger = (AbstractBackend) clz.getConstructor(AuditConfigurationMap.class).newInstance(config);
|
||||
} catch (ReflectiveOperationException e) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
//load log4j1 implement if not found log4j2
|
||||
if (logger == null) {
|
||||
loggerClass = "org.talend.logging.audit.log4j1.Log4j1Backend";
|
||||
try {
|
||||
final Class<?> clz = Class.forName(loggerClass);
|
||||
logger = (AbstractBackend) clz.getConstructor(AuditConfigurationMap.class).newInstance(config);
|
||||
} catch (ReflectiveOperationException e) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
if(logger == null) {
|
||||
throw new RuntimeException("Unable to load backend : " + loggerClass);
|
||||
}
|
||||
|
||||
final DefaultAuditLoggerBase loggerBase = new DefaultAuditLoggerBase(logger, config);
|
||||
|
||||
@@ -38,4 +55,4 @@ public class JobEventAuditLoggerFactory {
|
||||
return (T) Proxy.newProxyInstance(AuditLoggerFactory.class.getClassLoader(), new Class<?>[] { clz },
|
||||
new ProxyEventAuditLogger(auditLoggerBase));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,8 @@ public class JobAuditLoggerTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Properties props = new Properties();
|
||||
props.setProperty("root.logger", "audit");
|
||||
String root_logger_name = "audit";
|
||||
props.setProperty("root.logger", root_logger_name);
|
||||
props.setProperty("encoding", "UTF-8");
|
||||
props.setProperty("application.name", "Talend Studio");
|
||||
props.setProperty("service.name", "Talend Studio Job");
|
||||
@@ -19,6 +20,10 @@ public class JobAuditLoggerTest {
|
||||
props.setProperty("appender.file.maxsize", "52428800");
|
||||
props.setProperty("appender.file.maxbackup", "20");
|
||||
props.setProperty("host", "false");
|
||||
|
||||
org.apache.logging.log4j.core.config.Configurator.setLevel(root_logger_name, org.apache.logging.log4j.Level.DEBUG);
|
||||
//org.apache.log4j.Logger.getLogger("audit").setLevel(org.apache.log4j.Level.DEBUG);
|
||||
|
||||
final JobAuditLogger logger = JobEventAuditLoggerFactory.createJobAuditLogger(props);
|
||||
Context context = JobContextBuilder.create().jobName("fetch_from_s3_every_day").jobId("jobid_123")
|
||||
.jobVersion("0.1").connectorType("tXMLMAP").connectorId("tXMLMap_1")
|
||||
@@ -31,4 +36,4 @@ public class JobAuditLoggerTest {
|
||||
logger.flowOutput(context);
|
||||
logger.jobstop(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
@@ -2103,7 +2103,7 @@ class SnowflaketManager extends Manager {
|
||||
StringBuilder javaCode = new StringBuilder();
|
||||
if(useExistingConnection) {
|
||||
javaCode.append(retrieveTable());
|
||||
javaCode.append("java.sql.Connection conn_" + cid + " = (java.sql.Connection)globalMap.get(\"" + connection + "_Connection\");");
|
||||
javaCode.append("java.sql.Connection conn_" + cid + " = (java.sql.Connection)globalMap.get(\"" + connection + "_connection\");");
|
||||
} else {
|
||||
javaCode.append(super.getConnection());
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
</ADVANCED_PARAMETERS>
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT MODULE="janet-java-1.1.jar" MVN="mvn:org.talend.libraries/janet-java-1.1/6.0.0" NAME="janet-java-1.1"
|
||||
REQUIRED="true" />
|
||||
<IMPORT MODULE="janet-java-1.2.jar" MVN="mvn:org.talend.libraries/janet-java-1.2/6.0.0" NAME="janet-java-1.2"
|
||||
REQUIRED="true" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
<RETURNS>
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
</ADVANCED_PARAMETERS>
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT MODULE="janet-java-1.1.jar" MVN="mvn:org.talend.libraries/janet-java-1.1/6.0.0" NAME="janet-java-1.1"
|
||||
<IMPORT MODULE="janet-java-1.2.jar" MVN="mvn:org.talend.libraries/janet-java-1.2/6.0.0" NAME="janet-java-1.2"
|
||||
REQUIRED="true" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -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;
|
||||
@@ -93,7 +94,7 @@ skeleton="../templates/db_output_bulk.skeleton"
|
||||
String username = "username_" + connection;
|
||||
String connectionKey=null;
|
||||
if("tSnowflakeConnection".equals(connNode.getComponent().getName())){
|
||||
connectionKey=connection+"_Connection";
|
||||
connectionKey=connection+"_connection";
|
||||
}else{
|
||||
connectionKey=conn;
|
||||
}
|
||||
@@ -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.5-talend.jar" MVN="mvn:net.sf.json-lib/json-lib/2.4.5-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.5-talend.jar" MVN="mvn:net.sf.json-lib/json-lib/2.4.5-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 %>);
|
||||
<%}%>
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@
|
||||
<IMPORT NAME="MSAX-Ncacn_ip_tcp" MODULE="b-ncacn_ip_tcp.jar" MVN="mvn:org.talend.libraries/b-ncacn_ip_tcp/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.microsoft/lib/b-ncacn_ip_tcp.jar" REQUIRED="false" REQUIRED_IF="CONNECTION_TYPE == 'DCOM'" />
|
||||
<IMPORT NAME="MSAX-Ncacn_np" MODULE="b-ncacn_np.jar" MVN="mvn:org.talend.libraries/b-ncacn_np/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.microsoft/lib/b-ncacn_np.jar" REQUIRED="false" REQUIRED_IF="CONNECTION_TYPE == 'DCOM'"/>
|
||||
<IMPORT NAME="MSAX-Ntlm-securityt" MODULE="b-ntlm-security.jar" MVN="mvn:org.talend.libraries/b-ntlm-security/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.microsoft/lib/b-ntlm-security.jar" REQUIRED="false" REQUIRED_IF="CONNECTION_TYPE == 'DCOM'"/>
|
||||
<IMPORT NAME="MSAX-NET-CONNECTOR" MODULE="janet-java-1.0.jar" MVN="mvn:org.talend.libraries/janet-java-1.0/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.microsoft/lib/janet-java-1.0.jar" REQUIRED="false" REQUIRED_IF="CONNECTION_TYPE == 'DOTNET'"/>
|
||||
<IMPORT NAME="MSAX-NET-CONNECTOR" MODULE="janet-java-1.2.jar" MVN="mvn:org.talend.libraries/janet-java-1.2/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.microsoft/lib/janet-java-1.2.jar" REQUIRED="false" REQUIRED_IF="CONNECTION_TYPE == 'DOTNET'"/>
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@
|
||||
<IMPORT NAME="MSAX-Ncacn_ip_tcp" MODULE="b-ncacn_ip_tcp.jar" MVN="mvn:org.talend.libraries/b-ncacn_ip_tcp/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.microsoft/lib/b-ncacn_ip_tcp.jar" REQUIRED="false" REQUIRED_IF="CONNECTION_TYPE == 'DCOM'" />
|
||||
<IMPORT NAME="MSAX-Ncacn_np" MODULE="b-ncacn_np.jar" MVN="mvn:org.talend.libraries/b-ncacn_np/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.microsoft/lib/b-ncacn_np.jar" REQUIRED="false" REQUIRED_IF="CONNECTION_TYPE == 'DCOM'"/>
|
||||
<IMPORT NAME="MSAX-Ntlm-securityt" MODULE="b-ntlm-security.jar" MVN="mvn:org.talend.libraries/b-ntlm-security/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.microsoft/lib/b-ntlm-security.jar" REQUIRED="false" REQUIRED_IF="CONNECTION_TYPE == 'DCOM'"/>
|
||||
<IMPORT NAME="MSAX-NET-CONNECTOR" MODULE="janet-java-1.0.jar" MVN="mvn:org.talend.libraries/janet-java-1.0/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.microsoft/lib/janet-java-1.0.jar" REQUIRED="false" REQUIRED_IF="CONNECTION_TYPE == 'DOTNET'"/>
|
||||
<IMPORT NAME="MSAX-NET-CONNECTOR" MODULE="janet-java-1.2.jar" MVN="mvn:org.talend.libraries/janet-java-1.2/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.microsoft/lib/janet-java-1.2.jar" REQUIRED="false" REQUIRED_IF="CONNECTION_TYPE == 'DOTNET'"/>
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -69,3 +69,5 @@ imports="
|
||||
globalMap.put("conn_<%=cid%>",conn_<%=cid%>);
|
||||
|
||||
globalMap.put("shareIdentitySetting_<%=cid%>", <%=ElementParameterParser.getValue(node, "__SHARE_IDENTITY_SETTING__")%>);
|
||||
|
||||
globalMap.put("driver_<%=cid%>", "<%=ElementParameterParser.getValue(node, "__DRIVER__")%>");
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -27506,7 +27506,7 @@
|
||||
<IMPORT NAME="commons-httpclient" MODULE="commons-httpclient-3.1.jar" MVN="mvn:commons-httpclient/commons-httpclient/3.1" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/commons-httpclient-3.1.jar" REQUIRED_IF="((AUTH_TYPE == 'ON_PREMISE') AND (MS_CRM_VERSION == 'CRM_2011')) OR (API_VERSION=='API_2007')"/>
|
||||
<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="((AUTH_TYPE == 'ON_PREMISE') AND (MS_CRM_VERSION == 'CRM_2011')) OR (API_VERSION=='API_2007')"/>
|
||||
<IMPORT NAME="httpcore" MODULE="httpcore-4.2.1.jar" MVN="mvn:org.talend.libraries/httpcore-4.2.1/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.2.1.jar" REQUIRED_IF="((AUTH_TYPE == 'ON_PREMISE') AND (MS_CRM_VERSION == 'CRM_2011')) OR (API_VERSION=='API_2007')"/>
|
||||
<IMPORT NAME="mail" MODULE="mail-1.4.jar" MVN="mvn:org.talend.libraries/mail-1.4/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.axis2/lib/mail-1.4.jar" REQUIRED_IF="((AUTH_TYPE == 'ON_PREMISE') AND (MS_CRM_VERSION == 'CRM_2011')) OR (API_VERSION=='API_2007')"/>
|
||||
<IMPORT NAME="mail" MODULE="mail-1.4.7.jar" MVN="mvn:javax.mail/mail/1.4.7" REQUIRED_IF="((AUTH_TYPE == 'ON_PREMISE') AND (MS_CRM_VERSION == 'CRM_2011')) OR (API_VERSION=='API_2007')"/>
|
||||
<IMPORT NAME="neethi" MODULE="neethi-3.0.1.jar" MVN="mvn:org.talend.libraries/neethi-3.0.1/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.axis2/lib/neethi-3.0.1.jar" REQUIRED_IF="((AUTH_TYPE == 'ON_PREMISE') AND (MS_CRM_VERSION == 'CRM_2011')) OR (API_VERSION=='API_2007')"/>
|
||||
<IMPORT NAME="WSDL4J-1_6_3" MODULE="wsdl4j-1.6.3.jar" MVN="mvn:wsdl4j/wsdl4j/1.6.3" BundleID="org.apache.servicemix.bundles.wsdl4j" REQUIRED_IF="((AUTH_TYPE == 'ON_PREMISE') AND (MS_CRM_VERSION == 'CRM_2011')) OR (API_VERSION=='API_2007')"/>
|
||||
<IMPORT NAME="xmlbeans" MODULE="xmlbeans-2.3.0.jar" MVN="mvn:org.talend.libraries/xmlbeans-2.3.0/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.xml/lib/xmlbeans-2.3.0.jar" REQUIRED_IF="((AUTH_TYPE == 'ON_PREMISE') AND (MS_CRM_VERSION == 'CRM_2011')) OR (API_VERSION=='API_2007')"/>
|
||||
@@ -27536,7 +27536,7 @@
|
||||
<IMPORT NAME="commons-cli-1.2" MODULE="commons-cli-1.2.jar" MVN="mvn:commons-cli/commons-cli/1.2" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-cli-1.2.jar" REQUIRED_IF="(AUTH_TYPE=='ONLINE') AND (API_VERSION=='API_2011')" />
|
||||
<IMPORT NAME="geronimo-stax-api_1.0_spec-1.0.1" MODULE="geronimo-stax-api_1.0_spec-1.0.1.jar" MVN="mvn:org.talend.libraries/geronimo-stax-api_1.0_spec-1.0.1/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.axis2/lib/geronimo-stax-api_1.0_spec-1.0.1.jar" REQUIRED_IF="(AUTH_TYPE=='ONLINE') AND (API_VERSION=='API_2011')" />
|
||||
<IMPORT NAME="jaxen-1.1.6" MODULE="jaxen-1.1.6.jar" MVN="mvn:jaxen/jaxen/1.1.6" REQUIRED_IF="(AUTH_TYPE=='ONLINE') AND (API_VERSION=='API_2011')" BundleID="" />
|
||||
<IMPORT NAME="mail-1.4" MODULE="mail-1.4.jar" MVN="mvn:org.talend.libraries/mail-1.4/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.axis2/lib/mail-1.4.jar" REQUIRED_IF="(AUTH_TYPE=='ONLINE') AND (API_VERSION=='API_2011')" />
|
||||
<IMPORT NAME="mail-1.4.7" MODULE="mail-1.4.7.jar" MVN="mvn:javax.mail/mail/1.4.7" REQUIRED_IF="(AUTH_TYPE=='ONLINE') AND (API_VERSION=='API_2011')" />
|
||||
<IMPORT NAME="neethi-3.0.3" MODULE="neethi-3.0.3.jar" MVN="mvn:org.apache.neethi/neethi/3.0.3" REQUIRED_IF="(AUTH_TYPE=='ONLINE') AND (API_VERSION=='API_2011')" />
|
||||
<IMPORT NAME="WSDL4J-1_6_3" MODULE="wsdl4j-1.6.3.jar" MVN="mvn:wsdl4j/wsdl4j/1.6.3" REQUIRED_IF="(AUTH_TYPE=='ONLINE') AND (API_VERSION=='API_2011')" />
|
||||
<IMPORT NAME="wstx-asl-3.2.9" MODULE="wstx-asl-3.2.9.jar" MVN="mvn:org.talend.libraries/wstx-asl-3.2.9/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.axis2/lib/wstx-asl-3.2.9.jar" REQUIRED_IF="(AUTH_TYPE=='ONLINE') AND (API_VERSION=='API_2011')" />
|
||||
|
||||
@@ -38269,7 +38269,7 @@
|
||||
<IMPORT NAME="commons-httpclient" MODULE="commons-httpclient-3.1.jar" MVN="mvn:commons-httpclient/commons-httpclient/3.1" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/commons-httpclient-3.1.jar" REQUIRED_IF="((AUTH_TYPE == 'ON_PREMISE') AND (MS_CRM_VERSION == 'CRM_2011')) OR (API_VERSION=='API_2007')"/>
|
||||
<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="((AUTH_TYPE == 'ON_PREMISE') AND (MS_CRM_VERSION == 'CRM_2011')) OR (API_VERSION=='API_2007')"/>
|
||||
<IMPORT NAME="httpcore" MODULE="httpcore-4.2.1.jar" MVN="mvn:org.talend.libraries/httpcore-4.2.1/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.2.1.jar" REQUIRED_IF="((AUTH_TYPE == 'ON_PREMISE') AND (MS_CRM_VERSION == 'CRM_2011')) OR (API_VERSION=='API_2007')"/>
|
||||
<IMPORT NAME="mail" MODULE="mail-1.4.jar" MVN="mvn:org.talend.libraries/mail-1.4/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.axis2/lib/mail-1.4.jar" REQUIRED_IF="((AUTH_TYPE == 'ON_PREMISE') AND (MS_CRM_VERSION == 'CRM_2011')) OR (API_VERSION=='API_2007')"/>
|
||||
<IMPORT NAME="mail" MODULE="mail-1.4.7.jar" MVN="mvn:javax.mail/mail/1.4.7" REQUIRED_IF="((AUTH_TYPE == 'ON_PREMISE') AND (MS_CRM_VERSION == 'CRM_2011')) OR (API_VERSION=='API_2007')"/>
|
||||
<IMPORT NAME="neethi" MODULE="neethi-3.0.1.jar" MVN="mvn:org.talend.libraries/neethi-3.0.1/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.axis2/lib/neethi-3.0.1.jar" REQUIRED_IF="((AUTH_TYPE == 'ON_PREMISE') AND (MS_CRM_VERSION == 'CRM_2011')) OR (API_VERSION=='API_2007')"/>
|
||||
<IMPORT NAME="WSDL4J-1_6_3" MODULE="wsdl4j-1.6.3.jar" MVN="mvn:wsdl4j/wsdl4j/1.6.3" BundleID="org.apache.servicemix.bundles.wsdl4j" REQUIRED_IF="((AUTH_TYPE == 'ON_PREMISE') AND (MS_CRM_VERSION == 'CRM_2011')) OR (API_VERSION=='API_2007')"/>
|
||||
<IMPORT NAME="xmlbeans" MODULE="xmlbeans-2.3.0.jar" MVN="mvn:org.talend.libraries/xmlbeans-2.3.0/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.xml/lib/xmlbeans-2.3.0.jar" REQUIRED_IF="((AUTH_TYPE == 'ON_PREMISE') AND (MS_CRM_VERSION == 'CRM_2011')) OR (API_VERSION=='API_2007')"/>
|
||||
@@ -38299,7 +38299,7 @@
|
||||
<IMPORT NAME="commons-cli-1.2" MODULE="commons-cli-1.2.jar" MVN="mvn:commons-cli/commons-cli/1.2" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-cli-1.2.jar" REQUIRED_IF="(AUTH_TYPE=='ONLINE') AND (API_VERSION=='API_2011')" />
|
||||
<IMPORT NAME="geronimo-stax-api_1.0_spec-1.0.1" MODULE="geronimo-stax-api_1.0_spec-1.0.1.jar" MVN="mvn:org.talend.libraries/geronimo-stax-api_1.0_spec-1.0.1/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.axis2/lib/geronimo-stax-api_1.0_spec-1.0.1.jar" REQUIRED_IF="(AUTH_TYPE=='ONLINE') AND (API_VERSION=='API_2011')" />
|
||||
<IMPORT NAME="jaxen-1.1.6" MODULE="jaxen-1.1.6.jar" MVN="mvn:jaxen/jaxen/1.1.6" REQUIRED_IF="(AUTH_TYPE=='ONLINE') AND (API_VERSION=='API_2011')" BundleID="" />
|
||||
<IMPORT NAME="mail-1.4" MODULE="mail-1.4.jar" MVN="mvn:org.talend.libraries/mail-1.4/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.axis2/lib/mail-1.4.jar" REQUIRED_IF="(AUTH_TYPE=='ONLINE') AND (API_VERSION=='API_2011')" />
|
||||
<IMPORT NAME="mail-1.4.7" MODULE="mail-1.4.7.jar" MVN="mvn:javax.mail/mail/1.4.7" REQUIRED_IF="(AUTH_TYPE=='ONLINE') AND (API_VERSION=='API_2011')" />
|
||||
<IMPORT NAME="neethi-3.0.3" MODULE="neethi-3.0.3.jar" MVN="mvn:org.apache.neethi/neethi/3.0.3" REQUIRED_IF="(AUTH_TYPE=='ONLINE') AND (API_VERSION=='API_2011')" />
|
||||
<IMPORT NAME="WSDL4J-1_6_3" MODULE="wsdl4j-1.6.3.jar" MVN="mvn:wsdl4j/wsdl4j/1.6.3" REQUIRED_IF="(AUTH_TYPE=='ONLINE') AND (API_VERSION=='API_2011')" />
|
||||
<IMPORT NAME="wstx-asl-3.2.9" MODULE="wstx-asl-3.2.9.jar" MVN="mvn:org.talend.libraries/wstx-asl-3.2.9/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.axis2/lib/wstx-asl-3.2.9.jar" REQUIRED_IF="(AUTH_TYPE=='ONLINE') AND (API_VERSION=='API_2011')" />
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT MODULE="janet-java-1.1.jar" MVN="mvn:org.talend.libraries/janet-java-1.1/6.0.0" NAME="janet-java-1.1"
|
||||
<IMPORT MODULE="janet-java-1.2.jar" MVN="mvn:org.talend.libraries/janet-java-1.2/6.0.0" NAME="janet-java-1.2"
|
||||
REQUIRED="true" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -179,7 +179,7 @@
|
||||
</ADVANCED_PARAMETERS>
|
||||
|
||||
<CODEGENERATION><IMPORTS>
|
||||
<IMPORT MODULE="janet-java-1.1.jar" MVN="mvn:org.talend.libraries/janet-java-1.1/6.0.0" NAME="janet-java-1.1"
|
||||
<IMPORT MODULE="janet-java-1.2.jar" MVN="mvn:org.talend.libraries/janet-java-1.2/6.0.0" NAME="janet-java-1.2"
|
||||
REQUIRED="true" />
|
||||
</IMPORTS></CODEGENERATION>
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@
|
||||
</ADVANCED_PARAMETERS>
|
||||
|
||||
<CODEGENERATION><IMPORTS>
|
||||
<IMPORT MODULE="janet-java-1.1.jar" MVN="mvn:org.talend.libraries/janet-java-1.1/6.0.0" NAME="janet-java-1.1"
|
||||
<IMPORT MODULE="janet-java-1.2.jar" MVN="mvn:org.talend.libraries/janet-java-1.2/6.0.0" NAME="janet-java-1.2"
|
||||
REQUIRED="true" />
|
||||
</IMPORTS></CODEGENERATION>
|
||||
|
||||
|
||||
@@ -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%>;
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ imports="
|
||||
String connection = ElementParameterParser.getValue(node,"__CONNECTION_" + dbType + "__");
|
||||
|
||||
String conn = "conn_" + connection;
|
||||
|
||||
%>
|
||||
java.sql.Connection conn_<%=cid%> = (java.sql.Connection)globalMap.get("<%=conn%>");
|
||||
java.sql.Statement stmt_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
|
||||
@@ -189,4 +189,6 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
}
|
||||
%>
|
||||
StringBuilder stringStdout_<%=cid%> =new StringBuilder();
|
||||
StringBuilder stringStderr_<%=cid%> =new StringBuilder();
|
||||
StringBuilder stringStderr_<%=cid%> =new StringBuilder();
|
||||
String out_content_<%=cid%> = null;
|
||||
String err_content_<%=cid%> = null;
|
||||
@@ -23,7 +23,7 @@ imports="
|
||||
if("TO_CONSOLE".equals(standardOutput) || "TO_CONSOLE_AND_GLOBAL_VARIABLE".equals(standardOutput)){
|
||||
%>
|
||||
if(stringStdout_<%=cid%>.length() > 0) {
|
||||
System.out.println(stringStdout_<%=cid%>.toString());
|
||||
System.out.println(out_content_<%=cid%>);
|
||||
}
|
||||
<%
|
||||
}
|
||||
@@ -31,7 +31,7 @@ imports="
|
||||
if("TO_CONSOLE".equals(errorOutput) || "TO_CONSOLE_AND_GLOBAL_VARIABLE".equals(errorOutput)){
|
||||
%>
|
||||
if(stringStderr_<%=cid%>.length() > 0) {
|
||||
System.out.println(stringStderr_<%=cid%>.toString());
|
||||
System.out.println(err_content_<%=cid%>);
|
||||
}
|
||||
<%
|
||||
}
|
||||
|
||||
@@ -77,7 +77,9 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
<%
|
||||
}
|
||||
%>
|
||||
java.io.InputStream stdout_<%=cid%> = sess_<%=cid%>.getStdout();
|
||||
java.io.InputStream stdout_<%=cid%> = new ch.ethz.ssh2.StreamGobbler(sess_<%=cid%>.getStdout());
|
||||
java.io.InputStream stderr_<%=cid%> = new ch.ethz.ssh2.StreamGobbler(sess_<%=cid%>.getStderr());
|
||||
|
||||
java.io.BufferedReader brout_<%=cid%>= new java.io.BufferedReader(new java.io.InputStreamReader(stdout_<%=cid%>));
|
||||
String line_<%=cid%> = "";
|
||||
|
||||
@@ -91,7 +93,6 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
brout_<%=cid%>.close();
|
||||
stdout_<%=cid%>.close();
|
||||
|
||||
java.io.InputStream stderr_<%=cid%> = sess_<%=cid%>.getStderr();
|
||||
java.io.BufferedReader breer_<%=cid%>= new java.io.BufferedReader(new java.io.InputStreamReader(stderr_<%=cid%>));
|
||||
String line1_<%=cid%> = "";
|
||||
|
||||
@@ -110,37 +111,41 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
/* Close this session */
|
||||
|
||||
sess_<%=cid%>.close();
|
||||
|
||||
out_content_<%=cid%> = stringStdout_<%=cid%>.toString();
|
||||
err_content_<%=cid%> = stringStderr_<%=cid%>.toString();
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.debug("<%=cid%> - Command line standard result: " + stringStdout_<%=cid%>.toString());
|
||||
log.debug("<%=cid%> - Command line error result: " + stringStderr_<%=cid%>.toString());
|
||||
log.debug("<%=cid%> - Command line standard result: " + out_content_<%=cid%>);
|
||||
log.debug("<%=cid%> - Command line error result: " + err_content_<%=cid%>);
|
||||
<%}%>
|
||||
<%
|
||||
//-----begin to handle output
|
||||
if(("TO_GLOBAL_VARIABLE").equals(standardOutput)){
|
||||
%>
|
||||
globalMap.put("<%=cid %>_STDOUT", stringStdout_<%=cid%>.toString());
|
||||
globalMap.put("<%=cid %>_STDOUT", out_content_<%=cid%>);
|
||||
<%
|
||||
}else if(("TO_CONSOLE_AND_GLOBAL_VARIABLE").equals(standardOutput)){
|
||||
%>
|
||||
globalMap.put("<%=cid %>_STDOUT", stringStdout_<%=cid%>.toString());
|
||||
globalMap.put("<%=cid %>_STDOUT", out_content_<%=cid%>);
|
||||
<%
|
||||
}else if(("NORMAL_OUTPUT").equals(standardOutput)){
|
||||
%>
|
||||
output_<%=cid%>.add(stringStdout_<%=cid%>.toString());
|
||||
output_<%=cid%>.add(out_content_<%=cid%>);
|
||||
stringStdout_<%=cid%>.delete(0,stringStdout_<%=cid%>.length());
|
||||
<%
|
||||
}
|
||||
if(("TO_GLOBAL_VARIABLE").equals(errorOutput)){
|
||||
%>
|
||||
globalMap.put("<%=cid %>_STDERR", stringStderr_<%=cid%>.toString());
|
||||
globalMap.put("<%=cid %>_STDERR", err_content_<%=cid%>);
|
||||
<%
|
||||
}else if(("TO_CONSOLE_AND_GLOBAL_VARIABLE").equals(errorOutput)){
|
||||
%>
|
||||
globalMap.put("<%=cid %>_STDERR", stringStderr_<%=cid%>.toString());
|
||||
globalMap.put("<%=cid %>_STDERR", err_content_<%=cid%>);
|
||||
<%
|
||||
}else if(("NORMAL_OUTPUT").equals(errorOutput)){
|
||||
%>
|
||||
output_<%=cid%>.add(stringStderr_<%=cid%>.toString());
|
||||
output_<%=cid%>.add(err_content_<%=cid%>);
|
||||
stringStderr_<%=cid%>.delete(0, stringStderr_<%=cid%>.length());
|
||||
<%
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ imports="
|
||||
<%
|
||||
if(useExistingConn){
|
||||
%>
|
||||
Object sharedConn_<%=cid%> = globalMap.get("<%= connection %>" + "_Connection");
|
||||
Object sharedConn_<%=cid%> = globalMap.get("<%= connection %>" + "_connection");
|
||||
if(sharedConn_<%=cid%> != null){
|
||||
if(sharedConn_<%=cid%> instanceof com.sforce.soap.partner.PartnerConnection){
|
||||
connectorConfig_<%= cid %> = ((com.sforce.soap.partner.PartnerConnection)sharedConn_<%=cid%>).getConfig();
|
||||
|
||||
@@ -206,7 +206,7 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="JavaMail" MODULE="mail-1.4.jar" MVN="mvn:org.talend.libraries/mail-1.4/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.axis2/lib/mail-1.4.jar" REQUIRED="true" BundleID="" />
|
||||
<IMPORT NAME="JavaMail" MODULE="mail-1.4.7.jar" MVN="mvn:javax.mail/mail/1.4.7" REQUIRED="true" BundleID="" />
|
||||
<IMPORT NAME="JAF" MODULE="activation.jar" MVN="mvn:org.talend.libraries/activation/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.axis2/lib/activation.jar" REQUIRED="true" BundleID="" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -180,7 +180,7 @@ if(("UPDATE").equals(dataAction)) {
|
||||
tableName_<%=cid%> = dbschema_<%=cid%> + "." + tableName_<%=cid%>;
|
||||
}
|
||||
|
||||
String sql_create_tmpdb = "<%=manager.getCreateTableSQL(stmtStructure)%>)";
|
||||
String sql_create_tmpdb_<%=cid%> = "<%=manager.getCreateTableSQL(stmtStructure)%>)";
|
||||
|
||||
<%
|
||||
}
|
||||
|
||||
@@ -66,19 +66,29 @@ java.io.FileInputStream fis_<%=cid %> = (java.io.FileInputStream)<%=connName %>.
|
||||
else {
|
||||
%>
|
||||
java.io.FileInputStream fis_<%=cid %> = null;
|
||||
<%
|
||||
}
|
||||
|
||||
boolean isUpdate = ("UPDATE".equals(dataAction) && columnList != null && columnList.size() > 0);
|
||||
if(isUpdate) {
|
||||
%>
|
||||
String tmpTableName_<%=cid%>= "tmp_<%=cid%>" + pid + Thread.currentThread().getId();
|
||||
if(dbschema_<%=cid%>!= null && !dbschema_<%=cid%>.trim().isEmpty()) {
|
||||
tmpTableName_<%=cid%> = dbschema_<%=cid%>+ "." + tmpTableName_<%=cid%>;
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
try{
|
||||
<%
|
||||
if(("UPDATE").equals(dataAction)) {
|
||||
if(("UPDATE").equals(dataAction)) {//TODO use isUpdate, now only follow refactor way
|
||||
%>
|
||||
java.sql.Statement stmtCreateTmp_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Creating temp table <%=manager.getLProtectedChar()%>" + tableName_<%=cid%> + "<%=manager.getRProtectedChar()%>." );
|
||||
<%}%>
|
||||
|
||||
stmtCreateTmp_<%=cid%>.execute(sql_create_tmpdb);
|
||||
stmtCreateTmp_<%=cid%>.execute(sql_create_tmpdb_<%=cid%>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Create temp table <%=manager.getLProtectedChar()%>" + tableName_<%=cid%> + "<%=manager.getRProtectedChar()%> has succeeded.");
|
||||
<%}%>
|
||||
@@ -121,15 +131,12 @@ if(("INSERT").equals(dataAction) || columnList != null && columnList.size() > 0)
|
||||
|
||||
}
|
||||
|
||||
if(("UPDATE").equals(dataAction) && columnList != null && columnList.size() > 0) {
|
||||
if(isUpdate) {
|
||||
%>
|
||||
String tmpTableName_<%=cid%>= "tmp_<%=cid%>" + pid + Thread.currentThread().getId();
|
||||
if(dbschema_<%=cid%>== null || dbschema_<%=cid%>.trim().length() == 0) {
|
||||
tableName_<%=cid%>=<%=table%>;
|
||||
}
|
||||
else {
|
||||
tableName_<%=cid%>= dbschema_<%=cid%>+ "." +<%=table%>;
|
||||
tmpTableName_<%=cid%>=dbschema_<%=cid%>+ "." + tmpTableName_<%=cid%>;
|
||||
} else {
|
||||
tableName_<%=cid%>= dbschema_<%=cid%>+ "." + <%=table%>;
|
||||
}
|
||||
java.sql.Statement stmtUpdateBulk_<%=cid%>= conn_<%=cid%>.createStatement();
|
||||
<%
|
||||
@@ -147,15 +154,14 @@ if(("UPDATE").equals(dataAction) && columnList != null && columnList.size() > 0)
|
||||
%>
|
||||
|
||||
stmtUpdateBulk_<%=cid%>.close();
|
||||
tableName_<%=cid%>= tmpTableName_<%=cid%>;
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}finally{
|
||||
|
||||
<%
|
||||
if(("UPDATE").equals(dataAction) && columnList != null && columnList.size() > 0) {
|
||||
if(isUpdate) {
|
||||
%>
|
||||
tableName_<%=cid%>= tmpTableName_<%=cid%>;
|
||||
java.sql.Statement stmtTmpDrop_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
|
||||
@@ -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.5-talend.jar" MVN="mvn:net.sf.json-lib/json-lib/2.4.5-talend" REQUIRED="true" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -106,7 +106,12 @@
|
||||
REQUIRED="false" NUM_ROW="11">
|
||||
<DEFAULT>true</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
|
||||
<PARAMETER NAME="IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY" FIELD="CHECK" NUM_ROW="11"
|
||||
SHOW_IF="CREATE_EMPTY_ELEMENT=='false'">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="EXPAND_EMPTY_ELM" FIELD="CHECK" NUM_ROW="11"
|
||||
SHOW_IF="CREATE_EMPTY_ELEMENT=='true'">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
@@ -173,6 +178,8 @@
|
||||
TARGET="Out.CREATE" />
|
||||
<TEMPLATE_PARAM SOURCE="self.CREATE_EMPTY_ELEMENT"
|
||||
TARGET="Out.CREATE_EMPTY_ELEMENT" />
|
||||
<TEMPLATE_PARAM SOURCE="self.IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY"
|
||||
TARGET="Out.IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY" />
|
||||
<TEMPLATE_PARAM SOURCE="self.EXPAND_EMPTY_ELM"
|
||||
TARGET="Out.EXPAND_EMPTY_ELM" />
|
||||
<TEMPLATE_PARAM SOURCE="self.OUTPUT_AS_XSD"
|
||||
|
||||
@@ -43,4 +43,5 @@ SCHEMA.NAME=Schema
|
||||
THOUSANDS_SEPARATOR.NAME=Thousands separator
|
||||
XMLFIELD.NAME=Output Column
|
||||
XSD_FILE.NAME=XSD file path
|
||||
IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY.NAME = Ignore service attributes for empty elements
|
||||
EXPAND_EMPTY_ELM.NAME = Expand Empty Element if needed(for dom4j)
|
||||
@@ -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{
|
||||
|
||||
@@ -45,6 +45,7 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
String removeHeader = ElementParameterParser.getValue(node, "__REMOVE_HEADER__"); // add for feature7788
|
||||
String encoding = ElementParameterParser.getValue(node, "__ENCODING__");
|
||||
boolean isAllowEmpty = ("true").equals(ElementParameterParser.getValue(node, "__CREATE_EMPTY_ELEMENT__"));
|
||||
boolean ignoreServiceAttributes = ("true").equals(ElementParameterParser.getValue(node, "__IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY__"));
|
||||
boolean expandEmptyElm = ("true").equals(ElementParameterParser.getValue(node, "__EXPAND_EMPTY_ELM__"));
|
||||
String mode = ElementParameterParser.getValue(node, "__GENERATION_MODE__");
|
||||
List<Map<String, String>> rootTable =
|
||||
@@ -119,6 +120,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 +140,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 +156,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -200,6 +209,18 @@ java.util.Map<String,String> arraysValueMap_<%=cid%> = new java.util.HashMap<Str
|
||||
%>
|
||||
|
||||
class NestXMLTool_<%=cid%>{
|
||||
<%
|
||||
if (!isAllowEmpty && ignoreServiceAttributes) {
|
||||
%>
|
||||
private java.util.Set<String> serviceAttributeNames = new java.util.HashSet<>();
|
||||
{
|
||||
serviceAttributeNames.add("type");
|
||||
serviceAttributeNames.add("class");
|
||||
serviceAttributeNames.add("array");
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
public void parseAndAdd(org.dom4j.Element nestRoot, String value){
|
||||
try {
|
||||
org.dom4j.Document doc4Str = org.dom4j.DocumentHelper.parseText("<root>"+ value + "</root>");
|
||||
@@ -235,16 +256,25 @@ class NestXMLTool_<%=cid%>{
|
||||
for (org.dom4j.Element tmp: (java.util.List<org.dom4j.Element>) root.elements()) {
|
||||
removeEmptyElement(tmp);
|
||||
}
|
||||
if (root.content().size() == 0
|
||||
&& root.attributes().size() == 0
|
||||
&& root.declaredNamespaces().size() == 0) {
|
||||
if(root.getParent()!=null){
|
||||
root.getParent().remove(root);
|
||||
|
||||
boolean noSignificantDataAnnotationsExist = root.attributes().isEmpty() <%if (!isAllowEmpty && ignoreServiceAttributes) {%>|| isOnlyServiceAttributesDeclared(root.attributes()) <% } %>;
|
||||
if (root.content().isEmpty()
|
||||
&& noSignificantDataAnnotationsExist && root.declaredNamespaces().isEmpty()) {
|
||||
if(root.getParent()!=null){
|
||||
root.getParent().remove(root);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
<%
|
||||
if (!isAllowEmpty && ignoreServiceAttributes) {
|
||||
%>
|
||||
private boolean isOnlyServiceAttributesDeclared(List<org.dom4j.Attribute> attributes) {
|
||||
return attributes.stream().allMatch(a -> serviceAttributeNames.contains(a.getName().toLowerCase()));
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
public String objectToString(Object value){
|
||||
if(value.getClass().isArray()){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,10 +99,20 @@
|
||||
<DEFAULT>true</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY" FIELD="CHECK" NUM_ROW="11"
|
||||
SHOW_IF="CREATE_EMPTY_ELEMENT=='false'">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="EXPAND_EMPTY_ELM" FIELD="CHECK" NUM_ROW="11"
|
||||
SHOW_IF="CREATE_EMPTY_ELEMENT=='true'">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</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();
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user