Compare commits
20 Commits
patch/TPS-
...
patch/TPS-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20bf94ec21 | ||
|
|
fd60c1edca | ||
|
|
568088d394 | ||
|
|
7e911f0b99 | ||
|
|
16b2b9bf62 | ||
|
|
44aabcdecd | ||
|
|
839af2e2f8 | ||
|
|
e89df33f76 | ||
|
|
a8c01d85da | ||
|
|
2420214bf6 | ||
|
|
1c5404c12e | ||
|
|
49cba020f9 | ||
|
|
396868b931 | ||
|
|
4f429f6a98 | ||
|
|
218aa295f1 | ||
|
|
c364565c33 | ||
|
|
04fc9056b9 | ||
|
|
507da793eb | ||
|
|
9dfee4a013 | ||
|
|
d8e2ccab3a |
@@ -3,15 +3,17 @@ version: 7.2.1
|
||||
module: https://talend.poolparty.biz/coretaxonomy/42
|
||||
product:
|
||||
- https://talend.poolparty.biz/coretaxonomy/23
|
||||
- https://talend.poolparty.biz/coretaxonomy/26
|
||||
- https://talend.poolparty.biz/coretaxonomy/24
|
||||
---
|
||||
|
||||
# TPS-3348
|
||||
# TPS-3403
|
||||
|
||||
| Info | Value |
|
||||
| ---------------- | ---------------- |
|
||||
| Patch Name | Patch\_20190909_TPS-3348\_v1-7.2.1 |
|
||||
| Release Date | 2019-09-20 |
|
||||
| Target Version | Talend-Studio-20190620\_1446-V7.2.1 |
|
||||
| Patch Name | Patch\_20190907\_TPS-3403\_v1-7.2.1 |
|
||||
| Release Date | 2019-09-07 |
|
||||
| Target Version | 20190620\_1446-V7.2.1 |
|
||||
| Product affected | Talend Studio |
|
||||
|
||||
## Introduction
|
||||
@@ -21,22 +23,21 @@ This is a self-contained patch.
|
||||
**NOTE**: For information on how to obtain this patch, reach out to your Support contact at Talend.
|
||||
|
||||
## Fixed issues
|
||||
This patch contains this following fixe:
|
||||
|
||||
This patch contains the following fixes:
|
||||
|
||||
- TPS-3348 [7.2.1] tFilecopy not working as expected for xlsx format (TDI-42789)
|
||||
- TPS-3403 filecopy fail with java11 (TDI-42230)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Consider the following requirements for your system:
|
||||
|
||||
- Talend Studio 7.2.1 must be installed.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
### Installing the patch using Software update
|
||||
|
||||
1) Logon TAC and switch to Configuration->Software Update, then enter the correct values and save referring to the documentation: https://help.talend.com/reader/f7Em9WV_cPm2RRywucSN0Q/j9x5iXV~vyxMlUafnDejaQ
|
||||
1) Logon TAC and switch to Configuration->Software Update, then enter the correct values and save referring to the documentation: https://help.talend.com/reader/f7Em9WV\_cPm2RRywucSN0Q/j9x5iXV~vyxMlUafnDejaQ
|
||||
|
||||
2) Switch to Software update page, where the new patch will be listed. The patch can be downloaded from here into the nexus repository.
|
||||
|
||||
@@ -52,17 +53,14 @@ Consider the following requirements for your system:
|
||||
|
||||
Execute the following commands:
|
||||
|
||||
1. Talend-Studio-win-x86_64.exe -nosplash -application org.talend.commandline.CommandLine -consoleLog -data commandline-workspace startServer -p 8002 --talendDebug
|
||||
2. initRemote {tac_url} -ul {TAC login username} -up {TAC login password}
|
||||
1. Talend-Studio-win-x86\_64.exe -nosplash -application org.talend.commandline.CommandLine -consoleLog -data commandline-workspace startServer -p 8002 --talendDebug
|
||||
2. initRemote {tac\_url} -ul {TAC login username} -up {TAC login password}
|
||||
3. checkAndUpdate -tu {TAC login username} -tup {TAC login password}
|
||||
|
||||
## Uninstallation
|
||||
Backup the Affected files list below. Uninstall the patch by restore the backup files.
|
||||
|
||||
## Affected files for this patch
|
||||
|
||||
The following files are installed by this patch:
|
||||
|
||||
- {Talend\_Studio\_path}/configuration/.m2/repository/org/talend/libraries/talendExcel-1.5-20190731/6.0.0/talendExcel-1.5-20190731-6.0.0.jar
|
||||
- {Talend\_Studio\_path}/plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tFileOutputExcel/tFileOutputExcel\_java.xml
|
||||
- {Talend\_Studio\_path}/plugins.org.talend.libraries.excel\_7.2.1.20190611\_0855/lib/talendExcel-1.5-20190731.jar
|
||||
- plugins/org.talend.designer.components.localprovider\_7.2.1.20190614\_0309/components/tFileCopy/tFileCopy\_java.xml
|
||||
- plugins/org.talend.libraries.custom\_7.2.1.20181114\_0551/lib/filecopy-2.0.0.jar
|
||||
|
||||
|
||||
@@ -59,88 +59,76 @@ if((codePart.equals(ECodePart.END))&&(stat || logstashCurrent)){
|
||||
List<String> needToEndConnNames = new ArrayList<String>();
|
||||
INode nextNode = node.getOutgoingConnections(EConnectionType.ITERATE).get(0).getTarget();
|
||||
NodeUtil.fillConnectionsForStat(needToEndConnNames, nextNode);
|
||||
%>
|
||||
|
||||
<%if(stat) {%>
|
||||
if(execStat){
|
||||
<%
|
||||
for(String connName : needToEndConnNames){
|
||||
if(!needToEndConnNames.isEmpty()) {
|
||||
if(stat && logstashCurrent) {
|
||||
%>
|
||||
runStat.updateStatOnConnection("<%=connName%>"+iterateId,2, 0);
|
||||
runStat.updateStatAndLog(execStat,enableLogStash,iterateId,2,0<%for(String connName : needToEndConnNames){%>,"<%=connName%>"<%}%>);
|
||||
<%
|
||||
} else {
|
||||
if(stat) {%>
|
||||
if(execStat){
|
||||
runStat.updateStatOnConnection(iterateId,2,0<%for(String connName : needToEndConnNames){%>,"<%=connName%>"<%}%>);
|
||||
}
|
||||
<%}%>
|
||||
|
||||
<%if(logstashCurrent) {//now only finish the log, not send, TODO%>
|
||||
if(enableLogStash){
|
||||
runStat.log(iterateId,2,0<%for(String connName : needToEndConnNames){%>,"<%=connName%>"<%}%>);
|
||||
}
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%}%>
|
||||
|
||||
<%if(logstashCurrent) {//now only finish the log, not send, TODO%>
|
||||
if(enableLogStash){
|
||||
<%
|
||||
for(String connName : needToEndConnNames){
|
||||
%>
|
||||
runStat.logStatOnConnection("<%=connName%>"+iterateId,2, 0);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<%
|
||||
}
|
||||
if(connSet.size()>0){
|
||||
for(IConnection con:connSet){
|
||||
INode source = con.getSource();
|
||||
String sourceNodeId = source.getUniqueName();
|
||||
String sourceNodeComponent = source.getComponent().getName();
|
||||
%>
|
||||
<%if(stat) {%>
|
||||
if(execStat){
|
||||
if(resourceMap.get("inIterateVComp") == null || !((Boolean)resourceMap.get("inIterateVComp"))){
|
||||
runStat.updateStatOnConnection("<%=con.getUniqueName()%>"+iterateId,2, 0);
|
||||
}
|
||||
|
||||
if(connSet.size()>0) {
|
||||
if(stat && logstashCurrent && (connSet.size()==1)) {//the most common case, write this ugly logic for 65535 issue
|
||||
for(IConnection con:connSet){
|
||||
INode source = con.getSource();
|
||||
String sourceNodeId = source.getUniqueName();
|
||||
String sourceNodeComponent = source.getComponent().getName();
|
||||
for (INode jobStructureCatcher : jobCatcherNodes) {
|
||||
%>
|
||||
if(runStat.updateStatAndLog(execStat,enableLogStash,resourceMap,iterateId,"<%=con.getUniqueName()%>",2,0,
|
||||
<%=jobStructureCatcher.getUniqueName()%>,"<%=sourceNodeId%>","<%=sourceNodeComponent%>","<%=node.getUniqueName()%>","<%=node.getComponent().getName()%>","<%="REJECT".equals(con.getConnectorName()) ? "reject" : "output"%>")) {
|
||||
<%=jobStructureCatcher.getDesignSubjobStartNode().getUniqueName() %>Process(globalMap);
|
||||
}
|
||||
<%
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(stat){
|
||||
%>
|
||||
if(execStat){
|
||||
runStat.updateStat(resourceMap,iterateId,2,0<%for(IConnection con : connSet){%>,"<%=con.getUniqueName()%>"<%}%>);
|
||||
}
|
||||
<%
|
||||
}
|
||||
<%}%>
|
||||
|
||||
<%if(logstashCurrent) {%>
|
||||
if(enableLogStash){
|
||||
if(resourceMap.get("inIterateVComp") == null || !((Boolean)resourceMap.get("inIterateVComp"))){
|
||||
<%
|
||||
if(logstashCurrent){
|
||||
%>
|
||||
if(enableLogStash) {
|
||||
<%
|
||||
for(IConnection con:connSet){
|
||||
INode source = con.getSource();
|
||||
String sourceNodeId = source.getUniqueName();
|
||||
String sourceNodeComponent = source.getComponent().getName();
|
||||
for (INode jobStructureCatcher : jobCatcherNodes) {
|
||||
%>
|
||||
RunStat.StatBean talend_statebean = runStat.logStatOnConnection("<%=con.getUniqueName()%>"+iterateId,2, 0);
|
||||
|
||||
<%=jobStructureCatcher.getUniqueName() %>.addConnectionMessage(
|
||||
"<%=sourceNodeId%>",
|
||||
"<%=sourceNodeComponent%>",
|
||||
false,
|
||||
"<%="REJECT".equals(con.getConnectorName()) ? "reject" : "output"%>",
|
||||
"<%=con.getUniqueName()%>",
|
||||
talend_statebean.getNbLine(),
|
||||
talend_statebean.getStartTime(),
|
||||
talend_statebean.getEndTime()
|
||||
);
|
||||
|
||||
<%=jobStructureCatcher.getUniqueName() %>.addConnectionMessage(
|
||||
"<%=node.getUniqueName()%>",
|
||||
"<%=node.getComponent().getName()%>",
|
||||
true,
|
||||
"input",
|
||||
"<%=con.getUniqueName()%>",
|
||||
talend_statebean.getNbLine(),
|
||||
talend_statebean.getStartTime(),
|
||||
talend_statebean.getEndTime()
|
||||
);
|
||||
<%=jobStructureCatcher.getDesignSubjobStartNode().getUniqueName() %>Process(globalMap);
|
||||
if(runStat.log(resourceMap,iterateId,"<%=con.getUniqueName()%>",2,0,
|
||||
<%=jobStructureCatcher.getUniqueName()%>,"<%=sourceNodeId%>","<%=sourceNodeComponent%>","<%=node.getUniqueName()%>","<%=node.getComponent().getName()%>","<%="REJECT".equals(con.getConnectorName()) ? "reject" : "output"%>")) {
|
||||
<%=jobStructureCatcher.getDesignSubjobStartNode().getUniqueName() %>Process(globalMap);
|
||||
}
|
||||
<%
|
||||
break;
|
||||
}
|
||||
%>
|
||||
}
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
}
|
||||
<%}%>
|
||||
<%
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
||||
@@ -146,83 +146,82 @@
|
||||
boolean logstashCurrent = !cid.startsWith("tJobStructureCatcher") && !cid.startsWith("talend") && enableLogStash;
|
||||
|
||||
if ((codePart.equals(ECodePart.BEGIN))&&(stat || logstashCurrent)&&connSet.size()>0) {
|
||||
for(IConnection con:connSet){
|
||||
%>
|
||||
if (<%if(stat){%>execStat<%}%><%if(stat && logstashCurrent){%> || <%}%><%if(logstashCurrent){%>enableLogStash<%}%>) {
|
||||
if(resourceMap.get("inIterateVComp") == null){
|
||||
<%if(containsTPartitioner){%>
|
||||
java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_<%=con.getUniqueName() %> = (java.util.concurrent.ConcurrentHashMap) globalMap.get("concurrentHashMap");
|
||||
concurrentHashMap_<%=con.getUniqueName() %>.putIfAbsent("<%=con.getUniqueName() %>" + iterateLoop,new java.util.concurrent.atomic.AtomicInteger(0));
|
||||
java.util.concurrent.atomic.AtomicInteger stats_<%=con.getUniqueName() %> = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_<%=con.getUniqueName() %>.get("<%=con.getUniqueName() %>" + iterateLoop);
|
||||
int step_<%=con.getUniqueName() %> = stats_<%=con.getUniqueName() %>.incrementAndGet()<=1?0:1;
|
||||
<%if(stat) {%>
|
||||
if(execStat) {
|
||||
runStat.updateStatOnConnection("<%=con.getUniqueName() %>"+iterateId, step_<%=con.getUniqueName()%>, 0);
|
||||
}
|
||||
<%}%>
|
||||
|
||||
<%if(logstashCurrent) {%>
|
||||
if(enableLogStash) {
|
||||
runStat.logStatOnConnection("<%=con.getUniqueName()%>"+iterateId, step_<%=con.getUniqueName()%>, 0);
|
||||
}
|
||||
<%}%>
|
||||
<%}else{%>
|
||||
<%if(stat) {%>
|
||||
if(execStat) {
|
||||
runStat.updateStatOnConnection("<%=con.getUniqueName() %>"+iterateId, 0, 0);
|
||||
}
|
||||
<%}%>
|
||||
|
||||
<%if(logstashCurrent) {%>
|
||||
if(enableLogStash) {
|
||||
runStat.logStatOnConnection("<%=con.getUniqueName()%>"+iterateId, 0, 0);
|
||||
}
|
||||
<%}%>
|
||||
<%}%>
|
||||
if(containsTPartitioner) {
|
||||
%>
|
||||
if(<%if(stat){%>execStat<%}%><%if(stat && logstashCurrent){%> || <%}%><%if(logstashCurrent){%>enableLogStash<%}%>) {
|
||||
runStat.updateStatOnConnectionAndLog(resourceMap,globalMap,iterateLoop,iterateId,<%if(stat){%>execStat<%} else {%>false<%}%>,enableLogStash,0<%for(IConnection con : connSet){%>,"<%=con.getUniqueName()%>"<%}%>);
|
||||
}
|
||||
<%
|
||||
} else {
|
||||
if(stat && logstashCurrent) {
|
||||
%>
|
||||
runStat.updateStatAndLog(execStat,enableLogStash,resourceMap,iterateId,0,0<%for(IConnection con : connSet){%>,"<%=con.getUniqueName()%>"<%}%>);
|
||||
<%
|
||||
} else {
|
||||
if(stat) {
|
||||
%>
|
||||
if(execStat) {
|
||||
runStat.updateStatOnConnection(resourceMap,iterateId,0,0<%for(IConnection con : connSet){%>,"<%=con.getUniqueName()%>"<%}%>);
|
||||
}
|
||||
<%
|
||||
}
|
||||
}
|
||||
|
||||
<%
|
||||
|
||||
if(logstashCurrent) {
|
||||
%>
|
||||
if(enableLogStash) {
|
||||
runStat.log(resourceMap,iterateId,0,0<%for(IConnection con : connSet){%>,"<%=con.getUniqueName()%>"<%}%>);
|
||||
}
|
||||
<%
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((codePart.equals(ECodePart.MAIN))&&(stat || logstashCurrent)&&connSet.size()>0){
|
||||
for(IConnection con:connSet){
|
||||
%>
|
||||
|
||||
//<%=con.getUniqueName()%>
|
||||
//<%=(String)codeGenArgument.getIncomingName()%>
|
||||
|
||||
|
||||
<%if (!node.getComponent().useMerge()) {%>
|
||||
<%if(stat) {%>
|
||||
if(execStat){
|
||||
runStat.updateStatOnConnection("<%=con.getUniqueName() %>"+iterateId,1, 1);
|
||||
}
|
||||
<%}%>
|
||||
|
||||
<%if(logstashCurrent) {%>
|
||||
if(enableLogStash) {
|
||||
runStat.logStatOnConnection("<%=con.getUniqueName() %>"+iterateId,1, 1);
|
||||
}
|
||||
<%}%>
|
||||
<%
|
||||
} else if(con.getUniqueName().equals((String)codeGenArgument.getIncomingName())){
|
||||
if(!node.getComponent().useMerge()) {
|
||||
if(stat && logstashCurrent) {
|
||||
%>
|
||||
<%if(stat) {%>
|
||||
if(execStat){
|
||||
runStat.updateStatOnConnection("<%=con.getUniqueName() %>"+iterateId,1, 1);
|
||||
runStat.updateStatAndLog(execStat,enableLogStash,iterateId,1,1<%for(IConnection con : connSet){%>,"<%=con.getUniqueName()%>"<%}%>);
|
||||
<%
|
||||
} else {
|
||||
if(stat) {
|
||||
%>
|
||||
if(execStat){
|
||||
runStat.updateStatOnConnection(iterateId,1,1<%for(IConnection con : connSet){%>,"<%=con.getUniqueName()%>"<%}%>);
|
||||
}
|
||||
<%
|
||||
}
|
||||
<%}%>
|
||||
|
||||
<%if(logstashCurrent) {%>
|
||||
if(enableLogStash) {
|
||||
runStat.logStatOnConnection("<%=con.getUniqueName() %>"+iterateId,1, 1);
|
||||
if(logstashCurrent) {
|
||||
%>
|
||||
if(enableLogStash) {
|
||||
runStat.log(iterateId,1,1<%for(IConnection con : connSet){%>,"<%=con.getUniqueName()%>"<%}%>);
|
||||
}
|
||||
<%
|
||||
}
|
||||
<%}%>
|
||||
<%}%>
|
||||
|
||||
<%
|
||||
}
|
||||
} else {
|
||||
for(IConnection connection:connSet){
|
||||
if(connection.getUniqueName().equals((String)codeGenArgument.getIncomingName())){
|
||||
if(stat && logstashCurrent) {
|
||||
%>
|
||||
runStat.updateStatAndLog(execStat,enableLogStash,iterateId,1,1<%for(IConnection con : connSet){if(con.getUniqueName().equals((String)codeGenArgument.getIncomingName())){%>,"<%=con.getUniqueName()%>"<%}}%>);
|
||||
<%
|
||||
} else {
|
||||
if(stat) {%>
|
||||
if(execStat){
|
||||
runStat.updateStatOnConnection(iterateId,1,1<%for(IConnection con : connSet){if(con.getUniqueName().equals((String)codeGenArgument.getIncomingName())){%>,"<%=con.getUniqueName()%>"<%}}%>);
|
||||
}
|
||||
<%}
|
||||
|
||||
if(logstashCurrent) {%>
|
||||
if(enableLogStash) {
|
||||
runStat.log(iterateId,1,1<%for(IConnection con : connSet){if(con.getUniqueName().equals((String)codeGenArgument.getIncomingName())){%>,"<%=con.getUniqueName()%>"<%}}%>);
|
||||
}
|
||||
<%}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,7 +250,7 @@
|
||||
for (INode jobStructureCatcher : jobCatcherNodes) {
|
||||
%>
|
||||
if(enableLogStash) {
|
||||
<%=jobStructureCatcher.getUniqueName() %>.addComponentMessage("<%=node.getUniqueName()%>", "<%=node.getComponent().getName()%>");
|
||||
<%=jobStructureCatcher.getUniqueName() %>.addCM("<%=node.getUniqueName()%>", "<%=node.getComponent().getName()%>");
|
||||
<%=jobStructureCatcher.getDesignSubjobStartNode().getUniqueName() %>Process(globalMap);
|
||||
}
|
||||
<%
|
||||
@@ -266,46 +265,37 @@
|
||||
List<String> needToStartConnNames = new ArrayList<String>();
|
||||
INode nextNode = node.getOutgoingConnections(EConnectionType.ITERATE).get(0).getTarget();
|
||||
NodeUtil.fillConnectionsForStat(needToStartConnNames, nextNode);
|
||||
if(needToStartConnNames.isEmpty()) {
|
||||
//do nothing
|
||||
} else if(containsTPartitioner){
|
||||
%>
|
||||
if(<%if(stat){%>execStat<%}%><%if(stat && logstashCurrent){%> || <%}%><%if(logstashCurrent){%>enableLogStash<%}%>){
|
||||
<%
|
||||
for(String connName : needToStartConnNames){
|
||||
%>
|
||||
<%if(containsTPartitioner){%>
|
||||
java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_<%=connName%> = (java.util.concurrent.ConcurrentHashMap) globalMap.get("concurrentHashMap");
|
||||
concurrentHashMap_<%=connName%>.putIfAbsent("<%=connName%>" + iterateLoop,new java.util.concurrent.atomic.AtomicInteger(0));
|
||||
java.util.concurrent.atomic.AtomicInteger stats_<%=connName%> = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_<%=connName%>.get("<%=connName%>" + iterateLoop);
|
||||
|
||||
int step_<%=connName %> = stats_<%=connName%>.incrementAndGet()<=1?0:1;
|
||||
<%if(stat) {%>
|
||||
if(execStat) {
|
||||
runStat.updateStatOnConnection("<%=connName%>"+iterateId, step_<%=connName%>, 0);
|
||||
}
|
||||
<%}%>
|
||||
|
||||
<%if(logstashCurrent) {%>
|
||||
if(enableLogStash) {
|
||||
runStat.logStatOnConnection("<%=connName%>"+iterateId, step_<%=connName%>, 0);
|
||||
}
|
||||
<%}%>
|
||||
<%}else{%>
|
||||
<%if(stat) {%>
|
||||
if(execStat) {
|
||||
runStat.updateStatOnConnection("<%=connName%>"+iterateId, 0, 0);
|
||||
}
|
||||
<%}%>
|
||||
|
||||
<%if(logstashCurrent) {%>
|
||||
if(enableLogStash) {
|
||||
runStat.logStatOnConnection("<%=connName%>"+iterateId, 0, 0);
|
||||
}
|
||||
<%}%>
|
||||
<%}%>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
runStat.updateStatOnConnectionAndLog(globalMap,iterateLoop,iterateId,<%if(stat){%>execStat<%} else {%>false<%}%>,enableLogStash,0<%for(String connName : needToStartConnNames){%>,"<%=connName%>"<%}%>);
|
||||
}
|
||||
<%
|
||||
} else {
|
||||
if(stat && logstashCurrent) {
|
||||
%>
|
||||
runStat.updateStatAndLog(execStat,enableLogStash,iterateId,0,0<%for(String connName : needToStartConnNames){%>,"<%=connName%>"<%}%>);
|
||||
<%
|
||||
} else {
|
||||
if(stat){
|
||||
%>
|
||||
if(execStat){
|
||||
runStat.updateStatOnConnection(iterateId,0,0<%for(String connName : needToStartConnNames){%>,"<%=connName%>"<%}%>);
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
<%if(logstashCurrent) {%>
|
||||
if(enableLogStash){
|
||||
runStat.log(iterateId,0,0<%for(String connName : needToStartConnNames){%>,"<%=connName%>"<%}%>);
|
||||
}
|
||||
<%
|
||||
}
|
||||
}
|
||||
}
|
||||
<%
|
||||
}else if(codePart.equals(ECodePart.MAIN)){
|
||||
%>
|
||||
resourceMap.put("inIterateVComp", true);
|
||||
|
||||
@@ -139,7 +139,7 @@ for (INode node : process.getNodesOfType("tRESTClient")) {
|
||||
}
|
||||
|
||||
boolean talendEsbJobFactory = actAsProvider || !process.getNodesOfType("tRouteInput").isEmpty();
|
||||
boolean talendEsbJob = talendEsbJobFactory || actAsConsumer || ProcessorUtilities.isEsbJob(process.getId(), process.getVersion());
|
||||
boolean talendEsbJob = talendEsbJobFactory || actAsConsumer || ProcessorUtilities.isEsbJob(process);
|
||||
|
||||
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(process, "__LOG4J_ACTIVATE__"));
|
||||
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
<project name="org.talend.designer.components.libs" default="buildall" basedir=".">
|
||||
|
||||
<target name="buildall">
|
||||
<ant antfile="filecopy/build.xml" target="process" inheritall="no" />
|
||||
<ant antfile="talend_file_enhanced_20070724/build.xml" target="process" inheritall="no" />
|
||||
<ant antfile="sugarCRMManagement/build.xml" target="process" inheritall="no" />
|
||||
<ant antfile="TalendSAX/build.xml" target="process" inheritall="no" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<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>commons-net-ftps-proxy</artifactId>
|
||||
<version>3.6.1-talend-20190128</version>
|
||||
<version>3.6.1-talend-20190819</version>
|
||||
|
||||
<name>commons-net-talend</name>
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.talend.ftp;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.Socket;
|
||||
import java.net.InetAddress;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
@@ -29,11 +30,13 @@ public class SSLSessionReuseFTPSClient extends FTPSClient {
|
||||
final Object cache = sessionHostPortCache.get(context);
|
||||
final Method putMethod = cache.getClass().getDeclaredMethod("put", Object.class, Object.class);
|
||||
putMethod.setAccessible(true);
|
||||
final Method getHostMethod = socket.getClass().getDeclaredMethod("getHost");
|
||||
getHostMethod.setAccessible(true);
|
||||
Object host = getHostMethod.invoke(socket);
|
||||
final String key =
|
||||
String.format("%s:%s", host, String.valueOf(socket.getPort())).toLowerCase(Locale.ROOT);
|
||||
InetAddress address = socket.getInetAddress();
|
||||
int port = socket.getPort();
|
||||
|
||||
String key = String.format("%s:%s", address.getHostName(), String.valueOf(port)).toLowerCase(Locale.ROOT);
|
||||
putMethod.invoke(cache, key, session);
|
||||
|
||||
key = String.format("%s:%s", address.getHostAddress(), String.valueOf(port)).toLowerCase(Locale.ROOT);
|
||||
putMethod.invoke(cache, key, session);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
3
main/plugins/org.talend.designer.components.libs/libs_src/filecopy/.gitignore
vendored
Normal file
3
main/plugins/org.talend.designer.components.libs/libs_src/filecopy/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
.classpath
|
||||
.project
|
||||
target/
|
||||
@@ -1,88 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="org.talend.designer.components.libs" default="process" basedir=".">
|
||||
|
||||
<property name="component.plugin.home" value="../../../org.talend.designer.components.localprovider/components" />
|
||||
|
||||
<!-- #################################################### -->
|
||||
|
||||
<!-- modification 1: config -->
|
||||
<property name="jar.name" value="filecopy.jar" />
|
||||
<property name="component.name" value="tFileCopy" />
|
||||
<property name="author.name" value="wyang" />
|
||||
|
||||
<!-- modification 2: compile classpath -->
|
||||
<path id="compile.classpath">
|
||||
</path>
|
||||
|
||||
<!-- #################################################### -->
|
||||
|
||||
|
||||
<!-- sourcecode and final jar path -->
|
||||
<property name="source.home" value="." />
|
||||
<property name="jar.home" value="${component.plugin.home}/${component.name}/${jar.name}" />
|
||||
|
||||
<!-- temp dir for clasee files -->
|
||||
<property name="build.dir" value="../../build" />
|
||||
|
||||
<!-- compile option -->
|
||||
<property name="compile.debug" value="true" />
|
||||
<property name="compile.deprecation" value="false" />
|
||||
<property name="compile.optimize" value="true" />
|
||||
|
||||
|
||||
<target name="process" description="prepare a temp dir">
|
||||
<antcall target="prepare" />
|
||||
<antcall target="compile" />
|
||||
<antcall target="clean" />
|
||||
</target>
|
||||
|
||||
<target name="prepare" description="prepare a temp dir">
|
||||
<delete dir="${build.dir}" />
|
||||
<mkdir dir="${build.dir}" />
|
||||
<mkdir dir="${build.dir}/classes" />
|
||||
</target>
|
||||
|
||||
<target name="compile" description="Compile Java sources">
|
||||
|
||||
<!-- compile -->
|
||||
<javac srcdir="${source.home}" destdir="${build.dir}/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}">
|
||||
<classpath refid="compile.classpath" />
|
||||
</javac>
|
||||
|
||||
<!-- include source code -->
|
||||
<copy todir="${build.dir}/classes">
|
||||
<fileset dir="${source.home}">
|
||||
<exclude name="build.xml" />
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<!-- make jar -->
|
||||
<tstamp>
|
||||
<format property="date" pattern="yyyy-MM-dd HH:mm:ss" />
|
||||
</tstamp>
|
||||
|
||||
<jar destfile="${build.dir}/${jar.name}" basedir="${build.dir}/classes">
|
||||
<manifest>
|
||||
<!-- who -->
|
||||
<attribute name="Built-By" value="${author.name}" />
|
||||
<!-- when -->
|
||||
<attribute name="Built-Date" value="${date}"/>
|
||||
<!-- JDK version -->
|
||||
<attribute name="Created-By" value="${java.version} (${java.vendor})" />
|
||||
<!-- Information about the program itself -->
|
||||
<attribute name="Implementation-Vendor" value="Talend SA" />
|
||||
<attribute name="Implementation-Title" value="${jar.name}" />
|
||||
<attribute name="Implementation-Version" value="1.0" />
|
||||
</manifest>
|
||||
</jar>
|
||||
|
||||
<!-- move jar -->
|
||||
<move file="${build.dir}/${jar.name}" tofile="${jar.home}" />
|
||||
|
||||
</target>
|
||||
|
||||
<target name="clean" description="clean the temp dir">
|
||||
<delete dir="${build.dir}" />
|
||||
<mkdir dir="${build.dir}" />
|
||||
</target>
|
||||
</project>
|
||||
@@ -1,190 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.nio.MappedByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
/**
|
||||
* DOC Administrator class global comment. Detailled comment
|
||||
*/
|
||||
public class FileCopy {
|
||||
|
||||
private final static long L_SIZE = 100 * 1024 * 1024; // 100M
|
||||
|
||||
private final static long M_SIZE = 10 * 1024 * 1024; // 10M
|
||||
|
||||
private final static long S_SIZE = 0; // 0M
|
||||
|
||||
public static void copyFile(String srcFileName, String desFileName, boolean delSrc) throws Exception {
|
||||
|
||||
FileInputStream srcInputStream = null;
|
||||
try{
|
||||
srcInputStream = new FileInputStream(srcFileName);
|
||||
long lastModified = new File(srcFileName).lastModified();
|
||||
int available = srcInputStream.available();
|
||||
if (available > L_SIZE) {// X > 100M
|
||||
copyFileL(srcFileName, srcInputStream, desFileName, delSrc);
|
||||
} else if (available > M_SIZE) {// 10M < X <100M
|
||||
copyFileM(srcFileName, srcInputStream, desFileName, delSrc);
|
||||
} else { // X < 10M
|
||||
copyFileS(srcFileName, srcInputStream, desFileName, delSrc);
|
||||
}
|
||||
// keep modification_time
|
||||
new File(desFileName).setLastModified(lastModified);
|
||||
}finally{
|
||||
if(srcInputStream!=null){
|
||||
srcInputStream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void copyFileS(String srcFileName, FileInputStream srcInputStream, String desFileName, boolean delSrc)
|
||||
throws IOException {
|
||||
File source = new File(srcFileName);
|
||||
File dest = new File(desFileName);
|
||||
|
||||
FileInputStream in = null;
|
||||
FileOutputStream out = null;
|
||||
try {
|
||||
in = srcInputStream;
|
||||
out = new FileOutputStream(dest);
|
||||
|
||||
byte[] buf = new byte[1024];
|
||||
int len = 0;
|
||||
while ((len = in.read(buf)) != -1) {
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
|
||||
in.close();
|
||||
out.close();
|
||||
if (delSrc) {
|
||||
source.delete();
|
||||
}
|
||||
|
||||
} finally {
|
||||
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void copyFileM(String srcFileName, FileInputStream srcInputStream, String desFileName, boolean delSrc)
|
||||
throws IOException {
|
||||
File source = new File(srcFileName);
|
||||
File dest = new File(desFileName);
|
||||
|
||||
FileChannel in = null;
|
||||
FileChannel out = null;
|
||||
try {
|
||||
in = srcInputStream.getChannel();
|
||||
out = new FileOutputStream(dest).getChannel();
|
||||
|
||||
int maxCount = (32 * 1024 * 1024) - (28 * 1024);
|
||||
long size = in.size();
|
||||
long position = 0;
|
||||
while (position < size) {
|
||||
position += in.transferTo(position, maxCount, out);
|
||||
}
|
||||
|
||||
in.close();
|
||||
out.close();
|
||||
|
||||
if (delSrc) {
|
||||
source.delete();
|
||||
}
|
||||
} finally {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void copyFileL(String srcFileName, FileInputStream srcInputStream, String desFileName, boolean delSrc)
|
||||
throws Exception {
|
||||
File source = new File(srcFileName);
|
||||
File dest = new File(desFileName);
|
||||
|
||||
FileChannel in = null, out = null;
|
||||
try {
|
||||
in = srcInputStream.getChannel();
|
||||
out = new FileOutputStream(dest).getChannel();
|
||||
|
||||
long size = in.size();
|
||||
long position = 0;
|
||||
final long MAP_SIZE = 33525760;
|
||||
MappedByteBuffer buf = null;
|
||||
while (true) {
|
||||
if (position + MAP_SIZE >= size) {
|
||||
buf = in.map(FileChannel.MapMode.READ_ONLY, position, size - position);
|
||||
out.write(buf);
|
||||
//For But TDI-26493, here must clean first, or it can't delete
|
||||
clean(buf);
|
||||
break;
|
||||
} else {
|
||||
buf = in.map(FileChannel.MapMode.READ_ONLY, position, MAP_SIZE);
|
||||
out.write(buf);
|
||||
// here must clean first, or it can't delete
|
||||
clean(buf);
|
||||
position += MAP_SIZE;
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
out.close();
|
||||
|
||||
if (delSrc) {
|
||||
source.delete();
|
||||
}
|
||||
|
||||
} finally {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void clean(final Object buffer) throws Exception {
|
||||
AccessController.doPrivileged(new PrivilegedAction() {
|
||||
|
||||
public Object run() {
|
||||
try {
|
||||
Method getCleanerMethod = buffer.getClass().getMethod("cleaner", new Class[0]);
|
||||
getCleanerMethod.setAccessible(true);
|
||||
sun.misc.Cleaner cleaner = (sun.misc.Cleaner) getCleanerMethod.invoke(buffer, new Object[0]);
|
||||
cleaner.clean();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<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>
|
||||
<artifactId>filecopy</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>talend-copy</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<talend.nexus.url>https://artifacts-oss.talend.com</talend.nexus.url>
|
||||
<java.source.version>1.8</java.source.version>
|
||||
<junit5.version>5.4.2</junit5.version>
|
||||
</properties>
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>talend_nexus_deployment</id>
|
||||
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceSnapshot/</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>talend_nexus_deployment</id>
|
||||
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceRelease/</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>${junit5.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${junit5.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>${java.source.version}</source>
|
||||
<target>${java.source.version}</target>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
<showWarnings>true</showWarnings>
|
||||
<fork>true</fork>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,49 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
|
||||
/**
|
||||
* DOC Administrator class global comment. Detailled comment
|
||||
*/
|
||||
public class FileCopy {
|
||||
|
||||
/** Private constructor, only static methods */
|
||||
private FileCopy() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy files.
|
||||
*
|
||||
* @param srcFileName : file name for source file.
|
||||
* @param desFileName : file name for destination file.
|
||||
* @param delSrc : true if delete source.
|
||||
* @throws IOException : if IO pb.
|
||||
*/
|
||||
public static void copyFile(String srcFileName, String desFileName, boolean delSrc) throws IOException {
|
||||
final File source = new File(srcFileName);
|
||||
final File destination = new File(desFileName);
|
||||
|
||||
if (delSrc) {
|
||||
// move : more efficient if in same FS and mustr delete existing file.
|
||||
Files.move(source.toPath(), destination.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
} else {
|
||||
Files.copy(source.toPath(), destination.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package org.talend;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test for FileCopy.class with diffents file size.
|
||||
*
|
||||
* @author clesaec
|
||||
*
|
||||
*/
|
||||
class FileCopyTest {
|
||||
|
||||
@Test
|
||||
void testCopyFile() throws Exception {
|
||||
final URL repCopy = Thread.currentThread().getContextClassLoader().getResource("copy");
|
||||
|
||||
File small = this.buildFile("small.txt", 10L * 1024L);
|
||||
small.deleteOnExit();
|
||||
File smallCopy = new File(repCopy.getPath(), "small.txt");
|
||||
smallCopy.deleteOnExit();
|
||||
|
||||
FileCopy.copyFile(small.getPath(), smallCopy.getPath(), false);
|
||||
|
||||
Assertions.assertTrue(smallCopy.exists(), "small file fail to copy (not created)");
|
||||
Assertions.assertTrue(small.exists(), "small file : original file deleted");
|
||||
Assertions.assertEquals(smallCopy.length(), small.length(), "Size error");
|
||||
|
||||
File medium = this.buildFile("medium.txt", 30L * 1024L * 1024L);
|
||||
medium.deleteOnExit();
|
||||
File mediumCopy = new File(repCopy.getPath(), "medium.txt");
|
||||
mediumCopy.deleteOnExit();
|
||||
|
||||
FileCopy.copyFile(medium.getPath(), mediumCopy.getPath(), false);
|
||||
|
||||
Assertions.assertTrue(mediumCopy.exists(), "medium file fail to copy (not created)");
|
||||
Assertions.assertTrue(medium.exists(), "medium file : original file deleted");
|
||||
Assertions.assertEquals(mediumCopy.length(), medium.length(), "Size error");
|
||||
|
||||
File large = this.buildFile("large.txt", 110L * 1024L * 1024L);
|
||||
large.deleteOnExit();
|
||||
long startTime = System.nanoTime();
|
||||
File largeCopy = new File(repCopy.getPath(), "large.txt");
|
||||
long duration = System.nanoTime() - startTime;
|
||||
System.out.println("Duration for 110 Mo file : " + TimeUnit.NANOSECONDS.toMicros(duration) + " µs");
|
||||
largeCopy.deleteOnExit();
|
||||
|
||||
FileCopy.copyFile(large.getPath(), largeCopy.getPath(), false);
|
||||
|
||||
Assertions.assertTrue(largeCopy.exists(), "small file fail to copy (not created)");
|
||||
Assertions.assertTrue(large.exists(), "small file : original file deleted");
|
||||
Assertions.assertEquals(largeCopy.length(), large.length(), "Size error");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCopyMv() throws Exception {
|
||||
final URL repCopy = Thread.currentThread().getContextClassLoader().getResource("copy");
|
||||
|
||||
File file = this.buildFile("fileToMove.txt", 10L * 1024L);
|
||||
file.deleteOnExit();
|
||||
File copy = new File(repCopy.getPath(), "fileToMove.txt");
|
||||
long referenceSize = file.length();
|
||||
if (copy.exists()) {
|
||||
copy.delete();
|
||||
}
|
||||
copy.deleteOnExit();
|
||||
|
||||
FileCopy.copyFile(file.getPath(), copy.getPath(), true);
|
||||
|
||||
Assertions.assertFalse(file.exists(), "file not delete");
|
||||
Assertions.assertTrue(copy.exists(), "small file : original file deleted");
|
||||
Assertions.assertEquals(referenceSize, copy.length(), "Size error");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCopyWithDelete() throws Exception {
|
||||
final URL repCopy = Thread.currentThread().getContextClassLoader().getResource("copy");
|
||||
|
||||
File file = this.buildFile("fileToDelete.txt", 10L * 1024L);
|
||||
file.deleteOnExit();
|
||||
File copy = new File(repCopy.getPath(), "fileToDelete.txt");
|
||||
long referenceSize = file.length();
|
||||
if (!copy.exists()) {
|
||||
copy.createNewFile();
|
||||
}
|
||||
copy.deleteOnExit();
|
||||
|
||||
FileCopy.copyFile(file.getPath(), copy.getPath(), true);
|
||||
|
||||
Assertions.assertFalse(file.exists(), "file not delete");
|
||||
Assertions.assertTrue(copy.exists(), "small file : original file deleted");
|
||||
Assertions.assertEquals(referenceSize, copy.length(), "Size error");
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a new file for testing.
|
||||
*
|
||||
* @param name : name of file.
|
||||
* @param minSize : minimum size.
|
||||
* @return the new file.
|
||||
* @throws IOException : on IO pb.
|
||||
*/
|
||||
private File buildFile(String name, long minSize) throws IOException {
|
||||
final URL repGenerated = Thread.currentThread().getContextClassLoader().getResource("generated");
|
||||
final File generatedFile = new File(repGenerated.getPath(), name);
|
||||
if (generatedFile.exists()) {
|
||||
generatedFile.delete();
|
||||
}
|
||||
final String data = "{ data to put in generated file for it have the desired sized }" + System.lineSeparator();
|
||||
|
||||
long nbeIteration = (minSize / data.length()) + 1;
|
||||
try (BufferedWriter writer = Files.newBufferedWriter(generatedFile.toPath(), StandardOpenOption.CREATE)) {
|
||||
for (long i = 0; i < nbeIteration; i++) {
|
||||
writer.append(data);
|
||||
}
|
||||
}
|
||||
|
||||
return generatedFile;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Just here to not have an empty directory.
|
||||
@@ -0,0 +1 @@
|
||||
Just here to not have an empty directory.
|
||||
@@ -7,7 +7,7 @@
|
||||
<groupId>net.sf.json-lib</groupId>
|
||||
<artifactId>json-lib</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>2.4.1-talend</version>
|
||||
<version>2.4.2-talend</version>
|
||||
<name>json-lib</name>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package net.sf.json.util;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONException;
|
||||
import net.sf.json.JSONNull;
|
||||
@@ -414,7 +415,7 @@ public class JSONTokener {
|
||||
}
|
||||
|
||||
try{
|
||||
return NumberUtils.createNumber(s);
|
||||
return createNumber(s);
|
||||
}catch( Exception e ){
|
||||
return s;
|
||||
}
|
||||
@@ -435,6 +436,26 @@ public class JSONTokener {
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method has been added to fix https://jira.talendforge.org/browse/TDI-42689
|
||||
*
|
||||
* @param s The String representation of the number
|
||||
* @return The Number instance
|
||||
*/
|
||||
private Number createNumber(String s){
|
||||
boolean isDecimal = s.indexOf('.') != -1;
|
||||
|
||||
if(isDecimal){
|
||||
Double d = Double.valueOf(s);
|
||||
if(Double.POSITIVE_INFINITY == Math.abs(d)){
|
||||
return new BigDecimal(s);
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
return NumberUtils.createNumber(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Look at the next character in the source string.
|
||||
*
|
||||
|
||||
@@ -184,14 +184,12 @@ public final class JSONUtils {
|
||||
return Integer.class;
|
||||
}else if( isLong( n ) ){
|
||||
return Long.class;
|
||||
}else if( isFloat( n ) ){
|
||||
return Float.class;
|
||||
}else if( isBigInteger( n ) ){
|
||||
return BigInteger.class;
|
||||
}else if( isBigDecimal( n ) ){
|
||||
return BigDecimal.class;
|
||||
}else if( isDouble( n ) ){
|
||||
return Double.class;
|
||||
}else if( isBigDecimal( n ) ){
|
||||
return BigDecimal.class;
|
||||
}else{
|
||||
throw new JSONException( "Unsupported type" );
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import net.sf.json.processors.PropertyNameProcessor;
|
||||
import net.sf.json.sample.BeanA;
|
||||
import net.sf.json.sample.BeanB;
|
||||
import net.sf.json.sample.BeanC;
|
||||
import net.sf.json.sample.BeanD;
|
||||
import net.sf.json.sample.BeanFoo;
|
||||
import net.sf.json.sample.BeanWithFunc;
|
||||
import net.sf.json.sample.ChildBean;
|
||||
@@ -1042,6 +1043,17 @@ public class TestJSONObject extends TestCase {
|
||||
JSONArray.toArray( jsonObject.getJSONArray( "intarray" ) ) );
|
||||
}
|
||||
|
||||
public void testToBean_BeanD() {
|
||||
String json = "{bool:true,integer:1,string:\"json\",doublearray:[4.2424245783E7, 123456789.2424245783E7, 6.0]}";
|
||||
JSONObject jsonObject = JSONObject.fromObject( json );
|
||||
BeanD bean = (BeanD) JSONObject.toBean( jsonObject, BeanD.class );
|
||||
assertEquals( jsonObject.get( "bool" ), Boolean.valueOf( bean.isBool() ) );
|
||||
assertEquals( jsonObject.get( "integer" ), new Integer( bean.getInteger() ) );
|
||||
assertEquals( jsonObject.get( "string" ), bean.getString() );
|
||||
Assertions.assertEquals( bean.getDoublearray(),
|
||||
JSONArray.toArray( jsonObject.getJSONArray( "doublearray" ) ) );
|
||||
}
|
||||
|
||||
public void testToBean_ClassBean() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.element( "klass", "java.lang.Object" );
|
||||
@@ -1050,9 +1062,29 @@ public class TestJSONObject extends TestCase {
|
||||
assertEquals( Object.class, bean.getKlass() );
|
||||
}
|
||||
|
||||
public void testToBean_DynaBean__BigInteger_BigDecimal() {
|
||||
public void testToBean_DynaBean__BigInteger_Double() {
|
||||
BigInteger l = new BigDecimal( "1.7976931348623157E308" ).toBigInteger();
|
||||
BigDecimal m = new BigDecimal( "1.7976931348623157E307" ).add( new BigDecimal( "0.0001" ) );
|
||||
JSONObject json = new JSONObject().element( "i", BigInteger.ZERO )
|
||||
.element( "d", MorphUtils.BIGDECIMAL_ONE )
|
||||
.element( "bi", l )
|
||||
.element( "bd", m );
|
||||
Object bean = JSONObject.toBean( json );
|
||||
Object i = ((MorphDynaBean) bean).get( "i" );
|
||||
Object d = ((MorphDynaBean) bean).get( "d" );
|
||||
assertTrue( i instanceof Integer );
|
||||
assertTrue( d instanceof Integer );
|
||||
|
||||
Object bi = ((MorphDynaBean) bean).get( "bi" );
|
||||
Object bd = ((MorphDynaBean) bean).get( "bd" );
|
||||
assertTrue( bi instanceof BigInteger );
|
||||
assertTrue( bd instanceof Double );
|
||||
}
|
||||
|
||||
|
||||
public void testToBean_DynaBean__BigInteger_BigDecimal() {
|
||||
BigInteger l = new BigDecimal( "1.7976931348623157E308" ).toBigInteger();
|
||||
BigDecimal m = new BigDecimal( "-1.7976931348623157E309" ).add( new BigDecimal( "0.0001" ) );
|
||||
JSONObject json = new JSONObject().element( "i", BigInteger.ZERO )
|
||||
.element( "d", MorphUtils.BIGDECIMAL_ONE )
|
||||
.element( "bi", l )
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.sf.json.sample;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang.builder.ToStringStyle;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author Andres Almiray <aalmiray@users.sourceforge.net>
|
||||
*/
|
||||
public class BeanD extends BeanA {
|
||||
private Double[] doublearray = new Double[3];
|
||||
|
||||
public Double[] getDoublearray() {
|
||||
return doublearray;
|
||||
}
|
||||
|
||||
public void setDoublearray(Double[] doublearray) {
|
||||
this.doublearray = doublearray;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString( this, ToStringStyle.MULTI_LINE_STYLE );
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@
|
||||
package net.sf.json.util;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import net.sf.json.JSONFunction;
|
||||
@@ -93,7 +94,7 @@ public class TestJSONBuilder extends TestCase {
|
||||
.endObject();
|
||||
JSONObject jsonObj = JSONObject.fromObject( w.toString() );
|
||||
assertEquals( Boolean.TRUE, jsonObj.get( "bool" ) );
|
||||
assertEquals( new Double( 1.1d ), jsonObj.get( "numDouble" ) );
|
||||
assertEquals( Double.valueOf( "1.1" ), jsonObj.get( "numDouble" ) );
|
||||
assertEquals( new Long( 2 ).longValue(), ((Number) jsonObj.get( "numInt" )).longValue() );
|
||||
assertEquals( "text", jsonObj.get( "text" ) );
|
||||
assertTrue( JSONUtils.isFunction( jsonObj.get( "func" ) ) );
|
||||
|
||||
@@ -20,6 +20,8 @@ import junit.framework.TestCase;
|
||||
import net.sf.json.JSONFunction;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author Andres Almiray <aalmiray@users.sourceforge.net>
|
||||
*/
|
||||
@@ -85,7 +87,7 @@ public class TestJSONStringer extends TestCase {
|
||||
.endObject();
|
||||
JSONObject jsonObj = JSONObject.fromObject( b.toString() );
|
||||
assertEquals( Boolean.TRUE, jsonObj.get( "bool" ) );
|
||||
assertEquals( new Double( 1.1d ), jsonObj.get( "numDouble" ) );
|
||||
assertEquals( Double.valueOf( "1.1" ), jsonObj.get( "numDouble" ) );
|
||||
assertEquals( new Long( 2 ).longValue(), ((Number) jsonObj.get( "numInt" )).longValue() );
|
||||
assertEquals( "text", jsonObj.get( "text" ) );
|
||||
assertTrue( JSONUtils.isFunction( jsonObj.get( "func" ) ) );
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<artifactId>talend-codegen-utils</artifactId>
|
||||
<!-- release for revert version of library -->
|
||||
<version>0.25.4</version>
|
||||
<version>0.28.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -51,6 +51,8 @@ public final class TypeConverter {
|
||||
|
||||
public static final String LIST = "id_List";
|
||||
|
||||
public static final String OBJECT = "id_Object";
|
||||
|
||||
private TypeConverter() {
|
||||
// Class provides static utility methods and shouldn't be instantiated
|
||||
}
|
||||
@@ -167,6 +169,8 @@ public final class TypeConverter {
|
||||
return SHORT;
|
||||
case "java.util.Date":
|
||||
return DATE;
|
||||
case "java.lang.Object":
|
||||
return OBJECT;
|
||||
default:
|
||||
throw new UnsupportedOperationException("Unrecognized java class " + javaClass);
|
||||
}
|
||||
|
||||
@@ -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.1-talend.jar" MVN="mvn:net.sf.json-lib/json-lib/2.4.1-talend" REQUIRED_IF="READ_BY == 'XPATH'" />
|
||||
<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="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'" />
|
||||
|
||||
@@ -239,7 +239,7 @@
|
||||
<IMPORT NAME="Java-FTP" MODULE="edtftpj-2.5.0.jar" MVN="mvn:com.enterprisedt/edtftpj/2.5.0" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj-2.5.0.jar" REQUIRED_IF="(SFTP == 'false') AND (FTPS == 'false')"/>
|
||||
<IMPORT NAME="Java-SFTP" MODULE="jsch-0.1.55.jar" MVN="mvn:com.jcraft/jsch/0.1.55" REQUIRED_IF="(SFTP == 'true')"/>
|
||||
<IMPORT NAME="Java-FTPS" MODULE="commons-net-3.6.jar" MVN="mvn:commons-net/commons-net/3.6" REQUIRED_IF="(FTPS == 'true')" />
|
||||
<IMPORT NAME="Java-FTPS-talend" MODULE="commons-net-ftps-proxy-3.6.1-talend-20190128.jar" MVN="mvn:org.talend.libraries/commons-net-ftps-proxy/3.6.1-talend-20190128" REQUIRED_IF="(FTPS == 'true')" />
|
||||
<IMPORT NAME="Java-FTPS-talend" MODULE="commons-net-ftps-proxy-3.6.1-talend-20190819.jar" MVN="mvn:org.talend.components.lib/commons-net-ftps-proxy/3.6.1-talend-20190819" REQUIRED_IF="(FTPS == 'true')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -296,8 +296,8 @@
|
||||
<IMPORT NAME="Java-SFTP" MODULE="jsch-0.1.55.jar" MVN="mvn:com.jcraft/jsch/0.1.55" REQUIRED_IF="(SFTP == 'true') AND (USE_EXISTING_CONNECTION == 'false')"/>
|
||||
<IMPORT NAME="jakarta-oro" MODULE="jakarta-oro-2.0.8.jar" MVN="mvn:org.talend.libraries/jakarta-oro-2.0.8/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache/lib/jakarta-oro-2.0.8.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="Java-FTPS" MODULE="commons-net-3.6.jar" MVN="mvn:commons-net/commons-net/3.6" REQUIRED_IF="(FTPS == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Java-FTPS-talend" MODULE="commons-net-ftps-proxy-3.6.1-talend-20190128.jar"
|
||||
MVN="mvn:org.talend.libraries/commons-net-ftps-proxy/3.6.1-talend-20190128" UrlPath="platform:/plugin/org.talend.designer.components.localprovider/components/tFTPConnection/commons-net-ftps-proxy-3.6.1-talend-20190128.jar"
|
||||
<IMPORT NAME="Java-FTPS-talend" MODULE="commons-net-ftps-proxy-3.6.1-talend-20190819.jar"
|
||||
MVN="mvn:org.talend.components.lib/commons-net-ftps-proxy/3.6.1-talend-20190819"
|
||||
REQUIRED_IF="(FTPS == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -283,8 +283,8 @@ COMPATIBILITY="ALL"
|
||||
<IMPORT NAME="Java-FTP" MODULE="edtftpj-2.5.0.jar" MVN="mvn:com.enterprisedt/edtftpj/2.5.0" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj-2.5.0.jar" REQUIRED_IF="(SFTP == 'false') AND (FTPS == 'false') AND (USE_EXISTING_CONNECTION == 'false')"/>
|
||||
<IMPORT NAME="Java-SFTP" MODULE="jsch-0.1.55.jar" MVN="mvn:com.jcraft/jsch/0.1.55" REQUIRED_IF="(SFTP == 'true') AND (USE_EXISTING_CONNECTION == 'false')"/>
|
||||
<IMPORT NAME="Java-FTPS" MODULE="commons-net-3.6.jar" MVN="mvn:commons-net/commons-net/3.6" REQUIRED_IF="(FTPS == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Java-FTPS-talend" MODULE="commons-net-ftps-proxy-3.6.1-talend-20190128.jar"
|
||||
MVN="mvn:org.talend.libraries/commons-net-ftps-proxy/3.6.1-talend-20190128" UrlPath="platform:/plugin/org.talend.designer.components.localprovider/components/tFTPConnection/commons-net-ftps-proxy-3.6.1-talend-20190128.jar"
|
||||
<IMPORT NAME="Java-FTPS-talend" MODULE="commons-net-ftps-proxy-3.6.1-talend-20190819.jar"
|
||||
MVN="mvn:org.talend.components.lib/commons-net-ftps-proxy/3.6.1-talend-20190819"
|
||||
REQUIRED_IF="(FTPS == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -261,8 +261,8 @@
|
||||
<IMPORT NAME="Java-FTP" MODULE="edtftpj-2.5.0.jar" MVN="mvn:com.enterprisedt/edtftpj/2.5.0" REQUIRED_IF="(SFTP == 'false') AND (FTPS == 'false') AND (USE_EXISTING_CONNECTION == 'false')"/>
|
||||
<IMPORT NAME="Java-SFTP" MODULE="jsch-0.1.55.jar" MVN="mvn:com.jcraft/jsch/0.1.55" REQUIRED_IF="(SFTP == 'true') AND (USE_EXISTING_CONNECTION == 'false')"/>
|
||||
<IMPORT NAME="Java-FTPS" MODULE="commons-net-3.6.jar" MVN="mvn:commons-net/commons-net/3.6" REQUIRED_IF="(FTPS == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Java-FTPS-talend" MODULE="commons-net-ftps-proxy-3.6.1-talend-20190128.jar"
|
||||
MVN="mvn:org.talend.libraries/commons-net-ftps-proxy/3.6.1-talend-20190128" UrlPath="platform:/plugin/org.talend.designer.components.localprovider/components/tFTPConnection/commons-net-ftps-proxy-3.6.1-talend-20190128.jar"
|
||||
<IMPORT NAME="Java-FTPS-talend" MODULE="commons-net-ftps-proxy-3.6.1-talend-20190819.jar"
|
||||
MVN="mvn:org.talend.components.lib/commons-net-ftps-proxy/3.6.1-talend-20190819"
|
||||
REQUIRED_IF="(FTPS == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -258,8 +258,8 @@
|
||||
<IMPORT NAME="Java-FTP" MODULE="edtftpj-2.5.0.jar" MVN="mvn:com.enterprisedt/edtftpj/2.5.0" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj-2.5.0.jar" REQUIRED_IF="(SFTP == 'false') AND (FTPS == 'false') AND (USE_EXISTING_CONNECTION == 'false')"/>
|
||||
<IMPORT NAME="Java-SFTP" MODULE="jsch-0.1.55.jar" MVN="mvn:com.jcraft/jsch/0.1.55" REQUIRED_IF="(SFTP == 'true') AND (USE_EXISTING_CONNECTION == 'false')"/>
|
||||
<IMPORT NAME="Java-FTPS" MODULE="commons-net-3.6.jar" MVN="mvn:commons-net/commons-net/3.6" REQUIRED_IF="(FTPS == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Java-FTPS-talend" MODULE="commons-net-ftps-proxy-3.6.1-talend-20190128.jar"
|
||||
MVN="mvn:org.talend.libraries/commons-net-ftps-proxy/3.6.1-talend-20190128" UrlPath="platform:/plugin/org.talend.designer.components.localprovider/components/tFTPConnection/commons-net-ftps-proxy-3.6.1-talend-20190128.jar"
|
||||
<IMPORT NAME="Java-FTPS-talend" MODULE="commons-net-ftps-proxy-3.6.1-talend-20190819.jar"
|
||||
MVN="mvn:org.talend.components.lib/commons-net-ftps-proxy/3.6.1-talend-20190819"
|
||||
REQUIRED_IF="(FTPS == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -302,8 +302,8 @@ COMPATIBILITY="ALL"
|
||||
<IMPORT NAME="Java-SFTP" MODULE="jsch-0.1.55.jar" MVN="mvn:com.jcraft/jsch/0.1.55" REQUIRED_IF="(SFTP == 'true') AND (USE_EXISTING_CONNECTION == 'false')"/>
|
||||
<IMPORT NAME="jakarta-oro" MODULE="jakarta-oro-2.0.8.jar" MVN="mvn:org.talend.libraries/jakarta-oro-2.0.8/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache/lib/jakarta-oro-2.0.8.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="Java-FTPS" MODULE="commons-net-3.6.jar" MVN="mvn:commons-net/commons-net/3.6" REQUIRED_IF="(FTPS == 'true') AND (USE_EXISTING_CONNECTION == 'false')"/>
|
||||
<IMPORT NAME="Java-FTPS-talend" MODULE="commons-net-ftps-proxy-3.6.1-talend-20190128.jar"
|
||||
MVN="mvn:org.talend.libraries/commons-net-ftps-proxy/3.6.1-talend-20190128" UrlPath="platform:/plugin/org.talend.designer.components.localprovider/components/tFTPConnection/commons-net-ftps-proxy-3.6.1-talend-20190128.jar"
|
||||
<IMPORT NAME="Java-FTPS-talend" MODULE="commons-net-ftps-proxy-3.6.1-talend-20190819.jar"
|
||||
MVN="mvn:org.talend.components.lib/commons-net-ftps-proxy/3.6.1-talend-20190819"
|
||||
REQUIRED_IF="(FTPS == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -346,8 +346,8 @@ COMPATIBILITY="ALL"
|
||||
<IMPORT NAME="Java-FTP" MODULE="edtftpj-2.5.0.jar" MVN="mvn:com.enterprisedt/edtftpj/2.5.0" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj-2.5.0.jar" REQUIRED_IF="(SFTP == 'false') AND (FTPS == 'false') AND (USE_EXISTING_CONNECTION == 'false')"/>
|
||||
<IMPORT NAME="Java-SFTP" MODULE="jsch-0.1.55.jar" MVN="mvn:com.jcraft/jsch/0.1.55" REQUIRED_IF="(SFTP == 'true') AND (USE_EXISTING_CONNECTION == 'false')"/>
|
||||
<IMPORT NAME="Java-FTPS" MODULE="commons-net-3.6.jar" MVN="mvn:commons-net/commons-net/3.6" REQUIRED_IF="(FTPS == 'true') AND (USE_EXISTING_CONNECTION == 'false')"/>
|
||||
<IMPORT NAME="Java-FTPS-talend" MODULE="commons-net-ftps-proxy-3.6.1-talend-20190128.jar"
|
||||
MVN="mvn:org.talend.libraries/commons-net-ftps-proxy/3.6.1-talend-20190128" UrlPath="platform:/plugin/org.talend.designer.components.localprovider/components/tFTPConnection/commons-net-ftps-proxy-3.6.1-talend-20190128.jar"
|
||||
<IMPORT NAME="Java-FTPS-talend" MODULE="commons-net-ftps-proxy-3.6.1-talend-20190819.jar"
|
||||
MVN="mvn:org.talend.components.lib/commons-net-ftps-proxy/3.6.1-talend-20190819"
|
||||
REQUIRED_IF="(FTPS == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -264,8 +264,8 @@ COMPATIBILITY="ALL"
|
||||
<IMPORT NAME="Java-FTP" MODULE="edtftpj-2.5.0.jar" MVN="mvn:com.enterprisedt/edtftpj/2.5.0" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj-2.5.0.jar" REQUIRED_IF="(SFTP == 'false') AND (FTPS == 'false') AND (USE_EXISTING_CONNECTION == 'false')"/>
|
||||
<IMPORT NAME="Java-SFTP" MODULE="jsch-0.1.55.jar" MVN="mvn:com.jcraft/jsch/0.1.55" REQUIRED_IF="(SFTP == 'true') AND (USE_EXISTING_CONNECTION == 'false')"/>
|
||||
<IMPORT NAME="Java-FTPS" MODULE="commons-net-3.6.jar" MVN="mvn:commons-net/commons-net/3.6" REQUIRED_IF="(FTPS == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Java-FTPS-talend" MODULE="commons-net-ftps-proxy-3.6.1-talend-20190128.jar"
|
||||
MVN="mvn:org.talend.libraries/commons-net-ftps-proxy/3.6.1-talend-20190128" UrlPath="platform:/plugin/org.talend.designer.components.localprovider/components/tFTPConnection/commons-net-ftps-proxy-3.6.1-talend-20190128.jar"
|
||||
<IMPORT NAME="Java-FTPS-talend" MODULE="commons-net-ftps-proxy-3.6.1-talend-20190819.jar"
|
||||
MVN="mvn:org.talend.components.lib/commons-net-ftps-proxy/3.6.1-talend-20190819"
|
||||
REQUIRED_IF="(FTPS == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -253,8 +253,8 @@ COMPATIBILITY="ALL"
|
||||
<IMPORT NAME="Java-SFTP" MODULE="jsch-0.1.55.jar" MVN="mvn:com.jcraft/jsch/0.1.55" REQUIRED_IF="(SFTP == 'true') AND (USE_EXISTING_CONNECTION == 'false')"/>
|
||||
<IMPORT NAME="jakarta-oro" MODULE="jakarta-oro-2.0.8.jar" MVN="mvn:org.talend.libraries/jakarta-oro-2.0.8/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache/lib/jakarta-oro-2.0.8.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="Java-FTPS" MODULE="commons-net-3.6.jar" MVN="mvn:commons-net/commons-net/3.6" REQUIRED_IF="(FTPS == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Java-FTPS-talend" MODULE="commons-net-ftps-proxy-3.6.1-talend-20190128.jar"
|
||||
MVN="mvn:org.talend.libraries/commons-net-ftps-proxy/3.6.1-talend-20190128" UrlPath="platform:/plugin/org.talend.designer.components.localprovider/components/tFTPConnection/commons-net-ftps-proxy-3.6.1-talend-20190128.jar"
|
||||
<IMPORT NAME="Java-FTPS-talend" MODULE="commons-net-ftps-proxy-3.6.1-talend-20190819.jar"
|
||||
MVN="mvn:org.talend.components.lib/commons-net-ftps-proxy/3.6.1-talend-20190819"
|
||||
REQUIRED_IF="(FTPS == 'true') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
Binary file not shown.
@@ -143,7 +143,10 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="filecopy" MODULE="filecopy.jar" MVN="mvn:org.talend.libraries/filecopy/6.0.0" REQUIRED="true" />
|
||||
<IMPORT NAME="filecopy" MODULE="filecopy-2.0.0.jar"
|
||||
MVN="mvn:org.talend.libraries/filecopy/2.0.0"
|
||||
UrlPath="platform:/plugin/org.talend.libraries.custom/lib/filecopy-2.0.0.jar"
|
||||
REQUIRED="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.1-talend.jar" MVN="mvn:net.sf.json-lib/json-lib/2.4.1-talend" REQUIRED_IF="(READ_BY == 'XPATH')" />
|
||||
<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="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"
|
||||
|
||||
@@ -425,7 +425,7 @@ String inputConnName = null;
|
||||
%>
|
||||
<%=childJob %> childJob_<%=cid %> = new <%=childJob %>();
|
||||
<%
|
||||
if (ProcessorUtilities.isEsbJob(process, version)) {
|
||||
if (ProcessorUtilities.isEsbJob(currentProcess)) {
|
||||
%>
|
||||
childJob_<%=cid %>.setEndpointRegistry(registry);
|
||||
<%
|
||||
|
||||
@@ -68,7 +68,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.1-talend.jar" MVN="mvn:net.sf.json-lib/json-lib/2.4.1-talend" 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" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<thashfile.dir>${project.basedir}/components/tHashInput</thashfile.dir>
|
||||
<thashfile.version>3.0-20170711</thashfile.version>
|
||||
<ftpProxy.dir>${project.basedir}/components/tFTPConnection</ftpProxy.dir>
|
||||
<ftpProxy.version>3.6.1-talend-20190128</ftpProxy.version>
|
||||
<ftpProxy.version>3.6.1-talend-20190819</ftpProxy.version>
|
||||
<talendMQRFH2.dir>${project.basedir}/components/tMomInput</talendMQRFH2.dir>
|
||||
<talendMQRFH2.version>1.0.1-20190206</talendMQRFH2.version>
|
||||
<talendMQConnectionUtil.dir>${project.basedir}/components/tMomConnection</talendMQConnectionUtil.dir>
|
||||
@@ -125,7 +125,7 @@
|
||||
<outputDirectory>${thashfile.dir}</outputDirectory>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<groupId>org.talend.components.lib</groupId>
|
||||
<artifactId>commons-net-ftps-proxy</artifactId>
|
||||
<version>${ftpProxy.version}</version>
|
||||
<type>jar</type>
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.beans.PropertyChangeEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.gef.commands.Command;
|
||||
import org.eclipse.swt.SWT;
|
||||
@@ -126,7 +127,9 @@ public class ButtonController extends AbstractElementPropertySectionController {
|
||||
continue;
|
||||
}
|
||||
for(String path : listString){
|
||||
jars.add(GenericTableUtils.getDriverJarPath(path));
|
||||
if (!StringUtils.isBlank(path)) {
|
||||
jars.add(GenericTableUtils.getDriverJarPath(path));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1262,7 +1262,7 @@ public class Component extends AbstractBasicComponent {
|
||||
}
|
||||
ModuleNeeded moduleNeeded = new ModuleNeeded(getName(), "", true, "mvn:org.talend.libraries/slf4j-log4j12-1.7.10/6.0.0");
|
||||
componentImportNeedsList.add(moduleNeeded);
|
||||
moduleNeeded = new ModuleNeeded(getName(), "", true, "mvn:org.talend.libraries/talend-codegen-utils/0.25.4");
|
||||
moduleNeeded = new ModuleNeeded(getName(), "", true, "mvn:org.talend.libraries/talend-codegen-utils/0.28.0");
|
||||
componentImportNeedsList.add(moduleNeeded);
|
||||
return componentImportNeedsList;
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ import org.talend.designer.core.ui.views.jobsettings.JobSettings;
|
||||
import org.talend.designer.core.ui.views.problems.Problems;
|
||||
import org.talend.designer.core.ui.views.properties.ComponentSettings;
|
||||
import org.talend.designer.core.ui.views.properties.ComponentSettingsView;
|
||||
import org.talend.designer.core.utils.BigDataJobUtil;
|
||||
import org.talend.designer.core.utils.JavaProcessUtil;
|
||||
import org.talend.designer.core.utils.UnifiedComponentUtil;
|
||||
import org.talend.designer.runprocess.ProcessorException;
|
||||
@@ -874,4 +875,9 @@ public class DesignerCoreService implements IDesignerCoreService {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNeedContextInJar(IProcess process) {
|
||||
return new BigDataJobUtil(process).needsToHaveContextInsideJar();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -598,6 +598,11 @@ public class TalendJavaSourceViewer extends ReconcilerViewer {
|
||||
StringTokenizer token = new StringTokenizer(var.getName(), "."); //$NON-NLS-1$
|
||||
String className = token.nextToken();
|
||||
if (token.hasMoreTokens()) {
|
||||
String subVarName = var.getName().substring(className.length() + 1);
|
||||
if (subVarName.contains("(") && subVarName.contains("")) {
|
||||
// no need for method like TalendDate.addDate(row1.test,arg2,arg3)
|
||||
continue;
|
||||
}
|
||||
String newVarName = token.nextToken();
|
||||
Variable newVar = new Variable(newVarName, var.getValue(), var.getTalendType(), var.isNullable());
|
||||
if (!classesToGenerate.containsKey(className)) {
|
||||
|
||||
@@ -436,7 +436,9 @@ public class JavaProcessUtil {
|
||||
if (var.equals(contextPara.getName())) {
|
||||
String value =
|
||||
context.getContextParameter(contextPara.getName()).getValue();
|
||||
|
||||
if (StringUtils.isBlank(value)) {
|
||||
continue;
|
||||
}
|
||||
if (curParam.getName().equals(EParameterName.DRIVER_JAR.getName())
|
||||
&& value.contains(";")) { //$NON-NLS-1$
|
||||
String[] jars = value.split(";"); //$NON-NLS-1$
|
||||
|
||||
@@ -376,17 +376,6 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
|
||||
} else {
|
||||
resourcesFolder = tProcessJavaProject.getExternalResourcesFolder();
|
||||
}
|
||||
if (ProcessorUtilities.isExportConfig() && !needContextInJar) {
|
||||
try {
|
||||
for (IResource resource : tProcessJavaProject.getResourcesFolder().members()) {
|
||||
if (resource.exists()) {
|
||||
resource.delete(true, monitor);
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
outputFolder = tProcessJavaProject.getOutputFolder();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
// ============================================================================
|
||||
package org.talend.expressionbuilder.test.shadow;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -89,6 +90,14 @@ public class VirtualRowGeneratorNode extends RowGeneratorComponent {
|
||||
|
||||
}
|
||||
|
||||
protected List<Variable> getVariableList() {
|
||||
return ExpressionBuilderDialog.getTestComposite().getVariableList();
|
||||
}
|
||||
|
||||
protected String getExpression() {
|
||||
return ExpressionBuilderDialog.getExpressionComposite().getExpression();
|
||||
}
|
||||
|
||||
/**
|
||||
* yzhang Comment method "initArray".
|
||||
*/
|
||||
@@ -99,8 +108,8 @@ public class VirtualRowGeneratorNode extends RowGeneratorComponent {
|
||||
VirtualMetadataColumn ext = (VirtualMetadataColumn) col;
|
||||
Map<String, String> value = new HashMap<String, String>();
|
||||
value.put(RowGeneratorComponent.COLUMN_NAME, ext.getLabel());
|
||||
List<Variable> variables = ExpressionBuilderDialog.getTestComposite().getVariableList();
|
||||
String expression = ExpressionBuilderDialog.getExpressionComposite().getExpression();
|
||||
List<Variable> variables = getVariableList();
|
||||
String expression = getExpression();
|
||||
// modify for bug 9471
|
||||
try {
|
||||
for (Variable varible : variables) {
|
||||
@@ -111,7 +120,7 @@ public class VirtualRowGeneratorNode extends RowGeneratorComponent {
|
||||
}
|
||||
String currentValue = varible.getValue();
|
||||
String newValue = renameVaribleValue(currentValue, type);
|
||||
if (valueContains(expression, varible.getName())) {
|
||||
if (valueContains(expression, varible.getName()) && !newValue.equals("null")) {
|
||||
if (currentValue != null && !currentValue.equals(newValue)) {
|
||||
expression = renameValues(expression, varible.getName(), newValue);
|
||||
} else {
|
||||
@@ -182,12 +191,17 @@ public class VirtualRowGeneratorNode extends RowGeneratorComponent {
|
||||
}
|
||||
|
||||
private String renameVaribleValue(String newValue, String type) {
|
||||
if (newValue == null || newValue.equals("null")) {
|
||||
return newValue;
|
||||
}
|
||||
if (JavaTypesManager.BIGDECIMAL.getLabel().equals(type)) {
|
||||
newValue = " new " + JavaTypesManager.BIGDECIMAL.getNullableClass().getName() + "(" + newValue + ")";//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
} else if (JavaTypesManager.CHARACTER.getLabel().contains(type)) {
|
||||
if (newValue.length() == 1) {
|
||||
newValue = " new " + JavaTypesManager.CHARACTER.getNullableClass().getName() + "('" + newValue.charAt(0) + "')";//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
}
|
||||
} else if (JavaTypesManager.DATE.getLabel().equals(type)) {
|
||||
newValue = " ParserUtils.parseTo_Date(" + (newValue.equals("") ? "\"\"" : newValue) + ", \"dd-MM-yyyy\")";
|
||||
}
|
||||
return newValue;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
context="plugin:org.talend.libraries.custom"
|
||||
language="java"
|
||||
message="Library for components API"
|
||||
name="talend-codegen-utils.jar" mvn_uri="mvn:org.talend.libraries/talend-codegen-utils/0.25.4"
|
||||
name="talend-codegen-utils.jar" mvn_uri="mvn:org.talend.libraries/talend-codegen-utils/0.28.0"
|
||||
required="true">
|
||||
</libraryNeeded>
|
||||
</extension>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<artifactItem>
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<artifactId>talend-codegen-utils</artifactId>
|
||||
<version>0.25.4</version>
|
||||
<version>0.28.0</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
@@ -58,6 +58,11 @@
|
||||
<artifactId>talendzip</artifactId>
|
||||
<version>1.0-20190527</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<artifactId>filecopy</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
@@ -52,7 +52,9 @@ import org.talend.core.context.Context;
|
||||
import org.talend.core.context.RepositoryContext;
|
||||
import org.talend.core.language.ECodeLanguage;
|
||||
import org.talend.core.language.LanguageManager;
|
||||
import org.talend.core.model.metadata.IMetadataTable;
|
||||
import org.talend.core.model.metadata.MetadataToolHelper;
|
||||
import org.talend.core.model.metadata.builder.ConvertionHelper;
|
||||
import org.talend.core.model.metadata.builder.connection.ConnectionFactory;
|
||||
import org.talend.core.model.metadata.builder.connection.MetadataColumn;
|
||||
import org.talend.core.model.metadata.builder.connection.MetadataTable;
|
||||
@@ -127,6 +129,8 @@ public class JSONWizard extends CheckLastVersionRepositoryWizard implements INew
|
||||
private List<ATreeNode> rootNodes;
|
||||
|
||||
private final Map<String, List<FOXTreeNode>> foxNodesMap = new HashMap<String, List<FOXTreeNode>>();
|
||||
|
||||
private List<IMetadataTable> oldMetadataTable = new ArrayList<IMetadataTable>();
|
||||
|
||||
private boolean isToolbar;
|
||||
|
||||
@@ -232,6 +236,10 @@ public class JSONWizard extends CheckLastVersionRepositoryWizard implements INew
|
||||
this.originalDescription = this.connectionItem.getProperty().getDescription();
|
||||
this.originalPurpose = this.connectionItem.getProperty().getPurpose();
|
||||
this.originalStatus = this.connectionItem.getProperty().getStatusCode();
|
||||
MetadataTable[] tables = ConnectionHelper.getTables(connectionItem.getConnection()).toArray(new MetadataTable[0]);
|
||||
for (MetadataTable table : tables) {
|
||||
this.oldMetadataTable.add(ConvertionHelper.convert(table));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,6 +305,10 @@ public class JSONWizard extends CheckLastVersionRepositoryWizard implements INew
|
||||
this.originalDescription = this.connectionItem.getProperty().getDescription();
|
||||
this.originalPurpose = this.connectionItem.getProperty().getPurpose();
|
||||
this.originalStatus = this.connectionItem.getProperty().getStatusCode();
|
||||
MetadataTable[] tables = ConnectionHelper.getTables(connectionItem.getConnection()).toArray(new MetadataTable[0]);
|
||||
for (MetadataTable table : tables) {
|
||||
this.oldMetadataTable.add(ConvertionHelper.convert(table));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,7 +517,7 @@ public class JSONWizard extends CheckLastVersionRepositoryWizard implements INew
|
||||
"There are some new fields to extract, guess your schema manually if you want to apply the update.");
|
||||
}
|
||||
// update
|
||||
RepositoryUpdateManager.updateFileConnection(connectionItem);
|
||||
RepositoryUpdateManager.updateFileConnection(connectionItem, oldMetadataTable);
|
||||
refreshInFinish(propertiesWizardPage.isNameModifiedByUser());
|
||||
final RepositoryWorkUnit<Object> workUnit = new RepositoryWorkUnit<Object>("", this) {
|
||||
|
||||
@@ -631,11 +643,6 @@ public class JSONWizard extends CheckLastVersionRepositoryWizard implements INew
|
||||
file = TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType, file));
|
||||
}
|
||||
|
||||
if (file != null) {
|
||||
// prepareColumnsFromXSD(file, newColumns, schemaTarget);
|
||||
return;
|
||||
}
|
||||
|
||||
if (csvArray == null || csvArray.getRows().isEmpty()) {
|
||||
return;
|
||||
} else {
|
||||
|
||||
@@ -135,7 +135,10 @@ public class JSONToJsonPathLinker extends JSONToXPathLinker {
|
||||
} else {
|
||||
fullPath = relativeXpathPrm;
|
||||
}
|
||||
TreeItem treeItemFromAbsoluteXPath = treePopulator.getTreeItem(fullPath);
|
||||
TreeItem treeItemFromAbsoluteXPath = null;
|
||||
if(fieldToExtract(relativeXpathPrm, treePopulator.getAllNodes())) {
|
||||
treeItemFromAbsoluteXPath = treePopulator.getTreeItem(fullPath);
|
||||
}
|
||||
if (treeItemFromAbsoluteXPath != null) {
|
||||
addFieldLink(treeItemFromAbsoluteXPath, treeItemFromAbsoluteXPath.getData(), tableItemTarget.getParent(),
|
||||
(SchemaTarget) tableItemTarget.getData());
|
||||
|
||||
@@ -71,6 +71,7 @@ import org.talend.commons.utils.data.list.IListenableListListener;
|
||||
import org.talend.commons.utils.data.list.ListenableListEvent;
|
||||
import org.talend.commons.utils.data.list.ListenableListEvent.TYPE;
|
||||
import org.talend.core.utils.TalendQuoteUtils;
|
||||
import org.talend.datatools.xml.utils.ATreeNode;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
|
||||
import org.talend.metadata.managment.ui.utils.ConnectionContextHelper;
|
||||
import org.talend.metadata.managment.ui.wizard.metadata.xml.XmlExtractorBgRefresher;
|
||||
@@ -331,12 +332,14 @@ public class JSONToXPathLinker extends TreeToTablesLinker<Object, Object> {
|
||||
TableItem tableItem = fieldsTableItems[i];
|
||||
SchemaTarget schemaTarget = schemaTargetList.get(indexShemaTarget);
|
||||
String relativeXpathQuery = schemaTarget.getRelativeXPathQuery();
|
||||
createFieldLinks(relativeXpathQuery, tableItem, monitorWrap, schemaTarget);
|
||||
if(fieldToExtract(schemaTarget.getTagName(), treePopulator.getAllNodes())) {
|
||||
createFieldLinks(relativeXpathQuery, tableItem, monitorWrap, schemaTarget);
|
||||
}
|
||||
monitorWrap.worked(1);
|
||||
}
|
||||
fieldsTableEditorView.getTableViewerCreator().getTableViewer().refresh();
|
||||
getLinksManager().sortLinks(getDrawingLinksComparator());
|
||||
getBackgroundRefresher().refreshBackground();
|
||||
fieldsTableEditorView.getTableViewerCreator().getTableViewer().refresh();
|
||||
}
|
||||
|
||||
private IModifiedBeanListener loopModelModifiedBeanListener;
|
||||
@@ -344,6 +347,15 @@ public class JSONToXPathLinker extends TreeToTablesLinker<Object, Object> {
|
||||
private IExtendedControlListener loopTableExtendedControlListener;
|
||||
|
||||
private ILineSelectionListener afterLineSelectionListener;
|
||||
|
||||
public boolean fieldToExtract(String relativeXpathQuery, List<ATreeNode> nodes) {
|
||||
for(ATreeNode node : nodes) {
|
||||
if(relativeXpathQuery.equals(node.getLabel())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC amaumont Comment method "initListeners".
|
||||
@@ -780,7 +792,10 @@ public class JSONToXPathLinker extends TreeToTablesLinker<Object, Object> {
|
||||
} else {
|
||||
fullPath = relativeXpath;
|
||||
}
|
||||
TreeItem treeItemFromAbsoluteXPath = treePopulator.getTreeItem(fullPath);
|
||||
TreeItem treeItemFromAbsoluteXPath = null;
|
||||
if(fieldToExtract(relativeXpath, treePopulator.getAllNodes())) {
|
||||
treeItemFromAbsoluteXPath = treePopulator.getTreeItem(fullPath);
|
||||
}
|
||||
if (treeItemFromAbsoluteXPath != null && !alreadyProcessedXPath.contains(fullPath)) {
|
||||
addFieldLink(treeItemFromAbsoluteXPath, treeItemFromAbsoluteXPath.getData(), tableItemTarget.getParent(),
|
||||
(SchemaTarget) tableItemTarget.getData());
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,84 @@
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.repository.model.migration;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.core.language.ECodeLanguage;
|
||||
import org.talend.core.model.components.ComponentUtilities;
|
||||
import org.talend.core.model.components.ModifyComponentsAction;
|
||||
import org.talend.core.model.components.conversions.IComponentConversion;
|
||||
import org.talend.core.model.components.filters.IComponentFilter;
|
||||
import org.talend.core.model.components.filters.NameComponentFilter;
|
||||
import org.talend.core.model.migration.AbstractJobMigrationTask;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
|
||||
import org.talend.migration.IMigrationTask.ExecutionResult;
|
||||
|
||||
public class changeDBVersionForMapROJAIOutputMigrationTask extends AbstractJobMigrationTask {
|
||||
|
||||
@Override
|
||||
public Date getOrder() {
|
||||
GregorianCalendar gc = new GregorianCalendar(2019, 8, 12, 12, 0, 0);
|
||||
return gc.getTime();
|
||||
}
|
||||
@Override
|
||||
public ExecutionResult execute(Item item) {
|
||||
final ProcessType processType = getProcessType(item);
|
||||
String[] compNames = {"tMapROjaiOutput"};
|
||||
|
||||
IComponentConversion changeDBNVersion = new IComponentConversion() {
|
||||
|
||||
public void transform(NodeType node) {
|
||||
if(node == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ElementParameterType database = ComponentUtilities.getNodeProperty(node, "DB_VERSION"); //$NON-NLS-1$
|
||||
|
||||
if (database == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String dbname = database.getValue();
|
||||
|
||||
if("MAPROJAI_5_1".equals(dbname)) {
|
||||
database.setValue("MAPR510");
|
||||
} else if ("MAPROJAI_5_2".equals(dbname)) {
|
||||
database.setValue("MAPR520");
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
for (String name : compNames) {
|
||||
IComponentFilter filter = new NameComponentFilter(name);
|
||||
|
||||
try {
|
||||
ModifyComponentsAction.searchAndModify(item, processType, filter, Arrays
|
||||
.<IComponentConversion> asList(changeDBNVersion));
|
||||
} catch (PersistenceException e) {
|
||||
// TODO Auto-generated catch block
|
||||
ExceptionHandler.process(e);
|
||||
return ExecutionResult.FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
return ExecutionResult.SUCCESS_NO_ALERT;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -961,6 +961,9 @@ public class JavaJobScriptsExportWSWizardPage extends JavaJobScriptsExportWizard
|
||||
log4jLevelCombo.select(2);
|
||||
}
|
||||
}
|
||||
// contextCombo applyToChildrenButton control by contextbutton
|
||||
contextCombo.setEnabled(contextButton.getSelection());
|
||||
applyToChildrenButton.setEnabled(contextButton.getSelection());
|
||||
}
|
||||
|
||||
private void restoreWidgetValuesForImage() {
|
||||
|
||||
@@ -39,6 +39,9 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.ui.runtime.CommonUIPlugin;
|
||||
import org.talend.commons.ui.runtime.exception.MessageBoxExceptionHandler;
|
||||
@@ -416,7 +419,14 @@ public class BuildJobHandler extends AbstractBuildJobHandler {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
MessageBoxExceptionHandler.process(e, Display.getDefault().getActiveShell());
|
||||
Shell shell = null;
|
||||
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
|
||||
|
||||
if (activeWorkbenchWindow != null) {
|
||||
shell = activeWorkbenchWindow.getShell();
|
||||
}
|
||||
|
||||
MessageBoxExceptionHandler.process(e, shell);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
1
pom.xml
1
pom.xml
@@ -156,6 +156,7 @@
|
||||
<module>test/plugins/org.talend.designer.webservice.test</module>
|
||||
<module>test/plugins/org.talend.designer.scd.test</module>
|
||||
<module>test/plugins/org.talend.designer.unifiedcomponent.test</module>
|
||||
<module>test/plugins/org.talend.expressionbuilder.test</module>
|
||||
</modules>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
11
test/plugins/org.talend.expressionbuilder.test/.classpath
Normal file
11
test/plugins/org.talend.expressionbuilder.test/.classpath
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src">
|
||||
<attributes>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
28
test/plugins/org.talend.expressionbuilder.test/.project
Normal file
28
test/plugins/org.talend.expressionbuilder.test/.project
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.talend.expressionbuilder.test</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,7 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Test
|
||||
Bundle-SymbolicName: org.talend.expressionbuilder.test
|
||||
Bundle-Version: 7.2.2.qualifier
|
||||
Fragment-Host: org.talend.expressionbuilder
|
||||
Require-Bundle: org.talend.testutils
|
||||
@@ -0,0 +1,4 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
12
test/plugins/org.talend.expressionbuilder.test/pom.xml
Normal file
12
test/plugins/org.talend.expressionbuilder.test/pom.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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>
|
||||
<parent>
|
||||
<groupId>org.talend.studio</groupId>
|
||||
<artifactId>tdi-studio-se</artifactId>
|
||||
<version>7.2.2-SNAPSHOT</version>
|
||||
<relativePath>../../../</relativePath>
|
||||
</parent>
|
||||
<artifactId>org.talend.expressionbuilder.test</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
@@ -0,0 +1,178 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.expressionbuilder.test.shadow;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.talend.commons.runtime.model.expressionbuilder.Variable;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.designer.rowgenerator.data.Function;
|
||||
import org.talend.designer.rowgenerator.data.Parameter;
|
||||
import org.talend.designer.rowgenerator.data.ParameterFactory;
|
||||
import org.talend.expressionbuilder.model.Category;
|
||||
import org.talend.expressionbuilder.model.CategoryManager;
|
||||
|
||||
/**
|
||||
* DOC jding class global comment. Detailled comment
|
||||
*/
|
||||
public class VirtualRowGeneratorNodeTest {
|
||||
|
||||
private static Map<String, Set<Function>> categoryFunctionHM;
|
||||
|
||||
private static List<Variable> variableList;
|
||||
|
||||
private static String expression;
|
||||
|
||||
@Before
|
||||
public void prepare() {
|
||||
// prepare function to found
|
||||
CategoryManager manager = new CategoryManager();
|
||||
List<Category> inputCategory = manager.getInputCategory("java");
|
||||
categoryFunctionHM = new HashMap<String, Set<Function>>();
|
||||
for (Category category : inputCategory) {
|
||||
String key = category.getName();
|
||||
if (categoryFunctionHM.get(key) == null) {
|
||||
categoryFunctionHM.put(key, new HashSet<Function>());
|
||||
}
|
||||
categoryFunctionHM.get(key).addAll(category.getFunctions());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExpressionSplicing() {
|
||||
Set<Function> functions = categoryFunctionHM.get("TalendDate");
|
||||
Assert.assertTrue(functions.size() != 0);
|
||||
String[] params = new String[] { ParameterFactory.PARAMETER_TYPE_DATE, ParameterFactory.PARAMETER_TYPE_INT,
|
||||
ParameterFactory.PARAMETER_TYPE_STRING };
|
||||
Function function = getFunctionByName(functions, "addDate", params);
|
||||
|
||||
// prepare variables and expression to test
|
||||
Variable var = new Variable("row1.mydate", "08-14-2019", "id_Date", true);
|
||||
variableList = new ArrayList<Variable>();
|
||||
variableList.add(var);
|
||||
expression = "TalendDate.addDate(row1.mydate,07,\"MM\")";
|
||||
|
||||
// case1: when input "08-14-2019"
|
||||
TestVirtualRowGeneratorNode node = new TestVirtualRowGeneratorNode(function);
|
||||
String expressionFromNode = getExpressionFromNode(node);
|
||||
Assert.assertNotNull(expressionFromNode);
|
||||
// the return of org.talend.expressionbuilder.test.shadow.VirtualRowGeneratorNode.getArray()
|
||||
String expectExpression = "\"\"+(TalendDate.addDate( ParserUtils.parseTo_Date(08-14-2019, \"dd-MM-yyyy\"),07,\"MM\"))+\"\"";
|
||||
Assert.assertEquals(expectExpression, expressionFromNode);
|
||||
|
||||
// case2: when input "null", null in the composite but "null" received
|
||||
Variable var2 = new Variable("row1.mydate", "null", "id_Date", true);
|
||||
variableList = new ArrayList<Variable>();
|
||||
variableList.add(var2);
|
||||
TestVirtualRowGeneratorNode node2 = new TestVirtualRowGeneratorNode(function);
|
||||
String expressionFromNode2 = getExpressionFromNode(node2);
|
||||
Assert.assertNotNull(expressionFromNode2);
|
||||
String expectExpression2 = "\"\"+(TalendDate.addDate(null,07,\"MM\"))+\"\"";
|
||||
Assert.assertEquals(expectExpression2, expressionFromNode2);
|
||||
|
||||
// case3: when input empty
|
||||
Variable var3 = new Variable("row1.mydate", "", "id_Date", true);
|
||||
variableList = new ArrayList<Variable>();
|
||||
variableList.add(var3);
|
||||
TestVirtualRowGeneratorNode node3 = new TestVirtualRowGeneratorNode(function);
|
||||
String expressionFromNode3 = getExpressionFromNode(node3);
|
||||
Assert.assertNotNull(expressionFromNode3);
|
||||
String expectExpression3 = "\"\"+(TalendDate.addDate( ParserUtils.parseTo_Date(\"\", \"dd-MM-yyyy\"),07,\"MM\"))+\"\"";
|
||||
Assert.assertEquals(expectExpression3, expressionFromNode3);
|
||||
|
||||
}
|
||||
|
||||
private String getExpressionFromNode(TestVirtualRowGeneratorNode node) {
|
||||
String expressionValue = null;
|
||||
IElementParameter elementParameter = node.getElementParameter("VALUES");
|
||||
Object value = elementParameter.getValue();
|
||||
if (value instanceof List) {
|
||||
List valueList = (List) value;
|
||||
for (Object object : valueList) {
|
||||
if (object instanceof Map) {
|
||||
Map elem = (Map) object;
|
||||
Object val = elem.get("ARRAY");
|
||||
if (val != null) {
|
||||
expressionValue = val.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return expressionValue;
|
||||
}
|
||||
|
||||
private Function getFunctionByName(Set<Function> functionSet, String functionName, String[] paramType) {
|
||||
Function found = null;
|
||||
List<String> paramTypsList = Arrays.asList(paramType);
|
||||
for (Function function : functionSet) {
|
||||
if (!function.getName().equals(functionName)) {
|
||||
continue;
|
||||
}
|
||||
List parameters = function.getParameters();
|
||||
if (parameters.size() != paramType.length) {
|
||||
continue;
|
||||
}
|
||||
boolean notMatch = false;
|
||||
for (Object obj : parameters) {
|
||||
Parameter param = (Parameter) obj;
|
||||
if (!paramTypsList.contains(param.getType())) {
|
||||
notMatch = true;
|
||||
}
|
||||
}
|
||||
if (!notMatch) {
|
||||
found = function;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
class TestVirtualRowGeneratorNode extends VirtualRowGeneratorNode {
|
||||
|
||||
|
||||
public TestVirtualRowGeneratorNode(Function function) {
|
||||
super(function);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.expressionbuilder.test.shadow.VirtualRowGeneratorNode#getVariableList()
|
||||
*/
|
||||
@Override
|
||||
protected List<Variable> getVariableList() {
|
||||
return variableList;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.expressionbuilder.test.shadow.VirtualRowGeneratorNode#getExpression()
|
||||
*/
|
||||
@Override
|
||||
protected String getExpression() {
|
||||
return expression;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user