Compare commits
148 Commits
csun/TESB-
...
msev-test
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
521ffffce0 | ||
|
|
7f292079bb | ||
|
|
e1ee2bd473 | ||
|
|
a2b1281156 | ||
|
|
83421a7f6c | ||
|
|
721258942c | ||
|
|
eb31686a3e | ||
|
|
223f5da7db | ||
|
|
a961d842ea | ||
|
|
922d138523 | ||
|
|
1c534b4b5f | ||
|
|
8dd9933294 | ||
|
|
09fd6c52ff | ||
|
|
0399e751f5 | ||
|
|
9ca8fa0663 | ||
|
|
43cb82c389 | ||
|
|
f3bfc9ca6b | ||
|
|
8a3ef23853 | ||
|
|
d2e9b874c1 | ||
|
|
e7e9908678 | ||
|
|
da0a057872 | ||
|
|
9052eb3e99 | ||
|
|
b88c6e3fbc | ||
|
|
457bd0fc40 | ||
|
|
c4c49001a2 | ||
|
|
c21f8e7551 | ||
|
|
cda47b2324 | ||
|
|
cab755152c | ||
|
|
14ed765ab8 | ||
|
|
1844d76b67 | ||
|
|
b3f4d37498 | ||
|
|
1c786fb4f2 | ||
|
|
d54077e7dc | ||
|
|
9d8ffa6d37 | ||
|
|
e5b9def018 | ||
|
|
08fb15d12b | ||
|
|
83d684ce0c | ||
|
|
2aa3688f12 | ||
|
|
229c1f8d95 | ||
|
|
c8325d6799 | ||
|
|
7139c9bb7f | ||
|
|
e73b0715dc | ||
|
|
ad56747c35 | ||
|
|
8faeb6dd45 | ||
|
|
706b61e22d | ||
|
|
fd891e2419 | ||
|
|
8599590f33 | ||
|
|
7c5a32acb1 | ||
|
|
600b37d142 | ||
|
|
c4900e7ad2 | ||
|
|
6d8adab44d | ||
|
|
751c6d7813 | ||
|
|
22792ee2a3 | ||
|
|
34b7458303 | ||
|
|
2f7a4e930d | ||
|
|
b3ea83c580 | ||
|
|
5920f991b0 | ||
|
|
1c40d8b173 | ||
|
|
4b56340f46 | ||
|
|
926bc55d86 | ||
|
|
e27ab0d505 | ||
|
|
4b1dd0a0c5 | ||
|
|
8ed935fc5f | ||
|
|
18b2039453 | ||
|
|
31d5836c01 | ||
|
|
6e88f43352 | ||
|
|
efd512cc4f | ||
|
|
5632263a99 | ||
|
|
b8d0a79ae6 | ||
|
|
1a1d07909f | ||
|
|
c9c865871b | ||
|
|
4eb95ff314 | ||
|
|
9058e5f0cf | ||
|
|
9db887667a | ||
|
|
115ff04f57 | ||
|
|
12181f8a75 | ||
|
|
ccdad6daa8 | ||
|
|
62dc6af821 | ||
|
|
739ca0b32c | ||
|
|
534feea221 | ||
|
|
f4a45b3659 | ||
|
|
e3a55d8b63 | ||
|
|
80fbfd17a8 | ||
|
|
0652420c79 | ||
|
|
23e645e8e6 | ||
|
|
2dcba4cddb | ||
|
|
9e7e4c0971 | ||
|
|
d5f863477d | ||
|
|
b802bb6a72 | ||
|
|
21b8a407de | ||
|
|
0352e0556c | ||
|
|
9ce74b5a90 | ||
|
|
b9c4102074 | ||
|
|
2733478a43 | ||
|
|
9b2180562c | ||
|
|
bec10957e5 | ||
|
|
d0a5929ad6 | ||
|
|
cc999c45b5 | ||
|
|
5defbea32b | ||
|
|
2583507d00 | ||
|
|
48b0e2ecbd | ||
|
|
f1b204b226 | ||
|
|
7f5e8bfa11 | ||
|
|
063f1daeec | ||
|
|
d2621d049e | ||
|
|
364d240804 | ||
|
|
7398c13e69 | ||
|
|
ea4ae4c735 | ||
|
|
5eb3f438ea | ||
|
|
dc1c743d48 | ||
|
|
b885667b38 | ||
|
|
4019138048 | ||
|
|
eb00028926 | ||
|
|
f439623eab | ||
|
|
8e65ae765f | ||
|
|
84edd12af5 | ||
|
|
cb8308df05 | ||
|
|
62fe9a0f38 | ||
|
|
ac80911050 | ||
|
|
7c682778ec | ||
|
|
4159e31ef1 | ||
|
|
b7ed047c91 | ||
|
|
be5a9a7dba | ||
|
|
0f0ead31aa | ||
|
|
70f45909b9 | ||
|
|
3e0d0538bb | ||
|
|
40d9315e48 | ||
|
|
0946243005 | ||
|
|
d544cfbbd8 | ||
|
|
38d73d1c3b | ||
|
|
a257812d17 | ||
|
|
4224c49747 | ||
|
|
2a48cfd3c5 | ||
|
|
c4adf887db | ||
|
|
18422df2a4 | ||
|
|
0985646d21 | ||
|
|
481edbbc18 | ||
|
|
02df23ffeb | ||
|
|
957704c0a4 | ||
|
|
cb85a154f8 | ||
|
|
c7c9d4bf2d | ||
|
|
4271923ca3 | ||
|
|
70f0e7a076 | ||
|
|
6e0af4dd99 | ||
|
|
26fbb4e014 | ||
|
|
28b472384b | ||
|
|
c0f93ad66b | ||
|
|
7a53a97ceb |
@@ -55,5 +55,6 @@
|
||||
<plugin id="org.talend.testutils" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
|
||||
<plugin id="org.talend.updates.runtime.test" download-size="0" install-size="0" version="0.0.0" fragment="true" unpack="false"/>
|
||||
<plugin id="org.talend.utils.test" download-size="0" install-size="0" version="0.0.0" fragment="true" unpack="false"/>
|
||||
<plugin id="org.talend.sdk.component.studio-integration.test" download-size="0" install-size="0" version="0.0.0" fragment="true" unpack="false"/>
|
||||
<plugin id="test.all.test.suite" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
|
||||
</feature>
|
||||
|
||||
@@ -22,6 +22,7 @@ Require-Bundle: org.talend.core.repository,
|
||||
org.apache.log4j,
|
||||
org.talend.components.api,
|
||||
org.talend.daikon,
|
||||
org.talend.daikon.crypto.utils,
|
||||
org.talend.designer.core.generic
|
||||
Eclipse-LazyStart: true
|
||||
Bundle-ClassPath: .
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -445,6 +445,7 @@
|
||||
lastStr = "";
|
||||
}
|
||||
}
|
||||
enableLogStash = "true".equalsIgnoreCase(System.getProperty("monitoring"));
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
if(!"".equals(log4jLevel)){
|
||||
@@ -493,7 +494,11 @@
|
||||
properties_<%=jobCatcherNode.getUniqueName()%>.setProperty("appender.file.maxsize", "52428800");
|
||||
properties_<%=jobCatcherNode.getUniqueName()%>.setProperty("appender.file.maxbackup", "20");
|
||||
properties_<%=jobCatcherNode.getUniqueName()%>.setProperty("host", "false");
|
||||
|
||||
|
||||
System.getProperties().stringPropertyNames().stream()
|
||||
.filter(it -> it.startsWith("monitoring.audit.logger.properties."))
|
||||
.forEach(key -> properties_<%=jobCatcherNode.getUniqueName()%>.setProperty(key.substring("monitoring.audit.logger.properties.".length()), System.getProperty(key)));
|
||||
|
||||
auditLogger_<%=jobCatcherNode.getUniqueName()%> = org.talend.job.audit.JobEventAuditLoggerFactory.createJobAuditLogger(properties_<%=jobCatcherNode.getUniqueName()%>);
|
||||
}
|
||||
<%
|
||||
@@ -1509,12 +1514,10 @@ if (execStat) {
|
||||
}
|
||||
} else if (arg.startsWith("--log4jLevel=")) {
|
||||
log4jLevel = arg.substring(13);
|
||||
} else if (arg.startsWith("--monitoring=")) {//for trunjob call
|
||||
enableLogStash = "true".equalsIgnoreCase(arg.substring(13));
|
||||
}
|
||||
|
||||
if(!enableLogStash) {
|
||||
enableLogStash = "true".equalsIgnoreCase(System.getProperty("monitoring"));
|
||||
} else if (arg.startsWith("--monitoring") && arg.contains("=")) {//for trunjob call
|
||||
final int equal = arg.indexOf('=');
|
||||
final String key = arg.substring("--".length(), equal);
|
||||
System.setProperty(key, arg.substring(equal + 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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__"));
|
||||
|
||||
|
||||
@@ -91,14 +91,6 @@ public class TalendJetEmitter extends JETEmitter {
|
||||
|
||||
private boolean classAvailable = true;
|
||||
|
||||
private boolean isInitialized;
|
||||
|
||||
private String packageName;
|
||||
|
||||
private String className;
|
||||
|
||||
private String methodName;
|
||||
|
||||
/**
|
||||
* DOC mhirt TalendJetEmitter constructor comment.
|
||||
*
|
||||
@@ -307,8 +299,7 @@ public class TalendJetEmitter extends JETEmitter {
|
||||
}
|
||||
}
|
||||
boolean needRebuild = true;
|
||||
String className = jetCompiler.getSkeleton().getClassName();
|
||||
String targetFileName = className + ".java"; //$NON-NLS-1$
|
||||
String targetFileName = jetCompiler.getSkeleton().getClassName() + ".java"; //$NON-NLS-1$
|
||||
IFile targetFile = sourceContainer.getFile(new Path(targetFileName));
|
||||
if (!targetFile.exists()) {
|
||||
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETCreating_message", //$NON-NLS-1$
|
||||
@@ -367,13 +358,26 @@ public class TalendJetEmitter extends JETEmitter {
|
||||
} else if (this.helperJetBean != null) {
|
||||
this.helperJetBean.setGenerationError(null);
|
||||
}
|
||||
|
||||
if (!errors) {
|
||||
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETLoadingClass_message", //$NON-NLS-1$
|
||||
new Object[] { jetCompiler.getSkeleton().getClassName() + ".class" })); //$NON-NLS-1$
|
||||
|
||||
// Construct a proper URL for relative lookup.
|
||||
//
|
||||
URL url = new File(project.getLocation() + "/" + "runtime" + "/") //$NON-NLS-1$ //$NON-NLS-2$
|
||||
.toURL();
|
||||
URLClassLoader theClassLoader = new URLClassLoader(new URL[] { url }, jetEmitter.classLoader);
|
||||
Class theClass = theClassLoader.loadClass((packageName.length() == 0 ? "" : packageName + ".") //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ jetCompiler.getSkeleton().getClassName());
|
||||
String methodName = jetCompiler.getSkeleton().getMethodName();
|
||||
loadMethod(subProgressMonitor, jetEmitter, packageName, className, methodName);
|
||||
jetEmitter.isInitialized = true;
|
||||
jetEmitter.packageName = packageName;
|
||||
jetEmitter.className = className;
|
||||
jetEmitter.methodName = methodName;
|
||||
Method[] methods = theClass.getDeclaredMethods();
|
||||
for (Method method2 : methods) {
|
||||
if (method2.getName().equals(methodName)) {
|
||||
jetEmitter.setMethod(method2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
subProgressMonitor.done();
|
||||
@@ -409,23 +413,6 @@ public class TalendJetEmitter extends JETEmitter {
|
||||
public void setHelperJetBean(JetBean helperJetBean) {
|
||||
this.helperJetBean = helperJetBean;
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
public void loadMethod(IProgressMonitor monitor, TalendJetEmitter jetEmitter, String packageName, String className,
|
||||
String methodName) throws ClassNotFoundException, IOException {
|
||||
monitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETLoadingClass_message", //$NON-NLS-1$
|
||||
new Object[] { className + ".class" })); //$NON-NLS-1$
|
||||
// Construct a proper URL for relative lookup.
|
||||
URL url = new File(project.getLocation() + "/runtime/").toURI().toURL(); //$NON-NLS-1$
|
||||
URLClassLoader theClassLoader = new URLClassLoader(new URL[] { url }, jetEmitter.classLoader);
|
||||
Class<?> theClass = theClassLoader.loadClass((packageName.length() == 0 ? "" : packageName + ".") + className); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
for (Method method : theClass.getDeclaredMethods()) {
|
||||
if (method.getName().equals(methodName)) {
|
||||
jetEmitter.setMethod(method);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void compileSingleClass(IProject project, IFile javaFile, OutputStream errorMsgStream) {
|
||||
@@ -592,32 +579,28 @@ public class TalendJetEmitter extends JETEmitter {
|
||||
*/
|
||||
@Override
|
||||
public Method getMethod() {
|
||||
IProgressMonitor monitor = new NullProgressMonitor();
|
||||
Method localMethod = super.getMethod();
|
||||
if (localMethod == null) {
|
||||
try {
|
||||
if (isInitialized) {
|
||||
talendEclipseHelper.loadMethod(monitor, this, packageName, className, methodName);
|
||||
localMethod = super.getMethod();
|
||||
}
|
||||
localMethod = loadMethod();
|
||||
} catch (Exception e) {
|
||||
// nothing since if got exception here, the method will be reloaded bellow. (normal case)
|
||||
// real error should be logged if the initialize fail.
|
||||
}
|
||||
}
|
||||
// add this part in case there is any problem in the project (should never be called in normal use)
|
||||
// but if there is any problem, it will force to regenerate again this component.
|
||||
// This might be also called for custom components.
|
||||
if (localMethod == null) {
|
||||
try {
|
||||
talendEclipseHelper.initialize(BasicMonitor.toMonitor(monitor), this, componentFamily,
|
||||
templateName, templateLanguage, codePart);
|
||||
localMethod = super.getMethod();
|
||||
} catch (JETException e) {
|
||||
ExceptionHandler.process(e);
|
||||
// add this part in case there is any problem in the project (should never be called in normal use)
|
||||
// but if there is any problem, it will force to regenerate again this component.
|
||||
// This might be also called for custom components.
|
||||
if (localMethod == null) {
|
||||
try {
|
||||
talendEclipseHelper.initialize(BasicMonitor.toMonitor(new NullProgressMonitor()), this, componentFamily,
|
||||
templateName, templateLanguage, codePart);
|
||||
localMethod = super.getMethod();
|
||||
} catch (JETException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
} else {
|
||||
setMethod(localMethod);
|
||||
}
|
||||
} else {
|
||||
setMethod(localMethod);
|
||||
}
|
||||
return localMethod;
|
||||
}
|
||||
@@ -629,7 +612,6 @@ public class TalendJetEmitter extends JETEmitter {
|
||||
* @return
|
||||
* @throws MalformedURLException
|
||||
* @throws ClassNotFoundException
|
||||
* @deprecated
|
||||
*/
|
||||
private Method loadMethod() throws ClassNotFoundException, MalformedURLException {
|
||||
if (jetbean == null) {
|
||||
@@ -699,12 +681,6 @@ public class TalendJetEmitter extends JETEmitter {
|
||||
}
|
||||
|
||||
getMethod(); // force to load the method before generate in case it was not set before.
|
||||
try {
|
||||
return super.generate(progressMonitor, list.toArray(), lineDelimiter);
|
||||
} finally {
|
||||
method = null;
|
||||
object = null;
|
||||
}
|
||||
return super.generate(progressMonitor, list.toArray(), lineDelimiter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,69 +1,69 @@
|
||||
<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>checkArchive-1.1-20181130</artifactId>
|
||||
<version>6.0.0</version>
|
||||
<name>checkArchive</name>
|
||||
<description>Dependence for tFileArchive and tFileUnAchive</description>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<talend.nexus.url>https://artifacts-oss.talend.com</talend.nexus.url>
|
||||
<java.source.version>1.7</java.source.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>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-compress -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.10</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>${java.source.version}</source>
|
||||
<target>${java.source.version}</target>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
<showWarnings>true</showWarnings>
|
||||
<compilerArgument>-XDignore.symbol.file</compilerArgument>
|
||||
<fork>true</fork>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
<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>checkArchive-1.1-20190917</artifactId>
|
||||
<version>6.0.0</version>
|
||||
<name>checkArchive</name>
|
||||
<description>Dependence for tFileArchive and tFileUnAchive</description>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<talend.nexus.url>https://artifacts-oss.talend.com</talend.nexus.url>
|
||||
<java.source.version>1.7</java.source.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>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-compress -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.19</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>${java.source.version}</source>
|
||||
<target>${java.source.version}</target>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
<showWarnings>true</showWarnings>
|
||||
<compilerArgument>-XDignore.symbol.file</compilerArgument>
|
||||
<fork>true</fork>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</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();
|
||||
|
||||
@@ -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.3-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" );
|
||||
}
|
||||
|
||||
@@ -163,6 +163,11 @@ public class XMLSerializer {
|
||||
*/
|
||||
private boolean useLongDecimals;
|
||||
|
||||
/**
|
||||
* flag for if parse empty elements as empty strings
|
||||
*/
|
||||
private boolean useEmptyStrings;
|
||||
|
||||
/**
|
||||
* Creates a new XMLSerializer with default options.<br>
|
||||
* <ul>
|
||||
@@ -803,6 +808,8 @@ public class XMLSerializer {
|
||||
clazz = JSONTypes.OBJECT;
|
||||
}else if( JSONTypes.ARRAY.compareToIgnoreCase( clazzText ) == 0 ){
|
||||
clazz = JSONTypes.ARRAY;
|
||||
} else if(JSONTypes.STRING.equalsIgnoreCase(clazzText)) {
|
||||
clazz = JSONTypes.STRING;
|
||||
}
|
||||
}
|
||||
return clazz;
|
||||
@@ -1414,6 +1421,8 @@ public class XMLSerializer {
|
||||
String text = element.getValue();
|
||||
params = StringUtils.split( paramsAttribute.getValue(), "," );
|
||||
setOrAccumulate( jsonObject, key, new JSONFunction( params, text ) );
|
||||
} else if( useEmptyStrings && clazz != null && clazz.equalsIgnoreCase(JSONTypes.STRING) ) {
|
||||
setTextValue(jsonObject, key, element);
|
||||
}else{
|
||||
if( isArray( element, false ) ){
|
||||
setOrAccumulate( jsonObject, key, processArrayElement( element, defaultType ) );
|
||||
@@ -1421,19 +1430,23 @@ public class XMLSerializer {
|
||||
setOrAccumulate( jsonObject, key, simplifyValue( jsonObject,
|
||||
processObjectElement( element, defaultType ) ) );
|
||||
}else{
|
||||
String value;
|
||||
if( isKeepCData && isCData( element ) ){
|
||||
value = "<![CDATA[" + element.getValue() + "]]>";
|
||||
}else{
|
||||
value = element.getValue();
|
||||
}
|
||||
setOrAccumulate( jsonObject, key, trimSpaceFromValue( value ) );
|
||||
setTextValue(jsonObject, key, element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setTextValue(final JSONObject jsonObject, final String key, final Element element) {
|
||||
String value;
|
||||
if( isKeepCData && isCData( element ) ){
|
||||
value = "<![CDATA[" + element.getValue() + "]]>";
|
||||
}else{
|
||||
value = element.getValue();
|
||||
}
|
||||
setOrAccumulate( jsonObject, key, trimSpaceFromValue( value ) );
|
||||
}
|
||||
|
||||
private boolean isCData( Element element ) {
|
||||
if( element.getChildCount() == 1 ){
|
||||
final Node child = element.getChild( 0 );
|
||||
@@ -1493,6 +1506,14 @@ public class XMLSerializer {
|
||||
return str;
|
||||
}
|
||||
|
||||
public void setUseEmptyStrings(boolean useEmptyStrings) {
|
||||
this.useEmptyStrings = useEmptyStrings;
|
||||
}
|
||||
|
||||
public boolean isUseEmptyStrings() {
|
||||
return this.useEmptyStrings;
|
||||
}
|
||||
|
||||
private static class CustomElement extends Element {
|
||||
private static String getName( String name ) {
|
||||
int colon = name.indexOf( ':' );
|
||||
|
||||
@@ -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" ) ) );
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<artifactId>simpleexcel-2.1-20190507</artifactId>
|
||||
<artifactId>simpleexcel-2.2-20190722</artifactId>
|
||||
<version>6.0.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
@@ -12,17 +12,21 @@
|
||||
// ============================================================================
|
||||
package com.talend.excel.xssf.event;
|
||||
|
||||
import org.apache.poi.ooxml.util.PackageHelper;
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
import org.apache.poi.poifs.crypt.Decryptor;
|
||||
import org.apache.poi.poifs.crypt.EncryptionInfo;
|
||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||
import org.apache.poi.ss.usermodel.DataFormatter;
|
||||
import org.apache.poi.xssf.eventusermodel.ReadOnlySharedStringsTable;
|
||||
import org.apache.poi.xssf.eventusermodel.XSSFReader;
|
||||
import org.apache.poi.xssf.model.StylesTable;
|
||||
import org.apache.poi.ooxml.util.PackageHelper;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.helpers.XMLReaderFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -32,7 +36,6 @@ import java.util.concurrent.FutureTask;
|
||||
|
||||
/**
|
||||
* created by wwang on 2012-9-27 Detailled comment
|
||||
*
|
||||
*/
|
||||
public class ExcelReader implements Callable {
|
||||
|
||||
@@ -46,6 +49,8 @@ public class ExcelReader implements Callable {
|
||||
|
||||
private String charset = "UTF-8";
|
||||
|
||||
private String password = null;
|
||||
|
||||
private java.io.InputStream is;
|
||||
|
||||
private List<String> sheetNames = new ArrayList<String>();
|
||||
@@ -64,15 +69,17 @@ public class ExcelReader implements Callable {
|
||||
task = new Thread(futureTask);
|
||||
}
|
||||
|
||||
public void parse(String fileURL, String charset) {
|
||||
public void parse(String fileURL, String charset, String password) {
|
||||
this.fileURL = fileURL;
|
||||
this.charset = charset;
|
||||
this.password = password;
|
||||
task.start();
|
||||
}
|
||||
|
||||
public void parse(java.io.InputStream is, String charset) {
|
||||
public void parse(java.io.InputStream is, String charset, String password) {
|
||||
this.is = is;
|
||||
this.charset = charset;
|
||||
this.password = password;
|
||||
task.start();
|
||||
}
|
||||
|
||||
@@ -120,11 +127,25 @@ public class ExcelReader implements Callable {
|
||||
|
||||
public Object call() throws Exception {
|
||||
OPCPackage pkg = null;
|
||||
POIFSFileSystem fs = null;
|
||||
try {
|
||||
if (fileURL != null) {
|
||||
pkg = OPCPackage.open(fileURL);
|
||||
if (password != null) {
|
||||
if (fileURL != null) {
|
||||
fs = new POIFSFileSystem(new File(fileURL));
|
||||
} else {
|
||||
fs = new POIFSFileSystem(is);
|
||||
}
|
||||
Decryptor d = Decryptor.getInstance(new EncryptionInfo(fs));
|
||||
if (!d.verifyPassword(password)) {
|
||||
throw new RuntimeException("Error: Cannot decrypt Excel file. Invalid password.");
|
||||
}
|
||||
pkg = OPCPackage.open(d.getDataStream(fs));
|
||||
} else {
|
||||
pkg = PackageHelper.open(is);
|
||||
if (fileURL != null) {
|
||||
pkg = OPCPackage.open(fileURL);
|
||||
} else {
|
||||
pkg = PackageHelper.open(is);
|
||||
}
|
||||
}
|
||||
XSSFReader r = new XSSFReader(pkg);
|
||||
|
||||
@@ -204,6 +225,9 @@ public class ExcelReader implements Callable {
|
||||
if (pkg != null) {
|
||||
pkg.revert();
|
||||
}
|
||||
if (fs != null) {
|
||||
fs.close();
|
||||
}
|
||||
cache.notifyErrorOccurred();
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<groupId>org.talend.components.lib</groupId>
|
||||
<artifactId>talend-db-exasol</artifactId>
|
||||
<version>2.1.3</version>
|
||||
<version>2.1.4</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>talend-db-exasol</name>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<artifactId>talendExcel-1.4-20190531</artifactId>
|
||||
<artifactId>talendExcel-1.5-20190731</artifactId>
|
||||
<version>6.0.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.talend;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Date;
|
||||
@@ -10,17 +11,23 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.poifs.crypt.EncryptionInfo;
|
||||
import org.apache.poi.poifs.crypt.EncryptionMode;
|
||||
import org.apache.poi.poifs.crypt.Encryptor;
|
||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
import org.apache.poi.ss.usermodel.CellType;
|
||||
import org.apache.poi.ss.usermodel.Font;
|
||||
import org.apache.poi.ss.usermodel.FormulaEvaluator;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.FormulaEvaluator;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbookType;
|
||||
|
||||
public class ExcelTool {
|
||||
|
||||
@@ -70,6 +77,8 @@ public class ExcelTool {
|
||||
|
||||
private boolean isTrackAllColumns = false;
|
||||
|
||||
private String password = null;
|
||||
|
||||
public ExcelTool() {
|
||||
cellStylesMapping = new HashMap<>();
|
||||
}
|
||||
@@ -110,21 +119,7 @@ public class ExcelTool {
|
||||
initPreXlsx(fileName);
|
||||
}
|
||||
if (appendWorkbook) {
|
||||
InputStream inp = new FileInputStream(fileName);
|
||||
wb = WorkbookFactory.create(inp);
|
||||
sheet = wb.getSheet(sheetName);
|
||||
if (sheet != null) {
|
||||
if (appendSheet) {
|
||||
if (sheet.getLastRowNum() != 0 || sheet.getRow(0) != null) {
|
||||
curY = sheet.getLastRowNum() + 1;
|
||||
}
|
||||
} else {
|
||||
wb.removeSheetAt(wb.getSheetIndex(sheetName));
|
||||
sheet = wb.createSheet(sheetName);
|
||||
}
|
||||
} else {
|
||||
sheet = wb.createSheet(sheetName);
|
||||
}
|
||||
appendActionForFile(fileName);
|
||||
} else {
|
||||
xlsxFile.delete();
|
||||
wb = new SXSSFWorkbook(rowAccessWindowSize);
|
||||
@@ -140,6 +135,47 @@ public class ExcelTool {
|
||||
}
|
||||
}
|
||||
|
||||
public void prepareXlsmFile(String fileName) throws Exception {
|
||||
File xlsmFile = new File(fileName);
|
||||
if (xlsmFile.exists()) {
|
||||
if (isAbsY && keepCellFormat) {
|
||||
initPreXlsx(fileName);
|
||||
}
|
||||
if (appendWorkbook) {
|
||||
appendActionForFile(fileName);
|
||||
} else {
|
||||
xlsmFile.delete();
|
||||
wb = new SXSSFWorkbook(new XSSFWorkbook(XSSFWorkbookType.XLSM), rowAccessWindowSize);
|
||||
sheet = wb.createSheet(sheetName);
|
||||
}
|
||||
} else {
|
||||
wb = new SXSSFWorkbook(new XSSFWorkbook(XSSFWorkbookType.XLSM), rowAccessWindowSize);
|
||||
sheet = wb.createSheet(sheetName);
|
||||
}
|
||||
if (isAbsY) {
|
||||
startX = absX;
|
||||
curY = absY;
|
||||
}
|
||||
}
|
||||
|
||||
private void appendActionForFile(String fileName) throws IOException {
|
||||
InputStream inp = new FileInputStream(fileName);
|
||||
wb = WorkbookFactory.create(inp);
|
||||
sheet = wb.getSheet(sheetName);
|
||||
if (sheet != null) {
|
||||
if (appendSheet) {
|
||||
if (sheet.getLastRowNum() != 0 || sheet.getRow(0) != null) {
|
||||
curY = sheet.getLastRowNum() + 1;
|
||||
}
|
||||
} else {
|
||||
wb.removeSheetAt(wb.getSheetIndex(sheetName));
|
||||
sheet = wb.createSheet(sheetName);
|
||||
}
|
||||
} else {
|
||||
sheet = wb.createSheet(sheetName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return start insert row index.
|
||||
@@ -302,13 +338,14 @@ public class ExcelTool {
|
||||
}
|
||||
|
||||
public void writeExcel(OutputStream outputStream) throws Exception {
|
||||
try {
|
||||
wb.write(outputStream);
|
||||
} finally {
|
||||
if(outputStream != null) {
|
||||
outputStream.close();
|
||||
}
|
||||
}
|
||||
try {
|
||||
wb.write(outputStream);
|
||||
wb.close();
|
||||
} finally {
|
||||
if (outputStream != null) {
|
||||
outputStream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void writeExcel(String fileName, boolean createDir) throws Exception {
|
||||
@@ -319,14 +356,29 @@ public class ExcelTool {
|
||||
pFile.mkdirs();
|
||||
}
|
||||
}
|
||||
FileOutputStream fileOutput = new FileOutputStream(fileName);
|
||||
if (appendWorkbook && appendSheet && recalculateFormula) {
|
||||
evaluateFormulaCell();
|
||||
}
|
||||
FileOutputStream fileOutput = new FileOutputStream(fileName);
|
||||
POIFSFileSystem fs = null;
|
||||
try {
|
||||
wb.write(fileOutput);
|
||||
if (password == null) {
|
||||
wb.write(fileOutput);
|
||||
} else {
|
||||
fs = new POIFSFileSystem();
|
||||
Encryptor encryptor = new EncryptionInfo(EncryptionMode.agile).getEncryptor();
|
||||
encryptor.confirmPassword(password);
|
||||
OutputStream encryptedDataStream = encryptor.getDataStream(fs);
|
||||
wb.write(encryptedDataStream);
|
||||
encryptedDataStream.close(); // this is mandatory to do that at that point
|
||||
fs.writeFilesystem(fileOutput);
|
||||
}
|
||||
} finally {
|
||||
fileOutput.close();
|
||||
wb.close();
|
||||
fileOutput.close();
|
||||
if (fs != null) {
|
||||
fs.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,4 +401,9 @@ public class ExcelTool {
|
||||
((SXSSFSheet) sheet).flushRows();
|
||||
}
|
||||
}
|
||||
|
||||
public void setPasswordProtection(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<artifactId>talendzip</artifactId>
|
||||
<version>1.0-20190527</version>
|
||||
<version>1.0-20190917</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
@@ -40,19 +40,19 @@
|
||||
<dependency>
|
||||
<groupId>net.lingala.zip4j</groupId>
|
||||
<artifactId>zip4j</artifactId>
|
||||
<version>1.3.1</version>
|
||||
<version>1.3.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.10</version>
|
||||
<version>1.19</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<artifactId>checkArchive-1.1-20181130</artifactId>
|
||||
<artifactId>checkArchive-1.1-20190917</artifactId>
|
||||
<version>6.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
</project>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.talend.compress.zip;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class Util {
|
||||
public java.util.List<UnzippedFile> unzippedFiles = new java.util.ArrayList<UnzippedFile>();
|
||||
|
||||
@@ -53,6 +55,10 @@ public class Util {
|
||||
f = new java.io.File(path, shortName);
|
||||
}
|
||||
|
||||
if(!f.getCanonicalPath().startsWith(new java.io.File(path).getCanonicalPath())) {
|
||||
throw new IOException("expanding " + f.getName()
|
||||
+ " would create file outside of " + path);
|
||||
}
|
||||
checkDir(f);
|
||||
|
||||
f.getParentFile().mkdirs();
|
||||
@@ -89,6 +95,10 @@ public class Util {
|
||||
f = new java.io.File(path, shortName);
|
||||
}
|
||||
|
||||
if(!f.getCanonicalPath().startsWith(new java.io.File(path).getCanonicalPath())) {
|
||||
throw new IOException("expanding " + f.getName()
|
||||
+ " would create file outside of " + path);
|
||||
}
|
||||
if (isDirectory) {
|
||||
if (!f.exists()) {
|
||||
f.mkdirs();
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<groupId>org.talend.components.lib</groupId>
|
||||
<artifactId>thashfile</artifactId>
|
||||
<version>3.0-20170711</version>
|
||||
<version>3.1-20190910</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>thashfile</name>
|
||||
@@ -45,8 +45,8 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
||||
@@ -9,45 +9,44 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import org.talend.designer.components.hashfile.memory.AdvancedMemoryHashFile;
|
||||
|
||||
public class MapHashFile {
|
||||
//use this map instead of globalMap
|
||||
// use this map instead of globalMap
|
||||
private Map<String, AdvancedMemoryHashFile> resourceMap = new ConcurrentHashMap<>();
|
||||
//keep the present key of AdvancedMemoryHashFile as key and the previous key as value
|
||||
// keep the present key of AdvancedMemoryHashFile as key and the previous key as
|
||||
// value
|
||||
private Map<String, String> keyMap = new ConcurrentHashMap<>();
|
||||
//singleton
|
||||
// singleton
|
||||
private static final MapHashFile mhf = new MapHashFile();
|
||||
|
||||
public static TalendMultiThreadLockMap resourceLockMap = new TalendMultiThreadLockMap();
|
||||
public static TalendMultiThreadLockMap resourceLockMap = new TalendMultiThreadLockMap();
|
||||
|
||||
public static class TalendMultiThreadLockMap {
|
||||
public static class TalendMultiThreadLockMap {
|
||||
|
||||
private Map<Object, Object> tMultiTheadLockMap = new HashMap<Object, Object>();
|
||||
private Map<Object, Object> tMultiTheadLockMap = new ConcurrentHashMap<>();
|
||||
|
||||
public Object get(Object key) {
|
||||
return tMultiTheadLockMap.computeIfAbsent(key, k -> new Object());
|
||||
}
|
||||
|
||||
public void remove(Object key) {
|
||||
tMultiTheadLockMap.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized Object get(Object key) {
|
||||
if (tMultiTheadLockMap.get(key) == null) {
|
||||
tMultiTheadLockMap.put(key, new Object());
|
||||
}
|
||||
return tMultiTheadLockMap.get(key);
|
||||
}
|
||||
|
||||
public synchronized void remove(Object key){
|
||||
tMultiTheadLockMap.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
private MapHashFile() {
|
||||
}
|
||||
|
||||
public static MapHashFile getMapHashFile() {
|
||||
return mhf;
|
||||
}
|
||||
|
||||
//get the linked AdvancedMemoryHashFile
|
||||
|
||||
// get the linked AdvancedMemoryHashFile
|
||||
public AdvancedMemoryHashFile getAdvancedMemoryHashFile(String key) {
|
||||
AdvancedMemoryHashFile amhf = resourceMap.get(key);
|
||||
String prekey = keyMap.get(key);
|
||||
//if present AdvancedMemoryHashFile is null get the AdvancedMemoryHashFile before present.
|
||||
// if present AdvancedMemoryHashFile is null get the AdvancedMemoryHashFile
|
||||
// before present.
|
||||
int size = keyMap.size();
|
||||
while(amhf==null && (size--)>0){
|
||||
while (amhf == null && (size--) > 0) {
|
||||
amhf = resourceMap.get(prekey);
|
||||
prekey = keyMap.get(prekey);
|
||||
}
|
||||
@@ -61,16 +60,18 @@ public class MapHashFile {
|
||||
public Map<String, String> getKeyMap() {
|
||||
return keyMap;
|
||||
}
|
||||
public void clearCache(String key){
|
||||
|
||||
public void clearCache(String key) {
|
||||
clearChildCache(getRootCache(key));
|
||||
}
|
||||
public void clearChildCache(String root){
|
||||
|
||||
public void clearChildCache(String root) {
|
||||
Set<String> set = keyMap.keySet();
|
||||
synchronized(keyMap) {
|
||||
synchronized (keyMap) {
|
||||
Iterator<String> it = set.iterator();
|
||||
while(it.hasNext()){
|
||||
while (it.hasNext()) {
|
||||
String key = it.next();
|
||||
if(root.equals(keyMap.get(key))){
|
||||
if (root.equals(keyMap.get(key))) {
|
||||
this.resourceMap.remove(key);
|
||||
this.keyMap.remove(key);
|
||||
clearChildCache(key);
|
||||
@@ -79,11 +80,11 @@ public class MapHashFile {
|
||||
}
|
||||
this.resourceMap.remove(root);
|
||||
}
|
||||
|
||||
public String getRootCache(String cache){
|
||||
|
||||
public String getRootCache(String cache) {
|
||||
String root;
|
||||
while((root = keyMap.get(cache))!=null){
|
||||
cache=root;
|
||||
while ((root = keyMap.get(cache)) != null) {
|
||||
cache = root;
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
String gsFileHeader = ElementParameterParser.getValue(node, "__GS_FILE_HEADER__");
|
||||
String tokenFile = ElementParameterParser.getValue(node,"__TOKEN_NAME__");
|
||||
boolean isLog4jEnabled = ElementParameterParser.getBooleanValue(node.getProcess(), "__LOG4J_ACTIVATE__");
|
||||
boolean dropTable = ElementParameterParser.getBooleanValue(node, "__DROP__");
|
||||
|
||||
String passwordFieldName = "";
|
||||
|
||||
@@ -260,77 +261,117 @@
|
||||
com.google.api.services.bigquery.model.JobConfiguration config_<%=cid%> = new com.google.api.services.bigquery.model.JobConfiguration();
|
||||
com.google.api.services.bigquery.model.JobConfigurationLoad queryLoad_<%=cid%> = new com.google.api.services.bigquery.model.JobConfigurationLoad();
|
||||
|
||||
<%if (createTableIfNotExist) { %>
|
||||
com.google.api.services.bigquery.model.TableSchema schema_<%=cid%> = new com.google.api.services.bigquery.model.TableSchema();
|
||||
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Table field schema:");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
java.util.List<com.google.api.services.bigquery.model.TableFieldSchema> fields_<%=cid%> = new java.util.ArrayList<com.google.api.services.bigquery.model.TableFieldSchema>();
|
||||
<%
|
||||
List<IMetadataTable> metadatas = node.getMetadataList();
|
||||
if ((metadatas!=null) && (metadatas.size() > 0)) {
|
||||
IMetadataTable metadata = metadatas.get(0);
|
||||
if (metadata != null) {
|
||||
List<IMetadataColumn> columns = metadata.getListColumns();
|
||||
int nbColumns = columns.size();
|
||||
for (int i = 0; i < nbColumns; i++ ) {
|
||||
IMetadataColumn column = columns.get(i);
|
||||
String columnName = column.getLabel();
|
||||
String typeToGenerate = "string";
|
||||
if("id_Float".equals(column.getTalendType()) || "id_Double".equals(column.getTalendType())) {
|
||||
typeToGenerate = "float";
|
||||
}else if("id_Integer".equals(column.getTalendType()) || "id_Long".equals(column.getTalendType()) || "id_Short".equals(column.getTalendType())) {
|
||||
typeToGenerate = "integer";
|
||||
} else if("id_Character".equals(column.getTalendType())) {
|
||||
typeToGenerate = "string";
|
||||
} else if("id_BigDecimal".equals(column.getTalendType())) {
|
||||
typeToGenerate = "numeric";
|
||||
} else if("id_Boolean".equals(column.getTalendType())) {
|
||||
typeToGenerate = "boolean";
|
||||
} else if("id_Date".equals(column.getTalendType())) {
|
||||
String pattern = column.getPattern();
|
||||
if(pattern.length() == 12 || pattern.isEmpty() || "\"\"".equals(pattern)) {
|
||||
typeToGenerate = "date";
|
||||
}else if(pattern.length() > 12){
|
||||
typeToGenerate = "timestamp";
|
||||
}else{
|
||||
typeToGenerate = "string";
|
||||
}
|
||||
}
|
||||
String modeType = (!column.isNullable()) ? "REQUIRED" : "NULLABLE";
|
||||
%>
|
||||
com.google.api.services.bigquery.model.TableFieldSchema <%=columnName%>_<%=cid%> = new com.google.api.services.bigquery.model.TableFieldSchema();
|
||||
<%=columnName%>_<%=cid%>.setName("<%=columnName%>");
|
||||
<%=columnName%>_<%=cid%>.setType("<%=typeToGenerate%>");
|
||||
<%=columnName%>_<%=cid%>.setMode("<%=modeType%>");
|
||||
fields_<%=cid%>.add(<%=columnName%>_<%=cid%>);
|
||||
<%
|
||||
<%if (dropTable) {%>
|
||||
try {
|
||||
bigqueryclient_<%=cid%>.tables().delete(PROJECT_ID_<%=cid%>, <%=dataset%>, <%=table%>).execute();
|
||||
} catch (com.google.api.client.googleapis.json.GoogleJsonResponseException e_<%=cid%>) {
|
||||
if (e_<%=cid%>.getDetails().getCode() != 404) {
|
||||
<%
|
||||
if(dieOnError) {
|
||||
%>
|
||||
throw e_<%=cid%>;
|
||||
<%
|
||||
} else {
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.debug("<%=cid%> - Field index[<%=i%>] {\"name\":\"<%=columnName%>\",\"type\":\"<%=typeToGenerate%>\",\"mode\":\"<%=modeType%>\"}");
|
||||
log.error("<%=cid%> - "+ e_<%=cid%>.getDetails().getMessage());
|
||||
<%
|
||||
}
|
||||
%>
|
||||
System.err.println(e_<%=cid%>.getDetails().getMessage());
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
}
|
||||
%>
|
||||
<%}%>
|
||||
|
||||
<%if (createTableIfNotExist) { %>
|
||||
|
||||
|
||||
schema_<%=cid%>.setFields(fields_<%=cid%>);
|
||||
|
||||
queryLoad_<%=cid%>.setSchema(schema_<%=cid%>);
|
||||
|
||||
|
||||
<%
|
||||
}
|
||||
if(createTableIfNotExist) {
|
||||
%>
|
||||
queryLoad_<%=cid%>.setCreateDisposition("CREATE_IF_NEEDED");
|
||||
try {
|
||||
com.google.api.services.bigquery.model.Table getTable = bigqueryclient_<%=cid%>.tables().get(PROJECT_ID_<%=cid%>, <%=dataset%>, <%=table%>).execute();
|
||||
queryLoad_<%=cid%>.setCreateDisposition("CREATE_NEVER");
|
||||
} catch (com.google.api.client.googleapis.json.GoogleJsonResponseException e_<%=cid%>){
|
||||
if (e_<%=cid%>.getDetails().getCode() == 404) {
|
||||
com.google.api.services.bigquery.model.TableSchema schema_<%=cid%> = new com.google.api.services.bigquery.model.TableSchema();
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Table field schema:");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
java.util.List<com.google.api.services.bigquery.model.TableFieldSchema> fields_<%=cid%> = new java.util.ArrayList<com.google.api.services.bigquery.model.TableFieldSchema>();
|
||||
<%
|
||||
List<IMetadataTable> metadatas = node.getMetadataList();
|
||||
if ((metadatas!=null) && (metadatas.size() > 0)) {
|
||||
IMetadataTable metadata = metadatas.get(0);
|
||||
if (metadata != null) {
|
||||
List<IMetadataColumn> columns = metadata.getListColumns();
|
||||
int nbColumns = columns.size();
|
||||
for (int i = 0; i < nbColumns; i++ ) {
|
||||
IMetadataColumn column = columns.get(i);
|
||||
String columnName = column.getLabel();
|
||||
String typeToGenerate = "string";
|
||||
if("id_Float".equals(column.getTalendType()) || "id_Double".equals(column.getTalendType())) {
|
||||
typeToGenerate = "float";
|
||||
}else if("id_Integer".equals(column.getTalendType()) || "id_Long".equals(column.getTalendType()) || "id_Short".equals(column.getTalendType())) {
|
||||
typeToGenerate = "integer";
|
||||
} else if("id_Character".equals(column.getTalendType())) {
|
||||
typeToGenerate = "string";
|
||||
} else if("id_BigDecimal".equals(column.getTalendType())) {
|
||||
typeToGenerate = "numeric";
|
||||
} else if("id_Boolean".equals(column.getTalendType())) {
|
||||
typeToGenerate = "boolean";
|
||||
} else if("id_Date".equals(column.getTalendType())) {
|
||||
String pattern = column.getPattern();
|
||||
if(pattern.length() == 12 || pattern.isEmpty() || "\"\"".equals(pattern)) {
|
||||
typeToGenerate = "date";
|
||||
}else if(pattern.length() > 12){
|
||||
typeToGenerate = "timestamp";
|
||||
}else{
|
||||
typeToGenerate = "string";
|
||||
}
|
||||
}
|
||||
String modeType = (!column.isNullable()) ? "REQUIRED" : "NULLABLE";
|
||||
%>
|
||||
com.google.api.services.bigquery.model.TableFieldSchema <%=columnName%>_<%=cid%> = new com.google.api.services.bigquery.model.TableFieldSchema();
|
||||
<%=columnName%>_<%=cid%>.setName("<%=columnName%>");
|
||||
<%=columnName%>_<%=cid%>.setType("<%=typeToGenerate%>");
|
||||
<%=columnName%>_<%=cid%>.setMode("<%=modeType%>");
|
||||
fields_<%=cid%>.add(<%=columnName%>_<%=cid%>);
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.debug("<%=cid%> - Field index[<%=i%>] {\"name\":\"<%=columnName%>\",\"type\":\"<%=typeToGenerate%>\",\"mode\":\"<%=modeType%>\"}");
|
||||
<%
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
schema_<%=cid%>.setFields(fields_<%=cid%>);
|
||||
queryLoad_<%=cid%>.setSchema(schema_<%=cid%>);
|
||||
queryLoad_<%=cid%>.setCreateDisposition("CREATE_IF_NEEDED");
|
||||
} else {
|
||||
<%
|
||||
if(dieOnError) {
|
||||
%>
|
||||
throw e_<%=cid%>;
|
||||
<%
|
||||
} else {
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.error("<%=cid%> - "+ e_<%=cid%>.getDetails().getMessage());
|
||||
<%
|
||||
}
|
||||
%>
|
||||
System.err.println(e_<%=cid%>.getDetails().getMessage());
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
}
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
@@ -456,12 +497,11 @@
|
||||
%>
|
||||
/* ----START-CREATING-JOB (Cloud API)---- */
|
||||
com.google.cloud.bigquery.TableId tableId_<%=cid%> = com.google.cloud.bigquery.TableId.of(<%=projectId%>, <%=dataset%>, <%=table%>);
|
||||
com.google.cloud.bigquery.Table table_<%=cid%> = bigquery_<%=cid%>.getTable(tableId_<%=cid%>);
|
||||
com.google.cloud.bigquery.LoadJobConfiguration.Builder loadJobBuilder_<%=cid%> = com.google.cloud.bigquery.LoadJobConfiguration.newBuilder(tableId_<%=cid%>, <%=gsFile%>);
|
||||
|
||||
boolean dropTable_<%=cid%> = <%=ElementParameterParser.getBooleanValue(node, "__DROP__")%>;
|
||||
boolean dropTable_<%=cid%> = <%=dropTable%>;
|
||||
|
||||
if ( dropTable_<%=cid%> && table_<%=cid%> != null) {
|
||||
if (dropTable_<%=cid%> && bigquery_<%=cid%>.getTable(tableId_<%=cid%>) != null) {
|
||||
boolean deleted = bigquery_<%=cid%>.delete(tableId_<%=cid%>);
|
||||
if (deleted) {
|
||||
<%
|
||||
@@ -475,8 +515,9 @@
|
||||
throw new RuntimeException("Unable to delete table " + tableId_<%=cid%>);
|
||||
}
|
||||
}
|
||||
|
||||
<%if(createTableIfNotExist){%>
|
||||
if(table_<%=cid%> == null){
|
||||
if(bigquery_<%=cid%>.getTable(tableId_<%=cid%>) == null){
|
||||
java.util.List<com.google.cloud.bigquery.Field> fields_<%=cid%> = new java.util.ArrayList<>();
|
||||
<%
|
||||
List<IMetadataTable> metadatas = node.getMetadataList();
|
||||
@@ -529,22 +570,17 @@
|
||||
|
||||
com.google.cloud.bigquery.Schema schema_<%=cid%> = com.google.cloud.bigquery.Schema.of(fields_<%=cid%>);
|
||||
com.google.cloud.bigquery.TableInfo tableInfo_<%=cid%> = com.google.cloud.bigquery.TableInfo.newBuilder(tableId_<%=cid%>, com.google.cloud.bigquery.StandardTableDefinition.of(schema_<%=cid%>)).build();
|
||||
table_<%=cid%> = bigquery_<%=cid%>.create(tableInfo_<%=cid%>);
|
||||
com.google.cloud.bigquery.Table table_<%=cid%> = bigquery_<%=cid%>.create(tableInfo_<%=cid%>);
|
||||
loadJobBuilder_<%=cid%>.setSchema(schema_<%=cid%>);
|
||||
|
||||
}
|
||||
<%}
|
||||
if(createTableIfNotExist) {
|
||||
%>
|
||||
loadJobBuilder_<%=cid%>.setCreateDisposition(com.google.cloud.bigquery.JobInfo.CreateDisposition.CREATE_IF_NEEDED);
|
||||
<%
|
||||
|
||||
} else {
|
||||
%>
|
||||
loadJobBuilder_<%=cid%>.setCreateDisposition(com.google.cloud.bigquery.JobInfo.CreateDisposition.CREATE_NEVER);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
<%} else {%>
|
||||
loadJobBuilder_<%=cid%>.setCreateDisposition(com.google.cloud.bigquery.JobInfo.CreateDisposition.CREATE_NEVER);
|
||||
<%}%>
|
||||
|
||||
loadJobBuilder_<%=cid%>.setWriteDisposition(com.google.cloud.bigquery.JobInfo.WriteDisposition.WRITE_<%=actionOnData%>);
|
||||
loadJobBuilder_<%=cid%>.setDestinationTable(tableId_<%=cid%>);
|
||||
com.google.cloud.bigquery.CsvOptions.Builder csvOptions_<%=cid%> = com.google.cloud.bigquery.CsvOptions.newBuilder();
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
SHOW_IF="(SET_FIELD_DELIMITER == 'true')">
|
||||
<DEFAULT>","</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="DROP" FIELD="CHECK" REQUIRED="true" NUM_ROW="25" SHOW_IF="AUTH_MODE == 'SERVICEACCOUNT'">
|
||||
<PARAMETER NAME="DROP" FIELD="CHECK" REQUIRED="true" NUM_ROW="25">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="ENCODING" FIELD="ENCODING_TYPE" NUM_ROW="30"
|
||||
|
||||
@@ -6,45 +6,55 @@
|
||||
|
||||
class BigQueryUtil_<%=cid%> {
|
||||
String projectId;
|
||||
com.google.api.services.bigquery.Bigquery bigqueryclient = null;
|
||||
|
||||
<%=basePackage%>com.google.api.services.bigquery.Bigquery bigqueryclient = null;
|
||||
String tokenFile;
|
||||
boolean useLargeResult = false;
|
||||
String tempDataset;
|
||||
String tempTable;
|
||||
final boolean isAutoGeneratedTemporaryDataset;
|
||||
|
||||
public BigQueryUtil_<%=cid%>(String projectId, com.google.api.services.bigquery.Bigquery bigqueryclient, String tokenFile) {
|
||||
public BigQueryUtil_<%=cid%>(String projectId, <%=basePackage%>com.google.api.services.bigquery.Bigquery bigqueryclient, String tokenFile) {
|
||||
this (projectId, bigqueryclient, tokenFile, null);
|
||||
}
|
||||
|
||||
public BigQueryUtil_<%=cid%>(String projectId, <%=basePackage%>com.google.api.services.bigquery.Bigquery bigqueryclient, String tokenFile, String tempDataset) {
|
||||
this.projectId = projectId;
|
||||
this.bigqueryclient = bigqueryclient;
|
||||
this.tokenFile = tokenFile;
|
||||
this.tempDataset = tempDataset;
|
||||
this.isAutoGeneratedTemporaryDataset = tempDataset == null;
|
||||
}
|
||||
|
||||
|
||||
private String genTempName(String prefix){
|
||||
return "temp_" + prefix + java.util.UUID.randomUUID().toString().replaceAll("-", "") + "<%=cid%>".toLowerCase().replaceAll("[^a-z0-9]", "0").replaceAll("^[^a-z]", "a") + Integer.toHexString(java.util.concurrent.ThreadLocalRandom.current().nextInt());
|
||||
}
|
||||
|
||||
|
||||
public void cleanup() throws Exception{
|
||||
if(useLargeResult){
|
||||
bigqueryclient.tables().delete(projectId, tempDataset, tempTable).execute();
|
||||
bigqueryclient.datasets().delete(projectId, tempDataset).execute();
|
||||
if (isAutoGeneratedTemporaryDataset) {
|
||||
bigqueryclient.datasets().delete(projectId, tempDataset).execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getLocation(com.google.api.services.bigquery.model.JobConfigurationQuery queryConfig) throws Exception {
|
||||
private String getLocation(<%=basePackage%>com.google.api.services.bigquery.model.JobConfigurationQuery queryConfig) throws Exception {
|
||||
String location = null;
|
||||
com.google.api.services.bigquery.model.JobConfiguration config = new com.google.api.services.bigquery.model.JobConfiguration();
|
||||
<%=basePackage%>com.google.api.services.bigquery.model.JobConfiguration config = new <%=basePackage%>com.google.api.services.bigquery.model.JobConfiguration();
|
||||
config.setQuery(queryConfig);
|
||||
config.setDryRun(true);
|
||||
com.google.api.services.bigquery.model.Job job = new com.google.api.services.bigquery.model.Job();
|
||||
<%=basePackage%>com.google.api.services.bigquery.model.Job job = new <%=basePackage%>com.google.api.services.bigquery.model.Job();
|
||||
job.setConfiguration(config);
|
||||
List<com.google.api.services.bigquery.model.TableReference> referencedTables = bigqueryclient.jobs().insert(projectId, job).execute().getStatistics().getQuery().getReferencedTables();
|
||||
List<<%=basePackage%>com.google.api.services.bigquery.model.TableReference> referencedTables = bigqueryclient.jobs().insert(projectId, job).execute().getStatistics().getQuery().getReferencedTables();
|
||||
if(referencedTables != null && !referencedTables.isEmpty()) {
|
||||
location = bigqueryclient.tables().get(projectId, referencedTables.get(0).getDatasetId(), referencedTables.get(0).getTableId()).execute().getLocation();
|
||||
location = bigqueryclient.tables().get(referencedTables.get(0).getProjectId(), referencedTables.get(0).getDatasetId(), referencedTables.get(0).getTableId()).execute().getLocation();
|
||||
}
|
||||
return location;
|
||||
}
|
||||
|
||||
|
||||
private void createDataset(String location) throws Exception {
|
||||
com.google.api.services.bigquery.model.Dataset dataset = new com.google.api.services.bigquery.model.Dataset().setDatasetReference(new com.google.api.services.bigquery.model.DatasetReference().setProjectId(projectId).setDatasetId(tempDataset));
|
||||
<%=basePackage%>com.google.api.services.bigquery.model.Dataset dataset = new <%=basePackage%>com.google.api.services.bigquery.model.Dataset().setDatasetReference(new <%=basePackage%>com.google.api.services.bigquery.model.DatasetReference().setProjectId(projectId).setDatasetId(tempDataset));
|
||||
if(location != null) {
|
||||
dataset.setLocation(location);
|
||||
}
|
||||
@@ -54,39 +64,41 @@ class BigQueryUtil_<%=cid%> {
|
||||
bigqueryclient.datasets().insert(projectId, dataset).execute();
|
||||
}
|
||||
|
||||
public com.google.api.services.bigquery.model.Job executeQuery(String query, boolean useLargeResult) throws Exception{
|
||||
public <%=basePackage%>com.google.api.services.bigquery.model.Job executeQuery(String query, boolean useLargeResult) throws Exception{
|
||||
return executeQuery(query, useLargeResult, true);
|
||||
}
|
||||
|
||||
public com.google.api.services.bigquery.model.Job executeQuery(String query, boolean useLargeResult, boolean useLegacySql) throws Exception{
|
||||
com.google.api.services.bigquery.model.JobConfigurationQuery queryConfig = new com.google.api.services.bigquery.model.JobConfigurationQuery();
|
||||
public <%=basePackage%>com.google.api.services.bigquery.model.Job executeQuery(String query, boolean useLargeResult, boolean useLegacySql) throws Exception{
|
||||
<%=basePackage%>com.google.api.services.bigquery.model.JobConfigurationQuery queryConfig = new <%=basePackage%>com.google.api.services.bigquery.model.JobConfigurationQuery();
|
||||
queryConfig.setQuery(query);
|
||||
queryConfig.setUseLegacySql(useLegacySql);
|
||||
String location = getLocation(queryConfig);
|
||||
if(useLargeResult){
|
||||
this.useLargeResult = true;
|
||||
tempDataset = genTempName("dataset");
|
||||
tempTable = genTempName("table");
|
||||
createDataset(location);
|
||||
if (isAutoGeneratedTemporaryDataset) {
|
||||
tempDataset = genTempName("dataset");
|
||||
createDataset(location);
|
||||
}
|
||||
queryConfig.setAllowLargeResults(true);
|
||||
queryConfig.setDestinationTable(new com.google.api.services.bigquery.model.TableReference()
|
||||
queryConfig.setDestinationTable(new <%=basePackage%>com.google.api.services.bigquery.model.TableReference()
|
||||
.setProjectId(projectId)
|
||||
.setDatasetId(tempDataset)
|
||||
.setTableId(tempTable));
|
||||
}
|
||||
|
||||
com.google.api.services.bigquery.model.JobConfiguration config = new com.google.api.services.bigquery.model.JobConfiguration();
|
||||
<%=basePackage%>com.google.api.services.bigquery.model.JobConfiguration config = new <%=basePackage%>com.google.api.services.bigquery.model.JobConfiguration();
|
||||
config.setQuery(queryConfig);
|
||||
|
||||
com.google.api.services.bigquery.model.Job job = new com.google.api.services.bigquery.model.Job();
|
||||
<%=basePackage%>com.google.api.services.bigquery.model.Job job = new <%=basePackage%>com.google.api.services.bigquery.model.Job();
|
||||
job.setConfiguration(config);
|
||||
|
||||
com.google.api.services.bigquery.model.Job insert = null;
|
||||
com.google.api.services.bigquery.model.JobReference jobId = null;
|
||||
<%=basePackage%>com.google.api.services.bigquery.model.Job insert = null;
|
||||
<%=basePackage%>com.google.api.services.bigquery.model.JobReference jobId = null;
|
||||
try {
|
||||
insert = bigqueryclient.jobs().insert(projectId, job).execute();
|
||||
jobId = insert.getJobReference();
|
||||
} catch (com.google.api.client.googleapis.json.GoogleJsonResponseException e) {
|
||||
} catch (<%=basePackage%>com.google.api.client.googleapis.json.GoogleJsonResponseException e) {
|
||||
if(tokenFile != null){
|
||||
try {
|
||||
java.io.File f = new java.io.File(tokenFile);
|
||||
@@ -122,7 +134,7 @@ class BigQueryUtil_<%=cid%> {
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
@@ -132,10 +144,22 @@ class BigQueryUtil_<%=cid%> {
|
||||
%>
|
||||
// wait for query execution
|
||||
while (true) {
|
||||
com.google.api.services.bigquery.model.Job pollJob = bigqueryclient.jobs().get(projectId, jobId.getJobId()).setLocation(location).execute();
|
||||
com.google.api.services.bigquery.model.JobStatus status = pollJob.getStatus();
|
||||
|
||||
<%
|
||||
if("".equals(basePackage)) {
|
||||
%>
|
||||
<%=basePackage%>com.google.api.services.bigquery.model.Job pollJob = bigqueryclient.jobs().get(projectId, jobId.getJobId()).set("location", location).execute();
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
<%=basePackage%>com.google.api.services.bigquery.model.Job pollJob = bigqueryclient.jobs().get(projectId, jobId.getJobId()).setLocation(location).execute();
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
<%=basePackage%>com.google.api.services.bigquery.model.JobStatus status = pollJob.getStatus();
|
||||
if (status.getState().equals("DONE")) {
|
||||
com.google.api.services.bigquery.model.ErrorProto errorProto = status.getErrorResult();
|
||||
<%=basePackage%>com.google.api.services.bigquery.model.ErrorProto errorProto = status.getErrorResult();
|
||||
if(errorProto != null){// job failed, handle it
|
||||
<%if("AUTO".equals(resultSizeType)){%>
|
||||
if(!useLargeResult && "responseTooLarge".equals(errorProto.getReason())){// try with large result flag
|
||||
@@ -146,7 +170,7 @@ class BigQueryUtil_<%=cid%> {
|
||||
<%
|
||||
}
|
||||
%>
|
||||
return executeQuery(query, true);
|
||||
return executeQuery(query, true, useLegacySql);
|
||||
}
|
||||
<%}%>
|
||||
// Do not throw exception to avoid behavior changed(because it may throw "duplicate" exception which do not throw before);
|
||||
@@ -164,13 +188,12 @@ class BigQueryUtil_<%=cid%> {
|
||||
}// else job successful
|
||||
break;
|
||||
}
|
||||
// Pause execution for one second before polling job status again, to
|
||||
// Pause execution for one second before polling job status again, to
|
||||
// reduce unnecessary calls to the BigQUery API and lower overall
|
||||
// application bandwidth.
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
|
||||
|
||||
return insert;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<%@ jet
|
||||
imports="
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
org.talend.core.model.metadata.IMetadataTable
|
||||
org.talend.core.model.metadata.IMetadataColumn
|
||||
org.talend.core.model.metadata.IMetadataTable
|
||||
org.talend.core.model.metadata.IMetadataColumn
|
||||
org.talend.core.model.process.IConnection
|
||||
org.talend.core.model.process.IConnectionCategory
|
||||
org.talend.core.model.metadata.types.JavaTypesManager
|
||||
@@ -29,10 +29,13 @@
|
||||
String query = ElementParameterParser.getValue(node,"__QUERY__");
|
||||
boolean useLegacySql = ElementParameterParser.getBooleanValue(node,"__USE_LEGACY_SQL__");
|
||||
String resultSizeType = ElementParameterParser.getValue(node,"__RESULT_SIZE__");
|
||||
String basePackage = "";
|
||||
boolean isCustomTemporaryName = ElementParameterParser.getBooleanValue(node,"__USE_CUSTOM_TEMPORARY_DATASET__");
|
||||
String tempDataset = ElementParameterParser.getValue(node,"__TEMPORARY_DATASET_NAME__");
|
||||
|
||||
query = query.replaceAll("\n"," ");
|
||||
query = query.replaceAll("\r"," ");
|
||||
|
||||
|
||||
String tokenFile = ElementParameterParser.getValue(node,"__TOKEN_NAME__");
|
||||
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
if (authMode.equals("OAUTH")) {
|
||||
@@ -41,22 +44,22 @@
|
||||
<%
|
||||
String passwordFieldName = "__CLIENT_SECRET__";
|
||||
%>
|
||||
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
|
||||
final String CLIENT_SECRET_<%=cid%> = "{\"web\": {\"client_id\": \""+<%=clientId%>+"\",\"client_secret\": \"" +decryptedPassword_<%=cid%>+ "\",\"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\"token_uri\": \"https://accounts.google.com/o/oauth2/token\"}}";
|
||||
final String PROJECT_ID_<%=cid %> = <%=projectId %>;
|
||||
|
||||
|
||||
// Static variables for API scope, callback URI, and HTTP/JSON functions
|
||||
final List<String> SCOPES_<%=cid%> = java.util.Arrays.asList("https://www.googleapis.com/auth/bigquery");
|
||||
final String REDIRECT_URI_<%=cid%> = "urn:ietf:wg:oauth:2.0:oob";
|
||||
final com.google.api.client.http.HttpTransport TRANSPORT_<%=cid %> = new com.google.api.client.http.javanet.NetHttpTransport();
|
||||
final com.google.api.client.json.JsonFactory JSON_FACTORY_<%=cid %> = new com.google.api.client.json.jackson2.JacksonFactory();
|
||||
|
||||
|
||||
com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets clientSecrets_<%=cid%> = com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets.load(
|
||||
new com.google.api.client.json.jackson2.JacksonFactory(), new java.io.InputStreamReader(new java.io.ByteArrayInputStream(
|
||||
CLIENT_SECRET_<%=cid%>.getBytes())));
|
||||
|
||||
|
||||
com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow flow_<%=cid%> = null;
|
||||
com.google.api.services.bigquery.Bigquery bigqueryclient_<%=cid%> = null;
|
||||
long nb_line_<%=cid%> = 0;
|
||||
@@ -69,7 +72,7 @@
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
|
||||
// Attempt to load existing refresh token
|
||||
String tokenFile_<%=cid %> = <%=tokenFile%>;
|
||||
java.util.Properties properties_<%=cid%> = new java.util.Properties();
|
||||
@@ -95,16 +98,16 @@
|
||||
%>
|
||||
}
|
||||
String storedRefreshToken_<%=cid%> = (String) properties_<%=cid%>.get("refreshtoken");
|
||||
|
||||
|
||||
// Check to see if the an existing refresh token was loaded.
|
||||
// If so, create a credential and call refreshToken() to get a new
|
||||
// access token.
|
||||
if (storedRefreshToken_<%=cid%> != null) {
|
||||
// Request a new Access token using the refresh token.
|
||||
com.google.api.client.googleapis.auth.oauth2.GoogleCredential credential_<%=cid%> = new com.google.api.client.googleapis.auth.oauth2. GoogleCredential.Builder().setTransport(TRANSPORT_<%=cid%>)
|
||||
com.google.api.client.googleapis.auth.oauth2.GoogleCredential credential_<%=cid%> = new com.google.api.client.googleapis.auth.oauth2.GoogleCredential.Builder().setTransport(TRANSPORT_<%=cid%>)
|
||||
.setJsonFactory(JSON_FACTORY_<%=cid%>).setClientSecrets(clientSecrets_<%=cid%>)
|
||||
.build().setFromTokenResponse(new com.google.api.client.auth.oauth2.TokenResponse().setRefreshToken(storedRefreshToken_<%=cid%>));
|
||||
|
||||
|
||||
credential_<%=cid%>.refreshToken();
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
@@ -126,7 +129,7 @@
|
||||
if(authorizationCode_<%=cid%> == null || "".equals(authorizationCode_<%=cid%>) || "\"\"".equals(authorizationCode_<%=cid%>)) {
|
||||
String authorizeUrl_<%=cid%> = new com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl(
|
||||
clientSecrets_<%=cid%>, REDIRECT_URI_<%=cid%>, SCOPES_<%=cid%>).setState("").build();
|
||||
|
||||
|
||||
System.out
|
||||
.println("Paste this URL into a web browser to authorize BigQuery Access:\n"
|
||||
+ authorizeUrl_<%=cid%>);
|
||||
@@ -156,7 +159,7 @@
|
||||
}
|
||||
com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse response_<%=cid%> = flow_<%=cid%>.newTokenRequest(authorizationCode_<%=cid%>).setRedirectUri(REDIRECT_URI_<%=cid%>).execute();
|
||||
com.google.api.client.auth.oauth2.Credential credential_<%=cid%> = flow_<%=cid%>.createAndStoreCredential(response_<%=cid%>, null);
|
||||
|
||||
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
@@ -172,15 +175,15 @@
|
||||
if (outputStream_<%=cid%> != null) {
|
||||
outputStream_<%=cid%>.close();
|
||||
}
|
||||
|
||||
|
||||
bigqueryclient_<%=cid%> = new com.google.api.services.bigquery.Bigquery.Builder(new com.google.api.client.http.javanet.NetHttpTransport(),new com.google.api.client.json.jackson2.JacksonFactory(),credential_<%=cid%>).build();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/tBigQueryInput/BigQueryInputQueryHelper.javajet"%>
|
||||
|
||||
|
||||
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/tBigQueryInput/BigQueryInputQueryHelper.javajet"%>
|
||||
|
||||
// Start a Query Job
|
||||
String querySql_<%=cid %> = <%=query %>;
|
||||
System.out.format("Running Query : %s\n", querySql_<%=cid %>);
|
||||
@@ -191,9 +194,9 @@
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
BigQueryUtil_<%=cid%> bigQueryUtil_<%=cid%> = new BigQueryUtil_<%=cid%>(PROJECT_ID_<%=cid%>, bigqueryclient_<%=cid%>, tokenFile_<%=cid%>);
|
||||
|
||||
|
||||
BigQueryUtil_<%=cid%> bigQueryUtil_<%=cid%> = new BigQueryUtil_<%=cid%>(PROJECT_ID_<%=cid%>, bigqueryclient_<%=cid%>, tokenFile_<%=cid%><% if (isCustomTemporaryName) {%>, <%=tempDataset%> <%} %>);
|
||||
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
@@ -202,7 +205,7 @@
|
||||
}
|
||||
%>
|
||||
com.google.api.services.bigquery.model.Job insert_<%=cid %> = bigQueryUtil_<%=cid%>.executeQuery(querySql_<%=cid%>, <%="LARGE".equals(resultSizeType) ? true : false%>, <%=useLegacySql%>);
|
||||
|
||||
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
@@ -221,60 +224,99 @@
|
||||
}
|
||||
|
||||
String query_<%=cid%> = <%=query%>;
|
||||
String dataset = query_<%=cid%>.substring(query_<%=cid%>.indexOf("from") + 4, query_<%=cid%>.indexOf(".")).trim();
|
||||
String temp_table = "temp_" + dataset + java.util.UUID.randomUUID().toString().replaceAll("-", "")
|
||||
+ "<%=cid%>".toLowerCase().replaceAll("[^a-z0-9]", "0").replaceAll("^[^a-z]", "a")
|
||||
+ Integer.toHexString(java.util.concurrent.ThreadLocalRandom.current().nextInt());
|
||||
<% if(isLog4jEnabled) { %>
|
||||
log.info("<%=cid%> - query " + <%=query%>);
|
||||
<% } %>
|
||||
|
||||
com.google.cloud.bigquery.BigQuery bigquery_<%=cid%> = com.google.cloud.bigquery.BigQueryOptions.newBuilder()
|
||||
.setCredentials(credentials_<%=cid%>)
|
||||
.setProjectId(<%=projectId%>)
|
||||
.build()
|
||||
.getService();
|
||||
|
||||
com.google.cloud.bigquery.QueryJobConfiguration.Builder queryConfiguration_<%=cid%> = com.google.cloud.bigquery.QueryJobConfiguration.newBuilder(<%=query%>).setUseLegacySql(<%=useLegacySql%>);
|
||||
|
||||
<%
|
||||
if (resultSizeType.equals("LARGE") || resultSizeType.equals("AUTO")) {
|
||||
%>
|
||||
queryConfiguration_<%=cid%>.setDestinationTable(com.google.cloud.bigquery.TableId.of(dataset, temp_table)).setAllowLargeResults(true);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
com.google.cloud.bigquery.JobId jobId_<%=cid%> = com.google.cloud.bigquery.JobId.of(java.util.UUID.randomUUID().toString());
|
||||
com.google.cloud.bigquery.Job job_<%=cid%> = bigquery_<%=cid%>.create(com.google.cloud.bigquery.JobInfo.newBuilder(queryConfiguration_<%=cid%>.build()).setJobId(jobId_<%=cid%>).build());
|
||||
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
com.google.cloud.bigquery.QueryJobConfiguration.Builder queryConfiguration_<%=cid%> = com.google.cloud.bigquery.QueryJobConfiguration.newBuilder(<%=query%>).setUseLegacySql(<%=useLegacySql%>);
|
||||
|
||||
<%if (resultSizeType.equals("LARGE") || resultSizeType.equals("AUTO")) {
|
||||
if (isCustomTemporaryName) {%>
|
||||
String tempDataset_<%=cid%> = <%=tempDataset%>;
|
||||
<% if(isLog4jEnabled){ %>
|
||||
log.info("<%=cid%> - temporary Dataset name : " + tempDataset_<%=cid%>);
|
||||
<%
|
||||
}
|
||||
} else {
|
||||
%>
|
||||
com.google.cloud.bigquery.QueryJobConfiguration jobConfDryRun_<%=cid%> = queryConfiguration_<%=cid%> .setDryRun(true).build();
|
||||
com.google.cloud.bigquery.Job jobDryRun_<%=cid%> = bigquery_<%=cid%>.create(com.google.cloud.bigquery.JobInfo.of(jobConfDryRun_<%=cid%>));
|
||||
|
||||
String queryLocation_<%=cid%> =jobDryRun_<%=cid%>.getJobId().getLocation();
|
||||
String location_<%=cid%> = queryLocation_<%=cid%> == null ? "US" : queryLocation_<%=cid%>;
|
||||
String tempDataset_<%=cid%> = java.util.UUID.randomUUID().toString().replaceAll("-", "")
|
||||
+ Integer.toHexString(java.util.concurrent.ThreadLocalRandom.current().nextInt())
|
||||
+ Integer.toHexString(java.util.concurrent.ThreadLocalRandom.current().nextInt());
|
||||
|
||||
<% if(isLog4jEnabled){ %>
|
||||
log.info("<%=cid%> - query location :" + queryLocation_<%=cid%>);
|
||||
log.info("<%=cid%> - temporary dataset location :" + location_<%=cid%>);
|
||||
log.info("<%=cid%> - temporary Dataset name : " + tempDataset_<%=cid%>);
|
||||
|
||||
<% } %>
|
||||
|
||||
com.google.cloud.bigquery.DatasetInfo datasetInfo_<%=cid%> = com.google.cloud.bigquery.DatasetInfo.newBuilder(tempDataset_<%=cid%>).setLocation(location_<%=cid%>).build();
|
||||
com.google.cloud.bigquery.Dataset dataset_<%=cid%> = bigquery_<%=cid%> .create(datasetInfo_<%=cid%>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
String tempTable_<%=cid%> = java.util.UUID.randomUUID().toString().replaceAll("-", "")
|
||||
+ Integer.toHexString(java.util.concurrent.ThreadLocalRandom.current().nextInt())
|
||||
+ Integer.toHexString(java.util.concurrent.ThreadLocalRandom.current().nextInt());
|
||||
<% if(isLog4jEnabled){ %>
|
||||
log.info("<%=cid%> - temporary table name : " + tempTable_<%=cid%>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
queryConfiguration_<%=cid%>
|
||||
.setDryRun(false)
|
||||
.setAllowLargeResults(true)
|
||||
.setDestinationTable(com.google.cloud.bigquery.TableId.of(tempDataset_<%=cid%>, tempTable_<%=cid%>));
|
||||
|
||||
com.google.cloud.bigquery.JobId jobId_<%=cid%> = com.google.cloud.bigquery.JobId
|
||||
.newBuilder().setProject(<%=projectId%>)
|
||||
.setJob(java.util.UUID.randomUUID().toString())
|
||||
.build();
|
||||
|
||||
<% if(isLog4jEnabled){ %>
|
||||
log.info("<%=cid%> - job location : " + jobId_<%=cid%>.getLocation());
|
||||
<% } %>
|
||||
<% } else { %>
|
||||
com.google.cloud.bigquery.JobId jobId_<%=cid%> = com.google.cloud.bigquery.JobId.of(<%=projectId%>,java.util.UUID.randomUUID().toString());
|
||||
|
||||
<% } %>
|
||||
com.google.cloud.bigquery.Job job_<%=cid%> = bigquery_<%=cid%>.create(com.google.cloud.bigquery.JobInfo.newBuilder(queryConfiguration_<%=cid%>.build()).setJobId(jobId_<%=cid%>).build());
|
||||
|
||||
|
||||
<% if(isLog4jEnabled) { %>
|
||||
log.info("<%=cid%> - Sending job " + jobId_<%=cid%> + " with query: " + <%=query%>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<% } %>
|
||||
|
||||
job_<%=cid%> = job_<%=cid%>.waitFor();
|
||||
|
||||
|
||||
if (job_<%=cid%> == null) {
|
||||
throw new RuntimeException("Job no longer exists");
|
||||
} else if (job_<%=cid%>.getStatus().getError() != null) {
|
||||
throw new RuntimeException(job_<%=cid%>.getStatus().getError().toString());
|
||||
}
|
||||
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
<% if(isLog4jEnabled) { %>
|
||||
log.info("<%=cid%> - Job " + jobId_<%=cid%> + " finished successfully.");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<% } %>
|
||||
com.google.cloud.bigquery.TableResult result_<%=cid%> = job_<%=cid%>.getQueryResults();
|
||||
long nb_line_<%=cid%> = 0;
|
||||
<%
|
||||
} else {
|
||||
throw new IllegalArgumentException("authentication mode should be either \"SERVICEACCOUNT\" or \"OAUTH\", but it is " + authMode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (authMode.equals("OAUTH")) {
|
||||
%>
|
||||
while (true) {
|
||||
@@ -286,13 +328,13 @@
|
||||
insert_<%=cid %>.getConfiguration().getQuery()
|
||||
.getDestinationTable().getTableId())
|
||||
.setPageToken(pageToken_<%=cid%>).execute();
|
||||
|
||||
|
||||
List<com.google.api.services.bigquery.model.TableRow> rows_<%=cid %> = dataList_<%=cid %>.getRows();
|
||||
if(rows_<%=cid %> == null) {
|
||||
// Means there is no record.
|
||||
rows_<%=cid %> = new java.util.ArrayList<com.google.api.services.bigquery.model.TableRow>();
|
||||
}
|
||||
|
||||
|
||||
for (com.google.api.services.bigquery.model.TableRow row_<%=cid %> : rows_<%=cid %>) {
|
||||
java.util.List<com.google.api.services.bigquery.model.TableCell> field_<%=cid %> = row_<%=cid %>.getF();
|
||||
Object value_<%=cid%> = null;
|
||||
@@ -322,16 +364,16 @@
|
||||
boolean advancedSeparator = (advancedSeparatorStr!=null&&!("").equals(advancedSeparatorStr))?("true").equals(advancedSeparatorStr):false;
|
||||
String thousandsSeparator = ElementParameterParser.getValueWithJavaType(node, "__THOUSANDS_SEPARATOR__", JavaTypesManager.CHARACTER);
|
||||
String decimalSeparator = ElementParameterParser.getValueWithJavaType(node, "__DECIMAL_SEPARATOR__", JavaTypesManager.CHARACTER);
|
||||
|
||||
|
||||
List<IMetadataColumn> columns = metadata.getListColumns();
|
||||
int nbColumns = columns.size();
|
||||
for (int i = 0; i < nbColumns; i++ ) {
|
||||
IMetadataColumn column = columns.get(i);
|
||||
String columnName = column.getLabel();
|
||||
|
||||
|
||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getTalendType(), column.isNullable());
|
||||
JavaType javaType = JavaTypesManager.getJavaTypeFromId(column.getTalendType());
|
||||
String patternValue = column.getPattern() == null || column.getPattern().trim().length() == 0 ? null : column.getPattern();
|
||||
String patternValue = column.getPattern() == null || column.getPattern().trim().length() == 0 ? null : column.getPattern();
|
||||
if (authMode.equals("OAUTH")) {
|
||||
%>
|
||||
value_<%=cid%> = field_<%=cid %>.get(<%=i%>).getV();
|
||||
@@ -345,34 +387,34 @@
|
||||
}
|
||||
%>
|
||||
if(com.google.api.client.util.Data.isNull(value_<%=cid%>)) value_<%=cid%> = null;
|
||||
|
||||
|
||||
if(value_<%=cid%> != null){
|
||||
|
||||
|
||||
<%
|
||||
if (javaType == JavaTypesManager.STRING) {
|
||||
%>
|
||||
<%=connName%>.<%=columnName%> = value_<%=cid%>.toString();
|
||||
<%
|
||||
} else if (javaType == JavaTypesManager.OBJECT) {
|
||||
%>
|
||||
%>
|
||||
<%=connName%>.<%=columnName%> = value_<%=cid%>;
|
||||
<%
|
||||
} else if(javaType == JavaTypesManager.DATE) {
|
||||
%>
|
||||
|
||||
<%
|
||||
} else if(javaType == JavaTypesManager.DATE) {
|
||||
%>
|
||||
|
||||
if (value_<%=cid%>.toString().contains("-")) {
|
||||
<%=connName%>.<%=columnName%> = ParserUtils.parseTo_Date(value_<%=cid%>.toString(),<%=patternValue%>);
|
||||
} else {
|
||||
<%=connName%>.<%=columnName%> = ParserUtils.parseTo_Date(value_<%=cid%>.toString(),<%=patternValue%>);
|
||||
} else {
|
||||
<%=connName%>.<%=columnName%> = ParserUtils.parseTo_Date(value_<%=cid%>.toString());
|
||||
}
|
||||
|
||||
<%
|
||||
} else if(advancedSeparator && JavaTypesManager.isNumberType(javaType)) {
|
||||
%>
|
||||
|
||||
<%
|
||||
} else if(advancedSeparator && JavaTypesManager.isNumberType(javaType)) {
|
||||
%>
|
||||
<%=connName%>.<%=columnName%> = ParserUtils.parseTo_<%= typeToGenerate %>(ParserUtils.parseTo_Number(value_<%=cid%>.toString(), <%= thousandsSeparator %>, <%= decimalSeparator %>));
|
||||
<%
|
||||
} else if(javaType == JavaTypesManager.BYTE_ARRAY) {
|
||||
%>
|
||||
} else if(javaType == JavaTypesManager.BYTE_ARRAY) {
|
||||
%>
|
||||
<%=connName%>.<%=columnName%> = value_<%=cid%>.toString().getBytes(<%=encoding %>);
|
||||
<%
|
||||
} else {
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
<%@ jet
|
||||
<%@ jet
|
||||
imports="
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
"
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
"
|
||||
%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/Log4j/Log4jFileUtil.javajet"%>
|
||||
<%
|
||||
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
|
||||
INode node = (INode)codeGenArgument.getArgument();
|
||||
String cid = node.getUniqueName();
|
||||
String authMode = ElementParameterParser.getValue(node,"__AUTH_MODE__");
|
||||
String authMode = ElementParameterParser.getValue(node,"__AUTH_MODE__");
|
||||
String projectId = ElementParameterParser.getValue(node,"__PROJECT_ID__");
|
||||
String resultSizeType = ElementParameterParser.getValue(node,"__RESULT_SIZE__");
|
||||
boolean isCustomTemporaryName = ElementParameterParser.getBooleanValue(node,"__USE_CUSTOM_TEMPORARY_DATASET__");
|
||||
|
||||
if (authMode.equals("OAUTH")) {
|
||||
%>
|
||||
}
|
||||
@@ -24,10 +28,20 @@ imports="
|
||||
} else if (authMode.equals("SERVICEACCOUNT")) {
|
||||
%>
|
||||
}
|
||||
bigquery_<%=cid%>.delete(com.google.cloud.bigquery.TableId.of(dataset, temp_table));
|
||||
<%
|
||||
} else {
|
||||
throw new IllegalArgumentException("authentication mode should be either \"SERVICEACCOUNT\" or \"OAUTH\", but it is " + authMode);
|
||||
}
|
||||
log4jFileUtil.retrievedDataNumberInfo(node);
|
||||
%>
|
||||
<% if (resultSizeType.equals("LARGE") || resultSizeType.equals("AUTO")) {
|
||||
if (isCustomTemporaryName) {
|
||||
%>
|
||||
bigquery_<%=cid%>.delete(com.google.cloud.bigquery.TableId.of(tempDataset_<%=cid%>, tempTable_<%=cid%>));
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
com.google.cloud.bigquery.DatasetId datasetId_<%=cid%> = com.google.cloud.bigquery.DatasetId.of(<%=projectId%>, tempDataset_<%=cid%>);
|
||||
bigquery_<%=cid%>.delete(datasetId_<%=cid%>, com.google.cloud.bigquery.BigQuery.DatasetDeleteOption.deleteContents());
|
||||
<%
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("authentication mode should be either \"SERVICEACCOUNT\" or \"OAUTH\", but it is " + authMode);
|
||||
}
|
||||
log4jFileUtil.retrievedDataNumberInfo(node);
|
||||
%>
|
||||
|
||||
@@ -157,6 +157,17 @@
|
||||
REQUIRED="true" REPOSITORY_VALUE="ENCODING">
|
||||
<DEFAULT>"ISO-8859-15"</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER
|
||||
NAME="USE_CUSTOM_TEMPORARY_DATASET" FIELD="CHECK" NUM_ROW="30"
|
||||
SHOW_IF="(RESULT_SIZE != 'SMALL')">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="TEMPORARY_DATASET_NAME" FIELD="TEXT" REQUIRED="true" NUM_ROW="40"
|
||||
SHOW_IF="(USE_CUSTOM_TEMPORARY_DATASET == 'true') AND (RESULT_SIZE != 'SMALL')">
|
||||
<DEFAULT>"temp_dataset"</DEFAULT>
|
||||
</PARAMETER>
|
||||
</ADVANCED_PARAMETERS>
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
|
||||
@@ -27,5 +27,6 @@ RESULT_SIZE.NAME=Result size
|
||||
RESULT_SIZE.ITEM.SMALL=Small(without allowLargeResults)
|
||||
RESULT_SIZE.ITEM.LARGE=Large(with allowLargeResults)
|
||||
RESULT_SIZE.ITEM.AUTO=Auto
|
||||
|
||||
USE_LEGACY_SQL.NAME=Use Legacy SQL
|
||||
USE_CUSTOM_TEMPORARY_DATASET.NAME=Use custom temporary Dataset name
|
||||
TEMPORARY_DATASET_NAME.NAME=Temporary Dataset name
|
||||
USE_LEGACY_SQL.NAME=Use Legacy SQL
|
||||
|
||||
@@ -188,6 +188,7 @@ COMPATIBILITY="ALL"
|
||||
<IMPORT NAME="sshj-0_8_1" MODULE="sshj-0.8.1.jar" MVN="mvn:org.talend.libraries/sshj-0.8.1/6.0.0" REQUIRED_IF="PROVIDER=='AWS_EC2'"/>
|
||||
|
||||
<IMPORT NAME="sts-2.0.2" MODULE="sts-2.0.2.jar" MVN="mvn:org.talend.libraries/sts-2.0.2/6.0.0" REQUIRED_IF="PROVIDER=='AWS_EC2'"/>
|
||||
<IMPORT NAME="jaxb-api-2.3.1" MODULE="jaxb-api-2.3.1.jar" MVN="mvn:javax.xml.bind/jaxb-api/2.3.1" REQUIRED="true"/>
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -97,6 +97,7 @@ COMPATIBILITY="ALL"
|
||||
<IMPORT NAME="sshj-0_8_1" MODULE="sshj-0.8.1.jar" MVN="mvn:org.talend.libraries/sshj-0.8.1/6.0.0" REQUIRED_IF="PROVIDER=='AWS_EC2'"/>
|
||||
|
||||
<IMPORT NAME="sts-2.0.2" MODULE="sts-2.0.2.jar" MVN="mvn:org.talend.libraries/sts-2.0.2/6.0.0" REQUIRED_IF="PROVIDER=='AWS_EC2'"/>
|
||||
<IMPORT NAME="jaxb-api-2.3.1" MODULE="jaxb-api-2.3.1.jar" MVN="mvn:javax.xml.bind/jaxb-api/2.3.1" REQUIRED="true"/>
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
|
||||
<PARAMETER
|
||||
NAME="DBTYPE"
|
||||
REPOSITORY_VALUE="DBTYPE"
|
||||
FIELD="CLOSED_LIST"
|
||||
NUM_ROW="10"
|
||||
>
|
||||
@@ -897,8 +898,8 @@
|
||||
<IMPORT NAME="Driver-VERTICA_7.0.1" MODULE="vertica-jdbc-7.0.1-0.jar" MVN="mvn:org.talend.libraries/vertica-jdbc-7.0.1-0/6.0.0" REQUIRED_IF="(DBTYPE=='VERTICA') and (USE_EXISTING_CONNECTION == 'false') and (DB_VERTICA_VERSION=='VERTICA_7_0_X')" />
|
||||
<IMPORT NAME="Driver-VERTICA_7.1.2" MODULE="vertica-jdbc-7.1.2-0.jar" MVN="mvn:org.talend.libraries/vertica-jdbc-7.1.2-0/6.0.0" REQUIRED_IF="(DBTYPE=='VERTICA') and (USE_EXISTING_CONNECTION == 'false') and (DB_VERTICA_VERSION=='VERTICA_7_1_X')" />
|
||||
<IMPORT NAME="Driver-EXASolution" MODULE="exajdbc-6.0.9302.jar" MVN="mvn:org.talend.libraries/exajdbc-6.0.9302/6.3.0" REQUIRED_IF="(DBTYPE=='EXASOL') and (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Driver-Redshift" MODULE="redshift-jdbc42-no-awssdk-1.2.20.1043.jar" MVN="mvn:com.amazon.redshift/redshift-jdbc42-no-awssdk/1.2.20.1043" REQUIRED_IF="(DBTYPE=='REDSHIFT') and (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Driver-Snowflake" MODULE="snowflake-jdbc-3.5.3.jar" MVN="mvn:net.snowflake/snowflake-jdbc/3.5.3" REQUIRED_IF="(DBTYPE=='SNOWFLAKE') and (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Driver-Redshift" MODULE="redshift-jdbc42-no-awssdk-1.2.32.1056.jar" MVN="mvn:com.amazon.redshift/redshift-jdbc42-no-awssdk/1.2.32.1056" REQUIRED_IF="(DBTYPE=='REDSHIFT') and (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Driver-Snowflake" MODULE="snowflake-jdbc-3.9.0.jar" MVN="mvn:net.snowflake/snowflake-jdbc/3.9.0" REQUIRED_IF="(DBTYPE=='SNOWFLAKE') and (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Driver-VERTICA_9.0" MODULE="vertica-jdbc-9.0.0-0.jar" MVN="mvn:org.talend.libraries/vertica-jdbc-9.0.0-0/6.0.0" REQUIRED_IF="(DBTYPE=='VERTICA') and (USE_EXISTING_CONNECTION == 'false') and (DB_VERTICA_VERSION=='VERTICA_9_0')"/>
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -118,7 +118,7 @@ DB_VERTICA_VERSION.ITEM.VERTICA_7_1_X=Vertica 7.1.X
|
||||
DB_VERTICA_VERSION.ITEM.VERTICA_9_0=Vertica 9
|
||||
|
||||
DB_POSTGRE_VERSION.NAME=DB Version
|
||||
DB_POSTGRE_VERSION.ITEM.PRIOR_TO_V9=Prior to v9
|
||||
DB_POSTGRE_VERSION.ITEM.PRIOR_TO_V9=v7.2 to v8.X
|
||||
DB_POSTGRE_VERSION.ITEM.V9_X=v9 and later
|
||||
QUERY.NAME=Query
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
</ADVANCED_PARAMETERS>
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT MODULE="janet-java-1.1.jar" MVN="mvn:org.talend.libraries/janet-java-1.1/6.0.0" NAME="janet-java-1.1"
|
||||
REQUIRED="true" />
|
||||
<IMPORT MODULE="janet-java-1.2.jar" MVN="mvn:org.talend.libraries/janet-java-1.2/6.0.0" NAME="janet-java-1.2"
|
||||
REQUIRED="true" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
<RETURNS>
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
</ADVANCED_PARAMETERS>
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT MODULE="janet-java-1.1.jar" MVN="mvn:org.talend.libraries/janet-java-1.1/6.0.0" NAME="janet-java-1.1"
|
||||
<IMPORT MODULE="janet-java-1.2.jar" MVN="mvn:org.talend.libraries/janet-java-1.2/6.0.0" NAME="janet-java-1.2"
|
||||
REQUIRED="true" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -104,7 +104,6 @@ skeleton="@{org.talend.designer.components.localprovider}/components/templates/d
|
||||
|
||||
int deletedCount_<%=cid%> = 0;
|
||||
int insertedCount_<%=cid%> = 0;
|
||||
// schema is mandatory
|
||||
|
||||
String dbschema_<%=cid%> = null;
|
||||
<% if (useExistingConnection) { %>
|
||||
@@ -112,8 +111,12 @@ String dbschema_<%=cid%> = null;
|
||||
<% } else { %>
|
||||
dbschema_<%=cid%> = <%=dbschema%>;
|
||||
<% } %>
|
||||
|
||||
String tableName_<%=cid%> = dbschema_<%=cid%> + "." + <%=table%>;
|
||||
String tableName_<%=cid%> = null;
|
||||
if(dbschema_<%=cid%> == null || dbschema_<%=cid%>.trim().length() == 0) {
|
||||
tableName_<%=cid%> = <%=table%>;
|
||||
} else {
|
||||
tableName_<%=cid%> = dbschema_<%=cid%> + "." + <%=table%>;
|
||||
}
|
||||
java.sql.Connection conn_<%=cid%> = null;
|
||||
<% if (useExistingConnection) { %>
|
||||
conn_<%=cid%> = (java.sql.Connection) globalMap.get("conn_<%=connection%>");
|
||||
|
||||
@@ -650,8 +650,8 @@
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Driver-EXASolution" MODULE="exajdbc-6.0.9302.jar" MVN="mvn:org.talend.libraries/exajdbc-6.0.9302/6.3.0" REQUIRED="true" />
|
||||
<IMPORT NAME="Talend-DB-Exasol-Util" MODULE="talend-db-exasol-2.1.3.jar" MVN="mvn:org.talend.libraries/talend-db-exasol/2.1.3"
|
||||
UrlPath="platform:/plugin/org.talend.libraries.jdbc.exasol/lib/talend-db-exasol-2.1.3.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="Talend-DB-Exasol-Util" MODULE="talend-db-exasol-2.1.4.jar" MVN="mvn:org.talend.components.lib/talend-db-exasol/2.1.4"
|
||||
UrlPath="platform:/plugin/org.talend.libraries.jdbc.exasol/lib/talend-db-exasol-2.1.4.jar" REQUIRED="true" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -105,8 +105,12 @@ if(("true").equals(useExistingConn)) {
|
||||
<%
|
||||
}
|
||||
%>
|
||||
// schema is mandatory
|
||||
String tableName_<%=cid%> = dbschema_<%=cid%> + "." + <%=table%>;
|
||||
String tableName_<%=cid%> = null;
|
||||
if(dbschema_<%=cid%> == null || dbschema_<%=cid%>.trim().length() == 0) {
|
||||
tableName_<%=cid%> = <%=table%>;
|
||||
} else {
|
||||
tableName_<%=cid%> = dbschema_<%=cid%> + "." + <%=table%>;
|
||||
}
|
||||
<%
|
||||
if(("UPDATE").equals(dataAction) || ("INSERT_OR_UPDATE").equals(dataAction) || ("UPDATE_OR_INSERT").equals(dataAction)) {
|
||||
int updateKeyCount = 0;
|
||||
|
||||
@@ -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.3-talend.jar" MVN="mvn:net.sf.json-lib/json-lib/2.4.3-talend" REQUIRED_IF="READ_BY == 'XPATH'" />
|
||||
<IMPORT NAME="commons_lang" MODULE="commons-lang-2.6.jar" MVN="mvn:commons-lang/commons-lang/2.6" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-lang-2.6.jar" REQUIRED_IF="READ_BY == 'XPATH'" />
|
||||
<IMPORT NAME="commons_logging" MODULE="commons-logging-1.1.1.jar" MVN="mvn:org.talend.libraries/commons-logging-1.1.1/6.0.0" UrlPath="platform:/base/plugins/org.apache.commons.logging_1.1.1.v201101211721.jar" REQUIRED_IF="READ_BY == 'XPATH'" />
|
||||
<IMPORT NAME="ezmorph" MODULE="ezmorph-1.0.6.jar" MVN="mvn:org.talend.libraries/ezmorph-1.0.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/ezmorph-1.0.6.jar" REQUIRED_IF="READ_BY == 'XPATH'" />
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
<%@ jet
|
||||
%>
|
||||
|
||||
boolean retry_<%=cid%> = false;
|
||||
int retry_count_<%=cid%> = 0;
|
||||
int retry_max_<%=cid%> = 5;
|
||||
|
||||
com.jcraft.jsch.Session session_<%=cid%> = null;
|
||||
com.jcraft.jsch.Channel channel_<%=cid%> = null;
|
||||
|
||||
do {
|
||||
retry_<%=cid%> = false;
|
||||
|
||||
com.jcraft.jsch.JSch jsch_<%=cid%> = new com.jcraft.jsch.JSch();
|
||||
|
||||
<%if (("PUBLICKEY").equals(authMethod)){%>
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - SFTP authentication using a public key.");
|
||||
log.debug("<%=cid%> - Private key: '" + <%=privateKey%> + "'.");
|
||||
<%}%>
|
||||
jsch_<%=cid%>.addIdentity(<%=privateKey %>, defaultUserInfo_<%=cid%>.getPassphrase());
|
||||
<%}%>
|
||||
|
||||
session_<%=cid%> = jsch_<%=cid%>.getSession(<%=user%>, <%=host%>, <%=port%>);
|
||||
session_<%=cid%>.setConfig("PreferredAuthentications", "publickey,password,keyboard-interactive,gssapi-with-mic");
|
||||
|
||||
<%if (("PASSWORD").equals(authMethod)) {%>
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - SFTP authentication using a password.");
|
||||
<%}%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
session_<%=cid%>.setPassword(decryptedPassword_<%=cid%>);
|
||||
<%}%>
|
||||
|
||||
session_<%=cid%>.setUserInfo(defaultUserInfo_<%=cid%>);
|
||||
<%if (!useProxy) {%>
|
||||
if(("true").equals(System.getProperty("http.proxySet")) ){
|
||||
com.jcraft.jsch.ProxyHTTP proxy_<%=cid%> = new com.jcraft.jsch.ProxyHTTP(System.getProperty("http.proxyHost"),Integer.parseInt(System.getProperty("http.proxyPort")));
|
||||
if(!"".equals(System.getProperty("http.proxyUser"))){
|
||||
proxy_<%=cid%>.setUserPasswd(System.getProperty("http.proxyUser"),System.getProperty("http.proxyPassword"));
|
||||
}
|
||||
session_<%=cid%>.setProxy(proxy_<%=cid%>);
|
||||
}
|
||||
<%}%>
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Attempt to connect to '" + <%=host %> + "' with username '" + <%=user%> + "'.");
|
||||
<%}%>
|
||||
|
||||
channel_<%=cid%> = null;
|
||||
try {
|
||||
session_<%=cid%>.connect();
|
||||
channel_<%=cid%> = session_<%=cid%>.openChannel("sftp");
|
||||
channel_<%=cid%>.connect();
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Connect to '" + <%=host %> + "' has succeeded.");
|
||||
<%}%>
|
||||
} catch (com.jcraft.jsch.JSchException e_<%=cid%>) {
|
||||
try {
|
||||
if(channel_<%=cid%>!=null) {
|
||||
channel_<%=cid%>.disconnect();
|
||||
}
|
||||
|
||||
if(session_<%=cid%>!=null) {
|
||||
session_<%=cid%>.disconnect();
|
||||
}
|
||||
} catch(java.lang.Exception ce_<%=cid%>) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.warn("<%=cid%> - close sftp connection failed : " + ce_<%=cid%>.getClass() + " : " + ce_<%=cid%>.getMessage());
|
||||
<%}%>
|
||||
}
|
||||
|
||||
String message_<%=cid%> = new TalendException(null, null, null).getExceptionCauseMessage(e_<%=cid%>);
|
||||
if(message_<%=cid%>.contains("Signature length not correct") || message_<%=cid%>.contains("connection is closed by foreign host")) {
|
||||
retry_<%=cid%> = true;
|
||||
retry_count_<%=cid%>++;
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - connect: Signature length not correct or connection is closed by foreign host, so retry, retry time : " + retry_count_<%=cid%>);
|
||||
<%}%>
|
||||
} else {
|
||||
throw e_<%=cid%>;
|
||||
}
|
||||
}
|
||||
} while(retry_<%=cid%> && (retry_count_<%=cid%> < retry_max_<%=cid%>));
|
||||
|
||||
com.jcraft.jsch.ChannelSftp c_<%=cid%> = (com.jcraft.jsch.ChannelSftp)channel_<%=cid%>;
|
||||
@@ -28,10 +28,11 @@ String authMethod = ElementParameterParser.getValue(node, "__AUTH_METHOD__");
|
||||
String privateKey = ElementParameterParser.getValue(node, "__PRIVATEKEY__");
|
||||
boolean ftps = ("true").equals(ElementParameterParser.getValue(node, "__FTPS__"));
|
||||
String keystoreFile = ElementParameterParser.getValue(node, "__KEYSTORE_FILE__");
|
||||
String sEncoding = ElementParameterParser.getValue(node, "__ENCODING__");
|
||||
String encoding = ElementParameterParser.getValue(node, "__ENCODING__");
|
||||
String securityMode = ElementParameterParser.getValue(node, "__SECURITY_MODE__");
|
||||
String protectionLevel = ElementParameterParser.getValue(node, "__FTPS_PROT__");
|
||||
String protectionBufferSize = ElementParameterParser.getValue(node, "__FTPS_PROTECTION_BUFF_SIZE__");
|
||||
String timeoutValue = ElementParameterParser.getValue(node, "__CONNECTION_TIMEOUT__");
|
||||
boolean useRemoteVerification = ("true").equals(ElementParameterParser.getValue(node, "__REMOTE_VERIFICATION__"));
|
||||
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
String passwordFieldName = "";
|
||||
@@ -60,37 +61,18 @@ if (ElementParameterParser.canEncrypt(node, passwordFieldName)) {
|
||||
});
|
||||
<%
|
||||
}
|
||||
|
||||
%>
|
||||
int connectionTimeout_<%=cid %> = Integer.valueOf(<%=timeoutValue %>);
|
||||
<%
|
||||
if (!sftp && !ftps) { // *** ftp *** //
|
||||
if(isLog4jEnabled){%>
|
||||
log.debug("<%=cid%> - " + <%=(("ACTIVE").equals(connectMode))?"\"Using the active mode.\"":"\"Using the passive mode.\""%>);
|
||||
<%}%>
|
||||
com.enterprisedt.net.ftp.FTPClient ftp_<%=cid %> = new com.enterprisedt.net.ftp.FTPClient();
|
||||
ftp_<%=cid %>.setRemoteHost(<%=host %>);
|
||||
ftp_<%=cid %>.setRemotePort(<%=port %>);
|
||||
%>
|
||||
com.enterprisedt.net.ftp.FTPClient ftp_<%=cid %> = null;
|
||||
<%
|
||||
passwordFieldName = "__PASS__";
|
||||
%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/ftp_connect.javajet"%>
|
||||
|
||||
<%if (("ACTIVE").equals(connectMode)) {%>
|
||||
ftp_<%=cid %>.setConnectMode(com.enterprisedt.net.ftp.FTPConnectMode.ACTIVE);
|
||||
<%} else {%>
|
||||
ftp_<%=cid %>.setConnectMode(com.enterprisedt.net.ftp.FTPConnectMode.PASV);
|
||||
<%}%>
|
||||
ftp_<%=cid %>.setControlEncoding(<%=sEncoding%>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Attempt to connect to '" + <%=host %> + "' with username '" +<%=user %>+ "'.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.connect();
|
||||
|
||||
<%
|
||||
passwordFieldName = "__PASS__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
ftp_<%=cid %>.login(<%=user %>, decryptedPassword_<%=cid%>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Connect to '" + <%=host %> + "' has succeeded.");
|
||||
<%}%>
|
||||
globalMap.put("conn_<%=cid%>",ftp_<%=cid %>);
|
||||
globalMap.put("conn_<%=cid%>",ftp_<%=cid %>);
|
||||
<%
|
||||
} else if (!ftps) { // *** sftp *** //
|
||||
%>
|
||||
@@ -138,99 +120,20 @@ if (!sftp && !ftps) { // *** ftp *** //
|
||||
passwordFieldName = "__PASS__";
|
||||
%>
|
||||
|
||||
<%@ include file="sftp_connect.javajet"%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/sftp_connect.javajet"%>
|
||||
|
||||
<%if(use_encoding) {%>
|
||||
c_<%=cid%>.setFilenameEncoding(<%=sEncoding%>);
|
||||
c_<%=cid%>.setFilenameEncoding(<%=encoding%>);
|
||||
<%}%>
|
||||
|
||||
globalMap.put("conn_<%=cid%>", c_<%=cid%>);
|
||||
<%
|
||||
} else { // *** ftps *** //
|
||||
%>
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> = null;
|
||||
|
||||
<%@ include file="../templates/FTP/ftpsTrust.javajet"%>
|
||||
javax.net.ssl.SSLContext sslContext_<%=cid %> = null;
|
||||
javax.net.ssl.TrustManager[] trustManager_<%=cid %> = null;
|
||||
javax.net.ssl.SSLSocketFactory sslSocketFactory_<%=cid %> = null;
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> = null;
|
||||
MyTrust_<%=cid%> myTrust_<%=cid%> = null;
|
||||
|
||||
try {
|
||||
sslContext_<%=cid %> = javax.net.ssl.SSLContext.getInstance("SSL");
|
||||
myTrust_<%=cid%> = new MyTrust_<%=cid%>();
|
||||
trustManager_<%=cid %> = myTrust_<%=cid%>.getTrustManagers();
|
||||
sslContext_<%=cid %>.init(null, trustManager_<%=cid %>, new java.security.SecureRandom());
|
||||
sslSocketFactory_<%=cid %> = sslContext_<%=cid %>.getSocketFactory();
|
||||
boolean isHTTPProxyUsed = "true".equals(System.getProperty("http.proxySet"));
|
||||
if (isHTTPProxyUsed) {
|
||||
String httpProxyHost = System.getProperty("http.proxyHost");
|
||||
int httpProxyPort = Integer.getInteger("http.proxyPort");
|
||||
String httpProxyUser = System.getProperty("http.proxyUser");
|
||||
String httpProxyPass = System.getProperty("http.proxyPassword");
|
||||
|
||||
ftp_<%=cid %> = new org.talend.ftp.HTTPProxyFTPSClient(<%="IMPLICIT".equals(securityMode)%>, sslContext_<%=cid %>, httpProxyHost, httpProxyPort, httpProxyUser, httpProxyPass);
|
||||
} else {
|
||||
ftp_<%=cid %> = new org.talend.ftp.SSLSessionReuseFTPSClient(<%="IMPLICIT".equals(securityMode)%>, sslContext_<%=cid %>);
|
||||
}
|
||||
ftp_<%=cid %>.setControlEncoding(<%=sEncoding %>);
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> -FTPS security Mode is <%=securityMode%>.");
|
||||
log.info("<%=cid%> - Attempt to connect to '" + <%=host %> + "' with username '" + <%=user %>+ "'.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.connect(<%=host %>,<%=ftpsPort%>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Connect to '" + <%=host %> + "' has succeeded.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.setRemoteVerificationEnabled(<%=useRemoteVerification %>);
|
||||
<%
|
||||
passwordFieldName = "__PASS__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
boolean isLoginSuccessful_<%=cid %> = ftp_<%=cid %>.login(<%=user %>, decryptedPassword_<%=cid%>);
|
||||
|
||||
if (!isLoginSuccessful_<%=cid %>) {
|
||||
throw new RuntimeException("Login failed");
|
||||
}
|
||||
|
||||
ftp_<%=cid %>.setFileType(org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE);
|
||||
<%
|
||||
if (protectionBufferSize != null && !protectionBufferSize.isEmpty() ) {
|
||||
%>
|
||||
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
|
||||
<%
|
||||
}
|
||||
|
||||
if (protectionLevel != null && !protectionLevel.isEmpty()) {
|
||||
%>
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} catch (Exception e) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - Can't create connection: " + e.getMessage());
|
||||
<%}%>
|
||||
throw e;
|
||||
}
|
||||
|
||||
<%
|
||||
if ("PASSIVE".equals(connectMode)) {
|
||||
%>
|
||||
ftp_<%=cid %>.enterLocalPassiveMode();
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
log.debug("<%=cid%> - Using the passive mode.");
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
||||
globalMap.put("conn_<%=cid%>", ftp_<%=cid %>);
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/ftps_connect.javajet"%>
|
||||
globalMap.put("conn_<%=cid%>", ftp_<%=cid %>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
@@ -232,6 +232,11 @@
|
||||
NUM_ROW="95" SHOW_IF="(FTPS=='true')" REPOSITORY_VALUE="REMOTE_VERIFICATION">
|
||||
<DEFAULT>true</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="CONNECTION_TIMEOUT" FIELD="TEXT"
|
||||
NUM_ROW="96" REPOSITORY_VALUE="CONNECTION_TIMEOUT">
|
||||
<DEFAULT>0</DEFAULT>
|
||||
</PARAMETER>
|
||||
</ADVANCED_PARAMETERS>
|
||||
|
||||
<CODEGENERATION>
|
||||
@@ -239,7 +244,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>
|
||||
|
||||
|
||||
@@ -40,4 +40,5 @@ SECURITY_MODE.NAME=Security Mode
|
||||
SECURITY_MODE.ITEM.IMPLICIT=Implicit
|
||||
SECURITY_MODE.ITEM.EXPLICIT=Explicit
|
||||
|
||||
USE_ENCODING.NAME=Filename encoding
|
||||
USE_ENCODING.NAME=Filename encoding
|
||||
CONNECTION_TIMEOUT.NAME=Connection timeout (milliseconds)
|
||||
@@ -43,6 +43,7 @@ boolean sftp = false;
|
||||
boolean ftps = false;
|
||||
String protectionLevel = ElementParameterParser.getValue(node, "__FTPS_PROT__");
|
||||
String protectionBufferSize = ElementParameterParser.getValue(node, "__FTPS_PROTECTION_BUFF_SIZE__");
|
||||
String timeoutValue = ElementParameterParser.getValue(node, "__CONNECTION_TIMEOUT__");
|
||||
boolean useRemoteVerification = ("true").equals(ElementParameterParser.getValue(node, "__REMOTE_VERIFICATION__"));
|
||||
if (("true").equals(useExistingConn)) {
|
||||
List<? extends INode> nodeList = node.getProcess().getGeneratingNodes();
|
||||
@@ -55,6 +56,9 @@ if (("true").equals(useExistingConn)) {
|
||||
} else {
|
||||
sftp = ("true").equals(ElementParameterParser.getValue(node, "__SFTP__"));
|
||||
ftps = ("true").equals(ElementParameterParser.getValue(node, "__FTPS__"));
|
||||
%>
|
||||
int connectionTimeout_<%=cid %> = Integer.valueOf(<%=timeoutValue %>);
|
||||
<%
|
||||
}
|
||||
|
||||
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
@@ -129,7 +133,7 @@ int nb_file_<%=cid%> = 0;
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="../tFTPConnection/sftp_connect.javajet"%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/sftp_connect.javajet"%>
|
||||
|
||||
<%if(use_encoding) {%>
|
||||
c_<%=cid%>.setFilenameEncoding(<%=encoding%>);
|
||||
@@ -167,101 +171,18 @@ int nb_file_<%=cid%> = 0;
|
||||
|
||||
<%
|
||||
} else if (ftps) { // *** ftps *** //
|
||||
%>
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> = null;
|
||||
<%
|
||||
if (("false").equals(useExistingConn)) {
|
||||
String keystoreFile = ElementParameterParser.getValue(node, "__KEYSTORE_FILE__");
|
||||
String securityMode = ElementParameterParser.getValue(node, "__SECURITY_MODE__");
|
||||
%>
|
||||
<%@ include file="../templates/FTP/ftpsTrust.javajet"%>
|
||||
javax.net.ssl.SSLContext sslContext_<%=cid %> = null;
|
||||
javax.net.ssl.TrustManager[] trustManager_<%=cid %> = null;
|
||||
javax.net.ssl.SSLSocketFactory sslSocketFactory_<%=cid %> = null;
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> =null;
|
||||
MyTrust_<%=cid %> myTrust_<%=cid%> = null;
|
||||
|
||||
try {
|
||||
sslContext_<%=cid %> = javax.net.ssl.SSLContext.getInstance("SSL");
|
||||
myTrust_<%=cid%> = new MyTrust_<%=cid%>();
|
||||
trustManager_<%=cid %> = myTrust_<%=cid%>.getTrustManagers();
|
||||
sslContext_<%=cid %>.init(null, trustManager_<%=cid %>, new java.security.SecureRandom());
|
||||
sslSocketFactory_<%=cid %> = sslContext_<%=cid %>.getSocketFactory();
|
||||
boolean isHTTPProxyUsed = "true".equals(System.getProperty("http.proxySet"));
|
||||
if (isHTTPProxyUsed) {
|
||||
String httpProxyHost = System.getProperty("http.proxyHost");
|
||||
int httpProxyPort = Integer.getInteger("http.proxyPort");
|
||||
String httpProxyUser = System.getProperty("http.proxyUser");
|
||||
String httpProxyPass = System.getProperty("http.proxyPassword");
|
||||
|
||||
ftp_<%=cid %> = new org.talend.ftp.HTTPProxyFTPSClient(<%="IMPLICIT".equals(securityMode)%>, sslContext_<%=cid %>, httpProxyHost, httpProxyPort, httpProxyUser, httpProxyPass);
|
||||
} else {
|
||||
ftp_<%=cid %> = new org.talend.ftp.SSLSessionReuseFTPSClient(<%="IMPLICIT".equals(securityMode)%>, sslContext_<%=cid %>);
|
||||
}
|
||||
ftp_<%=cid %>.setControlEncoding(<%=encoding%>);
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> -FTPS security Mode is <%=securityMode%>.");
|
||||
log.info("<%=cid%> - Attempt to connect to '" + <%=host %> + "' with username '" + <%=user %>+ "'.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.connect(<%=host %>,<%=ftpsPort %>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Connect to '" + <%=host %> + "' has succeeded.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.setRemoteVerificationEnabled(<%=useRemoteVerification %>);
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/ftps_connect.javajet"%>
|
||||
<%
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
boolean isLoginSuccessful_<%=cid %> = ftp_<%=cid %>.login(<%=user %>, decryptedPassword_<%=cid%>);
|
||||
|
||||
if (!isLoginSuccessful_<%=cid %>) {
|
||||
throw new RuntimeException("Login failed");
|
||||
}
|
||||
|
||||
<%
|
||||
if (protectionBufferSize != null && !protectionBufferSize.isEmpty() ) {
|
||||
%>
|
||||
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
|
||||
<%
|
||||
}
|
||||
|
||||
if (protectionLevel != null && !protectionLevel.isEmpty()) {
|
||||
%>
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} catch (Exception e) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - Can't create connection: " + e.getMessage());
|
||||
<%}%>
|
||||
<%
|
||||
if (dieOnError) {
|
||||
%>
|
||||
throw e;
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
e.printStackTrace();
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
|
||||
<%
|
||||
if ("PASSIVE".equals(connectMode)) {
|
||||
%>
|
||||
ftp_<%=cid %>.enterLocalPassiveMode();
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
log.debug("<%=cid%> - Using the passive mode.");
|
||||
<%
|
||||
}
|
||||
}
|
||||
} else {
|
||||
%>
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> = (org.apache.commons.net.ftp.FTPSClient) globalMap.get("<%=conn %>");
|
||||
ftp_<%=cid %> = (org.apache.commons.net.ftp.FTPSClient) globalMap.get("<%=conn %>");
|
||||
<%
|
||||
if (moveToCurrentDir) {
|
||||
%>
|
||||
@@ -303,36 +224,12 @@ int nb_file_<%=cid%> = 0;
|
||||
<%if(!moveToCurrentDir){%>
|
||||
String rootDir_<%=cid %> = ftp_<%=cid %>.pwd();
|
||||
<%}%>
|
||||
<%} else {%>
|
||||
ftp_<%=cid %> = new com.enterprisedt.net.ftp.FTPClient();
|
||||
ftp_<%=cid %>.setRemoteHost(<%=host %>);
|
||||
ftp_<%=cid %>.setRemotePort(<%=port %>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.debug("<%=cid%> - " + <%=(("ACTIVE").equals(connectMode))?"\"Using the active mode.\"":"\"Using the passive mode.\""%>);
|
||||
<%}%>
|
||||
<%if (("ACTIVE").equals(connectMode)) {%>
|
||||
ftp_<%=cid %>.setConnectMode(com.enterprisedt.net.ftp.FTPConnectMode.ACTIVE);
|
||||
<%} else {%>
|
||||
ftp_<%=cid %>.setConnectMode(com.enterprisedt.net.ftp.FTPConnectMode.PASV);
|
||||
<%}%>
|
||||
ftp_<%=cid %>.setControlEncoding(<%=encoding%>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Attempt to connect to '" + <%=host %> + "' with username: '" +<%=user %>+ "'.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.connect();
|
||||
|
||||
<%
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
ftp_<%=cid %>.login(<%=user %>, decryptedPassword_<%=cid%>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Connect to '" + <%=host %> + "' has succeeded.");
|
||||
<%}%>
|
||||
<%}%>
|
||||
java.util.List<java.util.Map<String,String>> list<%=cid %> = new java.util.ArrayList<java.util.Map<String,String>>();
|
||||
<%} else {
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/ftp_connect.javajet"%>
|
||||
<%}%>
|
||||
java.util.List<java.util.Map<String,String>> list<%=cid %> = new java.util.ArrayList<java.util.Map<String,String>>();
|
||||
|
||||
<%for (int i = 0; i < files.size(); i++) {
|
||||
Map<String, String> line = files.get(i);
|
||||
|
||||
@@ -288,6 +288,11 @@
|
||||
NUM_ROW="95" SHOW_IF="(FTPS=='true') AND (USE_EXISTING_CONNECTION == 'false')" REPOSITORY_VALUE="REMOTE_VERIFICATION">
|
||||
<DEFAULT>true</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="CONNECTION_TIMEOUT" FIELD="TEXT"
|
||||
NUM_ROW="96" SHOW_IF="USE_EXISTING_CONNECTION == 'false'" REPOSITORY_VALUE="CONNECTION_TIMEOUT">
|
||||
<DEFAULT>0</DEFAULT>
|
||||
</PARAMETER>
|
||||
</ADVANCED_PARAMETERS>
|
||||
|
||||
<CODEGENERATION>
|
||||
@@ -296,8 +301,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>
|
||||
|
||||
@@ -56,4 +56,5 @@ IGNORE_FAILURE_AT_QUIT.NAME=Ignore Failure At Quit
|
||||
PERL5_REGEX.NAME=Use Perl5 Regex Expressions as Filemask (Unchecked means Glob Expressions)
|
||||
MOVE_TO_THE_CURRENT_DIRECTORY.NAME=Move to the current directory
|
||||
|
||||
USE_ENCODING.NAME=Filename encoding
|
||||
USE_ENCODING.NAME=Filename encoding
|
||||
CONNECTION_TIMEOUT.NAME=Connection timeout (milliseconds)
|
||||
@@ -42,6 +42,7 @@ boolean ftps = false;
|
||||
|
||||
String protectionLevel = ElementParameterParser.getValue(node, "__FTPS_PROT__");
|
||||
String protectionBufferSize = ElementParameterParser.getValue(node, "__FTPS_PROTECTION_BUFF_SIZE__");
|
||||
String timeoutValue = ElementParameterParser.getValue(node, "__CONNECTION_TIMEOUT__");
|
||||
boolean useRemoteVerification = ("true").equals(ElementParameterParser.getValue(node, "__REMOTE_VERIFICATION__"));
|
||||
|
||||
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
@@ -57,6 +58,9 @@ if (("true").equals(useExistingConn)) {
|
||||
} else {
|
||||
sftp = ("true").equals(ElementParameterParser.getValue(node, "__SFTP__"));
|
||||
ftps = ("true").equals(ElementParameterParser.getValue(node, "__FTPS__"));
|
||||
%>
|
||||
int connectionTimeout_<%=cid %> = Integer.valueOf(<%=timeoutValue %>);
|
||||
<%
|
||||
}
|
||||
|
||||
String passwordFieldName = "";
|
||||
@@ -134,7 +138,7 @@ if (sftp) { // *** sftp *** //
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="../tFTPConnection/sftp_connect.javajet"%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/sftp_connect.javajet"%>
|
||||
|
||||
<%if(use_encoding) {%>
|
||||
c_<%=cid%>.setFilenameEncoding(<%=encoding%>);
|
||||
@@ -154,90 +158,18 @@ if (sftp) { // *** sftp *** //
|
||||
<%
|
||||
}
|
||||
} else if (ftps) { // *** ftps *** //
|
||||
%>
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> = null;
|
||||
<%
|
||||
if (("false").equals(useExistingConn)) {
|
||||
String keystoreFile = ElementParameterParser.getValue(node, "__KEYSTORE_FILE__");
|
||||
String securityMode = ElementParameterParser.getValue(node, "__SECURITY_MODE__");
|
||||
%>
|
||||
<%@ include file="../templates/FTP/ftpsTrust.javajet"%>
|
||||
javax.net.ssl.SSLContext sslContext_<%=cid %> = null;
|
||||
javax.net.ssl.TrustManager[] trustManager_<%=cid %> = null;
|
||||
javax.net.ssl.SSLSocketFactory sslSocketFactory_<%=cid %> = null;
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> =null;
|
||||
MyTrust_<%=cid %> myTrust_<%=cid%> = null;
|
||||
|
||||
try {
|
||||
sslContext_<%=cid %> = javax.net.ssl.SSLContext.getInstance("SSL");
|
||||
myTrust_<%=cid%> = new MyTrust_<%=cid%>();
|
||||
trustManager_<%=cid %> = myTrust_<%=cid%>.getTrustManagers();
|
||||
sslContext_<%=cid %>.init(null, trustManager_<%=cid %>, new java.security.SecureRandom());
|
||||
sslSocketFactory_<%=cid %> = sslContext_<%=cid %>.getSocketFactory();
|
||||
boolean isHTTPProxyUsed = "true".equals(System.getProperty("http.proxySet"));
|
||||
if (isHTTPProxyUsed) {
|
||||
String httpProxyHost = System.getProperty("http.proxyHost");
|
||||
int httpProxyPort = Integer.getInteger("http.proxyPort");
|
||||
String httpProxyUser = System.getProperty("http.proxyUser");
|
||||
String httpProxyPass = System.getProperty("http.proxyPassword");
|
||||
|
||||
ftp_<%=cid %> = new org.talend.ftp.HTTPProxyFTPSClient(<%="IMPLICIT".equals(securityMode)%>, sslContext_<%=cid %>, httpProxyHost, httpProxyPort, httpProxyUser, httpProxyPass);
|
||||
} else {
|
||||
ftp_<%=cid %> = new org.talend.ftp.SSLSessionReuseFTPSClient(<%="IMPLICIT".equals(securityMode)%>, sslContext_<%=cid %>);
|
||||
}
|
||||
ftp_<%=cid %>.setControlEncoding(<%=encoding%>);
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> -FTPS security Mode is <%=securityMode%>.");
|
||||
log.info("<%=cid%> - Attempt to connect to '" + <%=host %> + "' with username '" + <%=user %>+ "'.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.connect(<%=host %>,<%=ftpsPort %>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Connect to '" + <%=host %> + "' has succeeded.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.setRemoteVerificationEnabled(<%=useRemoteVerification %>);
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/ftps_connect.javajet"%>
|
||||
<%
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
boolean isLoginSuccessful_<%=cid %> = ftp_<%=cid %>.login(<%=user %>, decryptedPassword_<%=cid%>);
|
||||
|
||||
if (!isLoginSuccessful_<%=cid %>) {
|
||||
throw new RuntimeException("Login failed");
|
||||
}
|
||||
|
||||
<%
|
||||
if (protectionBufferSize != null && !protectionBufferSize.isEmpty() ) {
|
||||
%>
|
||||
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
|
||||
<%
|
||||
}
|
||||
|
||||
if (protectionLevel != null && !protectionLevel.isEmpty()) {
|
||||
%>
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} catch (Exception e) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - Can't create connection: " + e.getMessage());
|
||||
<%}%>
|
||||
throw e;
|
||||
}
|
||||
<%
|
||||
if ("PASSIVE".equals(connectMode)) {
|
||||
%>
|
||||
ftp_<%=cid %>.enterLocalPassiveMode();
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
log.debug("<%=cid%> - Using the passive mode.");
|
||||
<%
|
||||
}
|
||||
}
|
||||
} else {
|
||||
%>
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> = (org.apache.commons.net.ftp.FTPSClient) globalMap.get("<%=conn %>");
|
||||
ftp_<%=cid %> = (org.apache.commons.net.ftp.FTPSClient) globalMap.get("<%=conn %>");
|
||||
<%
|
||||
}
|
||||
} else { // *** ftp *** //
|
||||
@@ -251,36 +183,10 @@ if (sftp) { // *** sftp *** //
|
||||
log.info("<%=cid%> - Use an existing connection. Connection hostname: " + ftp_<%=cid %>.getRemoteHost() + ", Connection port: " + ftp_<%=cid %>.getRemotePort() + ".");
|
||||
}
|
||||
<%}%>
|
||||
<%} else {%>
|
||||
ftp_<%=cid %> = new com.enterprisedt.net.ftp.FTPClient();
|
||||
ftp_<%=cid %>.setRemoteHost(<%=host %>);
|
||||
ftp_<%=cid %>.setRemotePort(<%=port %>);
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.debug("<%=cid%> - " + <%=(("ACTIVE").equals(connectMode))?"\"Using the active mode.\"":"\"Using the passive mode.\""%>);
|
||||
<%}%>
|
||||
|
||||
<%if (("ACTIVE").equals(connectMode)) {%>
|
||||
ftp_<%=cid %>.setConnectMode(com.enterprisedt.net.ftp.FTPConnectMode.ACTIVE);
|
||||
<%} else {%>
|
||||
ftp_<%=cid %>.setConnectMode(com.enterprisedt.net.ftp.FTPConnectMode.PASV);
|
||||
<%}%>
|
||||
ftp_<%=cid %>.setControlEncoding(<%=encoding%>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Attempt to connect to '" + <%=host %> + "' with username: '" +<%=username %>+ "'.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.connect();
|
||||
|
||||
<%
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
ftp_<%=cid %>.login(<%=username %>, decryptedPassword_<%=cid%>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Connect to '" + <%=host%> + "' has succeeded.");
|
||||
<%}%>
|
||||
<%
|
||||
<%} else {
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/ftp_connect.javajet"%>
|
||||
<%
|
||||
}
|
||||
}%>
|
||||
|
||||
@@ -276,6 +276,11 @@ COMPATIBILITY="ALL"
|
||||
NUM_ROW="95" SHOW_IF="(FTPS=='true') AND (USE_EXISTING_CONNECTION == 'false')" REPOSITORY_VALUE="REMOTE_VERIFICATION">
|
||||
<DEFAULT>true</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="CONNECTION_TIMEOUT" FIELD="TEXT"
|
||||
NUM_ROW="96" SHOW_IF="USE_EXISTING_CONNECTION == 'false'" REPOSITORY_VALUE="CONNECTION_TIMEOUT">
|
||||
<DEFAULT>0</DEFAULT>
|
||||
</PARAMETER>
|
||||
</ADVANCED_PARAMETERS>
|
||||
|
||||
<CODEGENERATION>
|
||||
@@ -283,8 +288,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>
|
||||
|
||||
@@ -56,4 +56,5 @@ CONNECT_MODE.ITEM.PASSIVE=Passive
|
||||
|
||||
IGNORE_FAILURE_AT_QUIT.NAME=Ignore Failure At Quit
|
||||
|
||||
USE_ENCODING.NAME=Filename encoding
|
||||
USE_ENCODING.NAME=Filename encoding
|
||||
CONNECTION_TIMEOUT.NAME=Connection timeout (milliseconds)
|
||||
@@ -42,6 +42,7 @@ boolean sftp = false;
|
||||
boolean ftps = false;
|
||||
String protectionLevel = ElementParameterParser.getValue(node, "__FTPS_PROT__");
|
||||
String protectionBufferSize = ElementParameterParser.getValue(node, "__FTPS_PROTECTION_BUFF_SIZE__");
|
||||
String timeoutValue = ElementParameterParser.getValue(node, "__CONNECTION_TIMEOUT__");
|
||||
boolean useRemoteVerification = ("true").equals(ElementParameterParser.getValue(node, "__REMOTE_VERIFICATION__"));
|
||||
|
||||
if (("true").equals(useExistingConn)) {
|
||||
@@ -56,6 +57,9 @@ if (("true").equals(useExistingConn)) {
|
||||
} else {
|
||||
sftp = ("true").equals(ElementParameterParser.getValue(node, "__SFTP__"));
|
||||
ftps = ("true").equals(ElementParameterParser.getValue(node, "__FTPS__"));
|
||||
%>
|
||||
int connectionTimeout_<%=cid %> = Integer.valueOf(<%=timeoutValue %>);
|
||||
<%
|
||||
}
|
||||
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
String passwordFieldName = "";
|
||||
@@ -151,7 +155,7 @@ if (sftp) {// *** sftp *** //
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="../tFTPConnection/sftp_connect.javajet"%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/sftp_connect.javajet"%>
|
||||
|
||||
<%if(use_encoding) {%>
|
||||
c_<%=cid%>.setFilenameEncoding(<%=encoding%>);
|
||||
@@ -233,93 +237,18 @@ if (sftp) {// *** sftp *** //
|
||||
nb_file_<%=cid%>++;
|
||||
<%
|
||||
} else if (ftps) { // *** ftps *** //
|
||||
%>
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> = null;
|
||||
<%
|
||||
if (("false").equals(useExistingConn)) {
|
||||
String keystoreFile = ElementParameterParser.getValue(node, "__KEYSTORE_FILE__");
|
||||
String securityMode = ElementParameterParser.getValue(node, "__SECURITY_MODE__");
|
||||
%>
|
||||
<%@ include file="../templates/FTP/ftpsTrust.javajet"%>
|
||||
javax.net.ssl.SSLContext sslContext_<%=cid %> = null;
|
||||
javax.net.ssl.TrustManager[] trustManager_<%=cid %> = null;
|
||||
javax.net.ssl.SSLSocketFactory sslSocketFactory_<%=cid %> = null;
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> =null;
|
||||
MyTrust_<%=cid %> myTrust_<%=cid%> = null;
|
||||
|
||||
try {
|
||||
sslContext_<%=cid %> = javax.net.ssl.SSLContext.getInstance("SSL");
|
||||
myTrust_<%=cid%> = new MyTrust_<%=cid%>();
|
||||
trustManager_<%=cid %> = myTrust_<%=cid%>.getTrustManagers();
|
||||
sslContext_<%=cid %>.init(null, trustManager_<%=cid %>, new java.security.SecureRandom());
|
||||
sslSocketFactory_<%=cid %> = sslContext_<%=cid %>.getSocketFactory();
|
||||
boolean isHTTPProxyUsed = "true".equals(System.getProperty("http.proxySet"));
|
||||
if (isHTTPProxyUsed) {
|
||||
String httpProxyHost = System.getProperty("http.proxyHost");
|
||||
int httpProxyPort = Integer.getInteger("http.proxyPort");
|
||||
String httpProxyUser = System.getProperty("http.proxyUser");
|
||||
String httpProxyPass = System.getProperty("http.proxyPassword");
|
||||
|
||||
ftp_<%=cid %> = new org.talend.ftp.HTTPProxyFTPSClient(<%="IMPLICIT".equals(securityMode)%>, sslContext_<%=cid %>, httpProxyHost, httpProxyPort, httpProxyUser, httpProxyPass);
|
||||
} else {
|
||||
ftp_<%=cid %> = new org.talend.ftp.SSLSessionReuseFTPSClient(<%="IMPLICIT".equals(securityMode)%>, sslContext_<%=cid %>);
|
||||
}
|
||||
ftp_<%=cid %>.setControlEncoding(<%=encoding%>);
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> -FTPS security Mode is <%=securityMode%>.");
|
||||
log.info("<%=cid%> - Attempt to connect to '" + <%=host %> + "' with username '" + <%=user %>+ "'.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.connect(<%=host %>,<%=ftpsPort %>);
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/ftps_connect.javajet"%>
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Connect to '" + <%=host %> + "' has succeeded.");
|
||||
<%
|
||||
}
|
||||
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
ftp_<%=cid %>.setRemoteVerificationEnabled(<%=useRemoteVerification %>);
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
boolean isLoginSuccessful_<%=cid %> = ftp_<%=cid %>.login(<%=user %>, decryptedPassword_<%=cid%>);
|
||||
|
||||
if (!isLoginSuccessful_<%=cid %>) {
|
||||
throw new RuntimeException("Login failed");
|
||||
}
|
||||
|
||||
<%
|
||||
if (protectionBufferSize != null && !protectionBufferSize.isEmpty() ) {
|
||||
%>
|
||||
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
|
||||
<%
|
||||
}
|
||||
|
||||
if (protectionLevel != null && !protectionLevel.isEmpty()) {
|
||||
%>
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} catch (Exception e) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - Can't create connection: " + e.getMessage());
|
||||
<%}%>
|
||||
throw e;
|
||||
}
|
||||
<%
|
||||
if ("PASSIVE".equals(connectMode)) {
|
||||
%>
|
||||
ftp_<%=cid %>.enterLocalPassiveMode();
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
log.debug("<%=cid%> - Using the passive mode.");
|
||||
<%
|
||||
}
|
||||
}
|
||||
} else {
|
||||
%>
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> = (org.apache.commons.net.ftp.FTPSClient) globalMap.get("<%=conn %>");
|
||||
ftp_<%=cid %> = (org.apache.commons.net.ftp.FTPSClient) globalMap.get("<%=conn %>");
|
||||
String rootDir_<%=cid %> = ftp_<%=cid %>.printWorkingDirectory();
|
||||
<%
|
||||
}
|
||||
@@ -401,40 +330,15 @@ if (sftp) {// *** sftp *** //
|
||||
<%if(!moveToCurrentDir){%>
|
||||
String rootDir_<%=cid %> = ftp_<%=cid %>.pwd();
|
||||
<%}%>
|
||||
<%} else {%>
|
||||
ftp_<%=cid %> = new com.enterprisedt.net.ftp.FTPClient();
|
||||
ftp_<%=cid %>.setRemoteHost(<%=host %>);
|
||||
ftp_<%=cid %>.setRemotePort(<%=port %>);
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.debug("<%=cid%> - " + <%=(("ACTIVE").equals(connectMode))?"\"Using the active mode.\"":"\"Using the passive mode.\""%>);
|
||||
<%}%>
|
||||
<%if (("ACTIVE").equals(connectMode)) {%>
|
||||
ftp_<%=cid %>.setConnectMode(com.enterprisedt.net.ftp.FTPConnectMode.ACTIVE);
|
||||
<%} else {%>
|
||||
ftp_<%=cid %>.setConnectMode(com.enterprisedt.net.ftp.FTPConnectMode.PASV);
|
||||
<%}%>
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Attempt to connect to '" + <%=host %> + "' with username '" +<%=user %>+ "'.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.setControlEncoding(<%=encoding%>);
|
||||
ftp_<%=cid %>.connect();
|
||||
|
||||
<%
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
ftp_<%=cid %>.login(<%=user %>, decryptedPassword_<%=cid%>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Connect to '" + <%=host %> + "' has succeeded.");
|
||||
<%}%>
|
||||
<%} else {
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/ftp_connect.javajet"%>
|
||||
<%}%>
|
||||
String remotedir_<%=cid %> = (<%=remotedir%>).replaceAll("\\\\","/");
|
||||
ftp_<%=cid %>.chdir(remotedir_<%=cid %>);
|
||||
String[] fileList_<%=cid %> = ftp_<%=cid %>.dir(null, true);
|
||||
String[] fileListwithNames_<%=cid %> = ftp_<%=cid %>.dir(null, false);
|
||||
com.enterprisedt.net.ftp.FTPFile[] fileList_<%=cid %> = ftp_<%=cid %>.dirDetails(null);
|
||||
String[] arrayWithNames_<%=cid %> = ftp_<%=cid %>.dir(null, false);
|
||||
<%
|
||||
if (("true").equals(useExistingConn)) {
|
||||
if(!moveToCurrentDir){
|
||||
@@ -445,17 +349,22 @@ if (sftp) {// *** sftp *** //
|
||||
}
|
||||
%>
|
||||
List<String> fileListTemp_<%=cid %> = new java.util.ArrayList<String>();
|
||||
List<String> fileListTempWithNames_<%=cid %> = new java.util.ArrayList<String>();
|
||||
List<String> fileListTempWithNames_<%=cid %> = new java.util.ArrayList<String>();
|
||||
|
||||
for (String filemask_<%=cid %> : maskList_<%=cid %>) {
|
||||
java.util.regex.Pattern fileNamePattern_<%=cid %> = java.util.regex.Pattern.compile(filemask_<%=cid %>.replaceAll("\\.", "\\\\.").replaceAll("\\*", ".*"));
|
||||
for (int i_<%=cid%> = 0; i_<%=cid%> < fileList_<%=cid%>.length; i_<%=cid%>++){
|
||||
String filemaskTemp_<%=cid%> = fileList_<%=cid%>[i_<%=cid%>];
|
||||
String filemaskTempName_<%=cid%> = fileListwithNames_<%=cid%>[i_<%=cid%>];
|
||||
|
||||
if (fileNamePattern_<%=cid %>.matcher(filemaskTempName_<%=cid %>).matches()) {
|
||||
fileListTemp_<%=cid %>.add(filemaskTemp_<%=cid %>);
|
||||
fileListTempWithNames_<%=cid%>.add(fileListwithNames_<%=cid%>[i_<%=cid%>]);
|
||||
|
||||
java.util.Set<String> setWithNames_<%=cid %> = new java.util.HashSet<>(java.util.Arrays.asList(arrayWithNames_<%=cid %>));
|
||||
for (com.enterprisedt.net.ftp.FTPFile ftpFile : fileList_<%=cid %>){
|
||||
String filemaskTemp_<%=cid%> = "";
|
||||
String filemaskTempName_<%=cid%> = "";
|
||||
if (setWithNames_<%=cid %>.contains(ftpFile.getName())){
|
||||
filemaskTemp_<%=cid%> = ftpFile.getRaw();
|
||||
filemaskTempName_<%=cid%> = ftpFile.getName();
|
||||
if (fileNamePattern_<%=cid %>.matcher(filemaskTempName_<%=cid %>).matches()) {
|
||||
fileListTemp_<%=cid %>.add(filemaskTemp_<%=cid %>);
|
||||
fileListTempWithNames_<%=cid%>.add(filemaskTempName_<%=cid%>);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,6 +254,11 @@
|
||||
NUM_ROW="95" SHOW_IF="(FTPS=='true') AND (USE_EXISTING_CONNECTION == 'false')" REPOSITORY_VALUE="REMOTE_VERIFICATION">
|
||||
<DEFAULT>true</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="CONNECTION_TIMEOUT" FIELD="TEXT"
|
||||
NUM_ROW="96" SHOW_IF="USE_EXISTING_CONNECTION == 'false'" REPOSITORY_VALUE="CONNECTION_TIMEOUT">
|
||||
<DEFAULT>0</DEFAULT>
|
||||
</PARAMETER>
|
||||
</ADVANCED_PARAMETERS>
|
||||
|
||||
<CODEGENERATION>
|
||||
@@ -261,8 +266,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>
|
||||
|
||||
@@ -51,4 +51,5 @@ FILES.NAME=Files
|
||||
FILES.ITEM.FILEMASK=Filemask
|
||||
MOVE_TO_THE_CURRENT_DIRECTORY.NAME=Move to the current directory
|
||||
|
||||
USE_ENCODING.NAME=Filename encoding
|
||||
USE_ENCODING.NAME=Filename encoding
|
||||
CONNECTION_TIMEOUT.NAME=Connection timeout (milliseconds)
|
||||
@@ -46,6 +46,7 @@ boolean ftps = false;
|
||||
|
||||
String protectionLevel = ElementParameterParser.getValue(node, "__FTPS_PROT__");
|
||||
String protectionBufferSize = ElementParameterParser.getValue(node, "__FTPS_PROTECTION_BUFF_SIZE__");
|
||||
String timeoutValue = ElementParameterParser.getValue(node, "__CONNECTION_TIMEOUT__");
|
||||
boolean useRemoteVerification = ("true").equals(ElementParameterParser.getValue(node, "__REMOTE_VERIFICATION__"));
|
||||
|
||||
log4jFileUtil.componentStartInfo(node);
|
||||
@@ -62,6 +63,9 @@ if (("true").equals(useExistingConn)) {
|
||||
} else {
|
||||
sftp = ("true").equals(ElementParameterParser.getValue(node, "__SFTP__"));
|
||||
ftps = ("true").equals(ElementParameterParser.getValue(node, "__FTPS__"));
|
||||
%>
|
||||
int connectionTimeout_<%=cid %> = Integer.valueOf(<%=timeoutValue %>);
|
||||
<%
|
||||
}
|
||||
|
||||
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
@@ -153,9 +157,9 @@ if (sftp) { // *** sftp *** //
|
||||
<%
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="../tFTPConnection/sftp_connect.javajet"%>
|
||||
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/sftp_connect.javajet"%>
|
||||
|
||||
<%if(use_encoding) {%>
|
||||
c_<%=cid%>.setFilenameEncoding(<%=encoding%>);
|
||||
<%}%>
|
||||
@@ -203,90 +207,18 @@ if (sftp) { // *** sftp *** //
|
||||
}
|
||||
<%
|
||||
} else if (ftps) { // *** ftps *** //
|
||||
%>
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> = null;
|
||||
<%
|
||||
if (("false").equals(useExistingConn)) {
|
||||
String keystoreFile = ElementParameterParser.getValue(node, "__KEYSTORE_FILE__");
|
||||
String securityMode = ElementParameterParser.getValue(node, "__SECURITY_MODE__");
|
||||
%>
|
||||
<%@ include file="../templates/FTP/ftpsTrust.javajet"%>
|
||||
javax.net.ssl.SSLContext sslContext_<%=cid %> = null;
|
||||
javax.net.ssl.TrustManager[] trustManager_<%=cid %> = null;
|
||||
javax.net.ssl.SSLSocketFactory sslSocketFactory_<%=cid %> = null;
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> =null;
|
||||
MyTrust_<%=cid %> myTrust_<%=cid%> = null;
|
||||
try {
|
||||
sslContext_<%=cid %> = javax.net.ssl.SSLContext.getInstance("SSL");
|
||||
myTrust_<%=cid%> = new MyTrust_<%=cid%>();
|
||||
trustManager_<%=cid %> = myTrust_<%=cid%>.getTrustManagers();
|
||||
sslContext_<%=cid %>.init(null, trustManager_<%=cid %>, new java.security.SecureRandom());
|
||||
sslSocketFactory_<%=cid %> = sslContext_<%=cid %>.getSocketFactory();
|
||||
boolean isHTTPProxyUsed = "true".equals(System.getProperty("http.proxySet"));
|
||||
if (isHTTPProxyUsed) {
|
||||
String httpProxyHost = System.getProperty("http.proxyHost");
|
||||
int httpProxyPort = Integer.getInteger("http.proxyPort");
|
||||
String httpProxyUser = System.getProperty("http.proxyUser");
|
||||
String httpProxyPass = System.getProperty("http.proxyPassword");
|
||||
|
||||
ftp_<%=cid %> = new org.talend.ftp.HTTPProxyFTPSClient(<%="IMPLICIT".equals(securityMode)%>, sslContext_<%=cid %>, httpProxyHost, httpProxyPort, httpProxyUser, httpProxyPass);
|
||||
} else {
|
||||
ftp_<%=cid %> = new org.talend.ftp.SSLSessionReuseFTPSClient(<%="IMPLICIT".equals(securityMode)%>, sslContext_<%=cid %>);
|
||||
}
|
||||
ftp_<%=cid %>.setControlEncoding(<%=encoding%>);
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> -FTPS security Mode is <%=securityMode%>.");
|
||||
log.info("<%=cid%> - Attempt to connect to '" + <%=host %> + "' with username '" + <%=user %>+ "'.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.connect(<%=host %>,<%=ftpsPort %>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Connect to '" + <%=host %> + "' has succeeded.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.setRemoteVerificationEnabled(<%=useRemoteVerification %>);
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/ftps_connect.javajet"%>
|
||||
<%
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
boolean isLoginSuccessful_<%=cid %> = ftp_<%=cid %>.login(<%=user %>, decryptedPassword_<%=cid%>);
|
||||
|
||||
if (!isLoginSuccessful_<%=cid %>) {
|
||||
throw new RuntimeException("Login failed");
|
||||
}
|
||||
|
||||
ftp_<%=cid %>.setFileType(org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE); //to calculate md5 for binary files correctly
|
||||
<%
|
||||
if (protectionBufferSize != null && !protectionBufferSize.isEmpty() ) {
|
||||
%>
|
||||
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
|
||||
<%
|
||||
}
|
||||
|
||||
if (protectionLevel != null && !protectionLevel.isEmpty()) {
|
||||
%>
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} catch (Exception e) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - Can't create connection: " + e.getMessage());
|
||||
<%}%>
|
||||
throw e;
|
||||
}
|
||||
<%
|
||||
if ("PASSIVE".equals(connectMode)) {
|
||||
%>
|
||||
ftp_<%=cid %>.enterLocalPassiveMode();
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
log.debug("<%=cid%> - Using the passive mode.");
|
||||
<%
|
||||
}
|
||||
}
|
||||
} else {
|
||||
%>
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> = (org.apache.commons.net.ftp.FTPSClient) globalMap.get("<%=conn %>");
|
||||
ftp_<%=cid %> = (org.apache.commons.net.ftp.FTPSClient) globalMap.get("<%=conn %>");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
@@ -341,36 +273,11 @@ if (sftp) { // *** sftp *** //
|
||||
log.info("<%=cid%> - Use an existing connection. Connection hostname: " + ftp_<%=cid %>.getRemoteHost() + ", Connection port: " + ftp_<%=cid %>.getRemotePort() + ".");
|
||||
}
|
||||
<%}%>
|
||||
<%} else {%>
|
||||
ftp_<%=cid %> = new com.enterprisedt.net.ftp.FTPClient();
|
||||
ftp_<%=cid %>.setRemoteHost(<%=host %>);
|
||||
ftp_<%=cid %>.setRemotePort(<%=port %>);
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.debug("<%=cid%> - " + <%=(("ACTIVE").equals(connectMode))?"\"Using the active mode.\"":"\"Using the passive mode.\""%>);
|
||||
<%}%>
|
||||
<%if (("ACTIVE").equals(connectMode)) {%>
|
||||
ftp_<%=cid %>.setConnectMode(com.enterprisedt.net.ftp.FTPConnectMode.ACTIVE);
|
||||
<%} else {%>
|
||||
ftp_<%=cid %>.setConnectMode(com.enterprisedt.net.ftp.FTPConnectMode.PASV);
|
||||
<%}%>
|
||||
ftp_<%=cid %>.setControlEncoding(<%=encoding%>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Attempt to connect to '" + <%=host %> + "' with username '" +<%=user %>+ "'.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.connect();
|
||||
|
||||
<%
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
ftp_<%=cid %>.login(<%=username %>, decryptedPassword_<%=cid%>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Connect to '" + <%=host %> + "' has succeeded.");
|
||||
<%}%>
|
||||
<%}%>
|
||||
<%} else {
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/ftp_connect.javajet"%>
|
||||
<%}%>
|
||||
<%
|
||||
//add feature 19709,add the "Transfer mode" option,
|
||||
//the default transfer mode is ASCII,we don't change the mode when ascii is choosed.
|
||||
|
||||
@@ -251,6 +251,11 @@
|
||||
NUM_ROW="95" SHOW_IF="(FTPS=='true') AND (USE_EXISTING_CONNECTION == 'false')" REPOSITORY_VALUE="REMOTE_VERIFICATION">
|
||||
<DEFAULT>true</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="CONNECTION_TIMEOUT" FIELD="TEXT"
|
||||
NUM_ROW="96" SHOW_IF="USE_EXISTING_CONNECTION == 'false'" REPOSITORY_VALUE="CONNECTION_TIMEOUT">
|
||||
<DEFAULT>0</DEFAULT>
|
||||
</PARAMETER>
|
||||
</ADVANCED_PARAMETERS>
|
||||
|
||||
<CODEGENERATION>
|
||||
@@ -258,8 +263,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>
|
||||
|
||||
@@ -50,4 +50,5 @@ MODE.ITEM.ASCII=ascii
|
||||
MODE.ITEM.BINARY=binary
|
||||
MODE.NAME=Transfer mode
|
||||
|
||||
USE_ENCODING.NAME=Filename encoding
|
||||
USE_ENCODING.NAME=Filename encoding
|
||||
CONNECTION_TIMEOUT.NAME=Connection timeout (milliseconds)
|
||||
@@ -49,6 +49,7 @@ boolean sftp = false;
|
||||
boolean ftps = false;
|
||||
String protectionLevel = ElementParameterParser.getValue(node, "__FTPS_PROT__");
|
||||
String protectionBufferSize = ElementParameterParser.getValue(node, "__FTPS_PROTECTION_BUFF_SIZE__");
|
||||
String timeoutValue = ElementParameterParser.getValue(node, "__CONNECTION_TIMEOUT__");
|
||||
boolean useRemoteVerification = ("true").equals(ElementParameterParser.getValue(node, "__REMOTE_VERIFICATION__"));
|
||||
|
||||
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
@@ -66,6 +67,9 @@ if ("true".equals(useExistingConn)) {
|
||||
} else {
|
||||
sftp = ("true").equals(ElementParameterParser.getValue(node, "__SFTP__"));
|
||||
ftps = ("true").equals(ElementParameterParser.getValue(node, "__FTPS__"));
|
||||
%>
|
||||
int connectionTimeout_<%=cid %> = Integer.valueOf(<%=timeoutValue %>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
int nb_file_<%=cid%> = 0;
|
||||
@@ -286,7 +290,7 @@ if (sftp) { // *** sftp *** //
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="../tFTPConnection/sftp_connect.javajet"%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/sftp_connect.javajet"%>
|
||||
|
||||
<%if(use_encoding) {%>
|
||||
c_<%=cid%>.setFilenameEncoding(<%=encoding%>);
|
||||
@@ -528,41 +532,11 @@ if (sftp) { // *** sftp *** //
|
||||
log.info("<%=cid%> - Uses an existing connection. Connection hostname: " + ftp_<%=cid %>.getRemoteHost() + ", Connection port: " + ftp_<%=cid %>.getRemotePort() + ".");
|
||||
}
|
||||
<%}%>
|
||||
<%} else {%>
|
||||
ftp_<%=cid %> = new com.enterprisedt.net.ftp.FTPClient();
|
||||
ftp_<%=cid %>.setRemoteHost(<%=host %>);
|
||||
ftp_<%=cid %>.setRemotePort(<%=port %>);
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.debug("<%=cid%> - " + <%=(("ACTIVE").equals(connectMode))?"\"Using the active mode.\"":"\"Using the passive mode.\""%>);
|
||||
<%}
|
||||
if (("ACTIVE").equals(connectMode)){
|
||||
%>
|
||||
ftp_<%=cid %>.setConnectMode(com.enterprisedt.net.ftp.FTPConnectMode.ACTIVE);
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
ftp_<%=cid %>.setConnectMode(com.enterprisedt.net.ftp.FTPConnectMode.PASV);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
ftp_<%=cid %>.setControlEncoding(<%=encoding%>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Attempt to connect to '" + <%=host %> + "' with username '" +<%=user %>+ "'.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.connect();
|
||||
|
||||
<%
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
ftp_<%=cid %>.login(<%=user %>, decryptedPassword_<%=cid%>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Connect to '" + <%=host %> + "' has succeeded.");
|
||||
<%}%>
|
||||
<%} %>
|
||||
<%} else {
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/ftp_connect.javajet"%>
|
||||
<%} %>
|
||||
msg_<%=cid%>.clearAll();
|
||||
FTPGetter_<%=cid%> getter_<%=cid%> = new FTPGetter_<%=cid%>();
|
||||
getter_<%=cid%>.ftpClient = ftp_<%=cid %>;
|
||||
@@ -650,96 +624,8 @@ if (sftp) { // *** sftp *** //
|
||||
<%
|
||||
if ("false".equals(useExistingConn)){
|
||||
%>
|
||||
<% /* create connection */ %>
|
||||
<%@ include file="../templates/FTP/ftpsTrust.javajet"%>
|
||||
|
||||
javax.net.ssl.SSLContext sslContext_<%=cid%> = null;
|
||||
javax.net.ssl.TrustManager[] trustManager_<%=cid%> = null;
|
||||
javax.net.ssl.SSLSocketFactory sslSocketFactory_<%=cid%> = null;
|
||||
|
||||
MyTrust_<%=cid %> myTrust_<%=cid%> = null;
|
||||
|
||||
try {
|
||||
sslContext_<%=cid %> = javax.net.ssl.SSLContext.getInstance("SSL");
|
||||
myTrust_<%=cid%> = new MyTrust_<%=cid%>();
|
||||
trustManager_<%=cid %> = myTrust_<%=cid%>.getTrustManagers();
|
||||
sslContext_<%=cid %>.init(null, trustManager_<%=cid %>, new java.security.SecureRandom());
|
||||
sslSocketFactory_<%=cid %> = sslContext_<%=cid%>.getSocketFactory();
|
||||
boolean isHTTPProxyUsed = "true".equals(System.getProperty("http.proxySet"));
|
||||
if (isHTTPProxyUsed) {
|
||||
String httpProxyHost = System.getProperty("http.proxyHost");
|
||||
int httpProxyPort = Integer.getInteger("http.proxyPort");
|
||||
String httpProxyUser = System.getProperty("http.proxyUser");
|
||||
String httpProxyPass = System.getProperty("http.proxyPassword");
|
||||
|
||||
ftp_<%=cid %> = new org.talend.ftp.HTTPProxyFTPSClient(<%="IMPLICIT".equals(securityMode)%>, sslContext_<%=cid %>, httpProxyHost, httpProxyPort, httpProxyUser, httpProxyPass);
|
||||
} else {
|
||||
ftp_<%=cid %> = new org.talend.ftp.SSLSessionReuseFTPSClient(<%="IMPLICIT".equals(securityMode)%>, sslContext_<%=cid %>);
|
||||
}
|
||||
ftp_<%=cid %>.setControlEncoding(<%=encoding%>);
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> -FTPS security Mode is <%=securityMode%>.");
|
||||
log.info("<%=cid%> - Attempt to connect to '" + <%=host %> + "' with username '" + <%=user %>+ "'.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.connect(<%=host %>,<%=ftpsPort %>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Connect to '" + <%=host %> + "' has succeeded.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.setRemoteVerificationEnabled(<%=useRemoteVerification %>);
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/ftps_connect.javajet"%>
|
||||
<%
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
boolean isLoginSuccessful_<%=cid %> = ftp_<%=cid %>.login(<%=user %>, decryptedPassword_<%=cid%>);
|
||||
|
||||
if (!isLoginSuccessful_<%=cid %>) {
|
||||
throw new RuntimeException("Login failed");
|
||||
}
|
||||
|
||||
ftp_<%=cid %>.setFileType(org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE);
|
||||
<%
|
||||
if (protectionBufferSize != null && !protectionBufferSize.isEmpty() ) {
|
||||
%>
|
||||
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
|
||||
<%
|
||||
}
|
||||
|
||||
if (protectionLevel != null && !protectionLevel.isEmpty()) {
|
||||
%>
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} catch (Exception e) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - Can't create connection: " + e.getMessage());
|
||||
<%}%>
|
||||
<%
|
||||
if (dieOnError) {
|
||||
%>
|
||||
throw e;
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
e.printStackTrace();
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
if ("PASSIVE".equals(connectMode)) {
|
||||
%>
|
||||
ftp_<%=cid %>.enterLocalPassiveMode();
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
log.debug("<%=cid%> - Using the passive mode.");
|
||||
<%
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String conn= "conn_" + connection;
|
||||
%>
|
||||
|
||||
@@ -294,6 +294,11 @@ COMPATIBILITY="ALL"
|
||||
NUM_ROW="100" SHOW_IF="(FTPS=='true') AND (USE_EXISTING_CONNECTION == 'false')" REPOSITORY_VALUE="REMOTE_VERIFICATION">
|
||||
<DEFAULT>true</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="CONNECTION_TIMEOUT" FIELD="TEXT"
|
||||
NUM_ROW="96" SHOW_IF="USE_EXISTING_CONNECTION == 'false'" REPOSITORY_VALUE="CONNECTION_TIMEOUT">
|
||||
<DEFAULT>0</DEFAULT>
|
||||
</PARAMETER>
|
||||
</ADVANCED_PARAMETERS>
|
||||
|
||||
<CODEGENERATION>
|
||||
@@ -302,8 +307,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>
|
||||
|
||||
@@ -68,4 +68,5 @@ PRINT_MESSAGE.NAME=Print message
|
||||
PERL5_REGEX.NAME=Use Perl5 Regex Expressions as Filemask (Unchecked means Glob Expressions)
|
||||
MOVE_TO_THE_CURRENT_DIRECTORY.NAME=Move to the current directory
|
||||
|
||||
USE_ENCODING.NAME=Filename encoding
|
||||
USE_ENCODING.NAME=Filename encoding
|
||||
CONNECTION_TIMEOUT.NAME=Connection timeout (milliseconds)
|
||||
@@ -46,6 +46,7 @@ boolean ftps = false;
|
||||
|
||||
String protectionLevel = ElementParameterParser.getValue(node, "__FTPS_PROT__");
|
||||
String protectionBufferSize = ElementParameterParser.getValue(node, "__FTPS_PROTECTION_BUFF_SIZE__");
|
||||
String timeoutValue = ElementParameterParser.getValue(node, "__CONNECTION_TIMEOUT__");
|
||||
boolean useRemoteVerification = ("true").equals(ElementParameterParser.getValue(node, "__REMOTE_VERIFICATION__"));
|
||||
|
||||
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
@@ -62,8 +63,11 @@ if (("true").equals(useExistingConn)) {
|
||||
}
|
||||
} else {
|
||||
sftp = ("true").equals(ElementParameterParser.getValue(node, "__SFTP__"));
|
||||
ftps = ("true").equals(ElementParameterParser.getValue(node, "__FTPS__"));
|
||||
}
|
||||
ftps = ("true").equals(ElementParameterParser.getValue(node, "__FTPS__"));
|
||||
%>
|
||||
int connectionTimeout_<%=cid %> = Integer.valueOf(<%=timeoutValue %>);
|
||||
<%
|
||||
}
|
||||
|
||||
//The following part support the socks proxy for FTP and SFTP (Socks V4 or V5, they are all OK).
|
||||
//And it can not work with the FTP proxy directly, only support the socks proxy.
|
||||
@@ -150,8 +154,8 @@ int nb_file_<%=cid%> = 0;
|
||||
<%
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="../tFTPConnection/sftp_connect.javajet"%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/sftp_connect.javajet"%>
|
||||
|
||||
<%if(use_encoding) {%>
|
||||
c_<%=cid%>.setFilenameEncoding(<%=encoding%>);
|
||||
@@ -242,37 +246,11 @@ int nb_file_<%=cid%> = 0;
|
||||
log.info("<%=cid%> - Uses an existing connection. Connection hostname: " + ftp_<%=cid %>.getRemoteHost() + ", Connection port: " + ftp_<%=cid %>.getRemotePort() + ".");
|
||||
}
|
||||
<%}%>
|
||||
<%} else {%>
|
||||
ftp_<%=cid %> = new com.enterprisedt.net.ftp.FTPClient();
|
||||
ftp_<%=cid %>.setRemoteHost(<%=host %>);
|
||||
ftp_<%=cid %>.setRemotePort(<%=port %>);
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.debug("<%=cid%> - " + <%=(("ACTIVE").equals(connectMode))?"\"Using the active mode.\"":"\"Using the passive mode.\""%>);
|
||||
<%}%>
|
||||
|
||||
<%if (("ACTIVE").equals(connectMode)) {%>
|
||||
ftp_<%=cid %>.setConnectMode(com.enterprisedt.net.ftp.FTPConnectMode.ACTIVE);
|
||||
<%} else {%>
|
||||
ftp_<%=cid %>.setConnectMode(com.enterprisedt.net.ftp.FTPConnectMode.PASV);
|
||||
<%}%>
|
||||
ftp_<%=cid %>.setControlEncoding(<%=encoding%>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Attempt to connect to '" + <%=host %> + "' with username '" +<%=user %>+ "'.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.connect();
|
||||
|
||||
<%
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
ftp_<%=cid %>.login(<%=user %>, decryptedPassword_<%=cid%>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Connect to '" + <%=host %> + "' has succeeded.");
|
||||
<%}%>
|
||||
<%}%>
|
||||
<%} else {
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/ftp_connect.javajet"%>
|
||||
<%}%>
|
||||
|
||||
String rootDir_<%=cid %> = ftp_<%=cid %>.pwd();
|
||||
// msg_<%=cid%> likes a String[] to save the message from transfer.
|
||||
@@ -335,96 +313,8 @@ int nb_file_<%=cid%> = 0;
|
||||
<%
|
||||
if(("false").equals(useExistingConn)){
|
||||
%>
|
||||
<% /* create connection */ %>
|
||||
<%@ include file="../templates/FTP/ftpsTrust.javajet"%>
|
||||
|
||||
javax.net.ssl.SSLContext sslContext_<%=cid%> = null;
|
||||
javax.net.ssl.TrustManager[] trustManager_<%=cid%> = null;
|
||||
javax.net.ssl.SSLSocketFactory sslSocketFactory_<%=cid%> = null;
|
||||
|
||||
MyTrust_<%=cid %> myTrust_<%=cid%> = null;
|
||||
|
||||
try {
|
||||
sslContext_<%=cid %> = javax.net.ssl.SSLContext.getInstance("SSL");
|
||||
myTrust_<%=cid%> = new MyTrust_<%=cid%>();
|
||||
trustManager_<%=cid %> = myTrust_<%=cid%>.getTrustManagers();
|
||||
sslContext_<%=cid %>.init(null, trustManager_<%=cid %>, new java.security.SecureRandom());
|
||||
sslSocketFactory_<%=cid %> = sslContext_<%=cid%>.getSocketFactory();
|
||||
boolean isHTTPProxyUsed = "true".equals(System.getProperty("http.proxySet"));
|
||||
if (isHTTPProxyUsed) {
|
||||
String httpProxyHost = System.getProperty("http.proxyHost");
|
||||
int httpProxyPort = Integer.getInteger("http.proxyPort");
|
||||
String httpProxyUser = System.getProperty("http.proxyUser");
|
||||
String httpProxyPass = System.getProperty("http.proxyPassword");
|
||||
|
||||
ftp_<%=cid %> = new org.talend.ftp.HTTPProxyFTPSClient(<%="IMPLICIT".equals(securityMode)%>, sslContext_<%=cid %>, httpProxyHost, httpProxyPort, httpProxyUser, httpProxyPass);
|
||||
} else {
|
||||
ftp_<%=cid %> = new org.talend.ftp.SSLSessionReuseFTPSClient(<%="IMPLICIT".equals(securityMode)%>, sslContext_<%=cid %>);
|
||||
}
|
||||
ftp_<%=cid %>.setControlEncoding(<%=encoding%>);
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> -FTPS security Mode is <%=securityMode%>.");
|
||||
log.info("<%=cid%> - Attempt to connect to '" + <%=host %> + "' with username '" + <%=user %>+ "'.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.connect(<%=host %>,<%=ftpsPort %>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Connect to '" + <%=host %> + "' has succeeded.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.setRemoteVerificationEnabled(<%=useRemoteVerification %>);
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/ftps_connect.javajet"%>
|
||||
<%
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
boolean isLoginSuccessful_<%=cid %> = ftp_<%=cid %>.login(<%=user %>, decryptedPassword_<%=cid%>);
|
||||
|
||||
if (!isLoginSuccessful_<%=cid %>) {
|
||||
throw new RuntimeException("Login failed");
|
||||
}
|
||||
|
||||
ftp_<%=cid %>.setFileType(org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE);
|
||||
<%
|
||||
if (protectionBufferSize != null && !protectionBufferSize.isEmpty() ) {
|
||||
%>
|
||||
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
|
||||
<%
|
||||
}
|
||||
|
||||
if (protectionLevel != null && !protectionLevel.isEmpty()) {
|
||||
%>
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} catch (Exception e) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - Can't create connection: " + e.getMessage());
|
||||
<%}%>
|
||||
<%
|
||||
if (dieOnError) {
|
||||
%>
|
||||
throw e;
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
e.printStackTrace();
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
if ("PASSIVE".equals(connectMode)) {
|
||||
%>
|
||||
ftp_<%=cid %>.enterLocalPassiveMode();
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
log.debug("<%=cid%> - Using the passive mode.");
|
||||
<%
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String conn= "conn_" + connection;
|
||||
%>
|
||||
|
||||
@@ -339,6 +339,11 @@ COMPATIBILITY="ALL"
|
||||
NUM_ROW="100" SHOW_IF="(FTPS=='true') AND (USE_EXISTING_CONNECTION == 'false')" REPOSITORY_VALUE="REMOTE_VERIFICATION">
|
||||
<DEFAULT>true</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="CONNECTION_TIMEOUT" FIELD="TEXT"
|
||||
NUM_ROW="96" SHOW_IF="USE_EXISTING_CONNECTION == 'false'" REPOSITORY_VALUE="CONNECTION_TIMEOUT">
|
||||
<DEFAULT>0</DEFAULT>
|
||||
</PARAMETER>
|
||||
</ADVANCED_PARAMETERS>
|
||||
|
||||
<CODEGENERATION>
|
||||
@@ -346,8 +351,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>
|
||||
|
||||
@@ -73,4 +73,5 @@ FTPSOVERWRITE.ITEM.NEVER=never
|
||||
FTPSOVERWRITE.ITEM.ALWAYS=always
|
||||
FTPSOVERWRITE.NAME=Overwrite file
|
||||
|
||||
USE_ENCODING.NAME=Filename encoding
|
||||
USE_ENCODING.NAME=Filename encoding
|
||||
CONNECTION_TIMEOUT.NAME=Connection timeout (milliseconds)
|
||||
@@ -42,6 +42,7 @@ boolean ftps = false;
|
||||
|
||||
String protectionLevel = ElementParameterParser.getValue(node, "__FTPS_PROT__");
|
||||
String protectionBufferSize = ElementParameterParser.getValue(node, "__FTPS_PROTECTION_BUFF_SIZE__");
|
||||
String timeoutValue = ElementParameterParser.getValue(node, "__CONNECTION_TIMEOUT__");
|
||||
boolean useRemoteVerification = ("true").equals(ElementParameterParser.getValue(node, "__REMOTE_VERIFICATION__"));
|
||||
|
||||
boolean dieOnError = ("true").equals(ElementParameterParser.getValue(node,"__DIE_ON_ERROR__"));
|
||||
@@ -57,6 +58,9 @@ if (("true").equals(useExistingConn)) {
|
||||
} else {
|
||||
sftp = ("true").equals(ElementParameterParser.getValue(node, "__SFTP__"));
|
||||
ftps = ("true").equals(ElementParameterParser.getValue(node, "__FTPS__"));
|
||||
%>
|
||||
int connectionTimeout_<%=cid %> = Integer.valueOf(<%=timeoutValue %>);
|
||||
<%
|
||||
}
|
||||
|
||||
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
@@ -131,9 +135,9 @@ if (sftp) { // *** sftp *** //
|
||||
<%
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="../tFTPConnection/sftp_connect.javajet"%>
|
||||
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/sftp_connect.javajet"%>
|
||||
|
||||
<%if(use_encoding) {%>
|
||||
c_<%=cid%>.setFilenameEncoding(<%=encoding%>);
|
||||
<%}%>
|
||||
@@ -173,99 +177,18 @@ if (sftp) { // *** sftp *** //
|
||||
|
||||
<%
|
||||
} else if (ftps) { // *** ftps *** //
|
||||
%>
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> = null;
|
||||
<%
|
||||
if (("false").equals(useExistingConn)) {
|
||||
String keystoreFile = ElementParameterParser.getValue(node, "__KEYSTORE_FILE__");
|
||||
String securityMode = ElementParameterParser.getValue(node, "__SECURITY_MODE__");
|
||||
%>
|
||||
<%@ include file="../templates/FTP/ftpsTrust.javajet"%>
|
||||
javax.net.ssl.SSLContext sslContext_<%=cid %> = null;
|
||||
javax.net.ssl.TrustManager[] trustManager_<%=cid %> = null;
|
||||
javax.net.ssl.SSLSocketFactory sslSocketFactory_<%=cid %> = null;
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> =null;
|
||||
MyTrust_<%=cid %> myTrust_<%=cid%> = null;
|
||||
try {
|
||||
sslContext_<%=cid %> = javax.net.ssl.SSLContext.getInstance("SSL");
|
||||
myTrust_<%=cid%> = new MyTrust_<%=cid%>();
|
||||
trustManager_<%=cid %> = myTrust_<%=cid%>.getTrustManagers();
|
||||
sslContext_<%=cid %>.init(null, trustManager_<%=cid %>, new java.security.SecureRandom());
|
||||
sslSocketFactory_<%=cid %> = sslContext_<%=cid %>.getSocketFactory();
|
||||
boolean isHTTPProxyUsed = "true".equals(System.getProperty("http.proxySet"));
|
||||
if (isHTTPProxyUsed) {
|
||||
String httpProxyHost = System.getProperty("http.proxyHost");
|
||||
int httpProxyPort = Integer.getInteger("http.proxyPort");
|
||||
String httpProxyUser = System.getProperty("http.proxyUser");
|
||||
String httpProxyPass = System.getProperty("http.proxyPassword");
|
||||
|
||||
ftp_<%=cid %> = new org.talend.ftp.HTTPProxyFTPSClient(<%="IMPLICIT".equals(securityMode)%>, sslContext_<%=cid %>, httpProxyHost, httpProxyPort, httpProxyUser, httpProxyPass);
|
||||
} else {
|
||||
ftp_<%=cid %> = new org.talend.ftp.SSLSessionReuseFTPSClient(<%="IMPLICIT".equals(securityMode)%>, sslContext_<%=cid %>);
|
||||
}
|
||||
ftp_<%=cid %>.setControlEncoding(<%=encoding%>);
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> -FTPS security Mode is <%=securityMode%>.");
|
||||
log.info("<%=cid%> - Attempt to connect to '" + <%=host %> + "' with username '" + <%=user %>+ "'.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.connect(<%=host %>,<%=ftpsPort %>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Connect to '" + <%=host %> + "' has succeeded.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.setRemoteVerificationEnabled(<%=useRemoteVerification %>);
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/ftps_connect.javajet"%>
|
||||
<%
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
boolean isLoginSuccessful_<%=cid %> = ftp_<%=cid %>.login(<%=user %>, decryptedPassword_<%=cid%>);
|
||||
|
||||
if (!isLoginSuccessful_<%=cid %>) {
|
||||
throw new RuntimeException("Login failed");
|
||||
}
|
||||
|
||||
<%
|
||||
if (protectionBufferSize != null && !protectionBufferSize.isEmpty() ) {
|
||||
%>
|
||||
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
|
||||
<%
|
||||
}
|
||||
|
||||
if (protectionLevel != null && !protectionLevel.isEmpty()) {
|
||||
%>
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} catch (Exception e) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - Can't create connection: " + e.getMessage());
|
||||
<%}%>
|
||||
<%
|
||||
if (dieOnError) {
|
||||
%>
|
||||
throw e;
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
e.printStackTrace();
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
<%
|
||||
if ("PASSIVE".equals(connectMode)) {
|
||||
%>
|
||||
ftp_<%=cid %>.enterLocalPassiveMode();
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
log.debug("<%=cid%> - Using the passive mode.");
|
||||
<%
|
||||
}
|
||||
}
|
||||
} else {
|
||||
%>
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> = (org.apache.commons.net.ftp.FTPSClient) globalMap.get("<%=conn %>");
|
||||
ftp_<%=cid %> = (org.apache.commons.net.ftp.FTPSClient) globalMap.get("<%=conn %>");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
@@ -308,36 +231,11 @@ if (sftp) { // *** sftp *** //
|
||||
<%if(!moveToCurrentDir){%>
|
||||
String rootDir_<%=cid %> = ftp_<%=cid %>.pwd();
|
||||
<%}%>
|
||||
<%} else {%>
|
||||
ftp_<%=cid %> = new com.enterprisedt.net.ftp.FTPClient();
|
||||
ftp_<%=cid %>.setRemoteHost(<%=host %>);
|
||||
ftp_<%=cid %>.setRemotePort(<%=port %>);
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.debug("<%=cid%> - " + <%=(("ACTIVE").equals(connectMode))?"\"Using the active mode.\"":"\"Using the passive mode.\""%>);
|
||||
<%}%>
|
||||
<%if (("ACTIVE").equals(connectMode)) {%>
|
||||
ftp_<%=cid %>.setConnectMode(com.enterprisedt.net.ftp.FTPConnectMode.ACTIVE);
|
||||
<%} else {%>
|
||||
ftp_<%=cid %>.setConnectMode(com.enterprisedt.net.ftp.FTPConnectMode.PASV);
|
||||
<%}%>
|
||||
ftp_<%=cid %>.setControlEncoding(<%=encoding%>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Attempt to connect to '" + <%=host %> + "' with username '" +<%=user %>+ "'.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.connect();
|
||||
|
||||
<%
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
ftp_<%=cid %>.login(<%=user %>, decryptedPassword_<%=cid%>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Connect to '" + <%=host %> + "' has succeeded.");
|
||||
<%}%>
|
||||
<%}%>
|
||||
<%} else {
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/ftp_connect.javajet"%>
|
||||
<%}%>
|
||||
java.util.List<java.util.Map<String,String>> list<%=cid %> = new java.util.ArrayList<java.util.Map<String,String>>();
|
||||
|
||||
<%
|
||||
|
||||
@@ -257,6 +257,11 @@ COMPATIBILITY="ALL"
|
||||
NUM_ROW="95" SHOW_IF="(FTPS=='true') AND (USE_EXISTING_CONNECTION == 'false')" REPOSITORY_VALUE="REMOTE_VERIFICATION">
|
||||
<DEFAULT>true</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="CONNECTION_TIMEOUT" FIELD="TEXT"
|
||||
NUM_ROW="96" SHOW_IF="USE_EXISTING_CONNECTION == 'false'" REPOSITORY_VALUE="CONNECTION_TIMEOUT">
|
||||
<DEFAULT>0</DEFAULT>
|
||||
</PARAMETER>
|
||||
</ADVANCED_PARAMETERS>
|
||||
|
||||
<CODEGENERATION>
|
||||
@@ -264,8 +269,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>
|
||||
|
||||
@@ -55,4 +55,5 @@ CONNECT_MODE.ITEM.PASSIVE=Passive
|
||||
IGNORE_FAILURE_AT_QUIT.NAME=Ignore Failure At Quit
|
||||
MOVE_TO_THE_CURRENT_DIRECTORY.NAME=Move to the current directory
|
||||
|
||||
USE_ENCODING.NAME=Filename encoding
|
||||
USE_ENCODING.NAME=Filename encoding
|
||||
CONNECTION_TIMEOUT.NAME=Connection timeout (milliseconds)
|
||||
@@ -41,6 +41,7 @@ boolean sftp = false;
|
||||
boolean ftps = false;
|
||||
String protectionLevel = ElementParameterParser.getValue(node, "__FTPS_PROT__");
|
||||
String protectionBufferSize = ElementParameterParser.getValue(node, "__FTPS_PROTECTION_BUFF_SIZE__");
|
||||
String timeoutValue = ElementParameterParser.getValue(node, "__CONNECTION_TIMEOUT__");
|
||||
boolean useRemoteVerification = ("true").equals(ElementParameterParser.getValue(node, "__REMOTE_VERIFICATION__"));
|
||||
|
||||
if (("true").equals(useExistingConn)) {
|
||||
@@ -55,6 +56,9 @@ if (("true").equals(useExistingConn)) {
|
||||
} else {
|
||||
sftp = ("true").equals(ElementParameterParser.getValue(node, "__SFTP__"));
|
||||
ftps = ("true").equals(ElementParameterParser.getValue(node, "__FTPS__"));
|
||||
%>
|
||||
int connectionTimeout_<%=cid %> = Integer.valueOf(<%=timeoutValue %>);
|
||||
<%
|
||||
}
|
||||
|
||||
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
@@ -131,7 +135,7 @@ if (sftp) {// *** sftp *** //
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="../tFTPConnection/sftp_connect.javajet"%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/sftp_connect.javajet"%>
|
||||
|
||||
<%if(use_encoding) {%>
|
||||
c_<%=cid%>.setFilenameEncoding(<%=encoding%>);
|
||||
@@ -168,92 +172,19 @@ if (sftp) {// *** sftp *** //
|
||||
|
||||
<%
|
||||
} else if (ftps) { // *** ftps *** //
|
||||
%>
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> = null;
|
||||
<%
|
||||
/* creating connection */
|
||||
if (("false").equals(useExistingConn)) {
|
||||
String keystoreFile = ElementParameterParser.getValue(node, "__KEYSTORE_FILE__");
|
||||
String securityMode = ElementParameterParser.getValue(node, "__SECURITY_MODE__");
|
||||
%>
|
||||
<%@ include file="../templates/FTP/ftpsTrust.javajet"%>
|
||||
javax.net.ssl.SSLContext sslContext_<%=cid %> = null;
|
||||
javax.net.ssl.TrustManager[] trustManager_<%=cid %> = null;
|
||||
javax.net.ssl.SSLSocketFactory sslSocketFactory_<%=cid %> = null;
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> =null;
|
||||
MyTrust_<%=cid %> myTrust_<%=cid%> = null;
|
||||
|
||||
try {
|
||||
sslContext_<%=cid %> = javax.net.ssl.SSLContext.getInstance("SSL");
|
||||
myTrust_<%=cid%> = new MyTrust_<%=cid%>();
|
||||
trustManager_<%=cid %> = myTrust_<%=cid%>.getTrustManagers();
|
||||
sslContext_<%=cid %>.init(null, trustManager_<%=cid %>, new java.security.SecureRandom());
|
||||
sslSocketFactory_<%=cid %> = sslContext_<%=cid %>.getSocketFactory();
|
||||
boolean isHTTPProxyUsed = "true".equals(System.getProperty("http.proxySet"));
|
||||
if (isHTTPProxyUsed) {
|
||||
String httpProxyHost = System.getProperty("http.proxyHost");
|
||||
int httpProxyPort = Integer.getInteger("http.proxyPort");
|
||||
String httpProxyUser = System.getProperty("http.proxyUser");
|
||||
String httpProxyPass = System.getProperty("http.proxyPassword");
|
||||
|
||||
ftp_<%=cid %> = new org.talend.ftp.HTTPProxyFTPSClient(<%="IMPLICIT".equals(securityMode)%>, sslContext_<%=cid %>, httpProxyHost, httpProxyPort, httpProxyUser, httpProxyPass);
|
||||
} else {
|
||||
ftp_<%=cid %> = new org.talend.ftp.SSLSessionReuseFTPSClient(<%="IMPLICIT".equals(securityMode)%>, sslContext_<%=cid %>);
|
||||
}
|
||||
ftp_<%=cid %>.setControlEncoding(<%=encoding%>);
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> -FTPS security Mode is <%=securityMode%>.");
|
||||
log.info("<%=cid%> - Attempt to connect to '" + <%=host %> + "' with username '" + <%=user %>+ "'.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.connect(<%=host %>,<%=ftpsPort %>);
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/ftps_connect.javajet"%>
|
||||
<%
|
||||
if(isLog4jEnabled){
|
||||
%>
|
||||
log.info("<%=cid%> - Connect to '" + <%=host %> + "' has succeeded.");
|
||||
<%
|
||||
}
|
||||
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
ftp_<%=cid %>.setRemoteVerificationEnabled(<%=useRemoteVerification %>);
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
boolean isLoginSuccessful_<%=cid %> = ftp_<%=cid %>.login(<%=user %>, decryptedPassword_<%=cid%>);
|
||||
|
||||
if (!isLoginSuccessful_<%=cid %>) {
|
||||
throw new RuntimeException("Login failed");
|
||||
}
|
||||
<%
|
||||
if (protectionBufferSize != null && !protectionBufferSize.isEmpty() ) {
|
||||
%>
|
||||
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
|
||||
<%
|
||||
}
|
||||
|
||||
if (protectionLevel != null && !protectionLevel.isEmpty()) {
|
||||
%>
|
||||
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
} catch (Exception e) {
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.error("<%=cid%> - Can't create connection: " + e.getMessage());
|
||||
<%}%>
|
||||
throw e;
|
||||
}
|
||||
<%
|
||||
if ("PASSIVE".equals(connectMode)) {
|
||||
%>
|
||||
ftp_<%=cid %>.enterLocalPassiveMode();
|
||||
<%
|
||||
if (isLog4jEnabled) {
|
||||
%>
|
||||
log.debug("<%=cid%> - Using the passive mode.");
|
||||
<%
|
||||
}
|
||||
}
|
||||
} else {
|
||||
%>
|
||||
org.apache.commons.net.ftp.FTPSClient ftp_<%=cid %> = (org.apache.commons.net.ftp.FTPSClient) globalMap.get("<%=conn %>");
|
||||
ftp_<%=cid %> = (org.apache.commons.net.ftp.FTPSClient) globalMap.get("<%=conn %>");
|
||||
<%
|
||||
if (moveToCurrentDir) {
|
||||
%>
|
||||
@@ -295,36 +226,11 @@ if (sftp) {// *** sftp *** //
|
||||
<%if(!moveToCurrentDir){%>
|
||||
String rootDir_<%=cid %> = ftp_<%=cid %>.pwd();
|
||||
<%}%>
|
||||
<%} else {%>
|
||||
ftp_<%=cid %> = new com.enterprisedt.net.ftp.FTPClient();
|
||||
ftp_<%=cid %>.setRemoteHost(<%=host %>);
|
||||
ftp_<%=cid %>.setRemotePort(<%=port %>);
|
||||
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.debug("<%=cid%> - " + <%=(("ACTIVE").equals(connectMode))?"\"Using the active mode.\"":"\"Using the passive mode.\""%>);
|
||||
<%}%>
|
||||
<% if (("ACTIVE").equals(connectMode)) {%>
|
||||
ftp_<%=cid %>.setConnectMode(com.enterprisedt.net.ftp.FTPConnectMode.ACTIVE);
|
||||
<%} else {%>
|
||||
ftp_<%=cid %>.setConnectMode(com.enterprisedt.net.ftp.FTPConnectMode.PASV);
|
||||
<%}%>
|
||||
ftp_<%=cid %>.setControlEncoding(<%=encoding%>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Attempt to connect to '" + <%=host %> + "' with username '" +<%=user %>+ "'.");
|
||||
<%}%>
|
||||
ftp_<%=cid %>.connect();
|
||||
|
||||
<%
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
ftp_<%=cid %>.login(<%=user %>, decryptedPassword_<%=cid%>);
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Connect to '" + <%=host %> + "' has succeeded.");
|
||||
<%}%>
|
||||
<%}%>
|
||||
<%} else {
|
||||
passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/FTP/ftp_connect.javajet"%>
|
||||
<%}%>
|
||||
java.util.List<java.util.Map<String,String>> list<%=cid %> = new java.util.ArrayList<java.util.Map<String,String>>();
|
||||
|
||||
<%for (int i = 0; i < files.size(); i++) {
|
||||
|
||||
@@ -245,6 +245,11 @@ COMPATIBILITY="ALL"
|
||||
NUM_ROW="95" SHOW_IF="(FTPS=='true') AND (USE_EXISTING_CONNECTION == 'false')" REPOSITORY_VALUE="REMOTE_VERIFICATION">
|
||||
<DEFAULT>true</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="CONNECTION_TIMEOUT" FIELD="TEXT"
|
||||
NUM_ROW="96" SHOW_IF="USE_EXISTING_CONNECTION == 'false'" REPOSITORY_VALUE="CONNECTION_TIMEOUT">
|
||||
<DEFAULT>0</DEFAULT>
|
||||
</PARAMETER>
|
||||
</ADVANCED_PARAMETERS>
|
||||
|
||||
<CODEGENERATION>
|
||||
@@ -253,8 +258,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>
|
||||
|
||||
@@ -52,4 +52,5 @@ IGNORE_FAILURE_AT_QUIT.NAME=Ignore Failure At Quit
|
||||
PERL5_REGEX.NAME=Use Perl5 Regex Expressions as Filemask (Unchecked means Glob Expressions)
|
||||
MOVE_TO_THE_CURRENT_DIRECTORY.NAME=Move to the current directory
|
||||
|
||||
USE_ENCODING.NAME=Filename encoding
|
||||
USE_ENCODING.NAME=Filename encoding
|
||||
CONNECTION_TIMEOUT.NAME=Connection timeout (milliseconds)
|
||||
@@ -131,10 +131,10 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="COMMONS-COMPRESS-1.10" MODULE="commons-compress-1.10.jar" MVN="mvn:org.talend.libraries/commons-compress-1.10/6.1.0" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-compress-1.10.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="Encrypt-Zip" MODULE="checkArchive-1.1-20181130.jar" MVN="mvn:org.talend.libraries/checkArchive-1.1-20181130/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/checkArchive-1.1-20181130.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="zip4j_1.3.1.jar" MODULE="zip4j_1.3.1.jar" MVN="mvn:org.talend.libraries/zip4j_1.3.1/6.0.0" REQUIRED="true" />
|
||||
<IMPORT NAME="talendzip-1.0-20190527.jar" MODULE="talendzip-1.0-20190527.jar" MVN="mvn:org.talend.libraries/talendzip/1.0-20190527" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talendzip-1.0-20190527.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="commons-compress-1.19" MODULE="commons-compress-1.19.jar" MVN="mvn:org.apache.commons/commons-compress/1.19" REQUIRED="true" />
|
||||
<IMPORT NAME="Encrypt-Zip" MODULE="checkArchive-1.1-20190917.jar" MVN="mvn:org.talend.libraries/checkArchive-1.1-20190917/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/checkArchive-1.1-20190917.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="zip4j-1.3.3.jar" MODULE="zip4j-1.3.3.jar" MVN="mvn:net.lingala.zip4j/zip4j/1.3.3" REQUIRED="true" />
|
||||
<IMPORT NAME="talendzip-1.0-20190917.jar" MODULE="talendzip-1.0-20190917.jar" MVN="mvn:org.talend.libraries/talendzip/1.0-20190917" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talendzip-1.0-20190917.jar" REQUIRED="true" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
%>
|
||||
|
||||
<%@ include file="../templates/Log4j/Log4jFileUtil.javajet"%>
|
||||
|
||||
|
||||
<%
|
||||
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
|
||||
INode node = (INode)codeGenArgument.getArgument();
|
||||
String cid = node.getUniqueName();
|
||||
String cid = node.getUniqueName();
|
||||
|
||||
String directory = ElementParameterParser.getValue(node, "__SOURCE__");
|
||||
String zipFile = ElementParameterParser.getValue(node, "__TARGET__");
|
||||
@@ -24,16 +24,16 @@
|
||||
boolean overwrite = ("true").equals(ElementParameterParser.getValue(node, "__OVERWRITE__"));
|
||||
String encoding = ElementParameterParser.getValue(node,"__ENCODING__");
|
||||
boolean isEncrypted = ("true").equals(ElementParameterParser.getValue(node, "__ENCRYPT_FILES__"));
|
||||
|
||||
List<Map<String, String>> masks = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__MASK__");
|
||||
|
||||
|
||||
List<Map<String, String>> masks = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__MASK__");
|
||||
|
||||
String zip64Mode = ElementParameterParser.getValue(node, "__ZIP64_MODE__");
|
||||
String encryptMethod = ElementParameterParser.getValue(node, "__ENCRYPT_METHOD__");
|
||||
String aesKeyStrength = ElementParameterParser.getValue(node, "__AES_KEY_STRENGTH__");
|
||||
|
||||
|
||||
String archiveFormat = ElementParameterParser.getValue(node, "__ARCHIVE_FORMAT__");
|
||||
String sourceFile = ElementParameterParser.getValue(node, "__SOURCE_FILE__");
|
||||
|
||||
|
||||
boolean isSyncFlush = "true".equals(ElementParameterParser.getValue(node, "__USE_SYNC_FLUSH__"));
|
||||
|
||||
log4jFileUtil.componentStartInfo(node);
|
||||
@@ -47,6 +47,11 @@
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
if (java.nio.file.Files.notExists(java.nio.file.Paths.get(sourceFile_<%=cid %>), java.nio.file.LinkOption.NOFOLLOW_LINKS)){
|
||||
throw new java.io.FileNotFoundException(sourceFile_<%=cid %> + " (The system cannot find the path specified)");
|
||||
}
|
||||
|
||||
String zipFile_<%=cid %> = <%=zipFile %>;
|
||||
|
||||
com.talend.compress.zip.Zip zip_<%=cid%> = new com.talend.compress.zip.Zip(sourceFile_<%=cid %>, zipFile_<%=cid %>);
|
||||
|
||||
Binary file not shown.
@@ -55,6 +55,17 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
String mode = ElementParameterParser.getValue(node,"__GENERATION_MODE__");
|
||||
final boolean eventMode = "EVENT_MODE".equals(mode);
|
||||
|
||||
if (version07) {
|
||||
String passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
String password_<%=cid%> = decryptedPassword_<%=cid%>;
|
||||
if (password_<%=cid%>.isEmpty()){
|
||||
password_<%=cid%> = null;
|
||||
}
|
||||
<%
|
||||
}
|
||||
|
||||
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
|
||||
int dynamic_index = -1;
|
||||
@@ -692,9 +703,9 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
org.apache.poi.xssf.usermodel.XSSFWorkbook workbook_<%=cid%> = null;
|
||||
|
||||
if(source_<%=cid %> instanceof String){
|
||||
workbook_<%=cid%> = new org.apache.poi.xssf.usermodel.XSSFWorkbook((String)source_<%=cid %>);
|
||||
workbook_<%=cid%> = (org.apache.poi.xssf.usermodel.XSSFWorkbook) org.apache.poi.ss.usermodel.WorkbookFactory.create(new java.io.File((String)source_<%=cid %>), password_<%=cid%>);
|
||||
} else if(source_<%=cid %> instanceof java.io.InputStream) {
|
||||
workbook_<%=cid%> = new org.apache.poi.xssf.usermodel.XSSFWorkbook((java.io.InputStream)source_<%=cid %>);
|
||||
workbook_<%=cid%> = (org.apache.poi.xssf.usermodel.XSSFWorkbook) org.apache.poi.ss.usermodel.WorkbookFactory.create((java.io.InputStream)source_<%=cid %>, password_<%=cid%>);
|
||||
} else{
|
||||
workbook_<%=cid%> = null;
|
||||
throw new java.lang.Exception("The data source should be specified as Inputstream or File Path!");
|
||||
@@ -1266,9 +1277,9 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
char decimalChar_<%=cid %> = df_<%=cid %>.getDecimalFormatSymbols().getDecimalSeparator();
|
||||
|
||||
if(source_<%=cid %> instanceof String){
|
||||
excelReader_<%=cid%>.parse((String)source_<%=cid %>,<%=encoding %>);
|
||||
excelReader_<%=cid%>.parse((String)source_<%=cid %>,<%=encoding %>, password_<%=cid%>);
|
||||
} else if(source_<%=cid %> instanceof java.io.InputStream) {
|
||||
excelReader_<%=cid%>.parse((java.io.InputStream)source_<%=cid %>,<%=encoding %>);
|
||||
excelReader_<%=cid%>.parse((java.io.InputStream)source_<%=cid %>,<%=encoding %>, password_<%=cid%>);
|
||||
}
|
||||
<%
|
||||
if(hasDynamic){
|
||||
|
||||
@@ -39,6 +39,10 @@
|
||||
<DEFAULT>"__COMP_DEFAULT_FILE_DIR__/in.xls"</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="PASSWORD" FIELD="PASSWORD" REQUIRED="false" SHOW_IF="(VERSION_2007 == 'true')" NUM_ROW="25">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="ALL_SHEETS" FIELD="CHECK" REQUIRED="true" NUM_ROW="30" REPOSITORY_VALUE="SELECT_ALL_SHEETS">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
@@ -182,10 +186,10 @@
|
||||
<IMPORT NAME="poi-ooxml-schemas" MODULE="poi-ooxml-schemas-4.1.0-20190523141255_modified_talend.jar" MVN="mvn:org.apache.poi/poi-ooxml-schemas/4.1.0-20190523141255_modified_talend" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-ooxml-schemas-4.1.0-20190523141255_modified_talend.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="poi-scratchpad" MODULE="poi-scratchpad-4.1.0-20190523141255_modified_talend.jar" MVN="mvn:org.apache.poi/poi-scratchpad/4.1.0-20190523141255_modified_talend" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/poi-scratchpad-4.1.0-20190523141255_modified_talend.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="xmlbeans" MODULE="xmlbeans-3.1.0.jar" MVN="mvn:org.apache.xmlbeans/xmlbeans/3.1.0" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="simpleexcel" MODULE="simpleexcel-2.1-20190507.jar" MVN="mvn:org.talend.libraries/simpleexcel-2.1-20190507/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/simpleexcel-2.1-20190507.jar" REQUIRED_IF="(VERSION_2007 == 'true') AND GENERATION_MODE == 'EVENT_MODE')" />
|
||||
<IMPORT NAME="simpleexcel" MODULE="simpleexcel-2.2-20190722.jar" MVN="mvn:org.talend.libraries/simpleexcel-2.2-20190722/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/simpleexcel-2.2-20190722.jar" REQUIRED_IF="(VERSION_2007 == 'true') AND GENERATION_MODE == 'EVENT_MODE')" />
|
||||
<IMPORT NAME="commons-collections4" MODULE="commons-collections4-4.1.jar" MVN="mvn:org.talend.libraries/commons-collections4-4.1/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/commons-collections4-4.1.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
|
||||
<IMPORT NAME="commons-compress" MODULE="commons-compress-1.18.jar" MVN="mvn:org.apache.commons/commons-compress/1.18" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="commons-compress" MODULE="commons-compress-1.19.jar" MVN="mvn:org.apache.commons/commons-compress/1.19" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="commons-math3" MODULE="commons-math3-3.6.1.jar" MVN="mvn:org.apache.commons/commons-math3/3.6.1" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -8,6 +8,7 @@ DIE_ON_ERROR.NAME=Die on error
|
||||
ENCODING.NAME=Encoding
|
||||
END_OF_FILE.NAME=End Of File
|
||||
FILENAME.NAME=File Name/Input Stream
|
||||
PASSWORD.NAME=Password
|
||||
FIRST_COLUMN.NAME=First column
|
||||
FOOTER.NAME=Footer
|
||||
HEADER.NAME=Header
|
||||
@@ -29,7 +30,7 @@ STOPREAD_ON_EMPTYROW.NAME=Stop to read on empty row
|
||||
SUPPRESS_WARN.NAME=Ignore the warning
|
||||
THOUSANDS_SEPARATOR.NAME=Thousands separator
|
||||
WITH_FORMAT.NAME=With format
|
||||
VERSION_2007.NAME=Read excel2007 file format(xlsx)
|
||||
VERSION_2007.NAME=Read excel2007 file format (xlsx / xlsm)
|
||||
TRIMALL.NAME=Trim all column
|
||||
TRIMSELECT.ITEM.TRIM=Trim
|
||||
TRIMSELECT.NAME=Check column to trim
|
||||
|
||||
@@ -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.3-talend.jar" MVN="mvn:net.sf.json-lib/json-lib/2.4.3-talend" REQUIRED_IF="(READ_BY == 'XPATH')" />
|
||||
<IMPORT NAME="commons_lang" MODULE="commons-lang-2.6.jar" MVN="mvn:commons-lang/commons-lang/2.6" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-lang-2.6.jar"
|
||||
REQUIRED_IF="(READ_BY == 'XPATH')" />
|
||||
<IMPORT NAME="commons_logging" MODULE="commons-logging-1.1.1.jar" MVN="mvn:org.talend.libraries/commons-logging-1.1.1/6.0.0" UrlPath="platform:/base/plugins/org.apache.commons.logging_1.1.1.v201101211721.jar"
|
||||
|
||||
@@ -66,25 +66,28 @@
|
||||
}
|
||||
}
|
||||
DecodeString_<%=cid%> decode_<%=cid%> = new DecodeString_<%=cid%>();
|
||||
|
||||
try{
|
||||
fileInput<%=cid%> = new java.io.FileInputStream(<%=filename %>);
|
||||
javax.mail.Session session_<%=cid %> = javax.mail.Session.getInstance(System.getProperties(), null);
|
||||
javax.mail.internet.MimeMessage msg_<%=cid %> = new javax.mail.internet.MimeMessage(session_<%=cid %>, fileInput<%=cid%>);
|
||||
javax.mail.internet.MimeMessage msg_<%=cid %> = new javax.mail.internet.MimeMessage(session_<%=cid %>, fileInput<%=cid%>);
|
||||
java.util.List<String> list_<%=cid %> = new java.util.ArrayList<String>();
|
||||
|
||||
for (int i_<%=cid %> =0;i_<%=cid %> < mailParts_<%=cid %>.length;i_<%=cid %>++) {
|
||||
String part_<%=cid %> = mailParts_<%=cid %>[i_<%=cid %>];
|
||||
String sep_<%=cid%>= mailSeparator_<%=cid %>[i_<%=cid %>];
|
||||
if(part_<%=cid %>.equalsIgnoreCase("body")) {
|
||||
|
||||
for (int i_<%=cid %> = 0; i_<%=cid %> < mailParts_<%=cid %>.length; i_<%=cid %>++) {
|
||||
String part_<%=cid %> = mailParts_<%=cid %>[i_<%=cid %>];
|
||||
String sep_<%=cid%>= mailSeparator_<%=cid %>[i_<%=cid %>];
|
||||
if(part_<%=cid %>.equalsIgnoreCase("body")) {
|
||||
boolean multiValueBody_<%=cid%> = ("true").equals(mailChecked_<%=cid %>[i_<%=cid%>]);
|
||||
if(msg_<%=cid %>.isMimeType("multipart/*")) {
|
||||
javax.mail.Multipart mp<%=cid%> = (javax.mail.Multipart) msg_<%=cid %>.getContent();
|
||||
for (int i = 0; i < mp<%=cid%>.getCount(); i++) {
|
||||
javax.mail.BodyPart mpart<%=cid%> = mp<%=cid%>.getBodyPart(i);
|
||||
String disposition<%=cid%> = mpart<%=cid%>.getDisposition();
|
||||
if (!((disposition<%=cid%> != null) && ((disposition<%=cid%>
|
||||
.equals(javax.mail.Part.ATTACHMENT)) || (disposition<%=cid%>.equals(javax.mail.Part.INLINE))))) {
|
||||
// the following extract the body part(text/plain + text/html)
|
||||
try{
|
||||
StringBuilder body_<%=cid %> = new StringBuilder();
|
||||
for (int i = 0; i < mp<%=cid%>.getCount(); i++) {
|
||||
javax.mail.BodyPart mpart<%=cid%> = mp<%=cid%>.getBodyPart(i);
|
||||
String disposition<%=cid%> = mpart<%=cid%>.getDisposition();
|
||||
if (!((disposition<%=cid%> != null) && ((disposition<%=cid%>
|
||||
.equals(javax.mail.Part.ATTACHMENT)) || (disposition<%=cid%>.equals(javax.mail.Part.INLINE))))) {
|
||||
// the following extract the body part(text/plain + text/html)
|
||||
try{
|
||||
Object content_<%=cid %> = mpart<%=cid %>.getContent();
|
||||
if (content_<%=cid %> instanceof javax.mail.internet.MimeMultipart) {
|
||||
javax.mail.internet.MimeMultipart mimeMultipart_<%=cid %> = (javax.mail.internet.MimeMultipart) content_<%=cid %>;
|
||||
@@ -99,130 +102,152 @@
|
||||
for(int j_<%=cid %>_body = 0; j_<%=cid %>_body < mimeMultipart_<%=cid %>_body.getCount(); j_<%=cid %>_body++){
|
||||
javax.mail.BodyPart bodyPart_<%=cid %>_body = mimeMultipart_<%=cid %>_body.getBodyPart(j_<%=cid %>_body);
|
||||
if (bodyPart_<%=cid %>_body.isMimeType("text/*")) {
|
||||
list_<%=cid %>.add(bodyPart_<%=cid %>_body.getContent().toString());
|
||||
if(multiValueBody_<%=cid%>) {
|
||||
body_<%=cid %>.append(bodyPart_<%=cid %>_body.getContent().toString()).append(sep_<%=cid%>);
|
||||
} else {
|
||||
list_<%=cid %>.add(bodyPart_<%=cid %>_body.getContent().toString());
|
||||
}
|
||||
} else {
|
||||
System.out.println("Ignore the part " + bodyPart_<%=cid %>_body.getContentType());
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if (bodyPart_<%=cid %>.isMimeType("text/*")) {
|
||||
list_<%=cid %>.add(bodyPart_<%=cid %>.getContent().toString());
|
||||
if(multiValueBody_<%=cid%>) {
|
||||
body_<%=cid %>.append(bodyPart_<%=cid %>.getContent().toString()).append(sep_<%=cid%>);
|
||||
} else {
|
||||
list_<%=cid %>.add(bodyPart_<%=cid %>.getContent().toString());
|
||||
}
|
||||
} else {
|
||||
System.out.println("Ignore the part " + bodyPart_<%=cid %>.getContentType());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
list_<%=cid %>.add(mpart<%=cid%>.getContent().toString());
|
||||
if(multiValueBody_<%=cid%>) {
|
||||
body_<%=cid %>.append(mpart<%=cid%>.getContent().toString()).append(sep_<%=cid%>);
|
||||
} else {
|
||||
list_<%=cid %>.add(mpart<%=cid%>.getContent().toString());
|
||||
}
|
||||
}
|
||||
}catch (java.io.UnsupportedEncodingException e){
|
||||
java.io.ByteArrayOutputStream bao_<%=cid%> = new java.io.ByteArrayOutputStream();
|
||||
mpart<%=cid %>.writeTo(bao_<%=cid%>);
|
||||
list_<%=cid %>.add(bao_<%=cid%>.toString());
|
||||
if(multiValueBody_<%=cid%>) {
|
||||
body_<%=cid %>.append(bao_<%=cid%>.toString()).append(sep_<%=cid%>);
|
||||
} else {
|
||||
list_<%=cid %>.add(bao_<%=cid%>.toString());
|
||||
}
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.warn("<%=cid%> - " + bao_<%=cid%>.toString());
|
||||
<%}%>
|
||||
}
|
||||
<%
|
||||
//both attachment and message context in the email,bug TDI-19065
|
||||
//both attachment and message context in the email,bug TDI-19065
|
||||
%>
|
||||
}else if(disposition<%=cid%> != null && disposition<%=cid%>.equals(javax.mail.Part.INLINE)){
|
||||
list_<%=cid %>.add(mpart<%=cid%>.getContent().toString());
|
||||
}
|
||||
if(multiValueBody_<%=cid%>) {
|
||||
body_<%=cid %>.append(mpart<%=cid%>.getContent().toString()).append(sep_<%=cid%>);
|
||||
} else {
|
||||
list_<%=cid %>.add(mpart<%=cid%>.getContent().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
if(multiValueBody_<%=cid%>) {
|
||||
list_<%=cid %>.add(body_<%=cid %>.toString());
|
||||
}
|
||||
} else {
|
||||
java.io.InputStream in_<%=cid %> = msg_<%=cid %>.getInputStream();
|
||||
byte[] buffer_<%=cid %> = new byte[1024];
|
||||
int length_<%=cid %> = 0;
|
||||
java.io.ByteArrayOutputStream baos_<%=cid %> = new java.io.ByteArrayOutputStream();
|
||||
while ((length_<%=cid %> = in_<%=cid %>.read(buffer_<%=cid %>, 0, 1024)) != -1) {
|
||||
baos_<%=cid %>.write(buffer_<%=cid %>, 0, length_<%=cid %>);
|
||||
}
|
||||
String contentType_<%=cid%> = msg_<%=cid%>.getContentType();
|
||||
String charsetName_<%=cid%> = "";
|
||||
if(contentType_<%=cid%>!=null && contentType_<%=cid%>.trim().length()>0){
|
||||
javax.mail.internet.ContentType cy_<%=cid%> = new javax.mail.internet.ContentType(contentType_<%=cid%>);
|
||||
charsetName_<%=cid%> = cy_<%=cid%>.getParameter("charset");
|
||||
}
|
||||
if(charsetName_<%=cid%>!=null && charsetName_<%=cid%>.length()>0){
|
||||
list_<%=cid %>.add(baos_<%=cid %>.toString(charsetName_<%=cid%>));
|
||||
}else{
|
||||
list_<%=cid %>.add(baos_<%=cid %>.toString());
|
||||
}
|
||||
in_<%=cid %>.close();
|
||||
baos_<%=cid %>.close();
|
||||
byte[] buffer_<%=cid %> = new byte[1024];
|
||||
int length_<%=cid %> = 0;
|
||||
java.io.ByteArrayOutputStream baos_<%=cid %> = new java.io.ByteArrayOutputStream();
|
||||
while ((length_<%=cid %> = in_<%=cid %>.read(buffer_<%=cid %>, 0, 1024)) != -1) {
|
||||
baos_<%=cid %>.write(buffer_<%=cid %>, 0, length_<%=cid %>);
|
||||
}
|
||||
String contentType_<%=cid%> = msg_<%=cid%>.getContentType();
|
||||
String charsetName_<%=cid%> = "";
|
||||
if(contentType_<%=cid%>!=null && contentType_<%=cid%>.trim().length()>0){
|
||||
javax.mail.internet.ContentType cy_<%=cid%> = new javax.mail.internet.ContentType(contentType_<%=cid%>);
|
||||
charsetName_<%=cid%> = cy_<%=cid%>.getParameter("charset");
|
||||
}
|
||||
if(charsetName_<%=cid%>!=null && charsetName_<%=cid%>.length()>0){
|
||||
list_<%=cid %>.add(baos_<%=cid %>.toString(charsetName_<%=cid%>));
|
||||
}else{
|
||||
list_<%=cid %>.add(baos_<%=cid %>.toString());
|
||||
}
|
||||
in_<%=cid %>.close();
|
||||
baos_<%=cid %>.close();
|
||||
}
|
||||
}else if(part_<%=cid %>.equalsIgnoreCase("header")){
|
||||
java.util.Enumeration em = msg_<%=cid %>.getAllHeaderLines();
|
||||
int em_count=0;
|
||||
|
||||
String tempStr_<%=cid %>="";
|
||||
|
||||
}else if(part_<%=cid %>.equalsIgnoreCase("header")){
|
||||
java.util.Enumeration em = msg_<%=cid %>.getAllHeaderLines();
|
||||
int em_count=0;
|
||||
|
||||
String tempStr_<%=cid %>="";
|
||||
|
||||
while (em.hasMoreElements()) {
|
||||
tempStr_<%=cid %> = tempStr_<%=cid %> + (String) em.nextElement() + sep_<%=cid%> ;
|
||||
}
|
||||
list_<%=cid%>.add(decode_<%=cid%>.decode(tempStr_<%=cid%>));
|
||||
}else{
|
||||
if(("true").equals(mailChecked_<%=cid %>[i_<%=cid%>])){
|
||||
} else {
|
||||
if(("true").equals(mailChecked_<%=cid %>[i_<%=cid%>])){
|
||||
String[] sa_<%=cid%> = msg_<%=cid %>.getHeader(part_<%=cid%>);
|
||||
String tempStr_<%=cid%>="";
|
||||
for(int i=0;i<sa_<%=cid%>.length;i++){
|
||||
tempStr_<%=cid%>=tempStr_<%=cid%>+sa_<%=cid%>[i] + sep_<%=cid%>;
|
||||
}
|
||||
list_<%=cid%>.add(decode_<%=cid%>.decode(tempStr_<%=cid%>));
|
||||
}else{
|
||||
String content_<%=cid %> = msg_<%=cid %>.getHeader(part_<%=cid %>, null);
|
||||
list_<%=cid %>.add(decode_<%=cid%>.decode(content_<%=cid %>));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//attachment Deal
|
||||
if(msg_<%=cid %>.isMimeType("multipart/*")){
|
||||
javax.mail.Multipart mp<%=cid%> = (javax.mail.Multipart) msg_<%=cid %>.getContent();
|
||||
String attachfileName<%=cid%> = "";
|
||||
String path<%=cid%> = "";
|
||||
java.io.BufferedOutputStream out<%=cid%> = null;
|
||||
java.io.BufferedInputStream in<%=cid%> = null;
|
||||
for (int i = 0; i < mp<%=cid%>.getCount(); i++) {
|
||||
javax.mail.BodyPart mpart<%=cid%> = mp<%=cid%>.getBodyPart(i);
|
||||
String disposition<%=cid%> = mpart<%=cid%>.getDisposition();
|
||||
<%
|
||||
// fixed bug TDI-8586,to deal with attachments download
|
||||
%>
|
||||
if (mpart<%=cid%>.getFileName()!=null
|
||||
&& ((disposition<%=cid%> != null && (disposition<%=cid%>.equals(javax.mail.Part.ATTACHMENT) || disposition<%=cid%>.equals(javax.mail.Part.INLINE)))
|
||||
|| disposition<%=cid%>==null)) { <%// TDI-29179 %>
|
||||
attachfileName<%=cid%> = mpart<%=cid%>.getFileName();
|
||||
attachfileName<%=cid%> = javax.mail.internet.MimeUtility.decodeText(attachfileName<%=cid%>);
|
||||
|
||||
|
||||
if(!(<%=directory%>).endsWith("/")){
|
||||
path<%=cid%> = <%=directory%> + "/";
|
||||
}else{
|
||||
path<%=cid%> =<%=directory%>;
|
||||
}
|
||||
path<%=cid%> = path<%=cid%> + attachfileName<%=cid%>;
|
||||
<% if(isLog4jEnabled){ %>
|
||||
log.info("<%= cid %> - Extracted attachment: '"+attachfileName<%=cid%>+"'.");
|
||||
<% } %>
|
||||
java.io.File attachFile = new java.io.File(path<%=cid%>);
|
||||
out<%=cid%> = new java.io.BufferedOutputStream(new java.io.FileOutputStream(attachFile));
|
||||
in<%=cid%> = new java.io.BufferedInputStream(mpart<%=cid%>.getInputStream());
|
||||
int buffer<%=cid%> = 0;
|
||||
while ((buffer<%=cid%> = in<%=cid%>.read()) != -1) {
|
||||
out<%=cid%>.write(buffer<%=cid%>);
|
||||
out<%=cid%>.flush();
|
||||
}
|
||||
out<%=cid%>.close();
|
||||
in<%=cid%>.close();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
String content_<%=cid %> = msg_<%=cid %>.getHeader(part_<%=cid %>, null);
|
||||
list_<%=cid %>.add(decode_<%=cid%>.decode(content_<%=cid %>));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//attachment Deal
|
||||
class MessagePartProcessor {
|
||||
void saveAttachment(javax.mail.Part mpart) throws IOException, javax.mail.MessagingException {
|
||||
if (mpart.getFileName() != null && (
|
||||
mpart.getDisposition() == null ||
|
||||
(mpart.getDisposition().equals(javax.mail.Part.ATTACHMENT) || mpart.getDisposition().equals(javax.mail.Part.INLINE))
|
||||
)) {
|
||||
String attachFileName = javax.mail.internet.MimeUtility.decodeText(mpart.getFileName());
|
||||
|
||||
String path = <%=directory%>;
|
||||
if(!path.endsWith("/")){
|
||||
path = path + "/";
|
||||
}
|
||||
path = path + attachFileName;
|
||||
<% if(isLog4jEnabled){ %>
|
||||
log.info("<%= cid %> - Extracted attachment: '" + attachFileName + "'.");
|
||||
<% } %>
|
||||
|
||||
java.io.File attachFile = new java.io.File(path);
|
||||
java.io.BufferedOutputStream out = new java.io.BufferedOutputStream(new java.io.FileOutputStream(attachFile));
|
||||
java.io.BufferedInputStream in = new java.io.BufferedInputStream(mpart.getInputStream());
|
||||
int buffer = 0;
|
||||
while ((buffer = in.read()) != -1) {
|
||||
out.write(buffer);
|
||||
out.flush();
|
||||
}
|
||||
out.close();
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
||||
// recursively process body parts
|
||||
void processPart(javax.mail.Part part) throws javax.mail.MessagingException, IOException {
|
||||
if (part.isMimeType("multipart/*")) {
|
||||
javax.mail.Multipart multipartContent = (javax.mail.Multipart) part.getContent();
|
||||
for (int i = 0; i < multipartContent.getCount(); i++) {
|
||||
javax.mail.Part mpart = multipartContent.getBodyPart(i);
|
||||
saveAttachment(mpart);
|
||||
processPart(mpart);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
new MessagePartProcessor().processPart(msg_<%=cid %>);
|
||||
|
||||
// for output
|
||||
<%
|
||||
List< ? extends IConnection> conns = node.getOutgoingSortedConnections();
|
||||
@@ -282,10 +307,10 @@
|
||||
for (int i=1;i<conns.size();i++) {
|
||||
IConnection conn2 = conns.get(i);
|
||||
if ((conn2.getName().compareTo(firstConnName)!=0)&&(conn2.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA))) {
|
||||
for (IMetadataColumn column: metadata.getListColumns()) {%>
|
||||
<%=conn2.getName() %>.<%=column.getLabel() %> = <%=firstConnName %>.<%=column.getLabel() %>;
|
||||
<%
|
||||
}
|
||||
for (IMetadataColumn column: metadata.getListColumns()) {%>
|
||||
<%=conn2.getName() %>.<%=column.getLabel() %> = <%=firstConnName %>.<%=column.getLabel() %>;
|
||||
<%
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,17 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
}else{
|
||||
globalMap.put("<%=cid %>_EXPORTED_FILE_PATH",<%=directory%>);
|
||||
}
|
||||
|
||||
// create output directory if not exists
|
||||
String path = <%=directory%>;
|
||||
if(!path.endsWith("/")){
|
||||
path = path + "/";
|
||||
}
|
||||
java.io.File outputDir = new java.io.File(path);
|
||||
if (!outputDir.exists()) {
|
||||
outputDir.mkdirs();
|
||||
}
|
||||
|
||||
boolean hasData_<%=cid%> = false;
|
||||
<%
|
||||
if("MIME".equals(mailType)) {
|
||||
|
||||
@@ -69,6 +69,16 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
if (metadata!=null) {
|
||||
List<IMetadataColumn> columns = metadata.getListColumns();
|
||||
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
|
||||
|
||||
boolean protectFile = ("true").equals(ElementParameterParser.getValue(node, "__PROTECT_FILE__")) ? true : false;
|
||||
if (protectFile) {
|
||||
String passwordFieldName = "__PASSWORD__";
|
||||
%>
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
String password_<%=cid%> = decryptedPassword_<%=cid%>;
|
||||
<%
|
||||
}
|
||||
|
||||
boolean hasDynamic = false;
|
||||
int dynamic_index = 0;
|
||||
String datePattern = "\"dd-MM-yyyy\"";
|
||||
@@ -416,13 +426,13 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
%>
|
||||
|
||||
writableSheet_<%=cid %> = writeableWorkbook_<%=cid %>.getSheet(<%=sheetname %>);
|
||||
if(writableSheet_<%=cid %> == null){
|
||||
writableSheet_<%=cid %> = writeableWorkbook_<%=cid %>.createSheet(<%=sheetname %>, writeableWorkbook_<%=cid %>.getNumberOfSheets());
|
||||
}
|
||||
|
||||
|
||||
<%if(!useStream && isAppendFile && !isAppendSheet){%>
|
||||
else {
|
||||
|
||||
@@ -479,7 +489,7 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
}else{
|
||||
%>
|
||||
if(true){
|
||||
throw new RuntimeException("Date pattern must be set for column <%=column.getLabel() %> in the schema of component <%=cid %>!");
|
||||
throw new RuntimeException("Date pattern must be set for column <%=column.getLabel() %> in the schema of component <%=cid %>! ");
|
||||
}
|
||||
<% }
|
||||
}
|
||||
@@ -760,6 +770,9 @@ if(!hasDynamic && isIncludeHeader){
|
||||
%>
|
||||
int nb_line_<%=cid%> = 0;
|
||||
org.talend.ExcelTool xlsxTool_<%=cid%> = new org.talend.ExcelTool();
|
||||
<% if (protectFile) { %>
|
||||
xlsxTool_<%=cid%>.setPasswordProtection(password_<%=cid%>);
|
||||
<%}%>
|
||||
<%
|
||||
if(flushOnRow && (useStream || !isAppendFile)){
|
||||
%>
|
||||
@@ -780,7 +793,15 @@ if(!hasDynamic && isIncludeHeader){
|
||||
java.util.concurrent.ConcurrentHashMap<java.lang.Object, java.lang.Object> chm_<%=cid%> = (java.util.concurrent.ConcurrentHashMap<java.lang.Object, java.lang.Object>) globalMap.get("concurrentHashMap");
|
||||
java.lang.Object lockObj_<%=cid%> = chm_<%=cid%>.computeIfAbsent("EXCEL_OUTPUT_LOCK_OBJ_<%=cid%>", k -> new Object());
|
||||
synchronized (lockObj_<%=cid%>) {
|
||||
xlsxTool_<%=cid%>.prepareXlsxFile(fileName_<%=cid%>);
|
||||
<%
|
||||
String rowFileName = filename.replaceAll("\"", "");
|
||||
String fileExtension = rowFileName.substring(rowFileName.lastIndexOf(".") + 1);
|
||||
if (fileExtension.equalsIgnoreCase("xlsm")){
|
||||
%>
|
||||
xlsxTool_<%=cid%>.prepareXlsmFile(fileName_<%=cid%>);
|
||||
<%} else {%>
|
||||
xlsxTool_<%=cid%>.prepareXlsxFile(fileName_<%=cid%>);
|
||||
<%}%>
|
||||
}
|
||||
<%}else{%>
|
||||
xlsxTool_<%=cid%>.prepareStream();
|
||||
|
||||
@@ -149,7 +149,14 @@
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER
|
||||
<PARAMETER NAME="PROTECT_FILE" FIELD="CHECK" REQUIRED="false" SHOW_IF="(VERSION_2007 == 'true') AND (USESTREAM=='false')" NUM_ROW="72">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="PASSWORD" FIELD="PASSWORD" REQUIRED="true" SHOW_IF="isShow[PROTECT_FILE] AND (PROTECT_FILE == 'true')" NUM_ROW="72">
|
||||
<DEFAULT>""</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER
|
||||
NAME="SCHEMA"
|
||||
FIELD="SCHEMA_TYPE"
|
||||
REQUIRED="true"
|
||||
@@ -220,7 +227,7 @@
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Java_Excel" MODULE="jxl.jar" MVN="mvn:org.talend.libraries/jxl/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.jexcel/lib/jxl.jar" REQUIRED_IF="(VERSION_2007 == 'false')" />
|
||||
<IMPORT NAME="TALEND_EXCEL" MODULE="talendExcel-1.4-20190531.jar" MVN="mvn:org.talend.libraries/talendExcel-1.4-20190531/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/talendExcel-1.4-20190531.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="TALEND_EXCEL" MODULE="talendExcel-1.5-20190731.jar" MVN="mvn:org.talend.libraries/talendExcel-1.5-20190731/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/talendExcel-1.5-20190731.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="commons-lang3" MODULE="commons-lang3-3.8.1.jar" MVN="mvn:org.apache.commons/commons-lang3/3.8.1" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="dom4j" 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="(VERSION_2007 == 'true')" BundleID="" />
|
||||
<IMPORT NAME="geronimo-stax-api" MODULE="geronimo-stax-api_1.0_spec-1.0.1.jar" MVN="mvn:org.talend.libraries/geronimo-stax-api_1.0_spec-1.0.1/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.axis2/lib/geronimo-stax-api_1.0_spec-1.0.1.jar" REQUIRED_IF="(VERSION_2007 == 'true')" BundleID="" />
|
||||
@@ -232,7 +239,7 @@
|
||||
<IMPORT NAME="xmlbeans" MODULE="xmlbeans-3.1.0.jar" MVN="mvn:org.apache.xmlbeans/xmlbeans/3.1.0" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="commons-collections4" MODULE="commons-collections4-4.1.jar" MVN="mvn:org.talend.libraries/commons-collections4-4.1/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.excel/lib/commons-collections4-4.1.jar" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
|
||||
<IMPORT NAME="commons-compress" MODULE="commons-compress-1.18.jar" MVN="mvn:org.apache.commons/commons-compress/1.18" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="commons-compress" MODULE="commons-compress-1.19.jar" MVN="mvn:org.apache.commons/commons-compress/1.19" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
<IMPORT NAME="commons-math3" MODULE="commons-math3-3.6.1.jar" MVN="mvn:org.apache.commons/commons-math3/3.6.1" REQUIRED_IF="(VERSION_2007 == 'true')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -74,6 +74,8 @@ IS_ALL_AUTO_SZIE.NAME=Define all columns auto size
|
||||
KEEP_LEADING_ZEROS.NAME=Keep leading zeros
|
||||
LONG_NAME=Writes the cells row by row in a Microsoft Excel file
|
||||
NB_LINE.NAME=Number of line
|
||||
PROTECT_FILE.NAME=Protect file
|
||||
PASSWORD.NAME=Password
|
||||
SCHEMA.NAME=Schema
|
||||
SHEETNAME.NAME=Sheet name
|
||||
THOUSANDS_SEPARATOR.NAME=Thousands separator
|
||||
@@ -84,8 +86,8 @@ FIRST_CELL_Y_ABSOLUTE.NAME=Is absolute Y pos.
|
||||
KEEP_CELL_FORMATING.NAME=Keep existing cell format
|
||||
USESTREAM.NAME=Use Output Stream
|
||||
STREAMNAME.NAME=Output Stream
|
||||
VERSION_2007.NAME=Write excel2007 file format(xlsx)
|
||||
VERSION_2007.NAME=Write excel2007 file format (xlsx / xlsm)
|
||||
FLUSHONROW.NAME=Custom the flush buffer size
|
||||
FLUSHONROW_NUM.NAME=Row number
|
||||
|
||||
RECALCULATE_FORMULA.NAME=Recalculate formula
|
||||
RECALCULATE_FORMULA.NAME=Recalculate formula
|
||||
|
||||
@@ -86,11 +86,11 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="COMMONS-COMPRESS-1.10" MODULE="commons-compress-1.10.jar" MVN="mvn:org.talend.libraries/commons-compress-1.10/6.1.0" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-compress-1.10.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="commons-compress-1.19" MODULE="commons-compress-1.19.jar" MVN="mvn:org.apache.commons/commons-compress/1.19" REQUIRED="true" />
|
||||
<IMPORT NAME="Ant-Zip" MODULE="ant-1.10.1.jar" MVN="mvn:org.apache.ant/ant/1.10.1" REQUIRED="true" />
|
||||
<IMPORT NAME="Check-Archive" MODULE="checkArchive-1.1-20181130.jar" MVN="mvn:org.talend.libraries/checkArchive-1.1-20181130/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/checkArchive-1.1-20181130.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="zip4j_1.3.1.jar" MODULE="zip4j_1.3.1.jar" MVN="mvn:org.talend.libraries/zip4j_1.3.1/6.0.0" REQUIRED="true" />
|
||||
<IMPORT NAME="talendzip-1.0-20190527.jar" MODULE="talendzip-1.0-20190527.jar" MVN="mvn:org.talend.libraries/talendzip/1.0-20190527" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talendzip-1.0-20190527.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="Check-Archive" MODULE="checkArchive-1.1-20190917.jar" MVN="mvn:org.talend.libraries/checkArchive-1.1-20190917/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/checkArchive-1.1-20190917.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="zip4j-1.3.3.jar" MODULE="zip4j-1.3.3.jar" MVN="mvn:net.lingala.zip4j/zip4j/1.3.3" REQUIRED="true" />
|
||||
<IMPORT NAME="talendzip-1.0-20190917.jar" MODULE="talendzip-1.0-20190917.jar" MVN="mvn:org.talend.libraries/talendzip/1.0-20190917" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talendzip-1.0-20190917.jar" REQUIRED="true" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -185,14 +185,14 @@ imports="
|
||||
%>
|
||||
for (org.jets3t.service.model.GSObject objectSummary_<%=cid%> : objects_<%=cid%>) {
|
||||
String objkey_<%=cid%> = objectSummary_<%=cid%>.getKey();
|
||||
java.io.File file_<%=cid%> = new java.io.File(<%=outputsDir%>+objkey_<%=cid%>);
|
||||
java.io.File file_<%=cid%> = new java.io.File(<%=outputsDir%>, objkey_<%=cid%>);
|
||||
org.jets3t.service.model.GSObject obj_<%=cid%> = service_<%=cid%>.getObject(currentBucketName_<%=cid%>, objkey_<%=cid%>);
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
for (java.util.Map<String, String> map_<%=cid %>: list_<%=cid%>) {
|
||||
String currentBucketName_<%=cid%>=map_<%=cid %>.get("BUCKET_NAME");
|
||||
java.io.File file_<%=cid%> = new java.io.File(<%=outputsDir%>+map_<%=cid %>.get("OBJECT_NEWNAME"));
|
||||
java.io.File file_<%=cid%> = new java.io.File(<%=outputsDir%>, map_<%=cid %>.get("OBJECT_NEWNAME"));
|
||||
org.jets3t.service.model.GSObject obj_<%=cid%> =null;
|
||||
try {
|
||||
obj_<%=cid%> = service_<%=cid%>.getObject(currentBucketName_<%=cid%>, map_<%=cid %>.get("OBJECT_KEY"));
|
||||
@@ -275,4 +275,4 @@ imports="
|
||||
obj_<%=cid%>.closeDataInputStream();
|
||||
<%
|
||||
}
|
||||
%>
|
||||
%>
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="thashfile-3.0-20170711" MODULE="thashfile-3.0-20170711.jar" MVN="mvn:org.talend.libraries/thashfile-3.0-20170711/6.0.0" REQUIRED="true" />
|
||||
<IMPORT NAME="thashfile-3.1-20190910" MODULE="thashfile-3.1-20190910.jar" MVN="mvn:org.talend.components.lib/thashfile/3.1-20190910" REQUIRED="true" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="thashfile-3.0-20170711" MODULE="thashfile-3.0-20170711.jar" MVN="mvn:org.talend.libraries/thashfile-3.0-20170711/6.0.0" REQUIRED="true" />
|
||||
<IMPORT NAME="thashfile-3.1-20190910" MODULE="thashfile-3.1-20190910.jar" MVN="mvn:org.talend.components.lib/thashfile/3.1-20190910" REQUIRED="true" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -77,6 +77,8 @@ if(isEnableType1) {
|
||||
|
||||
String startDateField = ElementParameterParser.getValue(node,"__L2_STARTDATE_FIELD__");
|
||||
String endDateField = ElementParameterParser.getValue(node,"__L2_ENDDATE_FIELD__");
|
||||
String l2EndDateFieldType = ElementParameterParser.getValue(node,"__L2_ENDDATE_FIELD_TYPE__");
|
||||
String l2EndDateFieldFixedDateValue = ElementParameterParser.getValue(node,"__FIXED_DATE_VALUE__");
|
||||
boolean isEnableActive = ("true").equals(ElementParameterParser.getValue(node,"__USE_L2_ACTIVE__"));
|
||||
String activeField = ElementParameterParser.getValue(node,"__L2_ACTIVE_FIELD__");
|
||||
boolean isEnableVersion = ("true").equals(ElementParameterParser.getValue(node,"__USE_L2_VERSION__"));
|
||||
@@ -98,8 +100,10 @@ if(isEnableType2) {
|
||||
String whereClauseString = StringUtils.join(whereClause.toArray(), " OR ");
|
||||
%>
|
||||
String changeDateTime_<%=cid%> = (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))).toString();
|
||||
|
||||
String updateForType2_<%=cid %> = "UPDATE <%=text_util.wrap("tableName", cid)%> SET <%=text_util.wrap(endDateField)%> = '" + (changeDateTime_<%=cid%>) + "'<%if (isEnableActive) {%>, <%=text_util.wrap(activeField)%> = 0<%}%> FROM <%=text_util.wrap("tableName", cid)%> d, <%=text_util.wrap("sourceTable", cid)%> t WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.<%=text_util.wrap(endDateField)%> IS NULL";
|
||||
<% if ("FIXED_DATE_VALUE".equals(l2EndDateFieldType)) { %>
|
||||
String customEndDate_<%=cid%> = java.sql.Timestamp.valueOf(<%=l2EndDateFieldFixedDateValue%> +" 00:00:00").toString();
|
||||
<%}%>
|
||||
String updateForType2_<%=cid %> = "UPDATE <%=text_util.wrap("tableName", cid)%> SET <%=text_util.wrap(endDateField)%> = '" + (changeDateTime_<%=cid%>) + "'<%if (isEnableActive) {%>, <%=text_util.wrap(activeField)%> = 0<%}%> FROM <%=text_util.wrap("tableName", cid)%> d, <%=text_util.wrap("sourceTable", cid)%> t WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.<%=text_util.wrap(endDateField)%><% if ("NULL".equals(l2EndDateFieldType)) { %> IS NULL "<% } else { %> = '" + (customEndDate_<%=cid%>) + "'"<%}%>;
|
||||
java.sql.Statement stmtType2Update_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
stmtType2Update_<%=cid%>.executeUpdate(updateForType2_<%=cid%>);
|
||||
stmtType2Update_<%=cid%>.close();
|
||||
@@ -137,7 +141,7 @@ if(isEnableType2) {
|
||||
columnNameString = StringUtils.join(columnNames.toArray(), ", ");
|
||||
%>
|
||||
String insertForType2_<%=cid%> = "INSERT INTO <%=text_util.wrap("tableName", cid)%>(<%if(useSequence) {%><%=text_util.wrap(surrogateKey)%>, <%}%><%=columnNameString%>) SELECT " + <%if(useSequence) {%>sequenceValueFetchPattern_<%=cid%> + ", " + <%}%>" t.<%=selectColumnString%>, '" +
|
||||
(changeDateTime_<%=cid%>) + "', NULL<%if(isEnableActive) {%>, 1<%}%><%if(isEnableVersion) {%>, d.<%=text_util.wrap(versionField)%> + 1<%}%> FROM <%=text_util.wrap("sourceTable", cid)%> t, <%=text_util.wrap("tableName", cid)%> d WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.<%=text_util.wrap(endDateField)%> = '" + (changeDateTime_<%=cid%>) + "'";
|
||||
(changeDateTime_<%=cid%>) + "',<% if("NULL".equals(l2EndDateFieldType)) { %> NULL <% } else {%> '" + (customEndDate_<%=cid%>) + "'<%} if(isEnableActive) {%>, 1<%}%><%if(isEnableVersion) {%>, d.<%=text_util.wrap(versionField)%> + 1<%}%> FROM <%=text_util.wrap("sourceTable", cid)%> t, <%=text_util.wrap("tableName", cid)%> d WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.<%=text_util.wrap(endDateField)%> = '" + (changeDateTime_<%=cid%>) + "'";
|
||||
java.sql.Statement stmtType2Insert_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
stmtType2Insert_<%=cid%>.executeUpdate(insertForType2_<%=cid%>);
|
||||
stmtType2Insert_<%=cid%>.close();
|
||||
@@ -155,7 +159,7 @@ for (Map<String, String> sk : sourceKeys) {
|
||||
}
|
||||
String outerWhereClauseString = StringUtils.join(outerWhereClause.toArray(), " AND ");
|
||||
%>
|
||||
String insert_<%=cid%> = "INSERT INTO <%=text_util.wrap("tableName", cid)%>(<%if(useSequence) {%><%=text_util.wrap(surrogateKey)%>, <%}%><%=columnNameString%>) SELECT " + <%if(useSequence) {%>sequenceValueFetchPattern_<%=cid%> + ", " + <%}%>" t.<%=selectColumnString%>"<%if(isEnableType2) {%> + ", '" + (changeDateTime_<%=cid%>) + "', NULL"<%}%>
|
||||
String insert_<%=cid%> = "INSERT INTO <%=text_util.wrap("tableName", cid)%>(<%if(useSequence) {%><%=text_util.wrap(surrogateKey)%>, <%}%><%=columnNameString%>) SELECT " + <%if(useSequence) {%>sequenceValueFetchPattern_<%=cid%> + ", " + <%}%>" t.<%=selectColumnString%>"<%if(isEnableType2) {%> + ", '" + (changeDateTime_<%=cid%>) + "', <% if ("NULL".equals(l2EndDateFieldType)) { %>NULL"<% } else {%>'" + (customEndDate_<%=cid%>) + "'"<%}}%>
|
||||
+ "<%if(isEnableType2 && isEnableActive) {%>, 1<%}%><%if(isEnableType2 && isEnableVersion) {%>, 1<%}%> FROM <%=text_util.wrap("sourceTable", cid)%> t LEFT JOIN <%=text_util.wrap("tableName", cid)%> d ON <%=joinClauseString%> WHERE (<%=outerWhereClauseString%>)";
|
||||
java.sql.Statement stmtInsert_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
stmtInsert_<%=cid%>.executeUpdate(insert_<%=cid%>);
|
||||
@@ -166,4 +170,4 @@ if(isEnableDebug) {
|
||||
System.out.println("[<%=cid%>] new rows sql\n" + insert_<%=cid %> + "\ndone");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
%>
|
||||
|
||||
@@ -77,6 +77,8 @@ if(isEnableType1) {
|
||||
|
||||
String startDateField = ElementParameterParser.getValue(node,"__L2_STARTDATE_FIELD__");
|
||||
String endDateField = ElementParameterParser.getValue(node,"__L2_ENDDATE_FIELD__");
|
||||
String l2EndDateFieldType = ElementParameterParser.getValue(node,"__L2_ENDDATE_FIELD_TYPE__");
|
||||
String l2EndDateFieldFixedDateValue = ElementParameterParser.getValue(node,"__FIXED_DATE_VALUE__");
|
||||
boolean isEnableActive = ("true").equals(ElementParameterParser.getValue(node,"__USE_L2_ACTIVE__"));
|
||||
String activeField = ElementParameterParser.getValue(node,"__L2_ACTIVE_FIELD__");
|
||||
boolean isEnableVersion = ("true").equals(ElementParameterParser.getValue(node,"__USE_L2_VERSION__"));
|
||||
@@ -98,8 +100,10 @@ if(isEnableType2) {
|
||||
String whereClauseString = StringUtils.join(whereClause.toArray(), " OR ");
|
||||
%>
|
||||
String changeDateTime_<%=cid%> = (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))).toString();
|
||||
|
||||
String updateForType2_<%=cid %> = "UPDATE <%=text_util.wrap("tableName", cid)%> d SET <%=text_util.wrap(endDateField)%> = '" + (changeDateTime_<%=cid%>) + "'<%if (isEnableActive) {%>, <%=text_util.wrap(activeField)%> = 0<%}%> FROM <%=text_util.wrap("sourceTable", cid)%> t WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.<%=text_util.wrap(endDateField)%> IS NULL";
|
||||
<% if ("FIXED_DATE_VALUE".equals(l2EndDateFieldType)) { %>
|
||||
String customEndDate_<%=cid%> = java.sql.Timestamp.valueOf(<%=l2EndDateFieldFixedDateValue%> +" 00:00:00").toString();
|
||||
<%}%>
|
||||
String updateForType2_<%=cid %> = "UPDATE <%=text_util.wrap("tableName", cid)%> d SET <%=text_util.wrap(endDateField)%> = '" + (changeDateTime_<%=cid%>) + "'<%if (isEnableActive) {%>, <%=text_util.wrap(activeField)%> = 0<%}%> FROM <%=text_util.wrap("sourceTable", cid)%> t WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.<%=text_util.wrap(endDateField)%><% if ("NULL".equals(l2EndDateFieldType)) { %> IS NULL "<% } else { %> = '" + (customEndDate_<%=cid%>) + "'"<%}%>;
|
||||
java.sql.Statement stmtType2Update_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
stmtType2Update_<%=cid%>.executeUpdate(updateForType2_<%=cid%>);
|
||||
stmtType2Update_<%=cid%>.close();
|
||||
@@ -137,7 +141,7 @@ if(isEnableType2) {
|
||||
columnNameString = StringUtils.join(columnNames.toArray(), ", ");
|
||||
%>
|
||||
String insertForType2_<%=cid%> = "INSERT INTO <%=text_util.wrap("tableName", cid)%>(<%if(useSequence) {%><%=text_util.wrap(surrogateKey)%>, <%}%><%=columnNameString%>) SELECT " + <%if(useSequence) {%>sequenceValueFetchPattern_<%=cid%> + ", " + <%}%>" t.<%=selectColumnString%>, '" +
|
||||
(changeDateTime_<%=cid%>) + "', NULL<%if(isEnableActive) {%>, 1<%}%><%if(isEnableVersion) {%>, d.<%=text_util.wrap(versionField)%> + 1<%}%> FROM <%=text_util.wrap("sourceTable", cid)%> t, <%=text_util.wrap("tableName", cid)%> d WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.<%=text_util.wrap(endDateField)%> = '" + (changeDateTime_<%=cid%>) + "'";
|
||||
(changeDateTime_<%=cid%>) + "',<% if("NULL".equals(l2EndDateFieldType)) { %> NULL <% } else {%> '" + (customEndDate_<%=cid%>) + "'<%} if(isEnableActive) {%>, 1<%}%><%if(isEnableVersion) {%>, d.<%=text_util.wrap(versionField)%> + 1<%}%> FROM <%=text_util.wrap("sourceTable", cid)%> t, <%=text_util.wrap("tableName", cid)%> d WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.<%=text_util.wrap(endDateField)%> = '" + (changeDateTime_<%=cid%>) + "'";
|
||||
java.sql.Statement stmtType2Insert_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
stmtType2Insert_<%=cid%>.executeUpdate(insertForType2_<%=cid%>);
|
||||
stmtType2Insert_<%=cid%>.close();
|
||||
@@ -155,7 +159,8 @@ for (Map<String, String> sk : sourceKeys) {
|
||||
}
|
||||
String outerWhereClauseString = StringUtils.join(outerWhereClause.toArray(), " AND ");
|
||||
%>
|
||||
String insert_<%=cid%> = "INSERT INTO <%=text_util.wrap("tableName", cid)%>(<%if(useSequence) {%><%=text_util.wrap(surrogateKey)%>, <%}%><%=columnNameString%>) SELECT " + <%if(useSequence) {%>sequenceValueFetchPattern_<%=cid%> + ", " + <%}%>" t.<%=selectColumnString%>"<%if(isEnableType2) {%> + ", '" + (changeDateTime_<%=cid%>) + "', NULL"<%}%>
|
||||
String insert_<%=cid%> = "INSERT INTO <%=text_util.wrap("tableName", cid)%>(<%if(useSequence) {%><%=text_util.wrap(surrogateKey)%>, <%}%><%=columnNameString%>) SELECT " + <%if(useSequence) {%>sequenceValueFetchPattern_<%=cid%> + ", " + <%}%>" t.<%=selectColumnString%>"<%if(isEnableType2) {%> + ", '" + (changeDateTime_<%=cid%>)
|
||||
+ "',<% if ("NULL".equals(l2EndDateFieldType)) { %> NULL"<% } else {%> '" + (customEndDate_<%=cid%>) + "'"<%}}%>
|
||||
+ "<%if(isEnableType2 && isEnableActive) {%>, 1<%}%><%if(isEnableType2 && isEnableVersion) {%>, 1<%}%> FROM <%=text_util.wrap("sourceTable", cid)%> t LEFT JOIN <%=text_util.wrap("tableName", cid)%> d ON <%=joinClauseString%> WHERE (<%=outerWhereClauseString%>)";
|
||||
java.sql.Statement stmtInsert_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
stmtInsert_<%=cid%>.executeUpdate(insert_<%=cid%>);
|
||||
@@ -166,4 +171,4 @@ if(isEnableDebug) {
|
||||
System.out.println("[<%=cid%>] new rows sql\n" + insert_<%=cid %> + "\ndone");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
%>
|
||||
|
||||
@@ -81,6 +81,8 @@ String sequenceName = ElementParameterParser.getValue(node,"__SK_DB_SEQUENCE__")
|
||||
|
||||
String startDateField = ElementParameterParser.getValue(node,"__L2_STARTDATE_FIELD__");
|
||||
String endDateField = ElementParameterParser.getValue(node,"__L2_ENDDATE_FIELD__");
|
||||
String l2EndDateFieldType = ElementParameterParser.getValue(node,"__L2_ENDDATE_FIELD_TYPE__");
|
||||
String l2EndDateFieldFixedDateValue = ElementParameterParser.getValue(node,"__FIXED_DATE_VALUE__");
|
||||
boolean isEnableActive = ("true").equals(ElementParameterParser.getValue(node,"__USE_L2_ACTIVE__"));
|
||||
String activeField = ElementParameterParser.getValue(node,"__L2_ACTIVE_FIELD__");
|
||||
boolean isEnableVersion = ("true").equals(ElementParameterParser.getValue(node,"__USE_L2_VERSION__"));
|
||||
@@ -104,8 +106,11 @@ if(isEnableType2) {
|
||||
}
|
||||
}
|
||||
%>
|
||||
<% if ("FIXED_DATE_VALUE".equals(l2EndDateFieldType)) { %>
|
||||
String customEndDate_<%=cid%> = java.sql.Timestamp.valueOf(<%=l2EndDateFieldFixedDateValue%> +" 00:00:00").toString();
|
||||
<%}%>
|
||||
String updateForType2_<%=cid %> = "UPDATE \"" + tableName_<%=cid%> + "\" d SET \"<%=endDateField%>\" = '" + (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "'<%if (isEnableActive) {%>, \"<%=activeField%>\" = 0<%}%> WHERE EXISTS (SELECT 1 FROM \"" + sourceTable_<%=cid%> +
|
||||
"\" t WHERE <%=joinClauseString%> AND (<%=whereClauseString%>)) AND d.\"<%=endDateField%>\" IS NULL";
|
||||
"\" t WHERE <%=joinClauseString%> AND (<%=whereClauseString%>)) AND d.\"<%=endDateField%>\"<% if ("NULL".equals(l2EndDateFieldType)) { %> IS NULL "<% } else { %> = '" + (customEndDate_<%=cid%>) + "'"<%}%>;
|
||||
java.sql.Statement stmtType2Update_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
stmtType2Update_<%=cid%>.executeUpdate(updateForType2_<%=cid%>);
|
||||
stmtType2Update_<%=cid%>.close();
|
||||
@@ -143,7 +148,7 @@ if(isEnableType2) {
|
||||
columnNameString = StringUtils.join(columnNames.toArray(), ", ");
|
||||
%>
|
||||
String insertForType2_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\"(<%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>\"<%=surrogateKey%>\", <%}%><%=columnNameString%>) SELECT <%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>NEXT VALUE FOR " + <%=sequenceName%> + ", <%}%>t.<%=selectColumnString%>, '" +
|
||||
(new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "', CAST(NULL AS <%=endDateFieldType%>)<%if(isEnableActive) {%>, 1<%}%><%if(isEnableVersion) {%>, d.\"<%=versionField%>\" + 1<%}%> FROM \"" +
|
||||
(new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "',<% if("NULL".equals(l2EndDateFieldType)) { %> CAST(NULL AS <%=endDateFieldType%>) <% } else {%> '" + (customEndDate_<%=cid%>) + "'<%} if(isEnableActive) {%>, 1<%}%><%if(isEnableVersion) {%>, d.\"<%=versionField%>\" + 1<%}%> FROM \"" +
|
||||
sourceTable_<%=cid%> + "\" t, \"" + tableName_<%=cid%> + "\" d WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.\"<%=endDateField%>\" = '" + (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "'";
|
||||
java.sql.Statement stmtType2Insert_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
stmtType2Insert_<%=cid%>.executeUpdate(insertForType2_<%=cid%>);
|
||||
@@ -162,9 +167,9 @@ for (Map<String, String> sk : sourceKeys) {
|
||||
}
|
||||
String outerWhereClauseString = StringUtils.join(outerWhereClause.toArray(), " AND ");
|
||||
%>
|
||||
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\"(<%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>\"<%=surrogateKey%>\", <%}%><%=columnNameString%>) SELECT <%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>NEXT VALUE FOR " + <%=sequenceName%> + ", <%}%>t.<%=selectColumnString%>"<%if(isEnableType2) {%> + ", '" + (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "', CAST(NULL AS <%=endDateFieldType%>)"<%}%>
|
||||
+ "<%if(isEnableType2 && isEnableActive) {%>, 1<%}%><%if(isEnableType2 && isEnableVersion) {%>, 1<%}%> FROM \"" +
|
||||
sourceTable_<%=cid%> + "\" t LEFT JOIN \"" + tableName_<%=cid%> + "\" d ON <%=joinClauseString%> WHERE (<%=outerWhereClauseString%>)";
|
||||
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\"(<%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>\"<%=surrogateKey%>\", <%}%><%=columnNameString%>) SELECT <%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>NEXT VALUE FOR " + <%=sequenceName%> + ", <%}%>t.<%=selectColumnString%>" <%if(isEnableType2) {%>
|
||||
+ ", '" + (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "',<% if ("NULL".equals(l2EndDateFieldType)) { %> CAST(NULL AS <%=endDateFieldType%>)"<% } else {%> '" + (customEndDate_<%=cid%>) + "'"<%}}%>
|
||||
+ "<%if(isEnableType2 && isEnableActive) {%>, 1<%}%><%if(isEnableType2 && isEnableVersion) {%>, 1<%}%> FROM \"" + sourceTable_<%=cid%> + "\" t LEFT JOIN \"" + tableName_<%=cid%> + "\" d ON <%=joinClauseString%> WHERE (<%=outerWhereClauseString%>)";
|
||||
java.sql.Statement stmtInsert_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
stmtInsert_<%=cid%>.executeUpdate(insert_<%=cid%>);
|
||||
stmtInsert_<%=cid%>.close();
|
||||
@@ -175,4 +180,3 @@ if(isEnableDebug) {
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
|
||||
@@ -77,6 +77,8 @@ if(isEnableType1) {
|
||||
|
||||
String startDateField = ElementParameterParser.getValue(node,"__L2_STARTDATE_FIELD__");
|
||||
String endDateField = ElementParameterParser.getValue(node,"__L2_ENDDATE_FIELD__");
|
||||
String l2EndDateFieldType = ElementParameterParser.getValue(node,"__L2_ENDDATE_FIELD_TYPE__");
|
||||
String l2EndDateFieldFixedDateValue = ElementParameterParser.getValue(node,"__FIXED_DATE_VALUE__");
|
||||
boolean isEnableActive = ("true").equals(ElementParameterParser.getValue(node,"__USE_L2_ACTIVE__"));
|
||||
String activeField = ElementParameterParser.getValue(node,"__L2_ACTIVE_FIELD__");
|
||||
boolean isEnableVersion = ("true").equals(ElementParameterParser.getValue(node,"__USE_L2_VERSION__"));
|
||||
@@ -95,6 +97,9 @@ if(isEnableType2) {
|
||||
String whereClauseString = StringUtils.join(whereClause.toArray(), " OR ");
|
||||
%>
|
||||
String changeDateTime_<%=cid%> = (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))).toString();
|
||||
<% if ("FIXED_DATE_VALUE".equals(l2EndDateFieldType)) { %>
|
||||
String customEndDate_<%=cid%> = java.sql.Timestamp.valueOf(<%=l2EndDateFieldFixedDateValue%> +" 00:00:00").toString();
|
||||
<%}%>
|
||||
<%if(isEnableDebug){%>
|
||||
String changeDateTime_<%=cid%>_begin = changeDateTime_<%=cid%>;
|
||||
String changeDateTime_<%=cid%>_end = changeDateTime_<%=cid%>;
|
||||
@@ -113,14 +118,14 @@ if(isEnableType2) {
|
||||
}
|
||||
}
|
||||
%>
|
||||
String updateForType2_<%=cid %> = "UPDATE `" + tableName_<%=cid%> + "` d, `" + sourceTable_<%=cid%> + "` t SET `<%=endDateField%>` = '" + (changeDateTime_<%=cid%>) + "'<%if (isEnableActive) {%>, `<%=activeField%>` = 0<%}%> WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.`<%=endDateField%>` IS NULL";
|
||||
String updateForType2_<%=cid %> = "UPDATE `" + tableName_<%=cid%> + "` d, `" + sourceTable_<%=cid%> + "` t SET `<%=endDateField%>` = '" + (changeDateTime_<%=cid%>) + "'<%if (isEnableActive) {%>, `<%=activeField%>` = 0<%}%> WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.`<%=endDateField%>`<% if ("NULL".equals(l2EndDateFieldType)) { %> IS NULL "<% } else { %> = '" + (customEndDate_<%=cid%>) + "'"<%}%>;
|
||||
java.sql.Statement stmtType2Update_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
stmtType2Update_<%=cid%>.executeUpdate(updateForType2_<%=cid%>);
|
||||
stmtType2Update_<%=cid%>.close();
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
String updateForType2_<%=cid %>_debug = "UPDATE `" + tableName_<%=cid%> + "` d, `" + sourceTable_<%=cid%> + "` t SET `<%=endDateField%>` = '" + (changeDateTime_<%=cid%>_end) + "'<%if (isEnableActive) {%>, `<%=activeField%>` = 0<%}%> WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.`<%=endDateField%>` IS NULL";
|
||||
String updateForType2_<%=cid %>_debug = "UPDATE `" + tableName_<%=cid%> + "` d, `" + sourceTable_<%=cid%> + "` t SET `<%=endDateField%>` = '" + (changeDateTime_<%=cid%>_end) + "'<%if (isEnableActive) {%>, `<%=activeField%>` = 0<%}%> WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.`<%=endDateField%>`<% if ("NULL".equals(l2EndDateFieldType)) { %> IS NULL "<% } else { %> = '" + (customEndDate_<%=cid%>) + "'"<%}%>;
|
||||
System.out.println("[<%=cid%>] type2 update sql\n" + updateForType2_<%=cid%>_debug + "\ndone");
|
||||
<%
|
||||
}
|
||||
@@ -152,7 +157,7 @@ if(isEnableType2) {
|
||||
columnNameString = StringUtils.join(columnNames.toArray(), ", ");
|
||||
%>
|
||||
String insertForType2_<%=cid%> = "INSERT INTO `" + tableName_<%=cid%> + "`(<%=columnNameString%>) SELECT t.<%=selectColumnString%>, '" +
|
||||
(changeDateTime_<%=cid%>) + "', NULL<%if(isEnableActive) {%>, 1<%}%><%if(isEnableVersion) {%>, d.`<%=versionField%>` + 1<%}%> FROM `" +
|
||||
(changeDateTime_<%=cid%>) + "',<% if("NULL".equals(l2EndDateFieldType)) { %> NULL<% } else {%> '" + (customEndDate_<%=cid%>) + "'<%} if(isEnableActive) {%>, 1<%}%><%if(isEnableVersion) {%>, d.`<%=versionField%>` + 1<%}%> FROM `" +
|
||||
sourceTable_<%=cid%> + "` t, `" + tableName_<%=cid%> + "` d WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.`<%=endDateField%>` = '" + (changeDateTime_<%=cid%>) + "'";
|
||||
java.sql.Statement stmtType2Insert_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
stmtType2Insert_<%=cid%>.executeUpdate(insertForType2_<%=cid%>);
|
||||
@@ -160,7 +165,7 @@ if(isEnableType2) {
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
String insertForType2_<%=cid%>_debug = "INSERT INTO `" + tableName_<%=cid%> + "`(<%=columnNameString%>) SELECT t.<%=selectColumnString%>, '" + (changeDateTime_<%=cid%>_begin) + "', NULL<%if(isEnableActive) {%>, 1<%}%><%if(isEnableVersion) {%>, d.`<%=versionField%>` + 1<%}%> FROM `" + sourceTable_<%=cid%> + "` t, `" + tableName_<%=cid%> + "` d WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.`<%=endDateField%>` = '" + (changeDateTime_<%=cid%>_end) + "'";
|
||||
String insertForType2_<%=cid%>_debug = "INSERT INTO `" + tableName_<%=cid%> + "`(<%=columnNameString%>) SELECT t.<%=selectColumnString%>, '" + (changeDateTime_<%=cid%>_begin) + "',<% if("NULL".equals(l2EndDateFieldType)) { %> NULL<% } else {%> '" + (customEndDate_<%=cid%>) + "'<%} if(isEnableActive) {%>, 1<%}%><%if(isEnableVersion) {%>, d.`<%=versionField%>` + 1<%}%> FROM `" + sourceTable_<%=cid%> + "` t, `" + tableName_<%=cid%> + "` d WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.`<%=endDateField%>` = '" + (changeDateTime_<%=cid%>_end) + "'";
|
||||
System.out.println("[<%=cid%>] type2 new active row slq\n" + insertForType2_<%=cid %>_debug + "\ndone");
|
||||
<%
|
||||
}
|
||||
@@ -172,7 +177,7 @@ for (Map<String, String> sk : sourceKeys) {
|
||||
}
|
||||
String outerWhereClauseString = StringUtils.join(outerWhereClause.toArray(), " AND ");
|
||||
%>
|
||||
String insert_<%=cid%> = "INSERT INTO `" + tableName_<%=cid%> + "`(<%=columnNameString%>) SELECT t.<%=selectColumnString%>"<%if(isEnableType2) {%> + ", '" + (changeDateTime_<%=cid%>) + "', NULL"<%}%>
|
||||
String insert_<%=cid%> = "INSERT INTO `" + tableName_<%=cid%> + "`(<%=columnNameString%>) SELECT t.<%=selectColumnString%>"<%if(isEnableType2) {%> + ", '" + (changeDateTime_<%=cid%>) + "',<% if ("NULL".equals(l2EndDateFieldType)) { %> NULL"<% } else {%> '" + (customEndDate_<%=cid%>) + "'"<%}}%>
|
||||
+ "<%if(isEnableType2 && isEnableActive) {%>, 1<%}%><%if(isEnableType2 && isEnableVersion) {%>, 1<%}%> FROM `" +
|
||||
sourceTable_<%=cid%> + "` t LEFT JOIN `" + tableName_<%=cid%> + "` d ON <%=joinClauseString%> WHERE (<%=outerWhereClauseString%>)";
|
||||
java.sql.Statement stmtInsert_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
@@ -181,9 +186,8 @@ stmtInsert_<%=cid%>.close();
|
||||
<%
|
||||
if(isEnableDebug) {
|
||||
%>
|
||||
String insert_<%=cid%>_debug = "INSERT INTO `" + tableName_<%=cid%> + "`(<%=columnNameString%>) SELECT t.<%=selectColumnString%>"<%if(isEnableType2) {%> + ", '" + (changeDateTime_<%=cid%>_begin) + "', NULL"<%}%> + "<%if(isEnableType2 && isEnableActive) {%>, 1<%}%><%if(isEnableType2 && isEnableVersion) {%>, 1<%}%> FROM `" + sourceTable_<%=cid%> + "` t LEFT JOIN `" + tableName_<%=cid%> + "` d ON <%=joinClauseString%> WHERE (<%=outerWhereClauseString%>)";
|
||||
String insert_<%=cid%>_debug = "INSERT INTO `" + tableName_<%=cid%> + "`(<%=columnNameString%>) SELECT t.<%=selectColumnString%>"<%if(isEnableType2) {%> + ", '" + (changeDateTime_<%=cid%>_begin) + "',<% if ("NULL".equals(l2EndDateFieldType)) { %> NULL"<% } else {%> '"+ (customEndDate_<%=cid%>) +"'"<%}}%> + "<%if(isEnableType2 && isEnableActive) {%>, 1<%}%><%if(isEnableType2 && isEnableVersion) {%>, 1<%}%> FROM `" + sourceTable_<%=cid%> + "` t LEFT JOIN `" + tableName_<%=cid%> + "` d ON <%=joinClauseString%> WHERE (<%=outerWhereClauseString%>)";
|
||||
System.out.println("[<%=cid%>] new rows sql\n" + insert_<%=cid %>_debug + "\ndone");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ String versionField = ElementParameterParser.getValue(node,"__L2_VERSION_FIELD__
|
||||
String l2StartDateFieldType = ElementParameterParser.getValue(node,"__L2_STARTDATE_FIELD_TYPE__");
|
||||
String l2EndDateFieldType = ElementParameterParser.getValue(node,"__L2_ENDDATE_FIELD_TYPE__");
|
||||
String l2StartDateFieldInputFieldName = ElementParameterParser.getValue(node,"__INPUT_FIELD_NAME__");
|
||||
String l2EndDateFieldFixedYearValue = ElementParameterParser.getValue(node,"__FIXED_YEAR_VALUE__");
|
||||
String l2EndDateFieldFixedYearValue = ElementParameterParser.getValue(node,"__FIXED_DATE_VALUE__");
|
||||
|
||||
if(isEnableType2) {
|
||||
List<String> whereClause = new ArrayList<String>();
|
||||
@@ -114,9 +114,9 @@ if(isEnableType2) {
|
||||
%>
|
||||
" IS NULL";
|
||||
<%
|
||||
}else if ("FIXED_YEAR_VALUE".equals(l2EndDateFieldType)) {
|
||||
}else if ("FIXED_DATE_VALUE".equals(l2EndDateFieldType)) {
|
||||
%>
|
||||
"= to_date ('" + <%=l2EndDateFieldFixedYearValue%> +"-01-01', 'yyyy-mm-dd')";
|
||||
"= to_date ('" + <%=l2EndDateFieldFixedYearValue%> + "', 'yyyy-mm-dd')";
|
||||
<%
|
||||
}%>
|
||||
java.sql.Statement stmtType2Update_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
@@ -171,9 +171,9 @@ if(isEnableType2) {
|
||||
%>
|
||||
", NULL"
|
||||
<%
|
||||
}else if ("FIXED_YEAR_VALUE".equals(l2EndDateFieldType)) {
|
||||
}else if ("FIXED_DATE_VALUE".equals(l2EndDateFieldType)) {
|
||||
%>
|
||||
", to_date('"+<%=l2EndDateFieldFixedYearValue%>+"-01-01', 'yyyy-mm-dd')"
|
||||
", to_date('" + <%=l2EndDateFieldFixedYearValue%> + "', 'yyyy-mm-dd')"
|
||||
<%
|
||||
}%>
|
||||
+"
|
||||
@@ -225,9 +225,9 @@ String insert_<%=cid%> = "INSERT INTO " + tableName_<%=cid%> + "(<%if(("DB_SEQUE
|
||||
%>
|
||||
", NULL"
|
||||
<%
|
||||
}else if ("FIXED_YEAR_VALUE".equals(l2EndDateFieldType)) {
|
||||
}else if ("FIXED_DATE_VALUE".equals(l2EndDateFieldType)) {
|
||||
%>
|
||||
", to_date('"+<%=l2EndDateFieldFixedYearValue%>+"-01-01', 'yyyy-mm-dd')"
|
||||
", to_date('" + <%=l2EndDateFieldFixedYearValue%> + "', 'yyyy-mm-dd')"
|
||||
<%
|
||||
}%>
|
||||
|
||||
@@ -247,4 +247,3 @@ if(isEnableDebug) {
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
|
||||
@@ -75,6 +75,8 @@ String sequenceName = ElementParameterParser.getValue(node,"__SK_DB_SEQUENCE__")
|
||||
|
||||
String startDateField = ElementParameterParser.getValue(node,"__L2_STARTDATE_FIELD__");
|
||||
String endDateField = ElementParameterParser.getValue(node,"__L2_ENDDATE_FIELD__");
|
||||
String l2EndDateFieldType = ElementParameterParser.getValue(node,"__L2_ENDDATE_FIELD_TYPE__");
|
||||
String l2EndDateFieldFixedDateValue = ElementParameterParser.getValue(node,"__FIXED_DATE_VALUE__");
|
||||
boolean isEnableActive = ("true").equals(ElementParameterParser.getValue(node,"__USE_L2_ACTIVE__"));
|
||||
String activeField = ElementParameterParser.getValue(node,"__L2_ACTIVE_FIELD__");
|
||||
boolean isEnableVersion = ("true").equals(ElementParameterParser.getValue(node,"__USE_L2_VERSION__"));
|
||||
@@ -87,8 +89,10 @@ if(isEnableType2) {
|
||||
whereClause.add(" COALESCE(d." + strFieldName + "<> t."+ strFieldName + ", (d." + strFieldName + " is null and not t." + strFieldName + " is null) or (not d." + strFieldName + " is null and t." + strFieldName + " is null))");
|
||||
}
|
||||
String whereClauseString = StringUtils.join(whereClause.toArray(), " OR ");
|
||||
%>
|
||||
String updateForType2_<%=cid%> = "UPDATE \"" + tableName_<%=cid%> + "\" d SET \"<%=endDateField%>\" = '" + (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "'<%if(isEnableActive) {%>, \"<%=activeField%>\" = 0<%}%> FROM \"" + sourceTable_<%=cid%> + "\" t WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.\"<%=endDateField%>\" IS NULL";
|
||||
if ("FIXED_DATE_VALUE".equals(l2EndDateFieldType)) { %>
|
||||
String customEndDate_<%=cid%> = java.sql.Timestamp.valueOf(<%=l2EndDateFieldFixedDateValue%> +" 00:00:00").toString();
|
||||
<%}%>
|
||||
String updateForType2_<%=cid%> = "UPDATE \"" + tableName_<%=cid%> + "\" d SET \"<%=endDateField%>\" = '" + (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "'<%if(isEnableActive) {%>, \"<%=activeField%>\" = 0<%}%> FROM \"" + sourceTable_<%=cid%> + "\" t WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.\"<%=endDateField%>\"<% if ("NULL".equals(l2EndDateFieldType)) { %> IS NULL"<% } else { %> = '" + (customEndDate_<%=cid%>) + "'"<%}%>;
|
||||
java.sql.Statement stmtType2Update_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
stmtType2Update_<%=cid%>.executeUpdate(updateForType2_<%=cid%>);
|
||||
stmtType2Update_<%=cid%>.close();
|
||||
@@ -126,7 +130,7 @@ if(isEnableType2) {
|
||||
columnNameString = StringUtils.join(columnNames.toArray(), ", ");
|
||||
%>
|
||||
String insertForType2_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\"(<%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>\"<%=surrogateKey%>\", <%}%><%=columnNameString%>) SELECT <%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>NEXTVAL('" + <%=sequenceName%> + "'), <%}%>t.<%=selectColumnString%>, '" +
|
||||
(new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "', NULL<%if(isEnableActive) {%>, 1<%}%><%if(isEnableVersion) {%>, d.\"<%=versionField%>\" + 1<%}%> FROM \"" +
|
||||
(new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "',<% if("NULL".equals(l2EndDateFieldType)) { %> NULL<% } else {%> '" + (customEndDate_<%=cid%>) + "'<%} if(isEnableActive) {%>, 1<%}%><%if(isEnableVersion) {%>, d.\"<%=versionField%>\" + 1<%}%> FROM \"" +
|
||||
sourceTable_<%=cid%> + "\" t, \"" + tableName_<%=cid%> + "\" d WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.\"<%=endDateField%>\" = '" + (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "'";
|
||||
java.sql.Statement stmtType2Insert_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
stmtType2Insert_<%=cid%>.executeUpdate(insertForType2_<%=cid%>);
|
||||
@@ -145,7 +149,8 @@ for (Map<String, String> sk : sourceKeys) {
|
||||
}
|
||||
String outerWhereClauseString = StringUtils.join(outerWhereClause.toArray(), " AND ");
|
||||
%>
|
||||
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\"(<%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>\"<%=surrogateKey%>\", <%}%><%=columnNameString%>) SELECT <%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>NEXTVAL('" + <%=sequenceName%> + "'), <%}%>t.<%=selectColumnString%>"<%if(isEnableType2) {%> + ", '" + (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "', NULL"<%}%>
|
||||
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\"(<%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>\"<%=surrogateKey%>\", <%}%><%=columnNameString%>) SELECT <%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>NEXTVAL('" + <%=sequenceName%> + "'), <%}%>t.<%=selectColumnString%>"<%if(isEnableType2) {%> + ", '" + (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>")))
|
||||
+ "',<% if ("NULL".equals(l2EndDateFieldType)) { %> NULL"<% } else {%> '" + (customEndDate_<%=cid%>) + "'"<%}}%>
|
||||
+ "<%if(isEnableType2 && isEnableActive) {%>, 1<%}%><%if(isEnableType2 && isEnableVersion) {%>, 1<%}%> FROM \"" +
|
||||
sourceTable_<%=cid%> + "\" t LEFT JOIN \"" + tableName_<%=cid%> + "\" d ON <%=joinClauseString%> WHERE (<%=outerWhereClauseString%>)";
|
||||
java.sql.Statement stmtInsert_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
@@ -158,4 +163,3 @@ if(isEnableDebug) {
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
|
||||
@@ -74,6 +74,8 @@ String sequenceName = ElementParameterParser.getValue(node,"__SK_DB_SEQUENCE__")
|
||||
|
||||
String startDateField = ElementParameterParser.getValue(node,"__L2_STARTDATE_FIELD__");
|
||||
String endDateField = ElementParameterParser.getValue(node,"__L2_ENDDATE_FIELD__");
|
||||
String l2EndDateFieldType = ElementParameterParser.getValue(node,"__L2_ENDDATE_FIELD_TYPE__");
|
||||
String l2EndDateFieldFixedDateValue = ElementParameterParser.getValue(node,"__FIXED_DATE_VALUE__");
|
||||
boolean isEnableActive = ("true").equals(ElementParameterParser.getValue(node,"__USE_L2_ACTIVE__"));
|
||||
String activeField = ElementParameterParser.getValue(node,"__L2_ACTIVE_FIELD__");
|
||||
boolean isEnableVersion = ("true").equals(ElementParameterParser.getValue(node,"__USE_L2_VERSION__"));
|
||||
@@ -85,8 +87,10 @@ if(isEnableType2) {
|
||||
" <> t." + StringUtils.getPostgresqlProtectedColumnName(type2Attribute.get("NAME")));
|
||||
}
|
||||
String whereClauseString = StringUtils.join(whereClause.toArray(), " OR ");
|
||||
%>
|
||||
String updateForType2_<%=cid%> = "UPDATE \"" + tableName_<%=cid%> + "\" d SET \"<%=endDateField%>\" = '" + (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "'<%if(isEnableActive) {%>, \"<%=activeField%>\" = 0<%}%> FROM \"" + sourceTable_<%=cid%> + "\" t WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.\"<%=endDateField%>\" IS NULL";
|
||||
if ("FIXED_DATE_VALUE".equals(l2EndDateFieldType)) { %>
|
||||
String customEndDate_<%=cid%> = java.sql.Timestamp.valueOf(<%=l2EndDateFieldFixedDateValue%> +" 00:00:00").toString();
|
||||
<%}%>
|
||||
String updateForType2_<%=cid%> = "UPDATE \"" + tableName_<%=cid%> + "\" d SET \"<%=endDateField%>\" = '" + (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "'<%if(isEnableActive) {%>, \"<%=activeField%>\" = 0<%}%> FROM \"" + sourceTable_<%=cid%> + "\" t WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.\"<%=endDateField%>\"<% if ("NULL".equals(l2EndDateFieldType)) { %> IS NULL"<% } else { %> = '" + (customEndDate_<%=cid%>) + "'"<%}%>;
|
||||
java.sql.Statement stmtType2Update_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
stmtType2Update_<%=cid%>.executeUpdate(updateForType2_<%=cid%>);
|
||||
stmtType2Update_<%=cid%>.close();
|
||||
@@ -124,7 +128,7 @@ if(isEnableType2) {
|
||||
columnNameString = StringUtils.join(columnNames.toArray(), ", ");
|
||||
%>
|
||||
String insertForType2_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\"(<%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>\"<%=surrogateKey%>\", <%}%><%=columnNameString%>) SELECT <%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>NEXTVAL('" + <%=sequenceName%> + "'), <%}%>t.<%=selectColumnString%>, '" +
|
||||
(new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "', NULL<%if(isEnableActive) {%>, 1<%}%><%if(isEnableVersion) {%>, d.\"<%=versionField%>\" + 1<%}%> FROM \"" +
|
||||
(new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "',<% if("NULL".equals(l2EndDateFieldType)) { %> NULL<% } else {%> '" + (customEndDate_<%=cid%>) + "'<%} if(isEnableActive) {%>, 1<%}%><%if(isEnableVersion) {%>, d.\"<%=versionField%>\" + 1<%}%> FROM \"" +
|
||||
sourceTable_<%=cid%> + "\" t, \"" + tableName_<%=cid%> + "\" d WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.\"<%=endDateField%>\" = '" + (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "'";
|
||||
java.sql.Statement stmtType2Insert_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
stmtType2Insert_<%=cid%>.executeUpdate(insertForType2_<%=cid%>);
|
||||
@@ -143,7 +147,8 @@ for (Map<String, String> sk : sourceKeys) {
|
||||
}
|
||||
String outerWhereClauseString = StringUtils.join(outerWhereClause.toArray(), " AND ");
|
||||
%>
|
||||
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\"(<%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>\"<%=surrogateKey%>\", <%}%><%=columnNameString%>) SELECT <%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>NEXTVAL('" + <%=sequenceName%> + "'), <%}%>t.<%=selectColumnString%>"<%if(isEnableType2) {%> + ", '" + (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "', NULL"<%}%>
|
||||
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\"(<%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>\"<%=surrogateKey%>\", <%}%><%=columnNameString%>) SELECT <%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>NEXTVAL('" + <%=sequenceName%> + "'), <%}%>t.<%=selectColumnString%>"<%if(isEnableType2) {%> + ", '" + (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>")))
|
||||
+ "',<% if ("NULL".equals(l2EndDateFieldType)) { %> NULL"<% } else {%> '" + (customEndDate_<%=cid%>) + "'"<%}}%>
|
||||
+ "<%if(isEnableType2 && isEnableActive) {%>, 1<%}%><%if(isEnableType2 && isEnableVersion) {%>, 1<%}%> FROM \"" +
|
||||
sourceTable_<%=cid%> + "\" t LEFT JOIN \"" + tableName_<%=cid%> + "\" d ON <%=joinClauseString%> WHERE (<%=outerWhereClauseString%>)";
|
||||
java.sql.Statement stmtInsert_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
@@ -156,4 +161,3 @@ if(isEnableDebug) {
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
|
||||
@@ -78,6 +78,8 @@ if(isEnableType1) {
|
||||
|
||||
String startDateField = ElementParameterParser.getValue(node,"__L2_STARTDATE_FIELD__");
|
||||
String endDateField = ElementParameterParser.getValue(node,"__L2_ENDDATE_FIELD__");
|
||||
String l2EndDateFieldType = ElementParameterParser.getValue(node,"__L2_ENDDATE_FIELD_TYPE__");
|
||||
String l2EndDateFieldFixedDateValue = ElementParameterParser.getValue(node,"__FIXED_DATE_VALUE__");
|
||||
boolean isEnableActive = ("true").equals(ElementParameterParser.getValue(node,"__USE_L2_ACTIVE__"));
|
||||
String activeField = ElementParameterParser.getValue(node,"__L2_ACTIVE_FIELD__");
|
||||
boolean isEnableVersion = ("true").equals(ElementParameterParser.getValue(node,"__USE_L2_VERSION__"));
|
||||
@@ -99,9 +101,11 @@ if(isEnableType2) {
|
||||
String whereClauseString = StringUtils.join(whereClause.toArray(), " OR ");
|
||||
%>
|
||||
String changeDateTime_<%=cid%> = (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))).toString();
|
||||
|
||||
String updateForType2_<%=cid %> = "UPDATE <%=text_util.wrap("tableName", cid)%> d SET <%=text_util.wrap(endDateField)%> = '" + (changeDateTime_<%=cid%>) + "'<%if (isEnableActive) {%>, <%=text_util.wrap(activeField)%> = 0<%}%> FROM <%=text_util.wrap("tableName", cid)%> d, <%=text_util.wrap("sourceTable", cid)%> t WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.<%=text_util.wrap(endDateField)%> IS NULL";
|
||||
|
||||
<% if ("FIXED_DATE_VALUE".equals(l2EndDateFieldType)) { %>
|
||||
String customEndDate_<%=cid%> = java.sql.Timestamp.valueOf(<%=l2EndDateFieldFixedDateValue%> +" 00:00:00").toString();
|
||||
<%}%>
|
||||
String updateForType2_<%=cid %> = "UPDATE <%=text_util.wrap("tableName", cid)%> d SET <%=text_util.wrap(endDateField)%> = '" + (changeDateTime_<%=cid%>)
|
||||
+ "'<%if (isEnableActive) {%>, <%=text_util.wrap(activeField)%> = 0<%}%> FROM <%=text_util.wrap("tableName", cid)%> d, <%=text_util.wrap("sourceTable", cid)%> t WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.<%=text_util.wrap(endDateField)%><% if ("NULL".equals(l2EndDateFieldType)) { %> IS NULL"<% } else { %> = '" + (customEndDate_<%=cid%>) + "'"<%}%>;
|
||||
java.sql.Statement stmtType2Update_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
stmtType2Update_<%=cid%>.executeUpdate(updateForType2_<%=cid%>);
|
||||
stmtType2Update_<%=cid%>.close();
|
||||
@@ -139,7 +143,7 @@ if(isEnableType2) {
|
||||
columnNameString = StringUtils.join(columnNames.toArray(), ", ");
|
||||
%>
|
||||
String insertForType2_<%=cid%> = "INSERT INTO <%=text_util.wrap("tableName", cid)%> (<%if(useSequence) {%><%=text_util.wrap(surrogateKey)%>, <%}%><%=columnNameString%>) SELECT " + <%if(useSequence) {%>sequenceValueFetchPattern_<%=cid%> + ", " + <%}%>" t.<%=selectColumnString%>, '" +
|
||||
(changeDateTime_<%=cid%>) + "', NULL<%if(isEnableActive) {%>, 1<%}%><%if(isEnableVersion) {%>, d.<%=text_util.wrap(versionField)%> + 1<%}%> FROM <%=text_util.wrap("sourceTable", cid)%> t, <%=text_util.wrap("tableName", cid)%> d WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.<%=text_util.wrap(endDateField)%> = '" + (changeDateTime_<%=cid%>) + "'";
|
||||
(changeDateTime_<%=cid%>) + "',<% if("NULL".equals(l2EndDateFieldType)) { %> NULL<% } else {%> '" + (customEndDate_<%=cid%>) + "'<%} if(isEnableActive) {%>, 1<%}%><%if(isEnableVersion) {%>, d.<%=text_util.wrap(versionField)%> + 1<%}%> FROM <%=text_util.wrap("sourceTable", cid)%> t, <%=text_util.wrap("tableName", cid)%> d WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.<%=text_util.wrap(endDateField)%> = '" + (changeDateTime_<%=cid%>) + "'";
|
||||
java.sql.Statement stmtType2Insert_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
stmtType2Insert_<%=cid%>.executeUpdate(insertForType2_<%=cid%>);
|
||||
stmtType2Insert_<%=cid%>.close();
|
||||
@@ -157,7 +161,8 @@ for (Map<String, String> sk : sourceKeys) {
|
||||
}
|
||||
String outerWhereClauseString = StringUtils.join(outerWhereClause.toArray(), " AND ");
|
||||
%>
|
||||
String insert_<%=cid%> = "INSERT INTO <%=text_util.wrap("tableName", cid)%> (<%if(useSequence) {%><%=text_util.wrap(surrogateKey)%>, <%}%><%=columnNameString%>) SELECT " + <%if(useSequence) {%>sequenceValueFetchPattern_<%=cid%> + ", " + <%}%>" t.<%=selectColumnString%>"<%if(isEnableType2) {%> + ", '" + (changeDateTime_<%=cid%>) + "', NULL"<%}%>
|
||||
String insert_<%=cid%> = "INSERT INTO <%=text_util.wrap("tableName", cid)%> (<%if(useSequence) {%><%=text_util.wrap(surrogateKey)%>, <%}%><%=columnNameString%>) SELECT " + <%if(useSequence) {%>sequenceValueFetchPattern_<%=cid%> + ", " + <%}%>" t.<%=selectColumnString%>"<%if(isEnableType2) {%> + ", '" + (changeDateTime_<%=cid%>)
|
||||
+ "',<% if ("NULL".equals(l2EndDateFieldType)) { %> NULL"<% } else {%> '" + (customEndDate_<%=cid%>) + "'"<%}}%>
|
||||
+ "<%if(isEnableType2 && isEnableActive) {%>, 1<%}%><%if(isEnableType2 && isEnableVersion) {%>, 1<%}%> FROM <%=text_util.wrap("sourceTable", cid)%> t LEFT JOIN <%=text_util.wrap("tableName", cid)%> d ON <%=joinClauseString%> WHERE (<%=outerWhereClauseString%>)";
|
||||
|
||||
java.sql.Statement stmtInsert_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
@@ -169,4 +174,4 @@ if(isEnableDebug) {
|
||||
System.out.println("[<%=cid%>] new rows sql\n" + insert_<%=cid %> + "\ndone");
|
||||
<%
|
||||
}
|
||||
%>
|
||||
%>
|
||||
|
||||
@@ -80,6 +80,8 @@ String sequenceName = ElementParameterParser.getValue(node,"__SK_DB_SEQUENCE__")
|
||||
|
||||
String startDateField = ElementParameterParser.getValue(node,"__L2_STARTDATE_FIELD__");
|
||||
String endDateField = ElementParameterParser.getValue(node,"__L2_ENDDATE_FIELD__");
|
||||
String l2EndDateFieldType = ElementParameterParser.getValue(node,"__L2_ENDDATE_FIELD_TYPE__");
|
||||
String l2EndDateFieldFixedDateValue = ElementParameterParser.getValue(node,"__FIXED_DATE_VALUE__");
|
||||
boolean isEnableActive = ("true").equals(ElementParameterParser.getValue(node,"__USE_L2_ACTIVE__"));
|
||||
String activeField = ElementParameterParser.getValue(node,"__L2_ACTIVE_FIELD__");
|
||||
boolean isEnableVersion = ("true").equals(ElementParameterParser.getValue(node,"__USE_L2_VERSION__"));
|
||||
@@ -100,8 +102,10 @@ if(isEnableType2) {
|
||||
}
|
||||
String whereClauseString = StringUtils.join(whereClause.toArray(), " OR ");
|
||||
String updateWhereClauseString = StringUtils.join(updateWhereClause.toArray(), " OR ");
|
||||
%>
|
||||
String updateForType2_<%=cid%> = "UPDATE " + tableName_<%=cid%> + " SET <%=endDateField%> = '" + (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "'<%if(isEnableActive) {%>, <%=activeField%> = 0<%}%> FROM " + sourceTable_<%=cid%> + " t WHERE <%=updateJoinClauseString%> AND (<%=updateWhereClauseString%>) AND " + tableName_<%=cid%> + ".<%=endDateField%> IS NULL";
|
||||
if ("FIXED_DATE_VALUE".equals(l2EndDateFieldType)) { %>
|
||||
String customEndDate_<%=cid%> = java.sql.Timestamp.valueOf(<%=l2EndDateFieldFixedDateValue%> +" 00:00:00").toString();
|
||||
<%}%>
|
||||
String updateForType2_<%=cid%> = "UPDATE " + tableName_<%=cid%> + " SET <%=endDateField%> = '" + (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "'<%if(isEnableActive) {%>, <%=activeField%> = 0<%}%> FROM " + sourceTable_<%=cid%> + " t WHERE <%=updateJoinClauseString%> AND (<%=updateWhereClauseString%>) AND " + tableName_<%=cid%> + ".<%=endDateField%><% if ("NULL".equals(l2EndDateFieldType)) { %> IS NULL"<% } else { %> = '" + (customEndDate_<%=cid%>) + "'"<%}%>;
|
||||
java.sql.Statement stmtType2Update_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
stmtType2Update_<%=cid%>.executeUpdate(updateForType2_<%=cid%>);
|
||||
stmtType2Update_<%=cid%>.close();
|
||||
@@ -139,7 +143,7 @@ if(isEnableType2) {
|
||||
columnNameString = StringUtils.join(columnNames.toArray(), ", ");
|
||||
%>
|
||||
String insertForType2_<%=cid%> = "INSERT INTO " + tableName_<%=cid%> + "(<%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%><%=surrogateKey%>, <%}%><%=columnNameString%>) SELECT <%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>" + <%=sequenceName%> + ".NEXTVAL, <%}%>t.<%=selectColumnString%>, '" +
|
||||
(new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "', NULL<%if(isEnableActive) {%>, 1<%}%><%if(isEnableVersion) {%>, d.<%=versionField%> + 1<%}%> FROM " +
|
||||
(new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "',<% if("NULL".equals(l2EndDateFieldType)) { %> NULL<% } else {%> '" + (customEndDate_<%=cid%>) + "'<%} if(isEnableActive) {%>, 1<%}%><%if(isEnableVersion) {%>, d.<%=versionField%> + 1<%}%> FROM " +
|
||||
sourceTable_<%=cid%> + " t, " + tableName_<%=cid%> + " d WHERE <%=joinClauseString%> AND (<%=whereClauseString%>) AND d.<%=endDateField%> = '" + (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "'";
|
||||
java.sql.Statement stmtType2Insert_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
stmtType2Insert_<%=cid%>.executeUpdate(insertForType2_<%=cid%>);
|
||||
@@ -158,7 +162,8 @@ for (Map<String, String> sk : sourceKeys) {
|
||||
}
|
||||
String outerWhereClauseString = StringUtils.join(outerWhereClause.toArray(), " AND ");
|
||||
%>
|
||||
String insert_<%=cid%> = "INSERT INTO " + tableName_<%=cid%> + "(<%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%><%=surrogateKey%>, <%}%><%=columnNameString%>) SELECT <%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>" + <%=sequenceName%> + ".NEXTVAL, <%}%>t.<%=selectColumnString%>"<%if(isEnableType2) {%> + ", '" + (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>"))) + "', NULL"<%}%>
|
||||
String insert_<%=cid%> = "INSERT INTO " + tableName_<%=cid%> + "(<%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%><%=surrogateKey%>, <%}%><%=columnNameString%>) SELECT <%if(("DB_SEQUENCE").equals(surrogateKeyType)) {%>" + <%=sequenceName%> + ".NEXTVAL, <%}%>t.<%=selectColumnString%>"<%if(isEnableType2) {%> + ", '" + (new java.sql.Timestamp((Long)start_Hash.get("<%=cid %>")))
|
||||
+ "',<% if ("NULL".equals(l2EndDateFieldType)) { %> NULL"<% } else {%> '" + (customEndDate_<%=cid%>) + "'"<%}}%>
|
||||
+ "<%if(isEnableType2 && isEnableActive) {%>, 1<%}%><%if(isEnableType2 && isEnableVersion) {%>, 1<%}%> FROM " +
|
||||
sourceTable_<%=cid%> + " t LEFT JOIN " + tableName_<%=cid%> + " d ON <%=joinClauseString%> WHERE (<%=outerWhereClauseString%>)";
|
||||
java.sql.Statement stmtInsert_<%=cid%> = conn_<%=cid%>.createStatement();
|
||||
@@ -171,4 +176,3 @@ if(isEnableDebug) {
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
|
||||
@@ -313,24 +313,22 @@
|
||||
>
|
||||
</PARAMETER>
|
||||
|
||||
<!-- this field only work for oracle, keep it hidden and use the default now -->
|
||||
<PARAMETER NAME="L2_ENDDATE_FIELD_TYPE" FIELD="CLOSED_LIST" NUM_ROW="86"
|
||||
SHOW="false"
|
||||
>
|
||||
<ITEMS DEFAULT="NULL">
|
||||
<ITEM NAME="NULL" VALUE="NULL" />
|
||||
<ITEM NAME="FIXED_YEAR_VALUE" VALUE="FIXED_YEAR_VALUE" />
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
SHOW_IF="USE_L2 == 'true'"
|
||||
>
|
||||
<ITEMS DEFAULT="NULL">
|
||||
<ITEM NAME="NULL" VALUE="NULL" />
|
||||
<ITEM NAME="FIXED_DATE_VALUE" VALUE="FIXED_DATE_VALUE" />
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
|
||||
<!-- this field only work for oracle, keep it hidden and use the default now -->
|
||||
<PARAMETER
|
||||
NAME="FIXED_YEAR_VALUE"
|
||||
NAME="FIXED_DATE_VALUE"
|
||||
FIELD="TEXT"
|
||||
NUM_ROW="86"
|
||||
SHOW_IF="isShow[L2_ENDDATE_FIELD_TYPE] AND (L2_ENDDATE_FIELD_TYPE == 'FIXED_YEAR_VALUE')"
|
||||
SHOW_IF="isShow[L2_ENDDATE_FIELD_TYPE] AND (L2_ENDDATE_FIELD_TYPE == 'FIXED_DATE_VALUE')"
|
||||
>
|
||||
<DEFAULT>""</DEFAULT>
|
||||
<DEFAULT>"9999-12-31"</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user