Compare commits
236 Commits
pyzhou/TDI
...
patch/5.5.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6c992b06d | ||
|
|
3ccc0f0d01 | ||
|
|
f5007780d9 | ||
|
|
44f2e01da6 | ||
|
|
3e12fbc758 | ||
|
|
a9e196ebca | ||
|
|
2bc2020ece | ||
|
|
8ceb5c5773 | ||
|
|
582ea02b7d | ||
|
|
9a990ff742 | ||
|
|
8dd361aeda | ||
|
|
6f937b39da | ||
|
|
4570bd16d6 | ||
|
|
ff335e14bc | ||
|
|
4c45e5abbb | ||
|
|
a82124b02d | ||
|
|
46a1e87f15 | ||
|
|
c979fd6755 | ||
|
|
68fc96339e | ||
|
|
65d15e5f52 | ||
|
|
ccb1edec7a | ||
|
|
596cad3214 | ||
|
|
65e4521e36 | ||
|
|
717294aad5 | ||
|
|
b27a6a21b9 | ||
|
|
025e308eef | ||
|
|
dce19f15a2 | ||
|
|
2de01a369f | ||
|
|
383537d9d8 | ||
|
|
ae00ffa110 | ||
|
|
420d0a777f | ||
|
|
486d8db790 | ||
|
|
4f23104649 | ||
|
|
3fbf8176f4 | ||
|
|
e682cd204b | ||
|
|
6a74149210 | ||
|
|
499b100fce | ||
|
|
02132228fb | ||
|
|
74aff65037 | ||
|
|
73f417e4b5 | ||
|
|
623fb53054 | ||
|
|
88c9b762b9 | ||
|
|
524318aee8 | ||
|
|
29de16fe5b | ||
|
|
799fa946df | ||
|
|
6cd53357c0 | ||
|
|
d4c5db24bd | ||
|
|
59bbc2493b | ||
|
|
80faef72a4 | ||
|
|
951c4204e9 | ||
|
|
2a9be6e310 | ||
|
|
19c84499ed | ||
|
|
62f92ee8ce | ||
|
|
8928c62fac | ||
|
|
699fc5fc38 | ||
|
|
782f80150d | ||
|
|
5b5b0bf9f7 | ||
|
|
a5d0a11612 | ||
|
|
19ed3062ca | ||
|
|
d68904d156 | ||
|
|
55caf730d9 | ||
|
|
39ed6bc995 | ||
|
|
1eb1390037 | ||
|
|
383034102b | ||
|
|
805bbeccb8 | ||
|
|
9c8b5ecc7b | ||
|
|
d8d650a031 | ||
|
|
5e7e0344a9 | ||
|
|
5e04476b26 | ||
|
|
a1c5b1935c | ||
|
|
c3bbac2bf0 | ||
|
|
9f74c2b355 | ||
|
|
d6afdea9b4 | ||
|
|
0f52298b0d | ||
|
|
24ebe4c5ff | ||
|
|
46bd13203e | ||
|
|
eb33166638 | ||
|
|
94c608bfd1 | ||
|
|
1eb310e587 | ||
|
|
22b7121ee6 | ||
|
|
e201c056a2 | ||
|
|
8295aed1f1 | ||
|
|
cc9adf9571 | ||
|
|
92a3236084 | ||
|
|
32d2c9949d | ||
|
|
c57859e6ae | ||
|
|
2e7efdb9e7 | ||
|
|
a81845446f | ||
|
|
035a8e9eb6 | ||
|
|
e97dad1ba2 | ||
|
|
3ba59befcc | ||
|
|
b184f79d79 | ||
|
|
075bfe212b | ||
|
|
b02ea77a65 | ||
|
|
e113071eb8 | ||
|
|
e063526e4a | ||
|
|
7cddcf0c2e | ||
|
|
cd12584459 | ||
|
|
787bb79340 | ||
|
|
5f2e621653 | ||
|
|
6c42742a6f | ||
|
|
fd3e879e49 | ||
|
|
4d5f5db43c | ||
|
|
8c7feb17df | ||
|
|
1cd74840bf | ||
|
|
6a53a1850a | ||
|
|
fff8025040 | ||
|
|
9c4306c6cd | ||
|
|
5d25d624c0 | ||
|
|
cc4269f3f2 | ||
|
|
75dd7e17d6 | ||
|
|
45d1a7f734 | ||
|
|
b7ae8a2f40 | ||
|
|
b0b2138fa0 | ||
|
|
5acca4f1c1 | ||
|
|
1225bbdf8f | ||
|
|
b73d0c7988 | ||
|
|
bcd069f1f1 | ||
|
|
4f3e0bd3d8 | ||
|
|
80b3ac3d6b | ||
|
|
dca5e42cb0 | ||
|
|
e1dc437cd4 | ||
|
|
5f53a01799 | ||
|
|
4ac60aac44 | ||
|
|
b97b329feb | ||
|
|
1ea8297f8f | ||
|
|
0733a0797f | ||
|
|
af18e8a3ce | ||
|
|
8a06a58fdc | ||
|
|
b8296e86f4 | ||
|
|
77dbd51477 | ||
|
|
0074dc2a90 | ||
|
|
904a10f96c | ||
|
|
9935c1d9ba | ||
|
|
ed19328f56 | ||
|
|
a156c12d6b | ||
|
|
bbea8e3fa4 | ||
|
|
7fd7b17ccb | ||
|
|
20cdc88c63 | ||
|
|
4c923c2867 | ||
|
|
9b67395e7f | ||
|
|
8d8050ad0c | ||
|
|
dec8532cdc | ||
|
|
0f532acf11 | ||
|
|
8b8e724bb4 | ||
|
|
a69b2f721e | ||
|
|
064cd01af3 | ||
|
|
a773751df8 | ||
|
|
4c37d77789 | ||
|
|
a8d622a938 | ||
|
|
6da232abf9 | ||
|
|
676dbf3e5d | ||
|
|
d3ad25d070 | ||
|
|
463add70e6 | ||
|
|
f4bce4c2e0 | ||
|
|
c273449832 | ||
|
|
9ebd1b69dc | ||
|
|
3f600741f9 | ||
|
|
cf102b7570 | ||
|
|
634b17e24f | ||
|
|
22611e1e5b | ||
|
|
677289c39a | ||
|
|
b5c2f45ebf | ||
|
|
7dcd7e5c9a | ||
|
|
a67ea5fdc5 | ||
|
|
d7e270b875 | ||
|
|
5955ccf400 | ||
|
|
dd0ec72c7a | ||
|
|
b04d6eef12 | ||
|
|
cbc5700e99 | ||
|
|
ea6bb6a285 | ||
|
|
85ae202f79 | ||
|
|
d2a245117f | ||
|
|
9ca528d37b | ||
|
|
ac81e3d231 | ||
|
|
0381894e7d | ||
|
|
6f419498e8 | ||
|
|
356ea0dba2 | ||
|
|
ff5ee21808 | ||
|
|
129ce13184 | ||
|
|
716fa891ad | ||
|
|
f1d6c93b36 | ||
|
|
2339918329 | ||
|
|
75212a5636 | ||
|
|
b62955c2ef | ||
|
|
706bb16293 | ||
|
|
7fe2d50e60 | ||
|
|
202fe371a3 | ||
|
|
f5e0dc709d | ||
|
|
629e0f8424 | ||
|
|
c543a04213 | ||
|
|
7abd2882ba | ||
|
|
349cd48178 | ||
|
|
960fcfe02f | ||
|
|
63f323a078 | ||
|
|
e9fff603fd | ||
|
|
307fcd80a0 | ||
|
|
0a0a27d9f9 | ||
|
|
229516934b | ||
|
|
787d9e4792 | ||
|
|
d723037e7f | ||
|
|
cd36af03ea | ||
|
|
36e67baf23 | ||
|
|
5fd65d7540 | ||
|
|
692a1fbdfa | ||
|
|
39853f528e | ||
|
|
9f72414fe1 | ||
|
|
246865e4dd | ||
|
|
6966d99b9f | ||
|
|
e321c2bfc0 | ||
|
|
5acc34e4fe | ||
|
|
205e8ecc69 | ||
|
|
b5165e5ba5 | ||
|
|
0ef11c33d0 | ||
|
|
d610220c94 | ||
|
|
8a48abe7d8 | ||
|
|
bcfce5dd01 | ||
|
|
bd1a153a9a | ||
|
|
be371811fa | ||
|
|
ac5544c972 | ||
|
|
1c7eaad2c4 | ||
|
|
eb58252a71 | ||
|
|
0b69fac187 | ||
|
|
62b058d6a7 | ||
|
|
89e13dd543 | ||
|
|
9ac1ccd558 | ||
|
|
9b321eafc1 | ||
|
|
eef8708b58 | ||
|
|
88587221b5 | ||
|
|
a651264695 | ||
|
|
33613cff3c | ||
|
|
fdd4415dea | ||
|
|
7b36650ee3 | ||
|
|
1c4cfda8f5 | ||
|
|
56ea52079e | ||
|
|
e49321897a |
@@ -230,11 +230,19 @@
|
|||||||
fragment="true"
|
fragment="true"
|
||||||
unpack="false"/>
|
unpack="false"/>
|
||||||
|
|
||||||
<plugin
|
<plugin
|
||||||
id="org.talend.osgi.lib.loader"
|
id="org.talend.osgi.lib.loader"
|
||||||
download-size="0"
|
download-size="0"
|
||||||
install-size="0"
|
install-size="0"
|
||||||
version="0.0.0"
|
version="0.0.0"
|
||||||
unpack="false"/>
|
unpack="false"/>
|
||||||
|
|
||||||
|
<plugin
|
||||||
|
id="org.talend.repository.items.importexport.ui.test"
|
||||||
|
download-size="0"
|
||||||
|
install-size="0"
|
||||||
|
version="0.0.0"
|
||||||
|
fragment="true"
|
||||||
|
unpack="false"/>
|
||||||
|
|
||||||
</feature>
|
</feature>
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ public class FileCopy {
|
|||||||
if (index > 0) {
|
if (index > 0) {
|
||||||
int end = index;
|
int end = index;
|
||||||
int start = index;
|
int start = index;
|
||||||
while (sb.charAt(start) != '"') { //$NON-NLS-1$
|
while (sb.charAt(start) != '"') {
|
||||||
start--;
|
start--;
|
||||||
}
|
}
|
||||||
sb.replace(start + 1, end, "../../.."); //$NON-NLS-1$
|
sb.replace(start + 1, end, "../../.."); //$NON-NLS-1$
|
||||||
@@ -156,8 +156,11 @@ public class FileCopy {
|
|||||||
input.close();
|
input.close();
|
||||||
}
|
}
|
||||||
if (temp.isDirectory()) { // copy subfolder
|
if (temp.isDirectory()) { // copy subfolder
|
||||||
copyComponentFolder(sourceComponentFolder + File.separator + file[i], targetComponentFolder + File.separator
|
// TDI-31436:Avoid case of copy infinite subfolder if target folder is under source folder
|
||||||
+ file[i], modifySkeletonValue);
|
if (!temp.getAbsolutePath().equals(targetComponentFolder)) {
|
||||||
|
copyComponentFolder(sourceComponentFolder + File.separator + file[i], targetComponentFolder
|
||||||
|
+ File.separator + file[i], modifySkeletonValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -1310,12 +1310,11 @@ if (isProvider) {
|
|||||||
String useRouteContext = ElementParameterParser.getValue(node, "__USE_ROUTE_CONTEXT__");
|
String useRouteContext = ElementParameterParser.getValue(node, "__USE_ROUTE_CONTEXT__");
|
||||||
String useJobContext = ElementParameterParser.getValue(node, "__USE_JOB_CONTEXT__");
|
String useJobContext = ElementParameterParser.getValue(node, "__USE_JOB_CONTEXT__");
|
||||||
if("true".equals(useRouteContext)){
|
if("true".equals(useRouteContext)){
|
||||||
context = ElementParameterParser.getProcessSelectedContext(process.getId()); // route context
|
// TESB-13614
|
||||||
boolean found = ElementParameterParser.checkIfContextExisted(id, context); // check the same context exist or not in job
|
// we can't define context during codegeneration in this case, because
|
||||||
if(!found){
|
// context will provided to the job before execution
|
||||||
context = ElementParameterParser.getProcessSelectedContext(id); // if not found, then use default job context
|
context = "NOT_DEFINED";
|
||||||
}
|
|
||||||
|
|
||||||
}else if("true".equals(useJobContext)){
|
}else if("true".equals(useJobContext)){
|
||||||
context = ElementParameterParser.getProcessSelectedContext(id);
|
context = ElementParameterParser.getProcessSelectedContext(id);
|
||||||
}
|
}
|
||||||
@@ -1326,9 +1325,18 @@ if (isProvider) {
|
|||||||
String jobFolderName = JavaResourcesHelper.getJobFolderName(jobName, jobVersion);
|
String jobFolderName = JavaResourcesHelper.getJobFolderName(jobName, jobVersion);
|
||||||
typeName = codeGenArgument.getCurrentProjectName().toLowerCase() + "." + jobFolderName + "." + jobName;
|
typeName = codeGenArgument.getCurrentProjectName().toLowerCase() + "." + jobFolderName + "." + jobName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if("NOT_DEFINED".equals(context)){
|
||||||
|
String executionContextVariable = "contextStr";
|
||||||
%>
|
%>
|
||||||
org.apache.camel.Endpoint endpoint_<%=cid%> = endpoint("talend:"+<%=typeName%>.class.getName()+"?context="+"<%=context%>&propagateHeader=<%=propagateHeader%>");
|
org.apache.camel.Endpoint endpoint_<%=cid%> = endpoint("talend:"+<%=typeName%>.class.getName()+"?context="+<%=executionContextVariable%>+"&propagateHeader=<%=propagateHeader%>");
|
||||||
<%
|
<%
|
||||||
|
} else {
|
||||||
|
%>
|
||||||
|
org.apache.camel.Endpoint endpoint_<%=cid%> = endpoint("talend:"+<%=typeName%>.class.getName()+"?context="+"<%=context%>&propagateHeader=<%=propagateHeader%>");
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
int contextParamsSize = contextParams.size();
|
int contextParamsSize = contextParams.size();
|
||||||
if(contextParamsSize > 0){
|
if(contextParamsSize > 0){
|
||||||
|
|||||||
@@ -339,6 +339,9 @@ end_Hash.put("<%=node.getUniqueName() %>", System.currentTimeMillis());
|
|||||||
if(errorThread_<%=iterateTargetNodeName %>.exception!=null){
|
if(errorThread_<%=iterateTargetNodeName %>.exception!=null){
|
||||||
throw errorThread_<%=iterateTargetNodeName %>.exception;
|
throw errorThread_<%=iterateTargetNodeName %>.exception;
|
||||||
}
|
}
|
||||||
|
if(errorThread_<%=iterateTargetNodeName %>.error!=null){
|
||||||
|
throw errorThread_<%=iterateTargetNodeName %>.error;
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
Integer threadErrorCode = mtp_<%=iterateTargetNodeName %>.getTalendThreadResult().getErrorCode();
|
Integer threadErrorCode = mtp_<%=iterateTargetNodeName %>.getTalendThreadResult().getErrorCode();
|
||||||
String threadStatus = mtp_<%=iterateTargetNodeName %>.getTalendThreadResult().getStatus();
|
String threadStatus = mtp_<%=iterateTargetNodeName %>.getTalendThreadResult().getStatus();
|
||||||
@@ -406,4 +409,4 @@ end_Hash.put("<%=node.getUniqueName() %>", System.currentTimeMillis());
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* [<%=node.getUniqueName() %> <%=codePart %> ] stop
|
* [<%=node.getUniqueName() %> <%=codePart %> ] stop
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -49,25 +49,15 @@
|
|||||||
boolean hasParallelIterate = false;
|
boolean hasParallelIterate = false;
|
||||||
for (IConnection iterateConn : iterateConnSet) {
|
for (IConnection iterateConn : iterateConnSet) {
|
||||||
parallelIterate = "true".equals(ElementParameterParser.getValue(iterateConn, "__ENABLE_PARALLEL__"));
|
parallelIterate = "true".equals(ElementParameterParser.getValue(iterateConn, "__ENABLE_PARALLEL__"));
|
||||||
|
String iterateNodeName = iterateConn.getTarget().getUniqueName();
|
||||||
if (parallelIterate) {
|
if (parallelIterate) {
|
||||||
%>
|
%>
|
||||||
TalendThreadPool mtp_<%=iterateConn.getTarget().getUniqueName() %> = new TalendThreadPool(<%=ElementParameterParser.getValue(iterateConn,"__NUMBER_PARALLEL__") %>);
|
TalendThreadPool mtp_<%=iterateConn.getTarget().getUniqueName() %> = new TalendThreadPool(<%=ElementParameterParser.getValue(iterateConn,"__NUMBER_PARALLEL__") %>);
|
||||||
|
|
||||||
<%
|
globalMap.put("lockWrite_<%=iterateNodeName%>", new Object[0]);
|
||||||
if(!hasParallelIterate){
|
int threadIdCounter_<%=iterateNodeName%> =0;
|
||||||
hasParallelIterate = true;
|
|
||||||
%>
|
|
||||||
|
|
||||||
final Object[] lockWrite = new Object[0];
|
|
||||||
int threadIdCounter =0;
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
|
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
|
|
||||||
String iterateNodeName = iterateConn.getTarget().getUniqueName();
|
|
||||||
%>
|
%>
|
||||||
int NB_ITERATE_<%=iterateNodeName %> = 0; //for statistics
|
int NB_ITERATE_<%=iterateNodeName %> = 0; //for statistics
|
||||||
<%
|
<%
|
||||||
|
|||||||
@@ -49,6 +49,42 @@
|
|||||||
exist_tMOM = true;
|
exist_tMOM = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String[] sqlDbComponents = new String[] {
|
||||||
|
"tAccessConnection",
|
||||||
|
"tAmazonMysqlConnection",
|
||||||
|
"tAmazonOracleConnection",
|
||||||
|
"tAS400Connection",
|
||||||
|
"tDB2Connection",
|
||||||
|
"tFirebirdConnection",
|
||||||
|
"tGreenplumConnection",
|
||||||
|
"tHiveConnection",
|
||||||
|
"tInformixConnection",
|
||||||
|
"tIngresConnection",
|
||||||
|
"tInterbaseConnection",
|
||||||
|
"tJDBCConnection",
|
||||||
|
"tMSSqlConnection",
|
||||||
|
"tMysqlConnection",
|
||||||
|
"tNetezzaConnection",
|
||||||
|
"tOracleConnection",
|
||||||
|
"tParAccelConnection",
|
||||||
|
"tPostgresPlusConnection",
|
||||||
|
"tPostgresqlConnection",
|
||||||
|
"tRedshiftConnection",
|
||||||
|
"tSQLiteConnection",
|
||||||
|
"tSybaseConnection",
|
||||||
|
"tTeradataConnection",
|
||||||
|
"tVectorWiseConnection",
|
||||||
|
"tVerticaConnection"
|
||||||
|
};
|
||||||
|
boolean exist_tSQLDB = false;
|
||||||
|
List<INode> sqlDbComponentsList = new ArrayList<INode>();
|
||||||
|
for (String sqlDbComponent : sqlDbComponents) {
|
||||||
|
sqlDbComponentsList.addAll((List<INode>)process.getNodesOfType(sqlDbComponent));
|
||||||
|
}
|
||||||
|
if (sqlDbComponentsList.size() > 0) {
|
||||||
|
exist_tSQLDB = true;
|
||||||
|
}
|
||||||
|
|
||||||
boolean exist_tSCP = false;
|
boolean exist_tSCP = false;
|
||||||
List<INode> scpComponentsList = (List<INode>)process.getNodesOfType("tSCPConnection");
|
List<INode> scpComponentsList = (List<INode>)process.getNodesOfType("tSCPConnection");
|
||||||
if (scpComponentsList.size() > 0) {
|
if (scpComponentsList.size() > 0) {
|
||||||
@@ -354,8 +390,17 @@
|
|||||||
resumeUtil = new ResumeUtil(resuming_logs_dir_path, isChildJob, rootPid);
|
resumeUtil = new ResumeUtil(resuming_logs_dir_path, isChildJob, rootPid);
|
||||||
resumeUtil.initCommonInfo(pid, rootPid, fatherPid, projectName, jobName, contextStr, jobVersion);
|
resumeUtil.initCommonInfo(pid, rootPid, fatherPid, projectName, jobName, contextStr, jobVersion);
|
||||||
|
|
||||||
|
List<String> parametersToEncrypt = new java.util.ArrayList<String>();
|
||||||
|
<% for(IContextParameter ctxParam :params) {
|
||||||
|
if ("id_Password".equals(ctxParam.getType())) {
|
||||||
|
%>
|
||||||
|
parametersToEncrypt.add("<%=ctxParam.getName()%>");
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%>
|
||||||
//Resume: jobStart
|
//Resume: jobStart
|
||||||
resumeUtil.addLog("JOB_STARTED", "JOB:" + jobName, parent_part_launcher, Thread.currentThread().getId() + "", "","","","",resumeUtil.convertToJsonText(context));
|
resumeUtil.addLog("JOB_STARTED", "JOB:" + jobName, parent_part_launcher, Thread.currentThread().getId() + "", "","","","",resumeUtil.convertToJsonText(context,parametersToEncrypt));
|
||||||
|
|
||||||
<%
|
<%
|
||||||
if (stats) {
|
if (stats) {
|
||||||
@@ -595,6 +640,10 @@ this.globalResumeTicket = true;//to run tPostJob
|
|||||||
closeScpConnections();
|
closeScpConnections();
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
|
<% if (exist_tSQLDB) { %>
|
||||||
|
closeSqlDbConnections();
|
||||||
|
<% } %>
|
||||||
|
|
||||||
<%
|
<%
|
||||||
if (hasSAM4RS || hasSAM4WS) {
|
if (hasSAM4RS || hasSAM4WS) {
|
||||||
%>
|
%>
|
||||||
@@ -641,10 +690,12 @@ if (execStat) {
|
|||||||
<% if(exist_tMOM) { %>
|
<% if(exist_tMOM) { %>
|
||||||
closeJmsConnections();
|
closeJmsConnections();
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<% if(exist_tSCP) { %>
|
<% if(exist_tSCP) { %>
|
||||||
closeScpConnections();
|
closeScpConnections();
|
||||||
<% } %>
|
<% } %>
|
||||||
|
<% if (exist_tSQLDB) { %>
|
||||||
|
closeSqlDbConnections();
|
||||||
|
<% } %>
|
||||||
}
|
}
|
||||||
|
|
||||||
<%
|
<%
|
||||||
@@ -693,6 +744,22 @@ if (execStat) {
|
|||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
|
|
||||||
|
<% if(exist_tSQLDB) { %>
|
||||||
|
private void closeSqlDbConnections() {
|
||||||
|
try {
|
||||||
|
Object obj_conn;
|
||||||
|
<% for (INode sqlDbComponent : sqlDbComponentsList) { %>
|
||||||
|
obj_conn = globalMap.remove("conn_<%=sqlDbComponent.getUniqueName() %>");
|
||||||
|
if (null != obj_conn) {
|
||||||
|
((java.sql.Connection) obj_conn).close();
|
||||||
|
}
|
||||||
|
<% } %>
|
||||||
|
} catch (java.lang.Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
|
||||||
private java.util.Map<String, Object> getSharedConnections4REST() {
|
private java.util.Map<String, Object> getSharedConnections4REST() {
|
||||||
java.util.Map<String, Object> connections = new java.util.HashMap<String, Object>();
|
java.util.Map<String, Object> connections = new java.util.HashMap<String, Object>();
|
||||||
<%
|
<%
|
||||||
@@ -710,6 +777,13 @@ if (execStat) {
|
|||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
|
<%
|
||||||
|
for (INode sqlDbNode : sqlDbComponentsList) {
|
||||||
|
%>
|
||||||
|
connections.put("conn_<%=sqlDbNode.getUniqueName() %>", globalMap.get("conn_<%=sqlDbNode.getUniqueName() %>"));
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
return connections;
|
return connections;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -801,4 +875,4 @@ if (execStat) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResumeUtil resumeUtil = null;
|
ResumeUtil resumeUtil = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -268,14 +268,14 @@ public <%=JavaTypesManager.getTypeToGenerate(ctxParam.getType(),true)%> get<%=Ch
|
|||||||
private String currentComponent = "";
|
private String currentComponent = "";
|
||||||
<%
|
<%
|
||||||
//tParallelize will wrap globalMap with synchronizedMap
|
//tParallelize will wrap globalMap with synchronizedMap
|
||||||
if(!isRunInMultiThread){
|
if(isRunInMultiThread || NodeUtil.containsMultiThreadComponent(process)){
|
||||||
%>
|
|
||||||
private final java.util.Map<String, Object> globalMap = new java.util.HashMap<String, Object>();
|
|
||||||
<%
|
|
||||||
}else{
|
|
||||||
%>
|
%>
|
||||||
private final java.util.Map<String, Object> globalMap = java.util.Collections.synchronizedMap(new java.util.HashMap<String, Object>());
|
private final java.util.Map<String, Object> globalMap = java.util.Collections.synchronizedMap(new java.util.HashMap<String, Object>());
|
||||||
<%
|
<%
|
||||||
|
} else {
|
||||||
|
%>
|
||||||
|
private final java.util.Map<String, Object> globalMap = new java.util.HashMap<String, Object>();
|
||||||
|
<%
|
||||||
}
|
}
|
||||||
boolean exist_tParallelize = false;
|
boolean exist_tParallelize = false;
|
||||||
List<? extends INode> tParallelizeList = process.getNodesOfType("tParallelize");
|
List<? extends INode> tParallelizeList = process.getNodesOfType("tParallelize");
|
||||||
|
|||||||
@@ -83,6 +83,17 @@
|
|||||||
talendThreadPool.setErrorThread(this);
|
talendThreadPool.setErrorThread(this);
|
||||||
talendThreadPool.stopAllWorkers();
|
talendThreadPool.stopAllWorkers();
|
||||||
|
|
||||||
|
} catch (java.lang.Error error){
|
||||||
|
this.status = "failure";
|
||||||
|
Integer localErrorCode = (Integer) (((java.util.Map) threadLocal.get()).get("errorCode"));
|
||||||
|
if (localErrorCode != null) {
|
||||||
|
if (this.errorCode == null || localErrorCode.compareTo(this.errorCode) > 0) {
|
||||||
|
this.errorCode = localErrorCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.error = error;
|
||||||
|
talendThreadPool.setErrorThread(this);
|
||||||
|
talendThreadPool.stopAllWorkers();
|
||||||
} finally {
|
} finally {
|
||||||
try{
|
try{
|
||||||
<%=finallyPart%>
|
<%=finallyPart%>
|
||||||
@@ -111,7 +122,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<%=node.getUniqueName() %>Thread bt_<%=node.getUniqueName() %> = new <%=node.getUniqueName() %>Thread(globalMap<%=schemaInstanceDeclaration %>,threadIdCounter++);
|
<%=node.getUniqueName() %>Thread bt_<%=node.getUniqueName() %> = new <%=node.getUniqueName() %>Thread(globalMap<%=schemaInstanceDeclaration %>,threadIdCounter_<%=node.getUniqueName()%>++);
|
||||||
mtp_<%=node.getUniqueName() %>.execute(bt_<%=node.getUniqueName() %>);
|
mtp_<%=node.getUniqueName() %>.execute(bt_<%=node.getUniqueName() %>);
|
||||||
|
|
||||||
<%
|
<%
|
||||||
@@ -134,4 +145,4 @@
|
|||||||
}//3
|
}//3
|
||||||
}//2
|
}//2
|
||||||
}//1
|
}//1
|
||||||
%>
|
%>
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ for (IConnection iterateConn : iterateConnSet) { //1
|
|||||||
rowList = rowList.substring(0, rowList.length()-1);
|
rowList = rowList.substring(0, rowList.length()-1);
|
||||||
%>
|
%>
|
||||||
class <%=node.getUniqueName() %>Thread extends TalendThread {//implements routines.system.TalendThreadPool.PropertySettable
|
class <%=node.getUniqueName() %>Thread extends TalendThread {//implements routines.system.TalendThreadPool.PropertySettable
|
||||||
|
|
||||||
class ThreadedMap extends java.util.HashMap<String, Object> {
|
class ThreadedMap extends java.util.HashMap<String, Object> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 0L;
|
private static final long serialVersionUID = 0L;
|
||||||
|
|||||||
@@ -39,6 +39,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<INode> departitionersInCurrentSubTree = new java.util.ArrayList<INode>();
|
||||||
|
INode startNode = subTree.getRootNode();
|
||||||
|
String startNodeId = startNode.getUniqueName();
|
||||||
|
|
||||||
|
if(startNodeId!=null && startNodeId.startsWith("tCollector")) {
|
||||||
|
List<? extends INode> departitioners = startNode.getProcess().getNodesOfType("tDepartitioner");
|
||||||
|
if(departitioners!=null) {
|
||||||
|
for(INode departitioner : departitioners) {
|
||||||
|
INode collectorNode = NodeUtil.getSubProcessStartNode(departitioner);
|
||||||
|
if(collectorNode == startNode) {//in current sub tree
|
||||||
|
departitionersInCurrentSubTree.add(departitioner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(isParallelize){
|
if(isParallelize){
|
||||||
%>
|
%>
|
||||||
|
|
||||||
@@ -104,6 +121,25 @@
|
|||||||
}
|
}
|
||||||
<%
|
<%
|
||||||
}else{
|
}else{
|
||||||
|
for(INode departitioner : departitionersInCurrentSubTree) {
|
||||||
|
String cid = departitioner.getUniqueName();
|
||||||
|
String connName = null;
|
||||||
|
if (departitioner.getIncomingConnections().size() == 1) {
|
||||||
|
IConnection conn = departitioner.getIncomingConnections().get(0);
|
||||||
|
connName = conn.getName();
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
globalMap.put("COMPLETED_<%=cid%>",Boolean.TRUE);
|
||||||
|
class DepartitionerPoison_<%=cid%> extends <%=connName%>Struct {
|
||||||
|
}
|
||||||
|
resourceMap.put("finish_<%=cid%>", true);
|
||||||
|
|
||||||
|
outputQueue_<%=cid%>.put(new DepartitionerPoison_<%=cid%>());
|
||||||
|
<%if(isLog4jEnabled){%>
|
||||||
|
log.info("<%=cid%>[" + Thread.currentThread().getName() + "] - Done.");
|
||||||
|
<%}%>
|
||||||
|
<%
|
||||||
|
}
|
||||||
%>
|
%>
|
||||||
}//end the resume
|
}//end the resume
|
||||||
|
|
||||||
@@ -197,23 +233,20 @@
|
|||||||
te.setVirtualComponentName(currentVirtualComponent);
|
te.setVirtualComponentName(currentVirtualComponent);
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
for(INode node : subTree.getNodes()){
|
|
||||||
if(node!=null){
|
for(INode departitioner : departitionersInCurrentSubTree) {
|
||||||
if("tDepartitioner".equals(node.getComponent().getName())){
|
String cid = departitioner.getUniqueName();
|
||||||
String cid = node.getUniqueName();
|
%>
|
||||||
%>
|
if(resourceMap.get("finish_<%=cid%>") == null){
|
||||||
if(resourceMap.get("finish_<%=cid%>") == null){
|
if(resourceMap.get("start_<%=cid%>") != null){
|
||||||
if(resourceMap.get("start_<%=cid%>") != null){
|
<%if(isLog4jEnabled){%>
|
||||||
<%if(isLog4jEnabled){%>
|
log.error("<%=cid%>[" + Thread.currentThread().getName() + "] - " + e.getMessage());
|
||||||
log.error("<%=cid%>[" + Thread.currentThread().getName() + "] - " + e.getMessage());
|
<%}%>
|
||||||
<%}%>
|
globalMap.put("THREADS_HAVE_ERROR", e);
|
||||||
globalMap.put("THREADS_HAVE_ERROR", e);
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
<%
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
<%
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
throw te;
|
throw te;
|
||||||
@@ -224,23 +257,20 @@
|
|||||||
runStat.stopThreadStat();
|
runStat.stopThreadStat();
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
for(INode node : subTree.getNodes()){
|
|
||||||
if(node!=null){
|
for(INode departitioner : departitionersInCurrentSubTree) {
|
||||||
if("tDepartitioner".equals(node.getComponent().getName())){
|
String cid = departitioner.getUniqueName();
|
||||||
String cid = node.getUniqueName();
|
%>
|
||||||
%>
|
if(resourceMap.get("finish_<%=cid%>") == null){
|
||||||
if(resourceMap.get("finish_<%=cid%>") == null){
|
if(resourceMap.get("start_<%=cid%>") != null){
|
||||||
if(resourceMap.get("start_<%=cid%>") != null){
|
<%if(isLog4jEnabled){%>
|
||||||
<%if(isLog4jEnabled){%>
|
log.error("<%=cid%>[" + Thread.currentThread().getName() + "] - " + error.getMessage());
|
||||||
log.error("<%=cid%>[" + Thread.currentThread().getName() + "] - " + error.getMessage());
|
<%}%>
|
||||||
<%}%>
|
globalMap.put("THREADS_HAVE_ERROR",error);
|
||||||
globalMap.put("THREADS_HAVE_ERROR",error);
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
<%
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
<%
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ ComponentsPreferencePage.rowLimit=Row limit
|
|||||||
ComponentsPreferencePage.WarningMsg=Need to restart Talend Open Studio to load extral components !
|
ComponentsPreferencePage.WarningMsg=Need to restart Talend Open Studio to load extral components !
|
||||||
ComponentsPreferencePage.WarningTitle=Warning
|
ComponentsPreferencePage.WarningTitle=Warning
|
||||||
ComponentsPreferencePage.directoryFieldLabel=User component folder\:
|
ComponentsPreferencePage.directoryFieldLabel=User component folder\:
|
||||||
|
ComponentsPreferencePage.notValidDirectory=Your selection will result in folder nesting, which is not recommended. Do you want to continue anyway?
|
||||||
ComponentsProviderManager.unableLoad=unable to load component provider
|
ComponentsProviderManager.unableLoad=unable to load component provider
|
||||||
ComponenttRunJobPreferencePage.label=Don't show corresponding job after double click on a tRunJob Component.
|
ComponenttRunJobPreferencePage.label=Don't show corresponding job after double click on a tRunJob Component.
|
||||||
ComponentJobletPreferencePage.label=Don't show corresponding job after double click on a Joblet Component.
|
ComponentJobletPreferencePage.label=Don't show corresponding job after double click on a Joblet Component.
|
||||||
|
|||||||
@@ -868,7 +868,6 @@ public class CodeGenerator implements ICodeGenerator {
|
|||||||
CodeGeneratorArgument argument = new CodeGeneratorArgument();
|
CodeGeneratorArgument argument = new CodeGeneratorArgument();
|
||||||
argument.setNode(node);
|
argument.setNode(node);
|
||||||
argument.setAllMainSubTreeConnections(subProcess.getAllMainSubTreeConnections());
|
argument.setAllMainSubTreeConnections(subProcess.getAllMainSubTreeConnections());
|
||||||
argument.setSubTreeContainsParallelIterate(subProcess.subTreeContainsParallelIterate());
|
|
||||||
argument.setCodePart(part);
|
argument.setCodePart(part);
|
||||||
argument.setStatistics(statistics);
|
argument.setStatistics(statistics);
|
||||||
argument.setTrace(trace);
|
argument.setTrace(trace);
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ package org.talend.designer.codegen.components.ui;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
||||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||||
@@ -43,7 +43,6 @@ import org.talend.commons.ui.utils.workbench.preferences.ComboFieldEditor;
|
|||||||
import org.talend.core.CorePlugin;
|
import org.talend.core.CorePlugin;
|
||||||
import org.talend.core.GlobalServiceRegister;
|
import org.talend.core.GlobalServiceRegister;
|
||||||
import org.talend.core.PluginChecker;
|
import org.talend.core.PluginChecker;
|
||||||
import org.talend.core.model.components.ComponentPaletteUtilities;
|
|
||||||
import org.talend.designer.codegen.CodeGeneratorActivator;
|
import org.talend.designer.codegen.CodeGeneratorActivator;
|
||||||
import org.talend.designer.codegen.ICodeGeneratorService;
|
import org.talend.designer.codegen.ICodeGeneratorService;
|
||||||
import org.talend.designer.codegen.i18n.Messages;
|
import org.talend.designer.codegen.i18n.Messages;
|
||||||
@@ -81,6 +80,8 @@ public class ComponentsPreferencePage extends FieldEditorPreferencePage implemen
|
|||||||
|
|
||||||
private static String oldPath = null;
|
private static String oldPath = null;
|
||||||
|
|
||||||
|
private final String component_suffix = "_java.xml";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class exists to provide visibility to the <code>refreshValidState</code> method and to perform more
|
* This class exists to provide visibility to the <code>refreshValidState</code> method and to perform more
|
||||||
* intelligent clearing of the error message.
|
* intelligent clearing of the error message.
|
||||||
@@ -290,6 +291,15 @@ public class ComponentsPreferencePage extends FieldEditorPreferencePage implemen
|
|||||||
filePathTemp.showErrorMessage();
|
filePathTemp.showErrorMessage();
|
||||||
setValid(false);
|
setValid(false);
|
||||||
} else {
|
} else {
|
||||||
|
if (oldPath.equals(newPath)) {
|
||||||
|
setValid(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!StringUtils.isEmpty(newPath)) {
|
||||||
|
if (!checkUserComponentsFolder(file)) {
|
||||||
|
filePathTemp.getTextControl(parent).setText(oldPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
setValid(true);
|
setValid(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -308,6 +318,18 @@ public class ComponentsPreferencePage extends FieldEditorPreferencePage implemen
|
|||||||
parent.pack();
|
parent.pack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean checkUserComponentsFolder(File componentsfolder) {
|
||||||
|
for (File subFile : componentsfolder.listFiles()) {
|
||||||
|
String name = subFile.getName();
|
||||||
|
if (name.equals(componentsfolder.getName() + component_suffix)) {
|
||||||
|
boolean isContinue = MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Confirm",
|
||||||
|
Messages.getString("ComponentsPreferencePage.notValidDirectory")); //$NON-NLS-1$
|
||||||
|
return isContinue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void propertyChangeForComponents(PropertyChangeEvent event) {
|
public void propertyChangeForComponents(PropertyChangeEvent event) {
|
||||||
MessageDialog warningMessageDialog = new MessageDialog(getFieldEditorParent().getShell(),
|
MessageDialog warningMessageDialog = new MessageDialog(getFieldEditorParent().getShell(),
|
||||||
Messages.getString("ComponentsPreferencePage.WarningTitle"), null, //$NON-NLS-1$
|
Messages.getString("ComponentsPreferencePage.WarningTitle"), null, //$NON-NLS-1$
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ public class CodeGeneratorArgument {
|
|||||||
|
|
||||||
private int pauseTime;
|
private int pauseTime;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
private boolean subTreeContainsParallelIterate;
|
private boolean subTreeContainsParallelIterate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -277,10 +278,15 @@ public class CodeGeneratorArgument {
|
|||||||
this.subTree = subTree;
|
this.subTree = subTree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
/*
|
||||||
|
* use org.talend.core.model.process.AbstractNode.getParallelIterator()
|
||||||
|
*/
|
||||||
public boolean subTreeContainsParallelIterate() {
|
public boolean subTreeContainsParallelIterate() {
|
||||||
return subTreeContainsParallelIterate;
|
return subTreeContainsParallelIterate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public void setSubTreeContainsParallelIterate(boolean subTreeContainsParallelIterate) {
|
public void setSubTreeContainsParallelIterate(boolean subTreeContainsParallelIterate) {
|
||||||
this.subTreeContainsParallelIterate = subTreeContainsParallelIterate;
|
this.subTreeContainsParallelIterate = subTreeContainsParallelIterate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.talend.core.model.process.AbstractNode;
|
import org.talend.core.model.process.AbstractNode;
|
||||||
import org.talend.core.model.process.EConnectionType;
|
import org.talend.core.model.process.EConnectionType;
|
||||||
import org.talend.core.model.process.ElementParameterParser;
|
|
||||||
import org.talend.core.model.process.IConnection;
|
import org.talend.core.model.process.IConnection;
|
||||||
import org.talend.core.model.process.IConnectionCategory;
|
import org.talend.core.model.process.IConnectionCategory;
|
||||||
import org.talend.core.model.process.INode;
|
import org.talend.core.model.process.INode;
|
||||||
@@ -61,6 +60,7 @@ public class NodesSubTree {
|
|||||||
|
|
||||||
List<IConnection> allMainSubTreeConnections = null;
|
List<IConnection> allMainSubTreeConnections = null;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
boolean subTreeContainsParallelIterate = false;
|
boolean subTreeContainsParallelIterate = false;
|
||||||
|
|
||||||
List<INode> mergeBranchStarts;
|
List<INode> mergeBranchStarts;
|
||||||
@@ -251,11 +251,7 @@ public class NodesSubTree {
|
|||||||
if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.MAIN)) {
|
if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.MAIN)) {
|
||||||
if (!connection.getLineStyle().hasConnectionCategory(IConnectionCategory.USE_ITERATE)) {
|
if (!connection.getLineStyle().hasConnectionCategory(IConnectionCategory.USE_ITERATE)) {
|
||||||
allMainSubTreeConnections.add(connection);
|
allMainSubTreeConnections.add(connection);
|
||||||
} else {
|
}
|
||||||
if (Boolean.TRUE.toString().equals(ElementParameterParser.getValue(connection, "__ENABLE_PARALLEL__"))) { //$NON-NLS-1$
|
|
||||||
subTreeContainsParallelIterate = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
System.out.print(" -> "); //$NON-NLS-1$
|
System.out.print(" -> "); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
@@ -505,6 +501,10 @@ public class NodesSubTree {
|
|||||||
this.allMainSubTreeConnections = allMainSubTreeConnections;
|
this.allMainSubTreeConnections = allMainSubTreeConnections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
/*
|
||||||
|
* use org.talend.core.model.process.AbstractNode.getParallelIterator()
|
||||||
|
*/
|
||||||
public boolean subTreeContainsParallelIterate() {
|
public boolean subTreeContainsParallelIterate() {
|
||||||
return subTreeContainsParallelIterate;
|
return subTreeContainsParallelIterate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,14 @@
|
|||||||
<property name="jar.name" value="cobolX.jar" />
|
<property name="jar.name" value="cobolX.jar" />
|
||||||
<property name="component.name" value="tFileInputEBCDIC" />
|
<property name="component.name" value="tFileInputEBCDIC" />
|
||||||
<property name="author.name" value="jjzhou" />
|
<property name="author.name" value="jjzhou" />
|
||||||
|
|
||||||
<!-- modification 2: compile classpath -->
|
<!-- modification 2: compile classpath -->
|
||||||
<path id="compile.classpath">
|
<path id="compile.classpath">
|
||||||
|
<pathelement location="../../libs/commons-lang-2.6.jar"/>
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
<!-- #################################################### -->
|
<!-- #################################################### -->
|
||||||
|
|
||||||
|
|
||||||
<!-- sourcecode and final jar path -->
|
<!-- sourcecode and final jar path -->
|
||||||
<property name="source.home" value="." />
|
<property name="source.home" value="." />
|
||||||
@@ -33,7 +34,7 @@
|
|||||||
<target name="process" description="prepare a temp dir">
|
<target name="process" description="prepare a temp dir">
|
||||||
<antcall target="prepare" />
|
<antcall target="prepare" />
|
||||||
<antcall target="compile" />
|
<antcall target="compile" />
|
||||||
<antcall target="clean" />
|
<antcall target="clean" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="prepare" description="prepare a temp dir">
|
<target name="prepare" description="prepare a temp dir">
|
||||||
@@ -48,7 +49,7 @@
|
|||||||
<javac srcdir="${source.home}" destdir="${build.dir}/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}">
|
<javac srcdir="${source.home}" destdir="${build.dir}/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}">
|
||||||
<classpath refid="compile.classpath" />
|
<classpath refid="compile.classpath" />
|
||||||
</javac>
|
</javac>
|
||||||
|
|
||||||
<!-- include source code -->
|
<!-- include source code -->
|
||||||
<copy todir="${build.dir}/classes">
|
<copy todir="${build.dir}/classes">
|
||||||
<fileset dir="${source.home}">
|
<fileset dir="${source.home}">
|
||||||
@@ -66,7 +67,7 @@
|
|||||||
<!-- who -->
|
<!-- who -->
|
||||||
<attribute name="Built-By" value="${author.name}" />
|
<attribute name="Built-By" value="${author.name}" />
|
||||||
<!-- when -->
|
<!-- when -->
|
||||||
<attribute name="Built-Date" value="${date}"/>
|
<attribute name="Built-Date" value="${date}"/>
|
||||||
<!-- JDK version -->
|
<!-- JDK version -->
|
||||||
<attribute name="Created-By" value="${java.version} (${java.vendor})" />
|
<attribute name="Created-By" value="${java.version} (${java.vendor})" />
|
||||||
<!-- Information about the program itself -->
|
<!-- Information about the program itself -->
|
||||||
@@ -85,4 +86,4 @@
|
|||||||
<delete dir="${build.dir}" />
|
<delete dir="${build.dir}" />
|
||||||
<mkdir dir="${build.dir}" />
|
<mkdir dir="${build.dir}" />
|
||||||
</target>
|
</target>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -4,9 +4,34 @@ import java.math.BigDecimal;
|
|||||||
import org.apache.commons.lang.mutable.MutableInt;
|
import org.apache.commons.lang.mutable.MutableInt;
|
||||||
|
|
||||||
public class EBCDICType3 {
|
public class EBCDICType3 {
|
||||||
|
|
||||||
public static BigDecimal readType3Value(byte[] byteValue, int decimal,
|
public static BigDecimal readType3Value(byte[] byteValue, int decimal,
|
||||||
boolean isImpliedDecimal) throws Exception {
|
boolean isImpliedDecimal){
|
||||||
|
BigDecimal retVal = new BigDecimal(convertByteArr2Hex(byteValue,decimal,isImpliedDecimal));
|
||||||
|
int lgth = byteValue.length;
|
||||||
|
int tmp = byteValue[lgth-1] & 0x0F;
|
||||||
|
|
||||||
|
if ((tmp == 0x0F) || (tmp == 0x0C)) {
|
||||||
|
return retVal;
|
||||||
|
} else if (tmp == 0x0D) {
|
||||||
|
return retVal.negate();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isValidPackedDecimal(byte[] byteArr){
|
||||||
|
boolean isValid = false;
|
||||||
|
int lgth = byteArr.length;
|
||||||
|
if(lgth > 0){
|
||||||
|
int tmp = byteArr[lgth-1] & 0x0F;
|
||||||
|
if(tmp == 0x0F || tmp == 0x0C || tmp == 0x0D){
|
||||||
|
isValid = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isValid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String convertByteArr2Hex(byte[] byteValue, int decimal, boolean isImpliedDecimal){
|
||||||
int len = byteValue.length;
|
int len = byteValue.length;
|
||||||
StringBuffer strbuf = new StringBuffer();
|
StringBuffer strbuf = new StringBuffer();
|
||||||
int tmp;
|
int tmp;
|
||||||
@@ -29,24 +54,27 @@ public class EBCDICType3 {
|
|||||||
strbuf.insert(strbuf.length() - decimal, '.');
|
strbuf.insert(strbuf.length() - decimal, '.');
|
||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal retVal;
|
return strbuf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
public static BigDecimal readType3(byte[] byteValue, int decimal,
|
||||||
retVal = new BigDecimal(strbuf.toString());
|
boolean isImpliedDecimal,String defaultStrValue){
|
||||||
} catch (NumberFormatException ex) {
|
if(defaultStrValue == null || "".equals(defaultStrValue)){
|
||||||
throw new Exception();
|
return readType3Value(byteValue,decimal,isImpliedDecimal);
|
||||||
}
|
}else{
|
||||||
|
boolean isValid = isValidPackedDecimal(byteValue);
|
||||||
tmp = byteValue[len - 1];
|
BigDecimal convertedBigDecimal = new BigDecimal(convertByteArr2Hex(byteValue,decimal,isImpliedDecimal));// implicit else part
|
||||||
tmp1 = tmp & 0x0F;
|
if(isValid){
|
||||||
|
int lgth = byteValue.length;
|
||||||
if ((tmp1 == 0x0F) || (tmp1 == 0x0C)) {
|
int tmp = byteValue[lgth-1] & 0x0F;
|
||||||
return retVal;
|
if(tmp == 0x0D){// implicit else part for 0x0F or 0x0C
|
||||||
} else if (tmp1 == 0x0D) {
|
convertedBigDecimal = convertedBigDecimal.negate();
|
||||||
return retVal.negate();
|
}
|
||||||
} else {
|
}else{
|
||||||
return retVal;
|
convertedBigDecimal = new BigDecimal(defaultStrValue);
|
||||||
}
|
}
|
||||||
|
return convertedBigDecimal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] writeType3Value(int length, int decimal,
|
public static byte[] writeType3Value(int length, int decimal,
|
||||||
|
|||||||
@@ -8,11 +8,6 @@ import java.io.FileOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.Authenticator;
|
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
import java.net.PasswordAuthentication;
|
|
||||||
import java.net.Proxy;
|
|
||||||
import java.net.SocketAddress;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -24,7 +19,6 @@ import java.util.Set;
|
|||||||
import com.sforce.async.AsyncApiException;
|
import com.sforce.async.AsyncApiException;
|
||||||
import com.sforce.async.BatchInfo;
|
import com.sforce.async.BatchInfo;
|
||||||
import com.sforce.async.BatchStateEnum;
|
import com.sforce.async.BatchStateEnum;
|
||||||
import com.sforce.async.BulkConnection;
|
|
||||||
import com.sforce.async.CSVReader;
|
import com.sforce.async.CSVReader;
|
||||||
import com.sforce.async.ConcurrencyMode;
|
import com.sforce.async.ConcurrencyMode;
|
||||||
import com.sforce.async.ContentType;
|
import com.sforce.async.ContentType;
|
||||||
@@ -32,18 +26,12 @@ import com.sforce.async.JobInfo;
|
|||||||
import com.sforce.async.JobStateEnum;
|
import com.sforce.async.JobStateEnum;
|
||||||
import com.sforce.async.OperationEnum;
|
import com.sforce.async.OperationEnum;
|
||||||
import com.sforce.async.QueryResultList;
|
import com.sforce.async.QueryResultList;
|
||||||
import com.sforce.soap.partner.PartnerConnection;
|
|
||||||
import com.sforce.ws.ConnectionException;
|
import com.sforce.ws.ConnectionException;
|
||||||
import com.sforce.ws.ConnectorConfig;
|
|
||||||
|
|
||||||
public class SalesforceBulkAPI {
|
public class SalesforceBulkAPI {
|
||||||
|
|
||||||
private final String FILE_ENCODING = "UTF-8";
|
private final String FILE_ENCODING = "UTF-8";
|
||||||
|
|
||||||
private String username;
|
|
||||||
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
private String sObjectType;
|
private String sObjectType;
|
||||||
|
|
||||||
private OperationEnum operation;
|
private OperationEnum operation;
|
||||||
@@ -88,25 +76,12 @@ public class SalesforceBulkAPI {
|
|||||||
maxRowsPerBatch = (maxRows > sforceMaxRows) ? sforceMaxRows : maxRows;
|
maxRowsPerBatch = (maxRows > sforceMaxRows) ? sforceMaxRows : maxRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BulkConnection connection;
|
private SforceBulkConnection connection;
|
||||||
|
|
||||||
public BulkConnection getConnection() {
|
public SalesforceBulkAPI(SforceBulkConnection connection) {
|
||||||
return connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void login(BulkConnection connection) {
|
|
||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void login(String endpoint, String username, String password, String apiVersion) throws ConnectionException,
|
|
||||||
AsyncApiException {
|
|
||||||
this.connection = getBulkConnection(endpoint, username, password, apiVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void login(String sessionID, String endpointURL) throws ConnectionException, AsyncApiException {
|
|
||||||
this.connection = getBulkConnection(sessionID, endpointURL);
|
|
||||||
}
|
|
||||||
|
|
||||||
private JobInfo job;
|
private JobInfo job;
|
||||||
|
|
||||||
private com.talend.csv.CSVReader baseFileReader;
|
private com.talend.csv.CSVReader baseFileReader;
|
||||||
@@ -134,135 +109,13 @@ public class SalesforceBulkAPI {
|
|||||||
baseFileHeaderSize = baseFileHeader.size();
|
baseFileHeaderSize = baseFileHeader.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean useProxy = false;
|
|
||||||
|
|
||||||
private String proxyHost;
|
|
||||||
|
|
||||||
private int proxyPort;
|
|
||||||
|
|
||||||
private String proxyUsername;
|
|
||||||
|
|
||||||
private String proxyPassword;
|
|
||||||
|
|
||||||
public void setProxy(boolean useProxy, String host, int port, String username, String password) {
|
|
||||||
this.proxyHost = host;
|
|
||||||
this.proxyPort = port;
|
|
||||||
this.proxyUsername = username;
|
|
||||||
this.proxyPassword = password;
|
|
||||||
this.useProxy = useProxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setProxyToConnection(ConnectorConfig conn) {
|
|
||||||
Proxy socketProxy = null;
|
|
||||||
if (!useProxy) {
|
|
||||||
proxyHost = System.getProperty("https.proxyHost");
|
|
||||||
if (proxyHost != null && System.getProperty("https.proxyPort") != null) {
|
|
||||||
proxyPort = Integer.parseInt(System.getProperty("https.proxyPort"));
|
|
||||||
proxyUsername = System.getProperty("https.proxyUser");
|
|
||||||
proxyPassword = System.getProperty("https.proxyPassword");
|
|
||||||
useProxy = true;
|
|
||||||
} else {
|
|
||||||
proxyHost = System.getProperty("http.proxyHost");
|
|
||||||
if (proxyHost != null && System.getProperty("http.proxyPort") != null) {
|
|
||||||
proxyPort = Integer.parseInt(System.getProperty("http.proxyPort"));
|
|
||||||
proxyUsername = System.getProperty("http.proxyUser");
|
|
||||||
proxyPassword = System.getProperty("http.proxyPassword");
|
|
||||||
useProxy = true;
|
|
||||||
} else {
|
|
||||||
proxyHost = System.getProperty("socksProxyHost");
|
|
||||||
if (proxyHost != null && System.getProperty("socksProxyPort") != null) {
|
|
||||||
proxyPort = Integer.parseInt(System.getProperty("socksProxyPort"));
|
|
||||||
proxyUsername = System.getProperty("java.net.socks.username");
|
|
||||||
proxyPassword = System.getProperty("java.net.socks.password");
|
|
||||||
useProxy = true;
|
|
||||||
|
|
||||||
SocketAddress addr = new InetSocketAddress(proxyHost, proxyPort);
|
|
||||||
socketProxy = new Proxy(Proxy.Type.SOCKS, addr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (useProxy) {
|
|
||||||
if (socketProxy != null) {
|
|
||||||
conn.setProxy(socketProxy);
|
|
||||||
} else {
|
|
||||||
conn.setProxy(proxyHost, proxyPort);
|
|
||||||
}
|
|
||||||
if (proxyUsername != null && !"".equals(proxyUsername)) {
|
|
||||||
conn.setProxyUsername(proxyUsername);
|
|
||||||
if (proxyPassword != null && !"".equals(proxyPassword)) {
|
|
||||||
conn.setProxyPassword(proxyPassword);
|
|
||||||
|
|
||||||
Authenticator.setDefault(new Authenticator() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PasswordAuthentication getPasswordAuthentication() {
|
|
||||||
if (getRequestorType() == Authenticator.RequestorType.PROXY) {
|
|
||||||
return new PasswordAuthentication(proxyUsername, proxyPassword.toCharArray());
|
|
||||||
} else {
|
|
||||||
return super.getPasswordAuthentication();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private BulkConnection getBulkConnection(String endpoint, String username, String password, String apiVersion)
|
|
||||||
throws ConnectionException, AsyncApiException {
|
|
||||||
ConnectorConfig partnerConfig = new ConnectorConfig();
|
|
||||||
partnerConfig.setUsername(username);
|
|
||||||
partnerConfig.setPassword(password);
|
|
||||||
partnerConfig.setAuthEndpoint(endpoint);
|
|
||||||
setProxyToConnection(partnerConfig);
|
|
||||||
// Creating the connection automatically handles login and stores
|
|
||||||
// the session in partnerConfig
|
|
||||||
new PartnerConnection(partnerConfig);
|
|
||||||
// The endpoint for the Bulk API service is the same as for the normal
|
|
||||||
// SOAP uri until the /Soap/ part. From here it's '/async/versionNumber'
|
|
||||||
String soapEndpoint = partnerConfig.getServiceEndpoint();
|
|
||||||
String restEndpoint = soapEndpoint.substring(0, soapEndpoint.indexOf("Soap/")) + "async/" + apiVersion;
|
|
||||||
// When PartnerConnection is instantiated, a login is implicitly
|
|
||||||
// executed and, if successful,
|
|
||||||
// a valid session is stored in the ConnectorConfig instance.
|
|
||||||
// Use this key to initialize a BulkConnection:
|
|
||||||
return getBulkConnection(partnerConfig.getSessionId(), restEndpoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
private BulkConnection getBulkConnection(String sessionID, String endpointURL) throws ConnectionException, AsyncApiException {
|
|
||||||
ConnectorConfig config = new ConnectorConfig();
|
|
||||||
config.setSessionId(sessionID);
|
|
||||||
config.setRestEndpoint(endpointURL);
|
|
||||||
setProxyToConnection(config);
|
|
||||||
// This should only be false when doing debugging.
|
|
||||||
config.setCompression(needCompression);
|
|
||||||
// Set this to true to see HTTP requests and responses on stdout
|
|
||||||
config.setTraceMessage(needTraceMessage);
|
|
||||||
BulkConnection connection = new BulkConnection(config);
|
|
||||||
return connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ConcurrencyMode concurrencyMode = null;
|
private ConcurrencyMode concurrencyMode = null;
|
||||||
|
|
||||||
public void setConcurrencyMode(String mode) {
|
public void setConcurrencyMode(String mode) {
|
||||||
concurrencyMode = ConcurrencyMode.valueOf(mode);
|
concurrencyMode = ConcurrencyMode.valueOf(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean needCompression = true;
|
private JobInfo createJob() throws AsyncApiException, ConnectionException {
|
||||||
|
|
||||||
public void setNeedCompression(boolean needCompression) {
|
|
||||||
this.needCompression = needCompression;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean needTraceMessage = false;
|
|
||||||
|
|
||||||
public void setNeedTraceMessage(boolean needTraceMessage) {
|
|
||||||
this.needTraceMessage = needTraceMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
private JobInfo createJob() throws AsyncApiException {
|
|
||||||
JobInfo job = new JobInfo();
|
JobInfo job = new JobInfo();
|
||||||
if (concurrencyMode != null) {
|
if (concurrencyMode != null) {
|
||||||
job.setConcurrencyMode(concurrencyMode);
|
job.setConcurrencyMode(concurrencyMode);
|
||||||
@@ -294,7 +147,7 @@ public class SalesforceBulkAPI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<BatchInfo> createBatchesFromCSVFile() throws IOException, AsyncApiException {
|
private List<BatchInfo> createBatchesFromCSVFile() throws IOException, AsyncApiException, ConnectionException {
|
||||||
List<BatchInfo> batchInfos = new ArrayList<BatchInfo>();
|
List<BatchInfo> batchInfos = new ArrayList<BatchInfo>();
|
||||||
BufferedReader rdr = new BufferedReader(new InputStreamReader(new FileInputStream(bulkFileName), FILE_ENCODING));
|
BufferedReader rdr = new BufferedReader(new InputStreamReader(new FileInputStream(bulkFileName), FILE_ENCODING));
|
||||||
// read the CSV header row
|
// read the CSV header row
|
||||||
@@ -361,7 +214,7 @@ public class SalesforceBulkAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createBatch(FileOutputStream tmpOut, File tmpFile, List<BatchInfo> batchInfos) throws IOException,
|
private void createBatch(FileOutputStream tmpOut, File tmpFile, List<BatchInfo> batchInfos) throws IOException,
|
||||||
AsyncApiException {
|
AsyncApiException, ConnectionException {
|
||||||
tmpOut.flush();
|
tmpOut.flush();
|
||||||
tmpOut.close();
|
tmpOut.close();
|
||||||
FileInputStream tmpInputStream = new FileInputStream(tmpFile);
|
FileInputStream tmpInputStream = new FileInputStream(tmpFile);
|
||||||
@@ -374,7 +227,7 @@ public class SalesforceBulkAPI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeJob() throws AsyncApiException {
|
private void closeJob() throws AsyncApiException, ConnectionException {
|
||||||
JobInfo closeJob = new JobInfo();
|
JobInfo closeJob = new JobInfo();
|
||||||
closeJob.setId(job.getId());
|
closeJob.setId(job.getId());
|
||||||
closeJob.setState(JobStateEnum.Closed);
|
closeJob.setState(JobStateEnum.Closed);
|
||||||
@@ -387,7 +240,7 @@ public class SalesforceBulkAPI {
|
|||||||
this.awaitTime = awaitTime;
|
this.awaitTime = awaitTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void awaitCompletion() throws AsyncApiException {
|
private void awaitCompletion() throws AsyncApiException, ConnectionException {
|
||||||
long sleepTime = 0L;
|
long sleepTime = 0L;
|
||||||
Set<String> incomplete = new HashSet<String>();
|
Set<String> incomplete = new HashSet<String>();
|
||||||
for (BatchInfo bi : batchInfoList) {
|
for (BatchInfo bi : batchInfoList) {
|
||||||
@@ -420,7 +273,7 @@ public class SalesforceBulkAPI {
|
|||||||
return dataInfo;
|
return dataInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Map<String, String>> getBatchLog(int batchNum) throws AsyncApiException, IOException {
|
public List<Map<String, String>> getBatchLog(int batchNum) throws AsyncApiException, IOException, ConnectionException {
|
||||||
// batchInfoList was populated when batches were created and submitted
|
// batchInfoList was populated when batches were created and submitted
|
||||||
List<Map<String, String>> resultInfoList = new ArrayList<Map<String, String>>();
|
List<Map<String, String>> resultInfoList = new ArrayList<Map<String, String>>();
|
||||||
Map<String, String> resultInfo;
|
Map<String, String> resultInfo;
|
||||||
@@ -458,7 +311,7 @@ public class SalesforceBulkAPI {
|
|||||||
private String[] queryResultIDs = null;
|
private String[] queryResultIDs = null;
|
||||||
|
|
||||||
public void doBulkQuery(String moduleName, String queryStatement, int secToWait) throws AsyncApiException,
|
public void doBulkQuery(String moduleName, String queryStatement, int secToWait) throws AsyncApiException,
|
||||||
InterruptedException {
|
InterruptedException, ConnectionException {
|
||||||
job = new JobInfo();
|
job = new JobInfo();
|
||||||
job.setObject(moduleName);
|
job.setObject(moduleName);
|
||||||
job.setOperation(OperationEnum.query);
|
job.setOperation(OperationEnum.query);
|
||||||
@@ -497,11 +350,11 @@ public class SalesforceBulkAPI {
|
|||||||
return queryResultIDs;
|
return queryResultIDs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputStream getQueryResultStream(String resultId) throws AsyncApiException, IOException {
|
public InputStream getQueryResultStream(String resultId) throws AsyncApiException, IOException, ConnectionException {
|
||||||
return connection.getQueryResultStream(job.getId(), batchInfoList.get(0).getId(), resultId);
|
return connection.getQueryResultStream(job.getId(), batchInfoList.get(0).getId(), resultId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Map<String, String>> getQueryResult(String resultId) throws AsyncApiException, IOException {
|
public List<Map<String, String>> getQueryResult(String resultId) throws AsyncApiException, IOException, ConnectionException {
|
||||||
// batchInfoList was populated when batches were created and submitted
|
// batchInfoList was populated when batches were created and submitted
|
||||||
List<Map<String, String>> resultInfoList = new ArrayList<Map<String, String>>();
|
List<Map<String, String>> resultInfoList = new ArrayList<Map<String, String>>();
|
||||||
Map<String, String> resultInfo;
|
Map<String, String> resultInfo;
|
||||||
|
|||||||
@@ -0,0 +1,214 @@
|
|||||||
|
// ============================================================================
|
||||||
|
//
|
||||||
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
|
//
|
||||||
|
// This source code is available under agreement available at
|
||||||
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
|
//
|
||||||
|
// You should have received a copy of the agreement
|
||||||
|
// along with this program; if not, write to Talend SA
|
||||||
|
// 9 rue Pages 92150 Suresnes, France
|
||||||
|
//
|
||||||
|
// ============================================================================
|
||||||
|
package org.talend.salesforceBulk;
|
||||||
|
|
||||||
|
import java.net.Authenticator;
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
import java.net.PasswordAuthentication;
|
||||||
|
import java.net.Proxy;
|
||||||
|
import java.net.SocketAddress;
|
||||||
|
|
||||||
|
import com.sforce.async.BulkConnection;
|
||||||
|
import com.sforce.soap.partner.PartnerConnection;
|
||||||
|
import com.sforce.ws.ConnectionException;
|
||||||
|
import com.sforce.ws.ConnectorConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* created by bchen on Jul 11, 2014 Detailled comment
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SforceBasicBulkConnection extends SforceBulkConnection {
|
||||||
|
|
||||||
|
private final String login_endpoint;
|
||||||
|
|
||||||
|
private final String username;
|
||||||
|
|
||||||
|
private final String password;
|
||||||
|
|
||||||
|
private final String apiVersion;
|
||||||
|
|
||||||
|
private boolean needCompression;
|
||||||
|
|
||||||
|
private boolean needTraceMessage;
|
||||||
|
|
||||||
|
private boolean useProxy;
|
||||||
|
|
||||||
|
private String proxyHost;
|
||||||
|
|
||||||
|
private int proxyPort;
|
||||||
|
|
||||||
|
private String proxyUsername;
|
||||||
|
|
||||||
|
private String proxyPassword;
|
||||||
|
|
||||||
|
private SforceBasicBulkConnection() throws Exception {
|
||||||
|
throw new Exception("should use builder to init"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
private SforceBasicBulkConnection(Builder builder) throws Exception {
|
||||||
|
this.login_endpoint = builder.login_endpoint;
|
||||||
|
this.username = builder.username;
|
||||||
|
this.password = builder.password;
|
||||||
|
this.apiVersion = builder.apiVersion;
|
||||||
|
this.needCompression = builder.needCompression;
|
||||||
|
this.needTraceMessage = builder.needTraceMessage;
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void renewSession() throws ConnectionException {
|
||||||
|
ConnectorConfig partnerConfig = new ConnectorConfig();
|
||||||
|
partnerConfig.setAuthEndpoint(login_endpoint);
|
||||||
|
partnerConfig.setUsername(username);
|
||||||
|
partnerConfig.setPassword(password);
|
||||||
|
setProxyToConnection(partnerConfig);
|
||||||
|
// Creating the connection automatically handles login and stores
|
||||||
|
// the session in partnerConfig
|
||||||
|
new PartnerConnection(partnerConfig);
|
||||||
|
// The endpoint for the Bulk API service is the same as for the normal
|
||||||
|
// SOAP uri until the /Soap/ part. From here it's '/async/versionNumber'
|
||||||
|
String soapEndpoint = partnerConfig.getServiceEndpoint();
|
||||||
|
String restEndpoint = soapEndpoint.substring(0, soapEndpoint.indexOf("Soap/")) + "async/" + apiVersion;
|
||||||
|
// When PartnerConnection is instantiated, a login is implicitly
|
||||||
|
// executed and, if successful,
|
||||||
|
// a valid session is stored in the ConnectorConfig instance.
|
||||||
|
// Use this key to initialize a BulkConnection:
|
||||||
|
config.setSessionId(partnerConfig.getSessionId());
|
||||||
|
config.setRestEndpoint(restEndpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() throws Exception {
|
||||||
|
config = new ConnectorConfig();
|
||||||
|
setProxyToConnection(config);
|
||||||
|
// This should only be false when doing debugging.
|
||||||
|
config.setCompression(needCompression);
|
||||||
|
// Set this to true to see HTTP requests and responses on stdout
|
||||||
|
config.setTraceMessage(needTraceMessage);
|
||||||
|
renewSession();
|
||||||
|
connection = new BulkConnection(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setProxyToConnection(ConnectorConfig conn) {
|
||||||
|
Proxy socketProxy = null;
|
||||||
|
if (!useProxy) {
|
||||||
|
proxyHost = System.getProperty("https.proxyHost");
|
||||||
|
if (proxyHost != null && System.getProperty("https.proxyPort") != null) {
|
||||||
|
proxyPort = Integer.parseInt(System.getProperty("https.proxyPort"));
|
||||||
|
proxyUsername = System.getProperty("https.proxyUser");
|
||||||
|
proxyPassword = System.getProperty("https.proxyPassword");
|
||||||
|
useProxy = true;
|
||||||
|
} else {
|
||||||
|
proxyHost = System.getProperty("http.proxyHost");
|
||||||
|
if (proxyHost != null && System.getProperty("http.proxyPort") != null) {
|
||||||
|
proxyPort = Integer.parseInt(System.getProperty("http.proxyPort"));
|
||||||
|
proxyUsername = System.getProperty("http.proxyUser");
|
||||||
|
proxyPassword = System.getProperty("http.proxyPassword");
|
||||||
|
useProxy = true;
|
||||||
|
} else {
|
||||||
|
proxyHost = System.getProperty("socksProxyHost");
|
||||||
|
if (proxyHost != null && System.getProperty("socksProxyPort") != null) {
|
||||||
|
proxyPort = Integer.parseInt(System.getProperty("socksProxyPort"));
|
||||||
|
proxyUsername = System.getProperty("java.net.socks.username");
|
||||||
|
proxyPassword = System.getProperty("java.net.socks.password");
|
||||||
|
useProxy = true;
|
||||||
|
|
||||||
|
SocketAddress addr = new InetSocketAddress(proxyHost, proxyPort);
|
||||||
|
socketProxy = new Proxy(Proxy.Type.SOCKS, addr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (useProxy) {
|
||||||
|
if (socketProxy != null) {
|
||||||
|
conn.setProxy(socketProxy);
|
||||||
|
} else {
|
||||||
|
conn.setProxy(proxyHost, proxyPort);
|
||||||
|
}
|
||||||
|
if (proxyUsername != null && !"".equals(proxyUsername)) {
|
||||||
|
conn.setProxyUsername(proxyUsername);
|
||||||
|
if (proxyPassword != null && !"".equals(proxyPassword)) {
|
||||||
|
conn.setProxyPassword(proxyPassword);
|
||||||
|
|
||||||
|
Authenticator.setDefault(new Authenticator() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PasswordAuthentication getPasswordAuthentication() {
|
||||||
|
if (getRequestorType() == Authenticator.RequestorType.PROXY) {
|
||||||
|
return new PasswordAuthentication(proxyUsername, proxyPassword.toCharArray());
|
||||||
|
} else {
|
||||||
|
return super.getPasswordAuthentication();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
private final String login_endpoint;
|
||||||
|
|
||||||
|
private final String username;
|
||||||
|
|
||||||
|
private final String password;
|
||||||
|
|
||||||
|
private final String apiVersion;
|
||||||
|
|
||||||
|
private boolean needCompression = true;
|
||||||
|
|
||||||
|
private boolean needTraceMessage = false;
|
||||||
|
|
||||||
|
private boolean useProxy = false;
|
||||||
|
|
||||||
|
private String proxyHost;
|
||||||
|
|
||||||
|
private int proxyPort;
|
||||||
|
|
||||||
|
private String proxyUsername;
|
||||||
|
|
||||||
|
private String proxyPassword;
|
||||||
|
|
||||||
|
public Builder(String login_endpoint, String username, String password, String apiVersion) {
|
||||||
|
this.login_endpoint = login_endpoint;
|
||||||
|
this.username = username;
|
||||||
|
this.password = password;
|
||||||
|
this.apiVersion = apiVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder needCompression(boolean needCompression) {
|
||||||
|
this.needCompression = needCompression;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder needTraceMessage(boolean needTraceMessage) {
|
||||||
|
this.needTraceMessage = needTraceMessage;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setProxy(boolean useProxy, String host, int port, String username, String password) {
|
||||||
|
this.proxyHost = host;
|
||||||
|
this.proxyPort = port;
|
||||||
|
this.proxyUsername = username;
|
||||||
|
this.proxyPassword = password;
|
||||||
|
this.useProxy = useProxy;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SforceBasicBulkConnection build() throws Exception {
|
||||||
|
return new SforceBasicBulkConnection(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
// ============================================================================
|
||||||
|
//
|
||||||
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
|
//
|
||||||
|
// This source code is available under agreement available at
|
||||||
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
|
//
|
||||||
|
// You should have received a copy of the agreement
|
||||||
|
// along with this program; if not, write to Talend SA
|
||||||
|
// 9 rue Pages 92150 Suresnes, France
|
||||||
|
//
|
||||||
|
// ============================================================================
|
||||||
|
package org.talend.salesforceBulk;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import com.sforce.async.AsyncApiException;
|
||||||
|
import com.sforce.async.AsyncExceptionCode;
|
||||||
|
import com.sforce.async.BatchInfo;
|
||||||
|
import com.sforce.async.BatchInfoList;
|
||||||
|
import com.sforce.async.BulkConnection;
|
||||||
|
import com.sforce.async.JobInfo;
|
||||||
|
import com.sforce.async.QueryResultList;
|
||||||
|
import com.sforce.ws.ConnectionException;
|
||||||
|
import com.sforce.ws.ConnectorConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* created by bchen on Jul 11, 2014 Detailled comment
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public abstract class SforceBulkConnection {
|
||||||
|
|
||||||
|
protected BulkConnection connection;
|
||||||
|
|
||||||
|
protected ConnectorConfig config;
|
||||||
|
|
||||||
|
protected void renewSession() throws ConnectionException {
|
||||||
|
throw new ConnectionException("Session expire, need to renew session");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected JobInfo createJob(JobInfo job) throws AsyncApiException, ConnectionException {
|
||||||
|
try {
|
||||||
|
return connection.createJob(job);
|
||||||
|
} catch (AsyncApiException sfException) {
|
||||||
|
if (AsyncExceptionCode.InvalidSessionId.equals(sfException.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return createJob(job);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected BatchInfo createBatchFromStream(JobInfo job, FileInputStream inputStream) throws AsyncApiException,
|
||||||
|
ConnectionException {
|
||||||
|
try {
|
||||||
|
return connection.createBatchFromStream(job, inputStream);
|
||||||
|
} catch (AsyncApiException sfException) {
|
||||||
|
if (AsyncExceptionCode.InvalidSessionId.equals(sfException.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return createBatchFromStream(job, inputStream);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected JobInfo updateJob(JobInfo job) throws AsyncApiException, ConnectionException {
|
||||||
|
try {
|
||||||
|
return connection.updateJob(job);
|
||||||
|
} catch (AsyncApiException sfException) {
|
||||||
|
if (AsyncExceptionCode.InvalidSessionId.equals(sfException.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return updateJob(job);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected BatchInfoList getBatchInfoList(String jobID) throws AsyncApiException, ConnectionException {
|
||||||
|
try {
|
||||||
|
return connection.getBatchInfoList(jobID);
|
||||||
|
} catch (AsyncApiException sfException) {
|
||||||
|
if (AsyncExceptionCode.InvalidSessionId.equals(sfException.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return getBatchInfoList(jobID);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected InputStream getBatchResultStream(String jobID, String batchID) throws AsyncApiException, ConnectionException {
|
||||||
|
try {
|
||||||
|
return connection.getBatchResultStream(jobID, batchID);
|
||||||
|
} catch (AsyncApiException sfException) {
|
||||||
|
if (AsyncExceptionCode.InvalidSessionId.equals(sfException.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return getBatchResultStream(jobID, batchID);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected JobInfo getJobStatus(String jobID) throws AsyncApiException, ConnectionException {
|
||||||
|
try {
|
||||||
|
return connection.getJobStatus(jobID);
|
||||||
|
} catch (AsyncApiException sfException) {
|
||||||
|
if (AsyncExceptionCode.InvalidSessionId.equals(sfException.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return getJobStatus(jobID);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected BatchInfo createBatchFromStream(JobInfo job, ByteArrayInputStream byteArrayInputStream) throws AsyncApiException,
|
||||||
|
ConnectionException {
|
||||||
|
try {
|
||||||
|
return connection.createBatchFromStream(job, byteArrayInputStream);
|
||||||
|
} catch (AsyncApiException sfException) {
|
||||||
|
if (AsyncExceptionCode.InvalidSessionId.equals(sfException.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return createBatchFromStream(job, byteArrayInputStream);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected BatchInfo getBatchInfo(String jobID, String batchID) throws AsyncApiException, ConnectionException {
|
||||||
|
try {
|
||||||
|
return connection.getBatchInfo(jobID, batchID);
|
||||||
|
} catch (AsyncApiException sfException) {
|
||||||
|
if (AsyncExceptionCode.InvalidSessionId.equals(sfException.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return getBatchInfo(jobID, batchID);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected QueryResultList getQueryResultList(String jobID, String batchID) throws AsyncApiException, ConnectionException {
|
||||||
|
try {
|
||||||
|
return connection.getQueryResultList(jobID, batchID);
|
||||||
|
} catch (AsyncApiException sfException) {
|
||||||
|
if (AsyncExceptionCode.InvalidSessionId.equals(sfException.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return getQueryResultList(jobID, batchID);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected InputStream getQueryResultStream(String jobID, String batchID, String resultID) throws AsyncApiException,
|
||||||
|
ConnectionException {
|
||||||
|
try {
|
||||||
|
return connection.getQueryResultStream(jobID, batchID, resultID);
|
||||||
|
} catch (AsyncApiException sfException) {
|
||||||
|
if (AsyncExceptionCode.InvalidSessionId.equals(sfException.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return getQueryResultStream(jobID, batchID, resultID);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,184 @@
|
|||||||
|
// ============================================================================
|
||||||
|
//
|
||||||
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
|
//
|
||||||
|
// This source code is available under agreement available at
|
||||||
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
|
//
|
||||||
|
// You should have received a copy of the agreement
|
||||||
|
// along with this program; if not, write to Talend SA
|
||||||
|
// 9 rue Pages 92150 Suresnes, France
|
||||||
|
//
|
||||||
|
// ============================================================================
|
||||||
|
package org.talend.salesforceBulk;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.talend.salesforce.oauth.OAuthClient;
|
||||||
|
import org.talend.salesforce.oauth.Token;
|
||||||
|
|
||||||
|
import com.sforce.async.BulkConnection;
|
||||||
|
import com.sforce.ws.ConnectionException;
|
||||||
|
import com.sforce.ws.ConnectorConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* created by bchen on Jul 11, 2014 Detailled comment
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SforceOAuthBulkConnection extends SforceBulkConnection {
|
||||||
|
|
||||||
|
private static final String REFRESHTOKEN_KEY = "refreshtoken";
|
||||||
|
|
||||||
|
private final String login_endpoint;
|
||||||
|
|
||||||
|
private final String oauth_clientID;
|
||||||
|
|
||||||
|
private final String oauth_clientSecret;
|
||||||
|
|
||||||
|
private String tokenFilePath;
|
||||||
|
|
||||||
|
private final String apiVersion;
|
||||||
|
|
||||||
|
private final String callbackHost;
|
||||||
|
|
||||||
|
private final int callbackPort;
|
||||||
|
|
||||||
|
private boolean needCompression;
|
||||||
|
|
||||||
|
private boolean needTraceMessage;
|
||||||
|
|
||||||
|
private SforceOAuthBulkConnection() throws Exception {
|
||||||
|
throw new Exception("should use builder to init"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
private SforceOAuthBulkConnection(Builder builder) throws Exception {
|
||||||
|
this.login_endpoint = builder.login_endpoint;
|
||||||
|
this.oauth_clientID = builder.oauth_clientID;
|
||||||
|
this.oauth_clientSecret = builder.oauth_clientSecret;
|
||||||
|
this.apiVersion = builder.apiVersion;
|
||||||
|
this.tokenFilePath = builder.tokenFilePath;
|
||||||
|
this.callbackHost = builder.callbackHost;
|
||||||
|
this.callbackPort = builder.callbackPort;
|
||||||
|
this.needCompression = builder.needCompression;
|
||||||
|
this.needTraceMessage = builder.needTraceMessage;
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Token loginWithOAuth() throws Exception {
|
||||||
|
String session_id = null;
|
||||||
|
|
||||||
|
OAuthClient oauthClient = new OAuthClient();
|
||||||
|
oauthClient.setBaseOAuthURL(login_endpoint);
|
||||||
|
oauthClient.setClientID(oauth_clientID);
|
||||||
|
oauthClient.setClientSecret(oauth_clientSecret);
|
||||||
|
Token token = null;
|
||||||
|
String refreshToken = null;
|
||||||
|
// 1. if tokenFile exist, try refresh token
|
||||||
|
if (tokenFilePath != null) {
|
||||||
|
Properties prop = new Properties();
|
||||||
|
FileInputStream inputStream = new FileInputStream(tokenFilePath);
|
||||||
|
prop.load(inputStream);
|
||||||
|
inputStream.close();
|
||||||
|
String storedRefreshToken = (String) prop.get(REFRESHTOKEN_KEY);
|
||||||
|
if (storedRefreshToken != null) {
|
||||||
|
token = oauthClient.refreshToken(storedRefreshToken);
|
||||||
|
session_id = token.getAccess_token();
|
||||||
|
refreshToken = token.getRefresh_token();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 2. try to auth if session_id can't be retrieved
|
||||||
|
if (session_id == null) {
|
||||||
|
oauthClient.setCallbackHost(callbackHost);
|
||||||
|
oauthClient.setCallbackPort(callbackPort);
|
||||||
|
token = oauthClient.getToken();
|
||||||
|
refreshToken = token.getRefresh_token();
|
||||||
|
}
|
||||||
|
// 3.if refresh token & tokenFile exist, store
|
||||||
|
if (refreshToken != null && tokenFilePath != null) {
|
||||||
|
Properties prop = new Properties();
|
||||||
|
prop.setProperty(REFRESHTOKEN_KEY, refreshToken);
|
||||||
|
FileOutputStream outputStream = new FileOutputStream(tokenFilePath);
|
||||||
|
prop.store(outputStream, null);
|
||||||
|
if (outputStream != null) {
|
||||||
|
outputStream.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() throws Exception {
|
||||||
|
config = new ConnectorConfig();
|
||||||
|
// This should only be false when doing debugging.
|
||||||
|
config.setCompression(needCompression);
|
||||||
|
// Set this to true to see HTTP requests and responses on stdout
|
||||||
|
config.setTraceMessage(needTraceMessage);
|
||||||
|
renewSession();
|
||||||
|
connection = new BulkConnection(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void renewSession() throws ConnectionException {
|
||||||
|
Token token;
|
||||||
|
try {
|
||||||
|
token = loginWithOAuth();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new ConnectionException(e.getMessage());
|
||||||
|
}
|
||||||
|
String session_id = token.getAccess_token();
|
||||||
|
String endpoint = OAuthClient.getBulkEndpoint(token, apiVersion);
|
||||||
|
config.setSessionId(session_id);
|
||||||
|
config.setRestEndpoint(endpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
private final String login_endpoint;
|
||||||
|
|
||||||
|
private final String oauth_clientID;
|
||||||
|
|
||||||
|
private final String oauth_clientSecret;
|
||||||
|
|
||||||
|
private final String apiVersion;
|
||||||
|
|
||||||
|
private String tokenFilePath = null;
|
||||||
|
|
||||||
|
private final String callbackHost;
|
||||||
|
|
||||||
|
private final int callbackPort;
|
||||||
|
|
||||||
|
private boolean needCompression = true;
|
||||||
|
|
||||||
|
private boolean needTraceMessage = false;
|
||||||
|
|
||||||
|
public Builder(String login_endpoint, String oauth_clientID, String oauth_clientSecret, String apiVersion,
|
||||||
|
String callbackHost, int callbackPort) {
|
||||||
|
this.login_endpoint = login_endpoint;
|
||||||
|
this.oauth_clientID = oauth_clientID;
|
||||||
|
this.oauth_clientSecret = oauth_clientSecret;
|
||||||
|
this.apiVersion = apiVersion;
|
||||||
|
this.callbackHost = callbackHost;
|
||||||
|
this.callbackPort = callbackPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setTokenFilePath(String tokenFilePath) {
|
||||||
|
this.tokenFilePath = tokenFilePath;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder needCompression(boolean needCompression) {
|
||||||
|
this.needCompression = needCompression;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder needTraceMessage(boolean needTraceMessage) {
|
||||||
|
this.needTraceMessage = needTraceMessage;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SforceOAuthBulkConnection build() throws Exception {
|
||||||
|
return new SforceOAuthBulkConnection(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10306,6 +10306,23 @@ public class SforceServiceStub extends org.apache.axis2.client.Stub implements
|
|||||||
"urn:partner.soap.sforce.com:Soap:describeGlobalRequest");
|
"urn:partner.soap.sforce.com:Soap:describeGlobalRequest");
|
||||||
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(
|
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(
|
||||||
true);
|
true);
|
||||||
|
{
|
||||||
|
/*- ADD - START - BY cmeng - 20140901*/
|
||||||
|
/**
|
||||||
|
* https://jira.talendforge.org/browse/TDI-30366<br>
|
||||||
|
* 1. Because this API seems not support this case: server use HTTP Protocol 1.0(not support CHUNKED) while client use HTTP Protocol 1.1<br>
|
||||||
|
* , then client will throw exception(org.apache.axis2.AxisFault: Transport error: 411 Error: Length Required)<br>
|
||||||
|
* 2. If the new API can support this case, then this additional codes can be cancelled.
|
||||||
|
*
|
||||||
|
* Some information I searched on the net:<br>
|
||||||
|
* https://www.mail-archive.com/basedb-devel@lists.sourceforge.net/msg00309.html
|
||||||
|
* http://axis.apache.org/axis2/java/core/docs/http-transport.html
|
||||||
|
* http://en.wikipedia.org/wiki/Chunked_transfer_encoding
|
||||||
|
*/
|
||||||
|
_operationClient.getOptions().setProperty(
|
||||||
|
org.apache.axis2.transport.http.HTTPConstants.CHUNKED, "false");
|
||||||
|
/*- ADD - END - BY cmeng* - 20140901*/
|
||||||
|
}
|
||||||
|
|
||||||
addPropertyToOperationClient(
|
addPropertyToOperationClient(
|
||||||
_operationClient,
|
_operationClient,
|
||||||
@@ -12816,6 +12833,23 @@ public class SforceServiceStub extends org.apache.axis2.client.Stub implements
|
|||||||
"urn:partner.soap.sforce.com:Soap:describeSObjectRequest");
|
"urn:partner.soap.sforce.com:Soap:describeSObjectRequest");
|
||||||
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(
|
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(
|
||||||
true);
|
true);
|
||||||
|
{
|
||||||
|
/*- ADD - START - BY cmeng - 20140901*/
|
||||||
|
/**
|
||||||
|
* https://jira.talendforge.org/browse/TDI-30366<br>
|
||||||
|
* 1. Because this API seems not support this case: server use HTTP Protocol 1.0(not support CHUNKED) while client use HTTP Protocol 1.1<br>
|
||||||
|
* , then client will throw exception(org.apache.axis2.AxisFault: Transport error: 411 Error: Length Required)<br>
|
||||||
|
* 2. If the new API can support this case, then this additional codes can be cancelled.
|
||||||
|
*
|
||||||
|
* Some information I searched on the net:<br>
|
||||||
|
* https://www.mail-archive.com/basedb-devel@lists.sourceforge.net/msg00309.html
|
||||||
|
* http://axis.apache.org/axis2/java/core/docs/http-transport.html
|
||||||
|
* http://en.wikipedia.org/wiki/Chunked_transfer_encoding
|
||||||
|
*/
|
||||||
|
_operationClient.getOptions().setProperty(
|
||||||
|
org.apache.axis2.transport.http.HTTPConstants.CHUNKED, "false");
|
||||||
|
/*- ADD - END - BY cmeng - 20140901*/
|
||||||
|
}
|
||||||
|
|
||||||
addPropertyToOperationClient(
|
addPropertyToOperationClient(
|
||||||
_operationClient,
|
_operationClient,
|
||||||
|
|||||||
@@ -0,0 +1,124 @@
|
|||||||
|
// ============================================================================
|
||||||
|
//
|
||||||
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
|
//
|
||||||
|
// This source code is available under agreement available at
|
||||||
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
|
//
|
||||||
|
// You should have received a copy of the agreement
|
||||||
|
// along with this program; if not, write to Talend SA
|
||||||
|
// 9 rue Pages 92150 Suresnes, France
|
||||||
|
//
|
||||||
|
// ============================================================================
|
||||||
|
package org.talend.salesforce;
|
||||||
|
|
||||||
|
import com.salesforce.soap.partner.CallOptions;
|
||||||
|
import com.salesforce.soap.partner.Login;
|
||||||
|
import com.salesforce.soap.partner.LoginResult;
|
||||||
|
import com.salesforce.soap.partner.SessionHeader;
|
||||||
|
import com.salesforce.soap.partner.SforceServiceStub;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* created by bchen on Jul 9, 2014 Detailled comment
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SforceBasicConnection extends SforceConnection {
|
||||||
|
|
||||||
|
private final String login_endpoint;
|
||||||
|
|
||||||
|
private final Login userInfo;
|
||||||
|
|
||||||
|
private boolean needCompression;
|
||||||
|
|
||||||
|
private int timeout;
|
||||||
|
|
||||||
|
private String clientID;
|
||||||
|
|
||||||
|
private SforceBasicConnection() throws Exception {
|
||||||
|
throw new Exception("should use builder to init"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
private SforceBasicConnection(Builder builder) throws Exception {
|
||||||
|
this.login_endpoint = builder.login_endpoint;
|
||||||
|
this.userInfo = builder.userInfo;
|
||||||
|
this.needCompression = builder.needCompression;
|
||||||
|
this.timeout = builder.timeout;
|
||||||
|
this.clientID = builder.clientID;
|
||||||
|
check();
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void check() throws Exception {
|
||||||
|
if (login_endpoint == null || login_endpoint.trim().length() == 0 || userInfo.getUsername() == null
|
||||||
|
|| userInfo.getUsername().trim().length() == 0 || userInfo.getPassword() == null
|
||||||
|
|| userInfo.getPassword().trim().length() == 0) {
|
||||||
|
throw new RuntimeException("Login failed! Please check the username,password and endpoint");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() throws Exception {
|
||||||
|
if (clientID != null) {
|
||||||
|
co = new CallOptions();
|
||||||
|
co.setClient(clientID);
|
||||||
|
}
|
||||||
|
stub = new SforceServiceStub();
|
||||||
|
SforceManagementUtil.needCompression(stub, needCompression);
|
||||||
|
SforceManagementUtil.setTimeout(stub, timeout);
|
||||||
|
SforceManagementUtil.setHttpProxy(stub);
|
||||||
|
sh = new SessionHeader();
|
||||||
|
renewSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void renewSession() throws Exception {
|
||||||
|
SforceManagementUtil.setEndpoint(stub, login_endpoint);// login_endpoint for login operation
|
||||||
|
LoginResult loginResult = stub.login(userInfo, null, co).getResult();
|
||||||
|
sh.setSessionId(loginResult.getSessionId());
|
||||||
|
SforceManagementUtil.setEndpoint(stub, loginResult.getServerUrl());// server url for CRUD operation
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
private final String login_endpoint;
|
||||||
|
|
||||||
|
private final Login userInfo;
|
||||||
|
|
||||||
|
private boolean needCompression = false;
|
||||||
|
|
||||||
|
private int timeout = 60000;
|
||||||
|
|
||||||
|
private String clientID = null;
|
||||||
|
|
||||||
|
public Builder(String login_endpoint, String username, String password) {
|
||||||
|
this.login_endpoint = login_endpoint;
|
||||||
|
this.userInfo = new Login();
|
||||||
|
this.userInfo.setUsername(username);
|
||||||
|
this.userInfo.setPassword(password);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder needCompression(boolean needCompression) {
|
||||||
|
this.needCompression = needCompression;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setTimeout(int timeout) {
|
||||||
|
this.timeout = timeout;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setTimeout(String timeout) {
|
||||||
|
this.timeout = Integer.valueOf(timeout);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setClientID(String clientID) {
|
||||||
|
this.clientID = clientID;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SforceBasicConnection build() throws Exception {
|
||||||
|
return new SforceBasicConnection(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,248 @@
|
|||||||
|
// ============================================================================
|
||||||
|
//
|
||||||
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
|
//
|
||||||
|
// This source code is available under agreement available at
|
||||||
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
|
//
|
||||||
|
// You should have received a copy of the agreement
|
||||||
|
// along with this program; if not, write to Talend SA
|
||||||
|
// 9 rue Pages 92150 Suresnes, France
|
||||||
|
//
|
||||||
|
// ============================================================================
|
||||||
|
package org.talend.salesforce;
|
||||||
|
|
||||||
|
import com.salesforce.soap.partner.CallOptions;
|
||||||
|
import com.salesforce.soap.partner.Create;
|
||||||
|
import com.salesforce.soap.partner.CreateResponse;
|
||||||
|
import com.salesforce.soap.partner.Delete;
|
||||||
|
import com.salesforce.soap.partner.DeleteResponse;
|
||||||
|
import com.salesforce.soap.partner.DescribeGlobal;
|
||||||
|
import com.salesforce.soap.partner.DescribeGlobalResponse;
|
||||||
|
import com.salesforce.soap.partner.DescribeSObject;
|
||||||
|
import com.salesforce.soap.partner.DescribeSObjectResponse;
|
||||||
|
import com.salesforce.soap.partner.DescribeSObjects;
|
||||||
|
import com.salesforce.soap.partner.DescribeSObjectsResponse;
|
||||||
|
import com.salesforce.soap.partner.GetDeleted;
|
||||||
|
import com.salesforce.soap.partner.GetDeletedResponse;
|
||||||
|
import com.salesforce.soap.partner.GetServerTimestamp;
|
||||||
|
import com.salesforce.soap.partner.GetServerTimestampResponse;
|
||||||
|
import com.salesforce.soap.partner.GetUpdated;
|
||||||
|
import com.salesforce.soap.partner.GetUpdatedResponse;
|
||||||
|
import com.salesforce.soap.partner.Query;
|
||||||
|
import com.salesforce.soap.partner.QueryAll;
|
||||||
|
import com.salesforce.soap.partner.QueryAllResponse;
|
||||||
|
import com.salesforce.soap.partner.QueryMore;
|
||||||
|
import com.salesforce.soap.partner.QueryMoreResponse;
|
||||||
|
import com.salesforce.soap.partner.QueryOptions;
|
||||||
|
import com.salesforce.soap.partner.QueryResponse;
|
||||||
|
import com.salesforce.soap.partner.Retrieve;
|
||||||
|
import com.salesforce.soap.partner.RetrieveResponse;
|
||||||
|
import com.salesforce.soap.partner.SessionHeader;
|
||||||
|
import com.salesforce.soap.partner.SforceServiceStub;
|
||||||
|
import com.salesforce.soap.partner.Update;
|
||||||
|
import com.salesforce.soap.partner.UpdateResponse;
|
||||||
|
import com.salesforce.soap.partner.Upsert;
|
||||||
|
import com.salesforce.soap.partner.UpsertResponse;
|
||||||
|
import com.salesforce.soap.partner.fault.ExceptionCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* created by bchen on Jul 9, 2014 Detailled comment
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public abstract class SforceConnection {
|
||||||
|
|
||||||
|
protected SforceServiceStub stub;
|
||||||
|
|
||||||
|
protected SessionHeader sh;
|
||||||
|
|
||||||
|
protected CallOptions co;
|
||||||
|
|
||||||
|
protected void renewSession() throws Exception {
|
||||||
|
throw new Exception("Session expire, need to renew session");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DeleteResponse delete(Delete delete) throws Exception {
|
||||||
|
try {
|
||||||
|
return stub.delete(delete, sh, co, null, null, null, null, null, null, null, null);
|
||||||
|
} catch (com.salesforce.soap.partner.UnexpectedErrorFault sfException) {
|
||||||
|
if (ExceptionCode.INVALID_SESSION_ID.equals(sfException.getFaultMessage().getUnexpectedErrorFault()
|
||||||
|
.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return delete(delete);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CreateResponse create(Create create) throws Exception {
|
||||||
|
try {
|
||||||
|
return stub.create(create, sh, co, null, null, null, null, null, null, null, null, null);
|
||||||
|
} catch (com.salesforce.soap.partner.UnexpectedErrorFault sfException) {
|
||||||
|
if (ExceptionCode.INVALID_SESSION_ID.equals(sfException.getFaultMessage().getUnexpectedErrorFault()
|
||||||
|
.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return create(create);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected UpdateResponse update(Update update) throws Exception {
|
||||||
|
try {
|
||||||
|
return stub.update(update, sh, co, null, null, null, null, null, null, null, null, null);
|
||||||
|
} catch (com.salesforce.soap.partner.UnexpectedErrorFault sfException) {
|
||||||
|
if (ExceptionCode.INVALID_SESSION_ID.equals(sfException.getFaultMessage().getUnexpectedErrorFault()
|
||||||
|
.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return update(update);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected UpsertResponse upsert(Upsert upsert) throws Exception {
|
||||||
|
try {
|
||||||
|
return stub.upsert(upsert, sh, co, null, null, null, null, null, null, null, null, null);
|
||||||
|
} catch (com.salesforce.soap.partner.UnexpectedErrorFault sfException) {
|
||||||
|
if (ExceptionCode.INVALID_SESSION_ID.equals(sfException.getFaultMessage().getUnexpectedErrorFault()
|
||||||
|
.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return upsert(upsert);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected GetServerTimestampResponse getServerTimestamp(GetServerTimestamp getServerTimestamp) throws Exception {
|
||||||
|
try {
|
||||||
|
return stub.getServerTimestamp(getServerTimestamp, sh, co);
|
||||||
|
} catch (com.salesforce.soap.partner.UnexpectedErrorFault sfException) {
|
||||||
|
if (ExceptionCode.INVALID_SESSION_ID.equals(sfException.getFaultMessage().getUnexpectedErrorFault()
|
||||||
|
.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return getServerTimestamp(getServerTimestamp);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected GetUpdatedResponse getUpdated(GetUpdated getUpdated) throws Exception {
|
||||||
|
try {
|
||||||
|
return stub.getUpdated(getUpdated, sh, co);
|
||||||
|
} catch (com.salesforce.soap.partner.UnexpectedErrorFault sfException) {
|
||||||
|
if (ExceptionCode.INVALID_SESSION_ID.equals(sfException.getFaultMessage().getUnexpectedErrorFault()
|
||||||
|
.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return getUpdated(getUpdated);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected RetrieveResponse retrieve(Retrieve retrieve) throws Exception {
|
||||||
|
try {
|
||||||
|
return stub.retrieve(retrieve, sh, co, null, null, null);
|
||||||
|
} catch (com.salesforce.soap.partner.UnexpectedErrorFault sfException) {
|
||||||
|
if (ExceptionCode.INVALID_SESSION_ID.equals(sfException.getFaultMessage().getUnexpectedErrorFault()
|
||||||
|
.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return retrieve(retrieve);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected GetDeletedResponse getDeleted(GetDeleted getDeleted) throws Exception {
|
||||||
|
try {
|
||||||
|
return stub.getDeleted(getDeleted, sh, co);
|
||||||
|
} catch (com.salesforce.soap.partner.UnexpectedErrorFault sfException) {
|
||||||
|
if (ExceptionCode.INVALID_SESSION_ID.equals(sfException.getFaultMessage().getUnexpectedErrorFault()
|
||||||
|
.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return getDeleted(getDeleted);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected QueryAllResponse queryAll(QueryAll queryAll, QueryOptions queryOptions) throws Exception {
|
||||||
|
try {
|
||||||
|
return stub.queryAll(queryAll, sh, co, queryOptions);
|
||||||
|
} catch (com.salesforce.soap.partner.UnexpectedErrorFault sfException) {
|
||||||
|
if (ExceptionCode.INVALID_SESSION_ID.equals(sfException.getFaultMessage().getUnexpectedErrorFault()
|
||||||
|
.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return queryAll(queryAll, queryOptions);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected QueryMoreResponse queryMore(QueryMore queryMore, QueryOptions queryOptions) throws Exception {
|
||||||
|
try {
|
||||||
|
return stub.queryMore(queryMore, sh, co, queryOptions);
|
||||||
|
} catch (com.salesforce.soap.partner.UnexpectedErrorFault sfException) {
|
||||||
|
if (ExceptionCode.INVALID_SESSION_ID.equals(sfException.getFaultMessage().getUnexpectedErrorFault()
|
||||||
|
.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return queryMore(queryMore, queryOptions);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected QueryResponse query(Query query, QueryOptions queryOptions) throws Exception {
|
||||||
|
try {
|
||||||
|
return stub.query(query, sh, co, queryOptions, null, null);
|
||||||
|
} catch (com.salesforce.soap.partner.UnexpectedErrorFault sfException) {
|
||||||
|
if (ExceptionCode.INVALID_SESSION_ID.equals(sfException.getFaultMessage().getUnexpectedErrorFault()
|
||||||
|
.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return query(query, queryOptions);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DescribeSObjectResponse describeSObject(DescribeSObject describeSObject) throws Exception {
|
||||||
|
try {
|
||||||
|
return stub.describeSObject(describeSObject, sh, co, null, null);
|
||||||
|
} catch (com.salesforce.soap.partner.UnexpectedErrorFault sfException) {
|
||||||
|
if (ExceptionCode.INVALID_SESSION_ID.equals(sfException.getFaultMessage().getUnexpectedErrorFault()
|
||||||
|
.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return describeSObject(describeSObject);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DescribeSObjectsResponse describeSObjects(DescribeSObjects describeSObjects) throws Exception {
|
||||||
|
try {
|
||||||
|
return stub.describeSObjects(describeSObjects, sh, co, null, null);
|
||||||
|
} catch (com.salesforce.soap.partner.UnexpectedErrorFault sfException) {
|
||||||
|
if (ExceptionCode.INVALID_SESSION_ID.equals(sfException.getFaultMessage().getUnexpectedErrorFault()
|
||||||
|
.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return describeSObjects(describeSObjects);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DescribeGlobalResponse describeGlobal(DescribeGlobal describeGlobal) throws Exception {
|
||||||
|
try {
|
||||||
|
return stub.describeGlobal(describeGlobal, sh, co, null);
|
||||||
|
} catch (com.salesforce.soap.partner.UnexpectedErrorFault sfException) {
|
||||||
|
if (ExceptionCode.INVALID_SESSION_ID.equals(sfException.getFaultMessage().getUnexpectedErrorFault()
|
||||||
|
.getExceptionCode())) {
|
||||||
|
renewSession();
|
||||||
|
return describeGlobal(describeGlobal);
|
||||||
|
}
|
||||||
|
throw sfException;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,15 +17,14 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.apache.axiom.om.OMElement;
|
import org.apache.axiom.om.OMElement;
|
||||||
|
|
||||||
import com.salesforce.soap.partner.CallOptions;
|
|
||||||
import com.salesforce.soap.partner.DeleteResult;
|
import com.salesforce.soap.partner.DeleteResult;
|
||||||
|
import com.salesforce.soap.partner.DescribeGlobalResult;
|
||||||
|
import com.salesforce.soap.partner.DescribeSObjectResult;
|
||||||
import com.salesforce.soap.partner.GetDeletedResult;
|
import com.salesforce.soap.partner.GetDeletedResult;
|
||||||
import com.salesforce.soap.partner.ID;
|
import com.salesforce.soap.partner.ID;
|
||||||
import com.salesforce.soap.partner.QueryLocator;
|
import com.salesforce.soap.partner.QueryLocator;
|
||||||
import com.salesforce.soap.partner.QueryResult;
|
import com.salesforce.soap.partner.QueryResult;
|
||||||
import com.salesforce.soap.partner.SaveResult;
|
import com.salesforce.soap.partner.SaveResult;
|
||||||
import com.salesforce.soap.partner.SessionHeader;
|
|
||||||
import com.salesforce.soap.partner.SforceServiceStub;
|
|
||||||
import com.salesforce.soap.partner.UpsertResult;
|
import com.salesforce.soap.partner.UpsertResult;
|
||||||
import com.salesforce.soap.partner.sobject.SObject;
|
import com.salesforce.soap.partner.sobject.SObject;
|
||||||
|
|
||||||
@@ -34,44 +33,11 @@ import com.salesforce.soap.partner.sobject.SObject;
|
|||||||
*/
|
*/
|
||||||
public interface SforceManagement {
|
public interface SforceManagement {
|
||||||
|
|
||||||
public SforceServiceStub getStub();
|
// todo: rename to end/finish?
|
||||||
|
|
||||||
public SessionHeader getSessionHeader();
|
|
||||||
|
|
||||||
public CallOptions getCallOptions();
|
|
||||||
|
|
||||||
public void setCallOptions(CallOptions co);
|
|
||||||
|
|
||||||
public void setClientID(String clientID);
|
|
||||||
|
|
||||||
public boolean login(String sessionID, String endpoint, int timeout, boolean needCompression) throws Exception;
|
|
||||||
|
|
||||||
public boolean login(String endpoint, String username, String password, int timeout, boolean needCompression)
|
|
||||||
throws Exception;
|
|
||||||
|
|
||||||
public boolean login(String endpoint, String username, String password, String timeout, boolean needCompression)
|
|
||||||
throws Exception;
|
|
||||||
|
|
||||||
public void login(SforceServiceStub stub, SessionHeader sh) throws Exception;
|
|
||||||
|
|
||||||
public boolean login(String sessionID, String endpoint, int timeout, boolean needCompression, int commitLevel,
|
|
||||||
boolean exceptionForErrors, String errorLogFile) throws Exception;
|
|
||||||
|
|
||||||
public boolean login(String endpoint, String username, String password, int timeout, boolean needCompression,
|
|
||||||
int commitLevel, boolean exceptionForErrors, String errorLogFile) throws Exception;
|
|
||||||
|
|
||||||
public boolean login(String endpoint, String username, String password, String timeout, boolean needCompression,
|
|
||||||
int commitLevel, boolean exceptionForErrors, String errorLogFile) throws Exception;
|
|
||||||
|
|
||||||
public void login(SforceServiceStub stub, SessionHeader sh, int commitLevel, boolean exceptionForErrors, String errorLogFile)
|
|
||||||
throws Exception;
|
|
||||||
|
|
||||||
public void logout() throws Exception;
|
public void logout() throws Exception;
|
||||||
|
|
||||||
public DeleteResult[] delete(String id) throws Exception;
|
public DeleteResult[] delete(String id) throws Exception;
|
||||||
|
|
||||||
public OMElement newOMElement(String name, String value) throws Exception;
|
|
||||||
|
|
||||||
public SaveResult[] insert(String tablename, OMElement[] nameValues) throws Exception;
|
public SaveResult[] insert(String tablename, OMElement[] nameValues) throws Exception;
|
||||||
|
|
||||||
public SaveResult[] update(String tablename, String idStr, OMElement[] updatefields, String[] fieldsToNull) throws Exception;
|
public SaveResult[] update(String tablename, String idStr, OMElement[] updatefields, String[] fieldsToNull) throws Exception;
|
||||||
@@ -94,4 +60,10 @@ public interface SforceManagement {
|
|||||||
public SObject[] retrieve(ID[] ids, String objectType, String fieldsList) throws Exception;
|
public SObject[] retrieve(ID[] ids, String objectType, String fieldsList) throws Exception;
|
||||||
|
|
||||||
public ID[] getUpdated(String objectType, Calendar startDate, Calendar endDate) throws Exception;
|
public ID[] getUpdated(String objectType, Calendar startDate, Calendar endDate) throws Exception;
|
||||||
|
|
||||||
|
public DescribeSObjectResult describeSObject(String tablename) throws Exception;
|
||||||
|
|
||||||
|
public DescribeSObjectResult[] describeSObjects(String[] tablenames) throws Exception;
|
||||||
|
|
||||||
|
public DescribeGlobalResult describeGlobal() throws Exception;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,18 +17,17 @@ import java.util.Calendar;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.axiom.om.OMAbstractFactory;
|
|
||||||
import org.apache.axiom.om.OMElement;
|
import org.apache.axiom.om.OMElement;
|
||||||
import org.apache.axiom.om.OMFactory;
|
|
||||||
import org.apache.axis2.client.Options;
|
|
||||||
import org.apache.axis2.transport.http.HTTPConstants;
|
|
||||||
import org.apache.axis2.transport.http.HttpTransportProperties.ProxyProperties;
|
|
||||||
|
|
||||||
import com.salesforce.soap.partner.CallOptions;
|
|
||||||
import com.salesforce.soap.partner.Create;
|
import com.salesforce.soap.partner.Create;
|
||||||
import com.salesforce.soap.partner.Delete;
|
import com.salesforce.soap.partner.Delete;
|
||||||
import com.salesforce.soap.partner.DeleteResponse;
|
import com.salesforce.soap.partner.DeleteResponse;
|
||||||
import com.salesforce.soap.partner.DeleteResult;
|
import com.salesforce.soap.partner.DeleteResult;
|
||||||
|
import com.salesforce.soap.partner.DescribeGlobal;
|
||||||
|
import com.salesforce.soap.partner.DescribeGlobalResult;
|
||||||
|
import com.salesforce.soap.partner.DescribeSObject;
|
||||||
|
import com.salesforce.soap.partner.DescribeSObjectResult;
|
||||||
|
import com.salesforce.soap.partner.DescribeSObjects;
|
||||||
import com.salesforce.soap.partner.Error;
|
import com.salesforce.soap.partner.Error;
|
||||||
import com.salesforce.soap.partner.GetDeleted;
|
import com.salesforce.soap.partner.GetDeleted;
|
||||||
import com.salesforce.soap.partner.GetDeletedResult;
|
import com.salesforce.soap.partner.GetDeletedResult;
|
||||||
@@ -36,8 +35,6 @@ import com.salesforce.soap.partner.GetServerTimestamp;
|
|||||||
import com.salesforce.soap.partner.GetUpdated;
|
import com.salesforce.soap.partner.GetUpdated;
|
||||||
import com.salesforce.soap.partner.GetUpdatedResult;
|
import com.salesforce.soap.partner.GetUpdatedResult;
|
||||||
import com.salesforce.soap.partner.ID;
|
import com.salesforce.soap.partner.ID;
|
||||||
import com.salesforce.soap.partner.Login;
|
|
||||||
import com.salesforce.soap.partner.LoginResult;
|
|
||||||
import com.salesforce.soap.partner.Query;
|
import com.salesforce.soap.partner.Query;
|
||||||
import com.salesforce.soap.partner.QueryAll;
|
import com.salesforce.soap.partner.QueryAll;
|
||||||
import com.salesforce.soap.partner.QueryLocator;
|
import com.salesforce.soap.partner.QueryLocator;
|
||||||
@@ -46,8 +43,6 @@ import com.salesforce.soap.partner.QueryOptions;
|
|||||||
import com.salesforce.soap.partner.QueryResult;
|
import com.salesforce.soap.partner.QueryResult;
|
||||||
import com.salesforce.soap.partner.Retrieve;
|
import com.salesforce.soap.partner.Retrieve;
|
||||||
import com.salesforce.soap.partner.SaveResult;
|
import com.salesforce.soap.partner.SaveResult;
|
||||||
import com.salesforce.soap.partner.SessionHeader;
|
|
||||||
import com.salesforce.soap.partner.SforceServiceStub;
|
|
||||||
import com.salesforce.soap.partner.Update;
|
import com.salesforce.soap.partner.Update;
|
||||||
import com.salesforce.soap.partner.Upsert;
|
import com.salesforce.soap.partner.Upsert;
|
||||||
import com.salesforce.soap.partner.UpsertResult;
|
import com.salesforce.soap.partner.UpsertResult;
|
||||||
@@ -58,114 +53,26 @@ import com.salesforce.soap.partner.sobject.SObject;
|
|||||||
*/
|
*/
|
||||||
public class SforceManagementImpl implements SforceManagement {
|
public class SforceManagementImpl implements SforceManagement {
|
||||||
|
|
||||||
private SforceServiceStub stub;
|
private SforceConnection sforceConn;
|
||||||
|
|
||||||
private SessionHeader sh;
|
private boolean exceptionForErrors = false;
|
||||||
|
|
||||||
private CallOptions co;
|
private java.io.BufferedWriter logWriter = null;
|
||||||
|
|
||||||
@Override
|
private int commitLevel = 1;
|
||||||
public SforceServiceStub getStub() {
|
|
||||||
return stub;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
private ArrayList<ID> deleteItems;
|
||||||
public SessionHeader getSessionHeader() {
|
|
||||||
return sh;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
private ArrayList<SObject> insertItems;
|
||||||
public CallOptions getCallOptions() {
|
|
||||||
return co;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
private ArrayList<SObject> upsertItems;
|
||||||
public void setCallOptions(CallOptions co) {
|
|
||||||
this.co = co;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
private ArrayList<SObject> updateItems;
|
||||||
public void setClientID(String clientID) {
|
|
||||||
if (co == null) {
|
|
||||||
co = new CallOptions();
|
|
||||||
}
|
|
||||||
co.setClient(clientID);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void needCompression(Options options) {
|
private String upsertKeyColumn;
|
||||||
options.setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.TRUE);
|
|
||||||
options.setProperty(HTTPConstants.MC_GZIP_REQUEST, Boolean.TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setTimeout(Options options, int timeout) {
|
|
||||||
options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, timeout);
|
|
||||||
options.setProperty(HTTPConstants.SO_TIMEOUT, timeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setHttpProxy(Options options) {
|
|
||||||
String httpsHost = System.getProperty("https.proxyHost");
|
|
||||||
String httpsPort = System.getProperty("https.proxyPort");
|
|
||||||
String httpsUser = System.getProperty("https.proxyUser");
|
|
||||||
String httpsPwd = System.getProperty("https.proxyPassword");
|
|
||||||
if (httpsHost != null) {
|
|
||||||
ProxyProperties proxyProperties = new ProxyProperties();
|
|
||||||
proxyProperties.setProxyName(httpsHost);
|
|
||||||
if (httpsPort != null) {
|
|
||||||
proxyProperties.setProxyPort(Integer.parseInt(httpsPort));
|
|
||||||
}
|
|
||||||
if (httpsUser != null && !"".equals(httpsUser)) {
|
|
||||||
proxyProperties.setUserName(httpsUser);
|
|
||||||
}
|
|
||||||
if (httpsPwd != null && !"".equals(httpsPwd)) {
|
|
||||||
proxyProperties.setPassWord(httpsPwd);
|
|
||||||
}
|
|
||||||
options.setProperty(HTTPConstants.PROXY, proxyProperties);
|
|
||||||
} else {
|
|
||||||
String host = System.getProperty("http.proxyHost");
|
|
||||||
String port = System.getProperty("http.proxyPort");
|
|
||||||
String user = System.getProperty("http.proxyUser");
|
|
||||||
String pwd = System.getProperty("http.proxyPassword");
|
|
||||||
if (host != null) {
|
|
||||||
ProxyProperties proxyProperties = new ProxyProperties();
|
|
||||||
proxyProperties.setProxyName(host);
|
|
||||||
if (port != null) {
|
|
||||||
proxyProperties.setProxyPort(Integer.parseInt(port));
|
|
||||||
}
|
|
||||||
if (user != null && !"".equals(user)) {
|
|
||||||
proxyProperties.setUserName(user);
|
|
||||||
}
|
|
||||||
if (pwd != null && !"".equals(pwd)) {
|
|
||||||
proxyProperties.setPassWord(pwd);
|
|
||||||
}
|
|
||||||
options.setProperty(HTTPConstants.PROXY, proxyProperties);
|
|
||||||
} else {
|
|
||||||
String socksHost = System.getProperty("socksProxyHost");
|
|
||||||
String socksPort = System.getProperty("socksProxyPort");
|
|
||||||
String socksUser = System.getProperty("java.net.socks.username");
|
|
||||||
String socksPwd = System.getProperty("java.net.socks.password");
|
|
||||||
if (socksHost != null) {
|
|
||||||
ProxyProperties proxyProperties = new ProxyProperties();
|
|
||||||
proxyProperties.setProxyName(socksHost);
|
|
||||||
if (socksPort != null) {
|
|
||||||
proxyProperties.setProxyPort(Integer.parseInt(socksPort));
|
|
||||||
}
|
|
||||||
if (socksUser != null && !"".equals(socksUser)) {
|
|
||||||
proxyProperties.setUserName(socksUser);
|
|
||||||
}
|
|
||||||
if (socksPwd != null && !"".equals(socksPwd)) {
|
|
||||||
proxyProperties.setPassWord(socksPwd);
|
|
||||||
}
|
|
||||||
options.setProperty(HTTPConstants.PROXY, proxyProperties);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// options.setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_PROTOCOL_VERSION,
|
|
||||||
// HTTPConstants.HEADER_PROTOCOL_10);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _init() {
|
private void _init() {
|
||||||
this.commitLevel = 1;
|
this.commitLevel = 1;
|
||||||
|
|
||||||
this.deleteItems = new ArrayList<ID>(commitLevel * 2);
|
this.deleteItems = new ArrayList<ID>(commitLevel * 2);
|
||||||
this.insertItems = new ArrayList<SObject>(commitLevel * 2);
|
this.insertItems = new ArrayList<SObject>(commitLevel * 2);
|
||||||
this.updateItems = new ArrayList<SObject>(commitLevel * 2);
|
this.updateItems = new ArrayList<SObject>(commitLevel * 2);
|
||||||
@@ -174,7 +81,9 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void _init(int commitLevel, boolean exceptionForErrors, String errorLogFile) throws Exception {
|
private void _init(int commitLevel, boolean exceptionForErrors, String errorLogFile) throws Exception {
|
||||||
if (commitLevel < 0) {
|
_init();
|
||||||
|
|
||||||
|
if (commitLevel <= 0) {
|
||||||
commitLevel = 1;
|
commitLevel = 1;
|
||||||
} else if (commitLevel > 200) {
|
} else if (commitLevel > 200) {
|
||||||
commitLevel = 200;
|
commitLevel = 200;
|
||||||
@@ -185,146 +94,17 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
if (errorLogFile != null && errorLogFile.trim().length() > 0) {
|
if (errorLogFile != null && errorLogFile.trim().length() > 0) {
|
||||||
logWriter = new java.io.BufferedWriter(new java.io.FileWriter(errorLogFile));
|
logWriter = new java.io.BufferedWriter(new java.io.FileWriter(errorLogFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.deleteItems = new ArrayList<ID>(commitLevel * 2);
|
|
||||||
this.insertItems = new ArrayList<SObject>(commitLevel * 2);
|
|
||||||
this.updateItems = new ArrayList<SObject>(commitLevel * 2);
|
|
||||||
this.upsertItems = new ArrayList<SObject>(commitLevel * 2);
|
|
||||||
this.upsertKeyColumn = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean _login(String endpoint, String username, String password, int timeout, boolean needCompression)
|
public SforceManagementImpl(SforceConnection sforceConn) {
|
||||||
throws Exception {
|
|
||||||
if (endpoint == null || endpoint.trim().length() == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (username == null || username.trim().length() == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (password == null || password.trim().length() == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
stub = new SforceServiceStub(endpoint);
|
|
||||||
Options options = stub._getServiceClient().getOptions();
|
|
||||||
|
|
||||||
if (needCompression) {
|
|
||||||
needCompression(options);
|
|
||||||
}
|
|
||||||
setTimeout(options, timeout);
|
|
||||||
setHttpProxy(options);
|
|
||||||
|
|
||||||
Login login = new Login();
|
|
||||||
login.setUsername(username);
|
|
||||||
login.setPassword(password);
|
|
||||||
|
|
||||||
LoginResult loginResult = stub.login(login, null, co).getResult();
|
|
||||||
return _login(loginResult.getSessionId(), loginResult.getServerUrl(), timeout, needCompression);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _login(SforceServiceStub stub, SessionHeader sh) throws Exception {
|
|
||||||
if (stub == null) {
|
|
||||||
throw new RuntimeException("SforceServiceStub is null! Connection is unavailable!");
|
|
||||||
}
|
|
||||||
if (sh == null) {
|
|
||||||
throw new RuntimeException("SessionHeader is null! Connection is unavailable!");
|
|
||||||
}
|
|
||||||
this.stub = stub;
|
|
||||||
this.sh = sh;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean _login(String sessionID, String endpoint, int timeout, boolean needCompression) throws Exception {
|
|
||||||
|
|
||||||
if (sessionID == null || sessionID.trim().length() == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (endpoint == null || endpoint.trim().length() == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
sh = new SessionHeader();
|
|
||||||
sh.setSessionId(sessionID);
|
|
||||||
stub = new SforceServiceStub(endpoint);
|
|
||||||
Options options = stub._getServiceClient().getOptions();
|
|
||||||
options = stub._getServiceClient().getOptions();
|
|
||||||
|
|
||||||
if (needCompression) {
|
|
||||||
needCompression(options);
|
|
||||||
}
|
|
||||||
setTimeout(options, timeout);
|
|
||||||
setHttpProxy(options);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean login(String sessionID, String endpoint, int timeout, boolean needCompression) throws Exception {
|
|
||||||
_init();
|
_init();
|
||||||
return _login(sessionID, endpoint, timeout, needCompression);
|
this.sforceConn = sforceConn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public SforceManagementImpl(SforceConnection sforceConn, int commitLevel, boolean exceptionForErrors, String errorLogFile)
|
||||||
public boolean login(String endpoint, String username, String password, String timeout, boolean needCompression)
|
|
||||||
throws Exception {
|
|
||||||
return login(endpoint, username, password, Integer.parseInt(timeout), needCompression);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean login(String endpoint, String username, String password, int timeout, boolean needCompression)
|
|
||||||
throws Exception {
|
|
||||||
_init();
|
|
||||||
return _login(endpoint, username, password, timeout, needCompression);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void login(SforceServiceStub stub, SessionHeader sh) throws Exception {
|
|
||||||
_init();
|
|
||||||
_login(stub, sh);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean exceptionForErrors = false;
|
|
||||||
|
|
||||||
private java.io.BufferedWriter logWriter = null;
|
|
||||||
|
|
||||||
private int commitLevel = 0;
|
|
||||||
|
|
||||||
private ArrayList<ID> deleteItems;
|
|
||||||
|
|
||||||
private ArrayList<SObject> insertItems;
|
|
||||||
|
|
||||||
private ArrayList<SObject> upsertItems;
|
|
||||||
|
|
||||||
private ArrayList<SObject> updateItems;
|
|
||||||
|
|
||||||
private String[] changedItemKeys = new String[0];
|
|
||||||
|
|
||||||
private String upsertKeyColumn;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean login(String sessionID, String endpoint, int timeout, boolean needCompression, int commitLevel,
|
|
||||||
boolean exceptionForErrors, String errorLogFile) throws Exception {
|
|
||||||
_init(commitLevel, exceptionForErrors, errorLogFile);
|
|
||||||
return _login(sessionID, endpoint, timeout, needCompression);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean login(String endpoint, String username, String password, String timeout, boolean needCompression,
|
|
||||||
int commitLevel, boolean exceptionForErrors, String errorLogFile) throws Exception {
|
|
||||||
return login(endpoint, username, password, Integer.parseInt(timeout), needCompression, commitLevel, exceptionForErrors,
|
|
||||||
errorLogFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean login(String endpoint, String username, String password, int timeout, boolean needCompression,
|
|
||||||
int commitLevel, boolean exceptionForErrors, String errorLogFile) throws Exception {
|
|
||||||
_init(commitLevel, exceptionForErrors, errorLogFile);
|
|
||||||
return _login(endpoint, username, password, timeout, needCompression);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void login(SforceServiceStub stub, SessionHeader sh, int commitLevel, boolean exceptionForErrors, String errorLogFile)
|
|
||||||
throws Exception {
|
throws Exception {
|
||||||
_init(commitLevel, exceptionForErrors, errorLogFile);
|
_init(commitLevel, exceptionForErrors, errorLogFile);
|
||||||
|
this.sforceConn = sforceConn;
|
||||||
_login(stub, sh);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -337,10 +117,10 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
try {
|
try {
|
||||||
if (insertItems.size() > 0) {
|
if (insertItems.size() > 0) {
|
||||||
SObject[] accs = insertItems.toArray(new SObject[insertItems.size()]);
|
SObject[] accs = insertItems.toArray(new SObject[insertItems.size()]);
|
||||||
changedItemKeys = new String[accs.length];
|
String[] changedItemKeys = new String[accs.length];
|
||||||
Create create = new Create();
|
Create create = new Create();
|
||||||
create.setSObjects(accs);
|
create.setSObjects(accs);
|
||||||
SaveResult[] sr = stub.create(create, sh, co, null, null, null, null, null, null, null, null, null).getResult();
|
SaveResult[] sr = sforceConn.create(create).getResult();
|
||||||
insertItems.clear();
|
insertItems.clear();
|
||||||
accs = null;
|
accs = null;
|
||||||
|
|
||||||
@@ -368,13 +148,13 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
}
|
}
|
||||||
if (deleteItems.size() > 0) {
|
if (deleteItems.size() > 0) {
|
||||||
ID[] delIDs = deleteItems.toArray(new ID[deleteItems.size()]);
|
ID[] delIDs = deleteItems.toArray(new ID[deleteItems.size()]);
|
||||||
changedItemKeys = new String[delIDs.length];
|
String[] changedItemKeys = new String[delIDs.length];
|
||||||
for (int ix = 0; ix < delIDs.length; ++ix) {
|
for (int ix = 0; ix < delIDs.length; ++ix) {
|
||||||
changedItemKeys[ix] = delIDs[ix].getID();
|
changedItemKeys[ix] = delIDs[ix].getID();
|
||||||
}
|
}
|
||||||
Delete dels = new Delete();
|
Delete dels = new Delete();
|
||||||
dels.setIds(delIDs);
|
dels.setIds(delIDs);
|
||||||
DeleteResponse dresp = stub.delete(dels, sh, co, null, null, null, null, null, null, null, null);
|
DeleteResponse dresp = sforceConn.delete(dels);
|
||||||
DeleteResult[] dr = dresp.getResult();
|
DeleteResult[] dr = dresp.getResult();
|
||||||
deleteItems.clear();
|
deleteItems.clear();
|
||||||
delIDs = null;
|
delIDs = null;
|
||||||
@@ -403,14 +183,13 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
}
|
}
|
||||||
if (updateItems.size() > 0) {
|
if (updateItems.size() > 0) {
|
||||||
SObject[] upds = updateItems.toArray(new SObject[updateItems.size()]);
|
SObject[] upds = updateItems.toArray(new SObject[updateItems.size()]);
|
||||||
changedItemKeys = new String[upds.length];
|
String[] changedItemKeys = new String[upds.length];
|
||||||
for (int ix = 0; ix < upds.length; ++ix) {
|
for (int ix = 0; ix < upds.length; ++ix) {
|
||||||
changedItemKeys[ix] = upds[ix].getId().getID();
|
changedItemKeys[ix] = upds[ix].getId().getID();
|
||||||
}
|
}
|
||||||
Update update = new Update();
|
Update update = new Update();
|
||||||
update.setSObjects(upds);
|
update.setSObjects(upds);
|
||||||
SaveResult[] saveResults = stub.update(update, sh, co, null, null, null, null, null, null, null, null, null)
|
SaveResult[] saveResults = sforceConn.update(update).getResult();
|
||||||
.getResult();
|
|
||||||
updateItems.clear();
|
updateItems.clear();
|
||||||
upds = null;
|
upds = null;
|
||||||
|
|
||||||
@@ -438,13 +217,13 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
}
|
}
|
||||||
if (upsertItems.size() > 0) {
|
if (upsertItems.size() > 0) {
|
||||||
SObject[] upds = upsertItems.toArray(new SObject[upsertItems.size()]);
|
SObject[] upds = upsertItems.toArray(new SObject[upsertItems.size()]);
|
||||||
changedItemKeys = new String[upds.length];
|
String[] changedItemKeys = new String[upds.length];
|
||||||
for (int ix = 0; ix < upds.length; ++ix) {
|
for (int ix = 0; ix < upds.length; ++ix) {
|
||||||
changedItemKeys[ix] = "No value for " + upsertKeyColumn + " ";
|
changedItemKeys[ix] = "No value for " + upsertKeyColumn + " ";
|
||||||
OMElement[] oms = upds[ix].getExtraElement();
|
OMElement[] oms = upds[ix].getExtraElement();
|
||||||
for (int iy = 0; iy < oms.length; ++iy) {
|
for (OMElement om : oms) {
|
||||||
if (upsertKeyColumn != null && oms[iy] != null && upsertKeyColumn.equals(oms[iy].getLocalName())) {
|
if (upsertKeyColumn != null && om != null && upsertKeyColumn.equals(om.getLocalName())) {
|
||||||
changedItemKeys[ix] = oms[iy].getText();
|
changedItemKeys[ix] = om.getText();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -452,8 +231,7 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
Upsert upsert = new Upsert();
|
Upsert upsert = new Upsert();
|
||||||
upsert.setSObjects(upds);
|
upsert.setSObjects(upds);
|
||||||
upsert.setExternalIDFieldName(upsertKeyColumn);
|
upsert.setExternalIDFieldName(upsertKeyColumn);
|
||||||
UpsertResult[] upsertResults = stub.upsert(upsert, sh, co, null, null, null, null, null, null, null, null, null)
|
UpsertResult[] upsertResults = sforceConn.upsert(upsert).getResult();
|
||||||
.getResult();
|
|
||||||
upsertItems.clear();
|
upsertItems.clear();
|
||||||
upds = null;
|
upds = null;
|
||||||
|
|
||||||
@@ -503,13 +281,13 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
|
|
||||||
if (deleteItems.size() >= commitLevel) {
|
if (deleteItems.size() >= commitLevel) {
|
||||||
ID[] delIDs = deleteItems.toArray(new ID[deleteItems.size()]);
|
ID[] delIDs = deleteItems.toArray(new ID[deleteItems.size()]);
|
||||||
changedItemKeys = new String[delIDs.length];
|
String[] changedItemKeys = new String[delIDs.length];
|
||||||
for (int ix = 0; ix < delIDs.length; ++ix) {
|
for (int ix = 0; ix < delIDs.length; ++ix) {
|
||||||
changedItemKeys[ix] = delIDs[ix].getID();
|
changedItemKeys[ix] = delIDs[ix].getID();
|
||||||
}
|
}
|
||||||
Delete dels = new Delete();
|
Delete dels = new Delete();
|
||||||
dels.setIds(delIDs);
|
dels.setIds(delIDs);
|
||||||
DeleteResponse dresp = stub.delete(dels, sh, co, null, null, null, null, null, null, null, null);
|
DeleteResponse dresp = sforceConn.delete(dels);
|
||||||
DeleteResult[] dr = dresp.getResult();
|
DeleteResult[] dr = dresp.getResult();
|
||||||
deleteItems.clear();
|
deleteItems.clear();
|
||||||
delIDs = null;
|
delIDs = null;
|
||||||
@@ -539,14 +317,6 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public OMElement newOMElement(String name, String value) throws Exception {
|
|
||||||
OMFactory fac = OMAbstractFactory.getOMFactory();
|
|
||||||
OMElement ome = fac.createOMElement(name, null);
|
|
||||||
ome.addChild(fac.createOMText(ome, value));
|
|
||||||
return ome;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create, one time one record.
|
* create, one time one record.
|
||||||
*/
|
*/
|
||||||
@@ -568,10 +338,10 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
|
|
||||||
if (insertItems.size() >= commitLevel) {
|
if (insertItems.size() >= commitLevel) {
|
||||||
SObject[] accs = insertItems.toArray(new SObject[insertItems.size()]);
|
SObject[] accs = insertItems.toArray(new SObject[insertItems.size()]);
|
||||||
changedItemKeys = new String[accs.length];
|
String[] changedItemKeys = new String[accs.length];
|
||||||
Create create = new Create();
|
Create create = new Create();
|
||||||
create.setSObjects(accs);
|
create.setSObjects(accs);
|
||||||
SaveResult[] sr = stub.create(create, sh, co, null, null, null, null, null, null, null, null, null).getResult();
|
SaveResult[] sr = sforceConn.create(create).getResult();
|
||||||
insertItems.clear();
|
insertItems.clear();
|
||||||
accs = null;
|
accs = null;
|
||||||
|
|
||||||
@@ -618,14 +388,13 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
// call the update passing an array of object
|
// call the update passing an array of object
|
||||||
if (updateItems.size() >= commitLevel) {
|
if (updateItems.size() >= commitLevel) {
|
||||||
SObject[] upds = updateItems.toArray(new SObject[updateItems.size()]);
|
SObject[] upds = updateItems.toArray(new SObject[updateItems.size()]);
|
||||||
changedItemKeys = new String[upds.length];
|
String[] changedItemKeys = new String[upds.length];
|
||||||
for (int ix = 0; ix < upds.length; ++ix) {
|
for (int ix = 0; ix < upds.length; ++ix) {
|
||||||
changedItemKeys[ix] = upds[ix].getId().getID();
|
changedItemKeys[ix] = upds[ix].getId().getID();
|
||||||
}
|
}
|
||||||
Update update = new Update();
|
Update update = new Update();
|
||||||
update.setSObjects(upds);
|
update.setSObjects(upds);
|
||||||
SaveResult[] saveResults = stub.update(update, sh, co, null, null, null, null, null, null, null, null, null)
|
SaveResult[] saveResults = sforceConn.update(update).getResult();
|
||||||
.getResult();
|
|
||||||
updateItems.clear();
|
updateItems.clear();
|
||||||
upds = null;
|
upds = null;
|
||||||
|
|
||||||
@@ -676,13 +445,13 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
// call the update passing an array of object
|
// call the update passing an array of object
|
||||||
if (upsertItems.size() >= commitLevel) {
|
if (upsertItems.size() >= commitLevel) {
|
||||||
SObject[] upds = upsertItems.toArray(new SObject[upsertItems.size()]);
|
SObject[] upds = upsertItems.toArray(new SObject[upsertItems.size()]);
|
||||||
changedItemKeys = new String[upds.length];
|
String[] changedItemKeys = new String[upds.length];
|
||||||
for (int ix = 0; ix < upds.length; ++ix) {
|
for (int ix = 0; ix < upds.length; ++ix) {
|
||||||
changedItemKeys[ix] = "No value for " + upsertKeyColumn + " ";
|
changedItemKeys[ix] = "No value for " + upsertKeyColumn + " ";
|
||||||
OMElement[] oms = upds[ix].getExtraElement();
|
OMElement[] oms = upds[ix].getExtraElement();
|
||||||
for (int iy = 0; iy < oms.length; ++iy) {
|
for (OMElement om : oms) {
|
||||||
if (upsertKeyColumn != null && oms[iy] != null && upsertKeyColumn.equals(oms[iy].getLocalName())) {
|
if (upsertKeyColumn != null && om != null && upsertKeyColumn.equals(om.getLocalName())) {
|
||||||
changedItemKeys[ix] = oms[iy].getText();
|
changedItemKeys[ix] = om.getText();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -690,8 +459,7 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
Upsert upsert = new Upsert();
|
Upsert upsert = new Upsert();
|
||||||
upsert.setSObjects(upds);
|
upsert.setSObjects(upds);
|
||||||
upsert.setExternalIDFieldName(upsertKeyColumn);
|
upsert.setExternalIDFieldName(upsertKeyColumn);
|
||||||
UpsertResult[] upsertResults = stub.upsert(upsert, sh, co, null, null, null, null, null, null, null, null, null)
|
UpsertResult[] upsertResults = sforceConn.upsert(upsert).getResult();
|
||||||
.getResult();
|
|
||||||
upsertItems.clear();
|
upsertItems.clear();
|
||||||
upds = null;
|
upds = null;
|
||||||
|
|
||||||
@@ -845,7 +613,7 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Calendar getServerTimestamp() throws Exception {
|
public Calendar getServerTimestamp() throws Exception {
|
||||||
return stub.getServerTimestamp(new GetServerTimestamp(), sh, co).getResult().getTimestamp();
|
return sforceConn.getServerTimestamp(new GetServerTimestamp()).getResult().getTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -854,7 +622,7 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
getUpdated.setSObjectType(objectType);
|
getUpdated.setSObjectType(objectType);
|
||||||
getUpdated.setStartDate(startDate);
|
getUpdated.setStartDate(startDate);
|
||||||
getUpdated.setEndDate(endDate);
|
getUpdated.setEndDate(endDate);
|
||||||
GetUpdatedResult result = stub.getUpdated(getUpdated, sh, co).getResult();
|
GetUpdatedResult result = sforceConn.getUpdated(getUpdated).getResult();
|
||||||
ID[] ids = result.getIds();
|
ID[] ids = result.getIds();
|
||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
@@ -865,7 +633,7 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
retrieve.setFieldList(fieldsList);
|
retrieve.setFieldList(fieldsList);
|
||||||
retrieve.setIds(ids);
|
retrieve.setIds(ids);
|
||||||
retrieve.setSObjectType(objectType);
|
retrieve.setSObjectType(objectType);
|
||||||
SObject[] results = stub.retrieve(retrieve, sh, co, null, null, null).getResult();
|
SObject[] results = sforceConn.retrieve(retrieve).getResult();
|
||||||
// for (SObject sob : results) {
|
// for (SObject sob : results) {
|
||||||
// OMElement[] omes = sob.getExtraElement();
|
// OMElement[] omes = sob.getExtraElement();
|
||||||
// for (int i = 0; i < omes.length; i++) {
|
// for (int i = 0; i < omes.length; i++) {
|
||||||
@@ -882,7 +650,7 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
getDeleted.setSObjectType(objectType);
|
getDeleted.setSObjectType(objectType);
|
||||||
getDeleted.setStartDate(startDate);
|
getDeleted.setStartDate(startDate);
|
||||||
getDeleted.setEndDate(endDate);
|
getDeleted.setEndDate(endDate);
|
||||||
GetDeletedResult result = stub.getDeleted(getDeleted, sh, co).getResult();
|
GetDeletedResult result = sforceConn.getDeleted(getDeleted).getResult();
|
||||||
// DeletedRecord[] deletedRecords = result.getDeletedRecords();
|
// DeletedRecord[] deletedRecords = result.getDeletedRecords();
|
||||||
// List<String> ids = new ArrayList<String>();
|
// List<String> ids = new ArrayList<String>();
|
||||||
// for (DeletedRecord deletedRecord : deletedRecords) {
|
// for (DeletedRecord deletedRecord : deletedRecords) {
|
||||||
@@ -897,7 +665,7 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
queryAll.setQueryString(soql);
|
queryAll.setQueryString(soql);
|
||||||
QueryOptions queryOptions = new QueryOptions();
|
QueryOptions queryOptions = new QueryOptions();
|
||||||
queryOptions.setBatchSize(batchSize);
|
queryOptions.setBatchSize(batchSize);
|
||||||
QueryResult qr = stub.queryAll(queryAll, sh, co, queryOptions).getResult();
|
QueryResult qr = sforceConn.queryAll(queryAll, queryOptions).getResult();
|
||||||
return qr;
|
return qr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -907,7 +675,7 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
queryOptions.setBatchSize(batchSize);
|
queryOptions.setBatchSize(batchSize);
|
||||||
QueryMore queryMore = new QueryMore();
|
QueryMore queryMore = new QueryMore();
|
||||||
queryMore.setQueryLocator(queryLocator);
|
queryMore.setQueryLocator(queryLocator);
|
||||||
QueryResult qr = stub.queryMore(queryMore, sh, co, queryOptions).getResult();
|
QueryResult qr = sforceConn.queryMore(queryMore, queryOptions).getResult();
|
||||||
return qr;
|
return qr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -917,8 +685,27 @@ public class SforceManagementImpl implements SforceManagement {
|
|||||||
query.setQueryString(soql);
|
query.setQueryString(soql);
|
||||||
QueryOptions queryOptions = new QueryOptions();
|
QueryOptions queryOptions = new QueryOptions();
|
||||||
queryOptions.setBatchSize(batchSize);
|
queryOptions.setBatchSize(batchSize);
|
||||||
QueryResult qr = stub.query(query, sh, co, queryOptions, null, null).getResult();
|
QueryResult qr = sforceConn.query(query, queryOptions).getResult();
|
||||||
return qr;
|
return qr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DescribeSObjectResult describeSObject(String tableName) throws Exception {
|
||||||
|
DescribeSObject describeSObject = new DescribeSObject();
|
||||||
|
describeSObject.setSObjectType(tableName);
|
||||||
|
return sforceConn.describeSObject(describeSObject).getResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DescribeSObjectResult[] describeSObjects(String[] tablenames) throws Exception {
|
||||||
|
DescribeSObjects describeSObjects = new DescribeSObjects();
|
||||||
|
describeSObjects.setSObjectType(tablenames);
|
||||||
|
return sforceConn.describeSObjects(describeSObjects).getResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DescribeGlobalResult describeGlobal() throws Exception {
|
||||||
|
return sforceConn.describeGlobal(new DescribeGlobal()).getResult();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
// ============================================================================
|
||||||
|
//
|
||||||
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
|
//
|
||||||
|
// This source code is available under agreement available at
|
||||||
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
|
//
|
||||||
|
// You should have received a copy of the agreement
|
||||||
|
// along with this program; if not, write to Talend SA
|
||||||
|
// 9 rue Pages 92150 Suresnes, France
|
||||||
|
//
|
||||||
|
// ============================================================================
|
||||||
|
package org.talend.salesforce;
|
||||||
|
|
||||||
|
import org.apache.axiom.om.OMAbstractFactory;
|
||||||
|
import org.apache.axiom.om.OMElement;
|
||||||
|
import org.apache.axiom.om.OMFactory;
|
||||||
|
import org.apache.axis2.client.Options;
|
||||||
|
import org.apache.axis2.transport.http.HTTPConstants;
|
||||||
|
import org.apache.axis2.transport.http.HttpTransportProperties.ProxyProperties;
|
||||||
|
|
||||||
|
import com.salesforce.soap.partner.SforceServiceStub;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* created by bchen on Jul 8, 2014 Detailled comment
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SforceManagementUtil {
|
||||||
|
|
||||||
|
public static OMElement newOMElement(String name, String value) throws Exception {
|
||||||
|
OMFactory fac = OMAbstractFactory.getOMFactory();
|
||||||
|
OMElement ome = fac.createOMElement(name, null);
|
||||||
|
ome.addChild(fac.createOMText(ome, value));
|
||||||
|
return ome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setEndpoint(SforceServiceStub stub, String endpoint) {
|
||||||
|
stub._getServiceClient().getOptions().setTo(new org.apache.axis2.addressing.EndpointReference(endpoint));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void needCompression(SforceServiceStub stub, boolean needCompression) {
|
||||||
|
if (!needCompression) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Options options = stub._getServiceClient().getOptions();
|
||||||
|
options.setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.TRUE);
|
||||||
|
options.setProperty(HTTPConstants.MC_GZIP_REQUEST, Boolean.TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setTimeout(SforceServiceStub stub, int timeout) {
|
||||||
|
Options options = stub._getServiceClient().getOptions();
|
||||||
|
options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, timeout);
|
||||||
|
options.setProperty(HTTPConstants.SO_TIMEOUT, timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setHttpProxy(SforceServiceStub stub) {
|
||||||
|
Options options = stub._getServiceClient().getOptions();
|
||||||
|
String httpsHost = System.getProperty("https.proxyHost");
|
||||||
|
String httpsPort = System.getProperty("https.proxyPort");
|
||||||
|
String httpsUser = System.getProperty("https.proxyUser");
|
||||||
|
String httpsPwd = System.getProperty("https.proxyPassword");
|
||||||
|
if (httpsHost != null) {
|
||||||
|
ProxyProperties proxyProperties = new ProxyProperties();
|
||||||
|
proxyProperties.setProxyName(httpsHost);
|
||||||
|
if (httpsPort != null) {
|
||||||
|
proxyProperties.setProxyPort(Integer.parseInt(httpsPort));
|
||||||
|
}
|
||||||
|
if (httpsUser != null && !"".equals(httpsUser)) {
|
||||||
|
proxyProperties.setUserName(httpsUser);
|
||||||
|
}
|
||||||
|
if (httpsPwd != null && !"".equals(httpsPwd)) {
|
||||||
|
proxyProperties.setPassWord(httpsPwd);
|
||||||
|
}
|
||||||
|
options.setProperty(HTTPConstants.PROXY, proxyProperties);
|
||||||
|
} else {
|
||||||
|
String host = System.getProperty("http.proxyHost");
|
||||||
|
String port = System.getProperty("http.proxyPort");
|
||||||
|
String user = System.getProperty("http.proxyUser");
|
||||||
|
String pwd = System.getProperty("http.proxyPassword");
|
||||||
|
if (host != null) {
|
||||||
|
ProxyProperties proxyProperties = new ProxyProperties();
|
||||||
|
proxyProperties.setProxyName(host);
|
||||||
|
if (port != null) {
|
||||||
|
proxyProperties.setProxyPort(Integer.parseInt(port));
|
||||||
|
}
|
||||||
|
if (user != null && !"".equals(user)) {
|
||||||
|
proxyProperties.setUserName(user);
|
||||||
|
}
|
||||||
|
if (pwd != null && !"".equals(pwd)) {
|
||||||
|
proxyProperties.setPassWord(pwd);
|
||||||
|
}
|
||||||
|
options.setProperty(HTTPConstants.PROXY, proxyProperties);
|
||||||
|
} else {
|
||||||
|
String socksHost = System.getProperty("socksProxyHost");
|
||||||
|
String socksPort = System.getProperty("socksProxyPort");
|
||||||
|
String socksUser = System.getProperty("java.net.socks.username");
|
||||||
|
String socksPwd = System.getProperty("java.net.socks.password");
|
||||||
|
if (socksHost != null) {
|
||||||
|
ProxyProperties proxyProperties = new ProxyProperties();
|
||||||
|
proxyProperties.setProxyName(socksHost);
|
||||||
|
if (socksPort != null) {
|
||||||
|
proxyProperties.setProxyPort(Integer.parseInt(socksPort));
|
||||||
|
}
|
||||||
|
if (socksUser != null && !"".equals(socksUser)) {
|
||||||
|
proxyProperties.setUserName(socksUser);
|
||||||
|
}
|
||||||
|
if (socksPwd != null && !"".equals(socksPwd)) {
|
||||||
|
proxyProperties.setPassWord(socksPwd);
|
||||||
|
}
|
||||||
|
options.setProperty(HTTPConstants.PROXY, proxyProperties);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// options.setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_PROTOCOL_VERSION,
|
||||||
|
// HTTPConstants.HEADER_PROTOCOL_10);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,198 @@
|
|||||||
|
// ============================================================================
|
||||||
|
//
|
||||||
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
|
//
|
||||||
|
// This source code is available under agreement available at
|
||||||
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
|
//
|
||||||
|
// You should have received a copy of the agreement
|
||||||
|
// along with this program; if not, write to Talend SA
|
||||||
|
// 9 rue Pages 92150 Suresnes, France
|
||||||
|
//
|
||||||
|
// ============================================================================
|
||||||
|
package org.talend.salesforce;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.talend.salesforce.oauth.OAuthClient;
|
||||||
|
import org.talend.salesforce.oauth.Token;
|
||||||
|
|
||||||
|
import com.salesforce.soap.partner.CallOptions;
|
||||||
|
import com.salesforce.soap.partner.SessionHeader;
|
||||||
|
import com.salesforce.soap.partner.SforceServiceStub;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* created by bchen on Jul 10, 2014 Detailled comment
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SforceOAuthConnection extends SforceConnection {
|
||||||
|
|
||||||
|
private static final String REFRESHTOKEN_KEY = "refreshtoken";
|
||||||
|
|
||||||
|
private final String login_endpoint;
|
||||||
|
|
||||||
|
private final String oauth_clientID;
|
||||||
|
|
||||||
|
private final String oauth_clientSecret;
|
||||||
|
|
||||||
|
private String tokenFilePath;
|
||||||
|
|
||||||
|
private final String apiVersion;
|
||||||
|
|
||||||
|
private final String callbackHost;
|
||||||
|
|
||||||
|
private final int callbackPort;
|
||||||
|
|
||||||
|
private boolean needCompression;
|
||||||
|
|
||||||
|
private int timeout;
|
||||||
|
|
||||||
|
private String clientID;
|
||||||
|
|
||||||
|
private SforceOAuthConnection() throws Exception {
|
||||||
|
throw new Exception("should use builder to init"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
private SforceOAuthConnection(Builder builder) throws Exception {
|
||||||
|
this.login_endpoint = builder.login_endpoint;
|
||||||
|
this.oauth_clientID = builder.oauth_clientID;
|
||||||
|
this.oauth_clientSecret = builder.oauth_clientSecret;
|
||||||
|
this.apiVersion = builder.apiVersion;
|
||||||
|
this.tokenFilePath = builder.tokenFilePath;
|
||||||
|
this.callbackHost = builder.callbackHost;
|
||||||
|
this.callbackPort = builder.callbackPort;
|
||||||
|
this.needCompression = builder.needCompression;
|
||||||
|
this.timeout = builder.timeout;
|
||||||
|
this.clientID = builder.clientID;
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Token loginWithOAuth() throws Exception {
|
||||||
|
String session_id = null;
|
||||||
|
|
||||||
|
OAuthClient oauthClient = new OAuthClient();
|
||||||
|
oauthClient.setBaseOAuthURL(login_endpoint);
|
||||||
|
oauthClient.setClientID(oauth_clientID);
|
||||||
|
oauthClient.setClientSecret(oauth_clientSecret);
|
||||||
|
Token token = null;
|
||||||
|
String refreshToken = null;
|
||||||
|
// 1. if tokenFile exist, try refresh token
|
||||||
|
if (tokenFilePath != null) {
|
||||||
|
Properties prop = new Properties();
|
||||||
|
FileInputStream inputStream = new FileInputStream(tokenFilePath);
|
||||||
|
prop.load(inputStream);
|
||||||
|
inputStream.close();
|
||||||
|
String storedRefreshToken = (String) prop.get(REFRESHTOKEN_KEY);
|
||||||
|
if (storedRefreshToken != null) {
|
||||||
|
token = oauthClient.refreshToken(storedRefreshToken);
|
||||||
|
session_id = token.getAccess_token();
|
||||||
|
refreshToken = token.getRefresh_token();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 2. try to auth if session_id can't be retrieved
|
||||||
|
if (session_id == null) {
|
||||||
|
oauthClient.setCallbackHost(callbackHost);
|
||||||
|
oauthClient.setCallbackPort(callbackPort);
|
||||||
|
token = oauthClient.getToken();
|
||||||
|
refreshToken = token.getRefresh_token();
|
||||||
|
}
|
||||||
|
// 3.if refresh token & tokenFile exist, store
|
||||||
|
if (refreshToken != null && tokenFilePath != null) {
|
||||||
|
Properties prop = new Properties();
|
||||||
|
prop.setProperty(REFRESHTOKEN_KEY, refreshToken);
|
||||||
|
FileOutputStream outputStream = new FileOutputStream(tokenFilePath);
|
||||||
|
prop.store(outputStream, null);
|
||||||
|
if (outputStream != null) {
|
||||||
|
outputStream.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() throws Exception {
|
||||||
|
if (clientID != null) {
|
||||||
|
co = new CallOptions();
|
||||||
|
co.setClient(clientID);
|
||||||
|
}
|
||||||
|
stub = new SforceServiceStub();
|
||||||
|
SforceManagementUtil.needCompression(stub, needCompression);
|
||||||
|
SforceManagementUtil.setTimeout(stub, timeout);
|
||||||
|
// SforceManagementUtil.setHttpProxy(stub);//don't support proxy for OAuth
|
||||||
|
sh = new SessionHeader();
|
||||||
|
renewSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void renewSession() throws Exception {
|
||||||
|
Token token = loginWithOAuth();
|
||||||
|
String session_id = token.getAccess_token();
|
||||||
|
String endpoint = OAuthClient.getSOAPEndpoint(token, apiVersion);
|
||||||
|
SforceManagementUtil.setEndpoint(stub, endpoint);
|
||||||
|
sh.setSessionId(session_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
private final String login_endpoint;
|
||||||
|
|
||||||
|
private final String oauth_clientID;
|
||||||
|
|
||||||
|
private final String oauth_clientSecret;
|
||||||
|
|
||||||
|
private final String apiVersion;
|
||||||
|
|
||||||
|
private String tokenFilePath = null;
|
||||||
|
|
||||||
|
private final String callbackHost;
|
||||||
|
|
||||||
|
private final int callbackPort;
|
||||||
|
|
||||||
|
private boolean needCompression = false;
|
||||||
|
|
||||||
|
private int timeout = 60000;
|
||||||
|
|
||||||
|
private String clientID = null;
|
||||||
|
|
||||||
|
public Builder(String login_endpoint, String oauth_clientID, String oauth_clientSecret, String apiVersion,
|
||||||
|
String callbackHost, int callbackPort) {
|
||||||
|
this.login_endpoint = login_endpoint;
|
||||||
|
this.oauth_clientID = oauth_clientID;
|
||||||
|
this.oauth_clientSecret = oauth_clientSecret;
|
||||||
|
this.apiVersion = apiVersion;
|
||||||
|
this.callbackHost = callbackHost;
|
||||||
|
this.callbackPort = callbackPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setTokenFilePath(String tokenFilePath) {
|
||||||
|
this.tokenFilePath = tokenFilePath;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder needCompression(boolean needCompression) {
|
||||||
|
this.needCompression = needCompression;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setTimeout(int timeout) {
|
||||||
|
this.timeout = timeout;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setTimeout(String timeout) {
|
||||||
|
this.timeout = Integer.valueOf(timeout);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setClientID(String clientID) {
|
||||||
|
this.clientID = clientID;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SforceOAuthConnection build() throws Exception {
|
||||||
|
return new SforceOAuthConnection(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
// ============================================================================
|
||||||
|
//
|
||||||
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
|
//
|
||||||
|
// This source code is available under agreement available at
|
||||||
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
|
//
|
||||||
|
// You should have received a copy of the agreement
|
||||||
|
// along with this program; if not, write to Talend SA
|
||||||
|
// 9 rue Pages 92150 Suresnes, France
|
||||||
|
//
|
||||||
|
// ============================================================================
|
||||||
|
package org.talend.salesforce;
|
||||||
|
|
||||||
|
import com.salesforce.soap.partner.CallOptions;
|
||||||
|
import com.salesforce.soap.partner.SessionHeader;
|
||||||
|
import com.salesforce.soap.partner.SforceServiceStub;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* created by bchen on Jul 9, 2014 Detailled comment
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SforceSessionConnection extends SforceConnection {
|
||||||
|
|
||||||
|
private final String endpoint;
|
||||||
|
|
||||||
|
private final String session_id;
|
||||||
|
|
||||||
|
private boolean needCompression;
|
||||||
|
|
||||||
|
private int timeout;
|
||||||
|
|
||||||
|
private String clientID;
|
||||||
|
|
||||||
|
private SforceSessionConnection() throws Exception {
|
||||||
|
throw new Exception("should use builder to init"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
private SforceSessionConnection(Builder builder) throws Exception {
|
||||||
|
this.endpoint = builder.endpoint;
|
||||||
|
this.session_id = builder.session_id;
|
||||||
|
check();
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void check() throws Exception {
|
||||||
|
if (endpoint == null || endpoint.trim().length() == 0 || session_id == null || session_id.trim().length() == 0) {
|
||||||
|
throw new RuntimeException("Login failed!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() throws Exception {
|
||||||
|
if (clientID != null) {
|
||||||
|
co = new CallOptions();
|
||||||
|
co.setClient(clientID);
|
||||||
|
}
|
||||||
|
stub = new SforceServiceStub();
|
||||||
|
SforceManagementUtil.needCompression(stub, needCompression);
|
||||||
|
SforceManagementUtil.setTimeout(stub, timeout);
|
||||||
|
// SforceManagementUtil.setHttpProxy(stub);//don't support proxy for OAuth
|
||||||
|
sh = new SessionHeader();
|
||||||
|
// renewSession();
|
||||||
|
SforceManagementUtil.setEndpoint(stub, endpoint);
|
||||||
|
sh.setSessionId(session_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void renewSession() throws Exception {
|
||||||
|
throw new Exception("Session expire, need to renew session");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
private final String endpoint;
|
||||||
|
|
||||||
|
private final String session_id;
|
||||||
|
|
||||||
|
private boolean needCompression = false;
|
||||||
|
|
||||||
|
private int timeout = 60000;
|
||||||
|
|
||||||
|
private String clientID = null;
|
||||||
|
|
||||||
|
public Builder(String endpoint, String session_id) {
|
||||||
|
this.endpoint = endpoint;
|
||||||
|
this.session_id = session_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder needCompression(boolean needCompression) {
|
||||||
|
this.needCompression = needCompression;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setTimeout(int timeout) {
|
||||||
|
this.timeout = timeout;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setTimeout(String timeout) {
|
||||||
|
this.timeout = Integer.valueOf(timeout);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setClientID(String clientID) {
|
||||||
|
this.clientID = clientID;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SforceSessionConnection build() throws Exception {
|
||||||
|
return new SforceSessionConnection(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -49,14 +49,14 @@ public class OAuthClient {
|
|||||||
private int callbackPort;
|
private int callbackPort;
|
||||||
|
|
||||||
private String baseOAuthURL;
|
private String baseOAuthURL;
|
||||||
|
|
||||||
private HttpsService service;
|
private HttpsService service;
|
||||||
|
|
||||||
public String getBulkEndpoint(Token token, String version) {
|
public static String getBulkEndpoint(Token token, String version) {
|
||||||
return token.getInstance_url() + "/services/async/" + version;
|
return token.getInstance_url() + "/services/async/" + version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSOAPEndpoint(Token token, String version) throws MalformedURLException, IOException ,ParseException{
|
public static String getSOAPEndpoint(Token token, String version) throws MalformedURLException, IOException, ParseException {
|
||||||
URLConnection idConn = new URL(token.getId()).openConnection();
|
URLConnection idConn = new URL(token.getId()).openConnection();
|
||||||
idConn.setRequestProperty("Authorization", "Bearer " + token.getAccess_token());
|
idConn.setRequestProperty("Authorization", "Bearer " + token.getAccess_token());
|
||||||
String endpointURL = null;
|
String endpointURL = null;
|
||||||
@@ -67,7 +67,7 @@ public class OAuthClient {
|
|||||||
JSONObject json = (JSONObject) jsonParser.parse(reader);
|
JSONObject json = (JSONObject) jsonParser.parse(reader);
|
||||||
JSONObject urls = (JSONObject) json.get("urls");
|
JSONObject urls = (JSONObject) json.get("urls");
|
||||||
endpointURL = urls.get("partner").toString().replace("{version}", version);
|
endpointURL = urls.get("partner").toString().replace("{version}", version);
|
||||||
}finally {
|
} finally {
|
||||||
if (reader != null) {
|
if (reader != null) {
|
||||||
try {
|
try {
|
||||||
reader.close();
|
reader.close();
|
||||||
@@ -138,8 +138,8 @@ public class OAuthClient {
|
|||||||
|
|
||||||
return newToken;
|
return newToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUrl()throws Exception{
|
public String getUrl() throws Exception {
|
||||||
URL callback_url = new URL("https", callbackHost, callbackPort, "");
|
URL callback_url = new URL("https", callbackHost, callbackPort, "");
|
||||||
String oauth2_authorize_url = baseOAuthURL.endsWith("/") ? baseOAuthURL + OAUTH2_AUTHORIZE : baseOAuthURL + "/"
|
String oauth2_authorize_url = baseOAuthURL.endsWith("/") ? baseOAuthURL + OAUTH2_AUTHORIZE : baseOAuthURL + "/"
|
||||||
+ OAUTH2_AUTHORIZE;
|
+ OAUTH2_AUTHORIZE;
|
||||||
@@ -147,22 +147,22 @@ public class OAuthClient {
|
|||||||
"code", clientID, URLEncoder.encode(callback_url.toString(), UTF8));// , "full%20refresh_token"
|
"code", clientID, URLEncoder.encode(callback_url.toString(), UTF8));// , "full%20refresh_token"
|
||||||
return authorize_url;
|
return authorize_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startServer() throws Exception{
|
public void startServer() throws Exception {
|
||||||
service = new HttpsService(callbackPort);
|
service = new HttpsService(callbackPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpsService getServer(){
|
public HttpsService getServer() {
|
||||||
return service;
|
return service;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopServer() throws Exception{
|
public void stopServer() throws Exception {
|
||||||
if(service!=null){
|
if (service != null) {
|
||||||
service.stop();
|
service.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Token getTokenForWizard(String code) throws Exception{
|
public Token getTokenForWizard(String code) throws Exception {
|
||||||
Token token = new Token();
|
Token token = new Token();
|
||||||
|
|
||||||
URL callback_url = new URL("https", callbackHost, callbackPort, "");
|
URL callback_url = new URL("https", callbackHost, callbackPort, "");
|
||||||
@@ -171,7 +171,7 @@ public class OAuthClient {
|
|||||||
+ OAUTH2_AUTHORIZE;
|
+ OAUTH2_AUTHORIZE;
|
||||||
String authorize_url = String.format("%s?response_type=%s&client_id=%s&redirect_uri=%s", oauth2_authorize_url,// &scope=%s
|
String authorize_url = String.format("%s?response_type=%s&client_id=%s&redirect_uri=%s", oauth2_authorize_url,// &scope=%s
|
||||||
"code", clientID, URLEncoder.encode(callback_url.toString(), UTF8));// , "full%20refresh_token"
|
"code", clientID, URLEncoder.encode(callback_url.toString(), UTF8));// , "full%20refresh_token"
|
||||||
|
|
||||||
String token_url = baseOAuthURL.endsWith("/") ? baseOAuthURL + OAUTH2_TOKEN : baseOAuthURL + "/" + OAUTH2_TOKEN;
|
String token_url = baseOAuthURL.endsWith("/") ? baseOAuthURL + OAUTH2_TOKEN : baseOAuthURL + "/" + OAUTH2_TOKEN;
|
||||||
URLConnection conn = new URL(token_url).openConnection();
|
URLConnection conn = new URL(token_url).openConnection();
|
||||||
conn.setDoOutput(true);// post
|
conn.setDoOutput(true);// post
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
// ============================================================================
|
|
||||||
//
|
|
||||||
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
|
||||||
//
|
|
||||||
// This source code is available under agreement available at
|
|
||||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
|
||||||
//
|
|
||||||
// You should have received a copy of the agreement
|
|
||||||
// along with this program; if not, write to Talend SA
|
|
||||||
// 9 rue Pages 92150 Suresnes, France
|
|
||||||
//
|
|
||||||
// ============================================================================
|
|
||||||
package org.talend.salesforce.oauth.test;
|
|
||||||
|
|
||||||
import org.talend.salesforce.oauth.OAuthClient;
|
|
||||||
import org.talend.salesforce.oauth.Token;
|
|
||||||
|
|
||||||
import com.salesforce.soap.partner.sobject.SObject;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* created by bchen on Aug 28, 2013 Detailled comment
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class OAuthClientTest {
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
|
||||||
OAuthClient client = new OAuthClient();
|
|
||||||
client.setBaseOAuthURL("https://login.salesforce.com/services/oauth2");
|
|
||||||
client.setCallbackHost("192.168.30.123");
|
|
||||||
client.setCallbackPort(8555);
|
|
||||||
client.setClientID("3MVG99qusVZJwhsl6LQR3j8Kp74AoXCfza9O6Q09mfGq0Rk1uGZ1whOlV24dxQLFIrn1MSe7dm4JUbG8oy9fY");
|
|
||||||
client.setClientSecret("8349684339611555474");
|
|
||||||
Token token = client.getToken();
|
|
||||||
System.out.println(token.getAccess_token());
|
|
||||||
String refreshToken = token.getRefresh_token();
|
|
||||||
token = client.refreshToken(refreshToken);
|
|
||||||
System.out.println(token.getAccess_token());
|
|
||||||
// rest bulk api
|
|
||||||
org.talend.salesforceBulk.SalesforceBulkAPI sforceBulk = new org.talend.salesforceBulk.SalesforceBulkAPI();
|
|
||||||
|
|
||||||
sforceBulk.login(token.getAccess_token(), client.getBulkEndpoint(token, "25.0"));
|
|
||||||
|
|
||||||
sforceBulk.setConcurrencyMode("Parallel");
|
|
||||||
sforceBulk.setAwaitTime(100 * 1000);
|
|
||||||
|
|
||||||
sforceBulk.executeBulk("Account", "insert", "Id", "csv", "/home/bchen/Desktop/sforce_bulk.csv", 10 * 1024 * 1024, 10000);
|
|
||||||
|
|
||||||
// soap api
|
|
||||||
String endpoint = client.getSOAPEndpoint(token, "25.0");
|
|
||||||
|
|
||||||
org.talend.salesforce.SforceManagement sfMgr = new org.talend.salesforce.SforceManagementImpl();
|
|
||||||
|
|
||||||
boolean result = sfMgr.login(token.getAccess_token(), endpoint, 60000, false);
|
|
||||||
if (!result) {
|
|
||||||
throw new RuntimeException("Login failed! Please check the username,password and endpoint");
|
|
||||||
}
|
|
||||||
com.salesforce.soap.partner.QueryResult qr = sfMgr.query("select Id from Account", 250);
|
|
||||||
SObject[] records = qr.getRecords();
|
|
||||||
System.out.println(records.length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project name="org.talend.designer.components.libs" default="process" basedir=".">
|
<project name="org.talend.designer.components.libs" default="process" basedir=".">
|
||||||
|
|
||||||
<property name="component.plugin.home" value="../../../org.talend.designer.components.localprovider/components" />
|
<property name="poi.jar.home" value="../../../org.talend.libraries.excel/lib" />
|
||||||
|
<property name="axis2.jar.home" value="../../../org.talend.libraries.apache.axis2/lib" />
|
||||||
|
<property name="dom4j.jar.home" value="../../../org.talend.libraries.dom4j-jaxen/lib" />
|
||||||
|
<property name="apache.jar.home" value="../../../org.talend.libraries.apache/lib" />
|
||||||
|
|
||||||
<!-- #################################################### -->
|
<!-- #################################################### -->
|
||||||
|
|
||||||
@@ -12,14 +15,14 @@
|
|||||||
|
|
||||||
<!-- modification 2: compile classpath -->
|
<!-- modification 2: compile classpath -->
|
||||||
<path id="compile.classpath">
|
<path id="compile.classpath">
|
||||||
<pathelement location="${component.plugin.home}/tFileInputXML/dom4j-1.6.1.jar" />
|
<pathelement location="${dom4j.jar.home}/dom4j-1.6.1.jar" />
|
||||||
<pathelement location="${component.plugin.home}/tMicrosoftCrmInput/geronimo-stax-api_1.0_spec-1.0.jar" />
|
<pathelement location="${axis2.jar.home}/geronimo-stax-api_1.0_spec-1.0.jar" />
|
||||||
<pathelement location="${component.plugin.home}/tFileInputExcel/log4j-1.2.15.jar" />
|
<pathelement location="${apache.jar.home}/log4j-1.2.17.jar" />
|
||||||
<pathelement location="${component.plugin.home}/tFileInputExcel/poi-3.8-20120913_modified_talend.jar" />
|
<pathelement location="${poi.jar.home}/poi-3.11-20141221_modified_talend.jar" />
|
||||||
<pathelement location="${component.plugin.home}/tFileInputExcel/poi-ooxml-3.8-20121127_modified_talend.jar" />
|
<pathelement location="${poi.jar.home}/poi-ooxml-3.11-20141221_modified_talend.jar" />
|
||||||
<pathelement location="${component.plugin.home}/tFileInputExcel/poi-ooxml-schemas-3.8-20120326.jar" />
|
<pathelement location="${poi.jar.home}/poi-ooxml-schemas-3.11-20141221.jar" />
|
||||||
<pathelement location="${component.plugin.home}/tFileInputExcel/poi-scratchpad-3.8-20120326.jar" />
|
<pathelement location="${poi.jar.home}/poi-scratchpad-3.11-20141221.jar" />
|
||||||
<pathelement location="${component.plugin.home}/tMicrosoftCrmInput/xmlbeans-2.3.0.jar" />
|
<pathelement location="${apache.jar.home}/xmlbeans-2.3.0.jar" />
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
<!-- #################################################### -->
|
<!-- #################################################### -->
|
||||||
@@ -27,7 +30,7 @@
|
|||||||
|
|
||||||
<!-- sourcecode and final jar path -->
|
<!-- sourcecode and final jar path -->
|
||||||
<property name="source.home" value="." />
|
<property name="source.home" value="." />
|
||||||
<property name="jar.home" value="${component.plugin.home}/${component.name}/${jar.name}" />
|
<property name="jar.home" value="${poi.jar.home}/${jar.name}" />
|
||||||
|
|
||||||
<!-- temp dir for clasee files -->
|
<!-- temp dir for clasee files -->
|
||||||
<property name="build.dir" value="../../build" />
|
<property name="build.dir" value="../../build" />
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ package com.talend.excel.xssf.event;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFComment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* created by wwang on 2012-9-27 Detailled comment
|
* created by wwang on 2012-9-27 Detailled comment
|
||||||
*
|
*
|
||||||
@@ -41,7 +43,7 @@ public class DefaultTalendSheetContentsHandler implements TalendXSSFSheetXMLHand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void endRow() {
|
public void endRow(int rowNum) {
|
||||||
cache.writeData(row);
|
cache.writeData(row);
|
||||||
row = null;
|
row = null;
|
||||||
// when each row end ,reset lastColumnIndex
|
// when each row end ,reset lastColumnIndex
|
||||||
@@ -52,7 +54,7 @@ public class DefaultTalendSheetContentsHandler implements TalendXSSFSheetXMLHand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cell(String cellReference, String formattedValue) {
|
public void cell(String cellReference, String formattedValue,XSSFComment comment) {
|
||||||
checkHasNullValue(cellReference);
|
checkHasNullValue(cellReference);
|
||||||
row.add(formattedValue);
|
row.add(formattedValue);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,10 +17,10 @@
|
|||||||
<pathelement location="${dom4j.jar.home}/dom4j-1.6.1.jar" />
|
<pathelement location="${dom4j.jar.home}/dom4j-1.6.1.jar" />
|
||||||
<pathelement location="${axis2.jar.home}/geronimo-stax-api_1.0_spec-1.0.jar" />
|
<pathelement location="${axis2.jar.home}/geronimo-stax-api_1.0_spec-1.0.jar" />
|
||||||
<pathelement location="${apache.jar.home}/log4j-1.2.17.jar" />
|
<pathelement location="${apache.jar.home}/log4j-1.2.17.jar" />
|
||||||
<pathelement location="${poi.jar.home}/poi-3.8-20120913_modified_talend.jar" />
|
<pathelement location="${poi.jar.home}/poi-3.11-20141221_modified_talend.jar" />
|
||||||
<pathelement location="${poi.jar.home}/poi-ooxml-3.8-20121127_modified_talend.jar" />
|
<pathelement location="${poi.jar.home}/poi-ooxml-3.11-20141221_modified_talend.jar" />
|
||||||
<pathelement location="${poi.jar.home}/poi-ooxml-schemas-3.8-20120326.jar" />
|
<pathelement location="${poi.jar.home}/poi-ooxml-schemas-3.11-20141221.jar" />
|
||||||
<pathelement location="${poi.jar.home}/poi-scratchpad-3.8-20120326.jar" />
|
<pathelement location="${poi.jar.home}/poi-scratchpad-3.11-20141221.jar" />
|
||||||
<pathelement location="${apache.jar.home}/xmlbeans-2.3.0.jar" />
|
<pathelement location="${apache.jar.home}/xmlbeans-2.3.0.jar" />
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ public class ExcelTool {
|
|||||||
private Font font = null;
|
private Font font = null;
|
||||||
|
|
||||||
private Map<String, CellStyle> cellStylesMapping = null;
|
private Map<String, CellStyle> cellStylesMapping = null;
|
||||||
|
|
||||||
|
boolean recalculateFormula = false;
|
||||||
|
|
||||||
private int rowAccessWindowSize = SXSSFWorkbook.DEFAULT_WINDOW_SIZE;//used in auto flush
|
private int rowAccessWindowSize = SXSSFWorkbook.DEFAULT_WINDOW_SIZE;//used in auto flush
|
||||||
|
|
||||||
@@ -83,6 +85,10 @@ public class ExcelTool {
|
|||||||
public void setSheet(String sheetName) {
|
public void setSheet(String sheetName) {
|
||||||
this.sheetName = sheetName;
|
this.sheetName = sheetName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRecalculateFormula(boolean recalculateFormula) {
|
||||||
|
this.recalculateFormula = recalculateFormula;
|
||||||
|
}
|
||||||
|
|
||||||
public void prepareStream() throws Exception {
|
public void prepareStream() throws Exception {
|
||||||
wb = new SXSSFWorkbook(rowAccessWindowSize);
|
wb = new SXSSFWorkbook(rowAccessWindowSize);
|
||||||
@@ -286,14 +292,14 @@ public class ExcelTool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
FileOutputStream fileOutput = new FileOutputStream(fileName);
|
FileOutputStream fileOutput = new FileOutputStream(fileName);
|
||||||
if(appendWorkbook && appendSheet){
|
if(appendWorkbook && appendSheet && recalculateFormula){
|
||||||
evaluateFormulaCell();
|
evaluateFormulaCell();
|
||||||
}
|
}
|
||||||
wb.write(fileOutput);
|
wb.write(fileOutput);
|
||||||
fileOutput.close();
|
fileOutput.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void evaluateFormulaCell(){
|
private void evaluateFormulaCell(){
|
||||||
FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
|
FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
|
||||||
for(int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++) {
|
for(int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++) {
|
||||||
sheet = wb.getSheetAt(sheetNum);
|
sheet = wb.getSheetAt(sheetNum);
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<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</groupId>
|
||||||
|
<artifactId>talendMQConnectionUtil</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>talendMQConnectionUtil</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.0</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.activemq</groupId>
|
||||||
|
<artifactId>activemq-all</artifactId>
|
||||||
|
<version>5.10.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ibm</groupId>
|
||||||
|
<artifactId>com.ibm.mq</artifactId>
|
||||||
|
<version>x</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ibm</groupId>
|
||||||
|
<artifactId>com.ibm.mqjms</artifactId>
|
||||||
|
<version>x</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.resource</groupId>
|
||||||
|
<artifactId>connector-api</artifactId>
|
||||||
|
<version>1.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.talend</groupId>
|
||||||
|
<artifactId>talendMQRFH2</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/java</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
Note:
|
||||||
|
About the jar we can't find in http://mvnrepository.com/ .
|
||||||
|
we need add it to the local repository manually.
|
||||||
|
For example:
|
||||||
|
mvn install:install-file -Dfile=D:\workspace\talend_540\.Java\lib\talendMQRFH2.jar -DgroupId=org.talend -DartifactId=talendMQRFH2 -Dversion=1.0.0 -Dpackaging=jar
|
||||||
|
mvn install:install-file -Dfile=D:\workspace\talend_540\.Java\lib\com.ibm.mq.jar -DgroupId=com.ibm -DartifactId=com.ibm.mq -Dversion=x -Dpackaging=jar
|
||||||
|
mvn install:install-file -Dfile=D:\workspace\talend_540\.Java\lib\com.ibm.mqjms.jar -DgroupId=com.ibm -DartifactId=com.ibm.mqjms -Dversion=x -Dpackaging=jar
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
// ============================================================================
|
||||||
|
//
|
||||||
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
|
//
|
||||||
|
// This source code is available under agreement available at
|
||||||
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
|
//
|
||||||
|
// You should have received a copy of the agreement
|
||||||
|
// along with this program; if not, write to Talend SA
|
||||||
|
// 9 rue Pages 92150 Suresnes, France
|
||||||
|
//
|
||||||
|
// ============================================================================
|
||||||
|
package org.talend.mq;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.jms.JMSException;
|
||||||
|
|
||||||
|
import org.apache.activemq.ConnectionClosedException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A buffer to keep all the MQ connections, make it reusable between the
|
||||||
|
* different jobs.
|
||||||
|
*/
|
||||||
|
public class SharedActiveMQConnection {
|
||||||
|
|
||||||
|
private static boolean DEBUG = false;
|
||||||
|
|
||||||
|
private static SharedActiveMQConnection instance = null;
|
||||||
|
|
||||||
|
private Map<String, javax.jms.Connection> sharedConnections = new HashMap<String, javax.jms.Connection>();
|
||||||
|
|
||||||
|
private SharedActiveMQConnection() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static synchronized SharedActiveMQConnection getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new SharedActiveMQConnection();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized javax.jms.Connection getConnection(String url,
|
||||||
|
String userName, String password, String mqConnectionName)
|
||||||
|
throws JMSException {
|
||||||
|
if (DEBUG) {
|
||||||
|
Set<String> keySet = sharedConnections.keySet();
|
||||||
|
System.out
|
||||||
|
.print("SharedMQConnection, current shared connections list is:"); //$NON-NLS-1$
|
||||||
|
for (String key : keySet) {
|
||||||
|
System.out.print(" " + key); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
javax.jms.Connection connection = sharedConnections
|
||||||
|
.get(mqConnectionName);
|
||||||
|
if (connection == null) {
|
||||||
|
if (DEBUG) {
|
||||||
|
System.out
|
||||||
|
.println("SharedMQConnection, can't find the key:" + mqConnectionName + " " //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
+ "so create a new one and share it."); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
org.apache.activemq.ActiveMQConnectionFactory factory = new org.apache.activemq.ActiveMQConnectionFactory(
|
||||||
|
url);
|
||||||
|
if (userName == null || ("").equals(userName)) {
|
||||||
|
connection = factory.createConnection();
|
||||||
|
} else {
|
||||||
|
connection = factory.createConnection(userName, password);
|
||||||
|
}
|
||||||
|
connection.start();
|
||||||
|
sharedConnections.put(mqConnectionName, connection);
|
||||||
|
} else {
|
||||||
|
try{
|
||||||
|
connection.start();
|
||||||
|
if (DEBUG) {
|
||||||
|
System.out
|
||||||
|
.println("SharedMQConnection, find the key: " + mqConnectionName + " " + "it is OK."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
|
}
|
||||||
|
}catch(ConnectionClosedException e){
|
||||||
|
if (DEBUG) {
|
||||||
|
System.out.println("SharedMQConnection, find the key: " + mqConnectionName + " " //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
+ "But it is closed. So create a new one and share it."); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
org.apache.activemq.ActiveMQConnectionFactory factory = new org.apache.activemq.ActiveMQConnectionFactory(
|
||||||
|
url);
|
||||||
|
if (userName == null || ("").equals(userName)) {
|
||||||
|
connection = factory.createConnection();
|
||||||
|
} else {
|
||||||
|
connection = factory.createConnection(userName, password);
|
||||||
|
}
|
||||||
|
connection.start();
|
||||||
|
sharedConnections.put(mqConnectionName, connection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If there don't exist the connection or it is closed, create and store it.
|
||||||
|
*
|
||||||
|
* @param url
|
||||||
|
* @param mqConnectionName
|
||||||
|
* @return
|
||||||
|
* @throws JMSException
|
||||||
|
*/
|
||||||
|
public static javax.jms.Connection getMQConnection(String url,
|
||||||
|
String userName, String password, String mqConnectionName)
|
||||||
|
throws JMSException {
|
||||||
|
SharedActiveMQConnection instanceLocal = getInstance();
|
||||||
|
javax.jms.Connection connection = instanceLocal.getConnection(url,
|
||||||
|
userName, password, mqConnectionName);
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the buffer as null, make it recyclable.
|
||||||
|
*/
|
||||||
|
public static void clear() {
|
||||||
|
instance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setDebugMode(boolean debug) {
|
||||||
|
DEBUG = debug;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
// ============================================================================
|
||||||
|
//
|
||||||
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
|
//
|
||||||
|
// This source code is available under agreement available at
|
||||||
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
|
//
|
||||||
|
// You should have received a copy of the agreement
|
||||||
|
// along with this program; if not, write to Talend SA
|
||||||
|
// 9 rue Pages 92150 Suresnes, France
|
||||||
|
//
|
||||||
|
// ============================================================================
|
||||||
|
package org.talend.mq;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.ibm.mq.MQException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A buffer to keep all the MQ connections, make it reusable between the
|
||||||
|
* different jobs.
|
||||||
|
*/
|
||||||
|
public class SharedWebSphereMQConnection {
|
||||||
|
|
||||||
|
private static boolean DEBUG = false;
|
||||||
|
|
||||||
|
private static SharedWebSphereMQConnection instance = null;
|
||||||
|
|
||||||
|
private Map<String, com.ibm.mq.MQQueueManager> sharedConnections = new HashMap<String, com.ibm.mq.MQQueueManager>();
|
||||||
|
|
||||||
|
private SharedWebSphereMQConnection() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static synchronized SharedWebSphereMQConnection getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new SharedWebSphereMQConnection();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized com.ibm.mq.MQQueueManager getConnection(
|
||||||
|
String queueManager,
|
||||||
|
java.util.Hashtable<String, Object> properties,
|
||||||
|
String mqConnectionName) throws MQException {
|
||||||
|
if (DEBUG) {
|
||||||
|
Set<String> keySet = sharedConnections.keySet();
|
||||||
|
System.out
|
||||||
|
.print("SharedMQConnection, current shared connections list is:"); //$NON-NLS-1$
|
||||||
|
for (String key : keySet) {
|
||||||
|
System.out.print(" " + key); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
com.ibm.mq.MQQueueManager connection = sharedConnections
|
||||||
|
.get(mqConnectionName);
|
||||||
|
if (connection == null) {
|
||||||
|
if (DEBUG) {
|
||||||
|
System.out
|
||||||
|
.println("SharedMQConnection, can't find the key:" + mqConnectionName + " " //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
+ "so create a new one and share it."); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
connection = new com.ibm.mq.MQQueueManager(queueManager, properties);
|
||||||
|
sharedConnections.put(mqConnectionName, connection);
|
||||||
|
} else if (!connection.isConnected()) {
|
||||||
|
if (DEBUG) {
|
||||||
|
System.out
|
||||||
|
.println("SharedMQConnection, find the key: " + mqConnectionName + " " //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
+ "But it is closed. So create a new one and share it."); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
connection = new com.ibm.mq.MQQueueManager(queueManager, properties);
|
||||||
|
sharedConnections.put(mqConnectionName, connection);
|
||||||
|
} else {
|
||||||
|
if (DEBUG) {
|
||||||
|
System.out
|
||||||
|
.println("SharedMQConnection, find the key: " + mqConnectionName + " " + "it is OK."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If there don't exist the connection or it is closed, create and store it.
|
||||||
|
*
|
||||||
|
* @param queueManager
|
||||||
|
* @param properties
|
||||||
|
* @param mqConnectionName
|
||||||
|
* @return
|
||||||
|
* @throws MQException
|
||||||
|
*/
|
||||||
|
public static com.ibm.mq.MQQueueManager getMQConnection(
|
||||||
|
String queueManager,
|
||||||
|
java.util.Hashtable<String, Object> properties,
|
||||||
|
String mqConnectionName) throws MQException {
|
||||||
|
SharedWebSphereMQConnection instanceLocal = getInstance();
|
||||||
|
com.ibm.mq.MQQueueManager connection = instanceLocal.getConnection(
|
||||||
|
queueManager, properties, mqConnectionName);
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the buffer as null, make it recyclable.
|
||||||
|
*/
|
||||||
|
public static void clear() {
|
||||||
|
instance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setDebugMode(boolean debug) {
|
||||||
|
DEBUG = debug;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package org.talend.mq;
|
||||||
|
|
||||||
|
import javax.jms.JMSException;
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class TestSharedActiveMQConn extends TestCase {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSameConnNAme() throws JMSException {
|
||||||
|
assertTrue(SharedActiveMQConnection.getMQConnection("tcp://localhost:61616", "", "", "conn")==SharedActiveMQConnection.getMQConnection("tcp://localhost:61616", "", "", "conn"));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testDiffConnNAme() throws JMSException {
|
||||||
|
assertFalse(SharedActiveMQConnection.getMQConnection("tcp://localhost:61616", "", "", "conn1")==SharedActiveMQConnection.getMQConnection("tcp://localhost:61616", "", "", "conn2"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package org.talend.mq;
|
||||||
|
|
||||||
|
import java.util.Hashtable;
|
||||||
|
|
||||||
|
import javax.jms.JMSException;
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.ibm.mq.MQException;
|
||||||
|
|
||||||
|
public class TestSharedWebShpereMQConn extends TestCase {
|
||||||
|
private static Hashtable<String,Object> properties = new java.util.Hashtable<String,Object>();
|
||||||
|
static{
|
||||||
|
properties.put("hostname", "localhost");
|
||||||
|
properties.put("port", Integer.valueOf("1414"));
|
||||||
|
properties.put("channel", "TALEND.CH");
|
||||||
|
properties.put("CCSID", new Integer(1208));
|
||||||
|
properties.put("transport", "MQSeries");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSameConnNAme() throws JMSException, MQException {
|
||||||
|
assertTrue(SharedWebSphereMQConnection.getMQConnection("TALEND", properties, "conn")==SharedWebSphereMQConnection.getMQConnection("TALEND", properties, "conn"));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void testDiffConnNAme() throws JMSException, MQException {
|
||||||
|
assertTrue(SharedWebSphereMQConnection.getMQConnection("TALEND", properties, "conn1")!=SharedWebSphereMQConnection.getMQConnection("TALEND", properties, "conn2"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -29,6 +29,8 @@
|
|||||||
<property name="compile.deprecation" value="false" />
|
<property name="compile.deprecation" value="false" />
|
||||||
<property name="compile.optimize" value="true" />
|
<property name="compile.optimize" value="true" />
|
||||||
|
|
||||||
|
<property name="ant.build.javac.source" value="1.6"/>
|
||||||
|
<property name="ant.build.javac.target" value="1.6"/>
|
||||||
|
|
||||||
<target name="process" description="prepare a temp dir">
|
<target name="process" description="prepare a temp dir">
|
||||||
<antcall target="prepare" />
|
<antcall target="prepare" />
|
||||||
|
|||||||
@@ -31,6 +31,10 @@ public class MapHashFile {
|
|||||||
}
|
}
|
||||||
return tMultiTheadLockMap.get(key);
|
return tMultiTheadLockMap.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void remove(Object key){
|
||||||
|
tMultiTheadLockMap.remove(key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private MapHashFile() {
|
private MapHashFile() {
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
<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</groupId>
|
||||||
|
<artifactId>xpathutil</artifactId>
|
||||||
|
<name>xpathutil</name>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.0</version>
|
||||||
|
<type>jar</type>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>2.3.2</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.6</source>
|
||||||
|
<target>1.6</target>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/java</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
|
||||||
|
<testResources>
|
||||||
|
<testResource>
|
||||||
|
<directory>src/test/java</directory>
|
||||||
|
</testResource>
|
||||||
|
</testResources>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
package org.talend.xpath;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class XPathUtil {
|
||||||
|
|
||||||
|
private List<String> defualtNSPath = new ArrayList<String>();
|
||||||
|
|
||||||
|
public void setDefaultNSPath(List<String> defualtNSPath) {
|
||||||
|
this.defualtNSPath = defualtNSPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final String LITERAL = "TALEND_LITERAL";
|
||||||
|
private java.util.regex.Pattern literalPattern = null;
|
||||||
|
private java.util.Map<String,String> resultCache;
|
||||||
|
|
||||||
|
private String removeLiterals(String path, List<String> literals) {
|
||||||
|
if(path == null || "".equals(path)) {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(literalPattern == null) {
|
||||||
|
literalPattern = java.util.regex.Pattern.compile("'([^']*)'|\"([^\"]*)\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
java.util.regex.Matcher matcher = literalPattern.matcher(path);
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
|
||||||
|
while(matcher.find()) {
|
||||||
|
literals.add(path.substring(matcher.start()+1,matcher.end()-1));
|
||||||
|
if(matcher.group(1)!=null) {
|
||||||
|
matcher.appendReplacement(sb, "'" + LITERAL + "'");
|
||||||
|
} else {
|
||||||
|
matcher.appendReplacement(sb, "\"" + LITERAL + "\"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return matcher.appendTail(sb).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String resetLiterals(String xpathExpression,List<String> literals) {
|
||||||
|
if(literals.isEmpty()) {
|
||||||
|
return xpathExpression;
|
||||||
|
}
|
||||||
|
|
||||||
|
int start = 0;
|
||||||
|
int end = xpathExpression.indexOf(LITERAL, start);
|
||||||
|
if (end == -1) {
|
||||||
|
return xpathExpression;
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
java.util.Iterator<String> iterator = literals.iterator();
|
||||||
|
|
||||||
|
while (end != -1 && iterator.hasNext()) {
|
||||||
|
sb.append(xpathExpression.substring(start, end)).append(iterator.next());
|
||||||
|
start = end + LITERAL.length();
|
||||||
|
end = xpathExpression.indexOf(LITERAL, start);
|
||||||
|
}
|
||||||
|
sb.append(xpathExpression.substring(start));
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String addDefaultNSPrefix(String basePath) {
|
||||||
|
return addDefaultNSPrefix(basePath,"/");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String addDefaultNSPrefix(String xpathExpression, String basePath) {
|
||||||
|
if(".".equals(basePath.trim())) {//addDefaultNSPrefix(path,".")==>process the special loop path
|
||||||
|
basePath = "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defualtNSPath.size() < 1) {
|
||||||
|
return xpathExpression;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(resultCache == null) {
|
||||||
|
resultCache = new java.util.HashMap<String,String>();
|
||||||
|
}
|
||||||
|
|
||||||
|
String resultXpathExpression = resultCache.get(xpathExpression);
|
||||||
|
if(resultXpathExpression!=null) {
|
||||||
|
return resultXpathExpression;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> literals = new java.util.ArrayList<String>();
|
||||||
|
resultXpathExpression = removeLiterals(xpathExpression,literals);
|
||||||
|
|
||||||
|
resultXpathExpression = addDefaultNSPrefixForLocationXPathExpression(resultXpathExpression,basePath);
|
||||||
|
|
||||||
|
resultXpathExpression = resetLiterals(resultXpathExpression, literals);
|
||||||
|
|
||||||
|
resultCache.put(xpathExpression,resultXpathExpression);
|
||||||
|
return resultXpathExpression;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String addDefaultNSPrefixForLocationXPathExpression(String path, String absolutePath) {
|
||||||
|
StringBuilder newPath = new StringBuilder();
|
||||||
|
String[] pathStrs = path.split("/");
|
||||||
|
String currentAbsolutePath = absolutePath;
|
||||||
|
for (int i = 0; i < pathStrs.length; i++) {
|
||||||
|
String step = pathStrs[i];
|
||||||
|
|
||||||
|
currentAbsolutePath = getCurrentAbsolutePath(step, currentAbsolutePath);
|
||||||
|
|
||||||
|
if (newPath.length() > 0) {
|
||||||
|
newPath.append("/");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (step.length() > 0 && step.indexOf(":") == -1 && step.indexOf(".") == -1 /*&& tmp.indexOf("@") == -1*/) {
|
||||||
|
int index = getDefaultNamespaceIndex(currentAbsolutePath);
|
||||||
|
if (index >= 0) {
|
||||||
|
//==== add by wliu to support both filter and functions==
|
||||||
|
if(step.indexOf("[")>0 && step.indexOf("]")>step.indexOf("[")){//include filter
|
||||||
|
String tmpStr=replaceElementWithNS(step,"pre"+index+":");
|
||||||
|
newPath.append(tmpStr);
|
||||||
|
}else{
|
||||||
|
if(step.indexOf("@") != -1 || step.indexOf("(")<step.indexOf(")")){ // include attribute
|
||||||
|
newPath.append(step);
|
||||||
|
}else{
|
||||||
|
//==add end=======
|
||||||
|
newPath.append("pre").append(index).append(":").append(step);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newPath.append(step);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newPath.append(step);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(newPath.length() == 0) {
|
||||||
|
return "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
return newPath.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getCurrentAbsolutePath(String step, String absolutePath) {
|
||||||
|
String currentAbsolutePath = absolutePath;
|
||||||
|
if ("..".equals(step)) {
|
||||||
|
currentAbsolutePath = currentAbsolutePath.substring(0, currentAbsolutePath.lastIndexOf("/"));
|
||||||
|
} else if(".".equals(step)) {
|
||||||
|
//do nothing
|
||||||
|
} else if("/".equals(currentAbsolutePath)) {
|
||||||
|
currentAbsolutePath += step;
|
||||||
|
} else {
|
||||||
|
currentAbsolutePath += "/" + step;
|
||||||
|
}
|
||||||
|
return currentAbsolutePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getDefaultNamespaceIndex(String currentAbsolutePath) {
|
||||||
|
int result = -1;
|
||||||
|
for (int i = 0,length = 0; i < defualtNSPath.size(); i++) {
|
||||||
|
if (defualtNSPath.get(i).length() > length && currentAbsolutePath.startsWith(defualtNSPath.get(i))) {
|
||||||
|
result = i;
|
||||||
|
length = defualtNSPath.get(i).length();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String matches = "@*\\b[a-z|A-Z|_]+[[-]*\\w]*\\b[^'\"|^\\(]";
|
||||||
|
private java.util.regex.Pattern pattern = java.util.regex.Pattern.compile(matches);
|
||||||
|
|
||||||
|
private String replaceElementWithNS(String global, String pre){
|
||||||
|
java.util.regex.Matcher match = pattern.matcher(global);
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
match.reset();
|
||||||
|
while (match.find()) {
|
||||||
|
String group = match.group();
|
||||||
|
String tmp = "";
|
||||||
|
if (group.toLowerCase().matches("\\b(div|mod|and|or)\\b.*") || group.matches("@.*")) {
|
||||||
|
tmp = group;
|
||||||
|
} else {
|
||||||
|
tmp = tmp + pre + group;
|
||||||
|
}
|
||||||
|
match.appendReplacement(sb, tmp);
|
||||||
|
}
|
||||||
|
match.appendTail(sb);
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,214 @@
|
|||||||
|
package org.talend.xpath;
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import org.junit.Test;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class XPathUtilTest extends TestCase {
|
||||||
|
|
||||||
|
private static List<String> defualtNSPath = new ArrayList<String>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
defualtNSPath.add("/root");
|
||||||
|
defualtNSPath.add("/root/loop/a/b");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWithoutDefaultNamespace1() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
assertEquals("/root/loop",util.addDefaultNSPrefix("/root/loop"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWithoutDefaultNamespace2() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
assertEquals("id",util.addDefaultNSPrefix("id","/root/loop"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWithoutDefaultNamespace3() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
assertEquals("@id",util.addDefaultNSPrefix("@id","/root/loop"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWithoutDefaultNamespace4() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
assertEquals("u_id",util.addDefaultNSPrefix("u_id","/root/loop"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWithoutDefaultNamespace5() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
assertEquals(".",util.addDefaultNSPrefix(".","/a/b/c/d"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWithoutDefaultNamespace6() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
assertEquals("..",util.addDefaultNSPrefix("..","/a/b/c/d"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWithoutDefaultNamespace7() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
assertEquals("../e/@_f",util.addDefaultNSPrefix("../e/@_f","/a/b/c/d"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWithoutDefaultNamespace8() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
assertEquals("../../e",util.addDefaultNSPrefix("../../e","/a/b/c/d"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWithoutDefaultNamespace9() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
assertEquals("/a/b/c/d/*[name()]",util.addDefaultNSPrefix("/a/b/c/d/*[name()]"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWithoutDefaultNamespace10() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
assertEquals(".",util.addDefaultNSPrefix(".","/a/b/c/d/*[name()]"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWithoutDefaultNamespace11() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
assertEquals(".",util.addDefaultNSPrefix(".","."));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWithoutDefaultNamespace12() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
assertEquals("/",util.addDefaultNSPrefix("/"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWithoutDefaultNamespace14() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
assertEquals(".",util.addDefaultNSPrefix(".","/"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test1() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
util.setDefaultNSPath(defualtNSPath);
|
||||||
|
assertEquals("pre0:root/pre0:loop",util.addDefaultNSPrefix("/root/loop"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test2() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
util.setDefaultNSPath(defualtNSPath);
|
||||||
|
assertEquals("pre0:id",util.addDefaultNSPrefix("id","/root/loop"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test3() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
util.setDefaultNSPath(defualtNSPath);
|
||||||
|
assertEquals("pre0:person[@name='wangwei']/pre0:Value",util.addDefaultNSPrefix("person[@name='wangwei']/Value","/root/loop"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test4() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
util.setDefaultNSPath(defualtNSPath);
|
||||||
|
assertEquals("pre0:person[@name='wangwei']/pre0:Value",util.addDefaultNSPrefix("person[@name='wangwei']/Value","/root/loop"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test5() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
util.setDefaultNSPath(defualtNSPath);
|
||||||
|
assertEquals("pre0:person[@name=\"wangwei\"]/pre0:Value",util.addDefaultNSPrefix("person[@name=\"wangwei\"]/Value","/root/loop"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test6() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
util.setDefaultNSPath(defualtNSPath);
|
||||||
|
assertEquals("pre0:person[@name=\"wangwei\"]/pre0:Value",util.addDefaultNSPrefix("person[@name=\"wangwei\"]/Value","/root/loop"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test7() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
util.setDefaultNSPath(defualtNSPath);
|
||||||
|
assertEquals("pre0:person[@name='{wang.wei}']/pre0:Value",util.addDefaultNSPrefix("person[@name='{wang.wei}']/Value","/root/loop"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test8() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
util.setDefaultNSPath(defualtNSPath);
|
||||||
|
assertEquals("pre0:person/pre0:id/..",util.addDefaultNSPrefix("person/id/..","/root"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test9() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
util.setDefaultNSPath(defualtNSPath);
|
||||||
|
assertEquals("pre0:a/pre1:b/pre1:c/pre1:d",util.addDefaultNSPrefix("a/b/c/d","/root/loop"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test10() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
util.setDefaultNSPath(defualtNSPath);
|
||||||
|
assertEquals("pre0:root/pre0:loop/pre0:a/pre1:b/pre1:c",util.addDefaultNSPrefix("/root/loop/a/b/c"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test11() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
util.setDefaultNSPath(defualtNSPath);
|
||||||
|
assertEquals("pre0:root/pre0:loop/pre0:a/pre1:b[@name='{wang.wei}']/pre1:c",util.addDefaultNSPrefix("/root/loop/a/b[@name='{wang.wei}']/c"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test12() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
util.setDefaultNSPath(defualtNSPath);
|
||||||
|
assertEquals("pre0:root/pre0:loop/pre0:a/pre1:b/pre1:c",util.addDefaultNSPrefix("root/loop/a/b/c","."));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test14() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
util.setDefaultNSPath(defualtNSPath);
|
||||||
|
assertEquals("pre0:root/pre0:loop/pre0:a/pre1:b/pre1:c",util.addDefaultNSPrefix("root/loop/a/b/c","/"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test15() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
util.setDefaultNSPath(defualtNSPath);
|
||||||
|
assertEquals("/",util.addDefaultNSPrefix("/"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test16() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
util.setDefaultNSPath(defualtNSPath);
|
||||||
|
assertEquals(".",util.addDefaultNSPrefix(".","/"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test17() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
util.setDefaultNSPath(defualtNSPath);
|
||||||
|
assertEquals("pre0:root//pre0:loop",util.addDefaultNSPrefix("/root//loop"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test18() {
|
||||||
|
XPathUtil util = new XPathUtil();
|
||||||
|
util.setDefaultNSPath(defualtNSPath);
|
||||||
|
assertEquals("pre0:a//pre0:b",util.addDefaultNSPrefix("/a//b","/root/loop"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -334,6 +334,6 @@
|
|||||||
<RETURN NAME="NB_LINE_INSERTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
<RETURN NAME="NB_LINE_INSERTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
||||||
<RETURN NAME="NB_LINE_DELETED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
<RETURN NAME="NB_LINE_DELETED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
||||||
<RETURN NAME="NB_LINE_REJECTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
<RETURN NAME="NB_LINE_REJECTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
||||||
<RETURN NAME="QUERY" TYPE="id_String" AVAILABILITY="AFTER" />
|
<RETURN NAME="QUERY" TYPE="id_String" AVAILABILITY="FLOW" SHOW_IF="ENABLE_DEBUG_MODE=='true'"/>
|
||||||
</RETURNS>
|
</RETURNS>
|
||||||
</COMPONENT>
|
</COMPONENT>
|
||||||
|
|||||||
@@ -5,10 +5,10 @@
|
|||||||
HAS_CONDITIONAL_OUTPUTS="true" PARALLELIZE="true" PARTITIONING="AUTO">
|
HAS_CONDITIONAL_OUTPUTS="true" PARALLELIZE="true" PARTITIONING="AUTO">
|
||||||
<SIGNATURE />
|
<SIGNATURE />
|
||||||
</HEADER>
|
</HEADER>
|
||||||
|
|
||||||
<FAMILIES>
|
<FAMILIES>
|
||||||
<FAMILY>Databases/Access</FAMILY>
|
<FAMILY>Databases/Access</FAMILY>
|
||||||
</FAMILIES>
|
</FAMILIES>
|
||||||
|
|
||||||
<DOCUMENTATION>
|
<DOCUMENTATION>
|
||||||
<URL />
|
<URL />
|
||||||
@@ -216,6 +216,6 @@
|
|||||||
<RETURN NAME="NB_LINE_UPDATED" TYPE="id_Integer" AVAILABILITY="AFTER" />
|
<RETURN NAME="NB_LINE_UPDATED" TYPE="id_Integer" AVAILABILITY="AFTER" />
|
||||||
<RETURN NAME="NB_LINE_INSERTED" TYPE="id_Integer" AVAILABILITY="AFTER" />
|
<RETURN NAME="NB_LINE_INSERTED" TYPE="id_Integer" AVAILABILITY="AFTER" />
|
||||||
<RETURN NAME="NB_LINE_DELETED" TYPE="id_Integer" AVAILABILITY="AFTER" />
|
<RETURN NAME="NB_LINE_DELETED" TYPE="id_Integer" AVAILABILITY="AFTER" />
|
||||||
<RETURN NAME="QUERY" TYPE="id_String" AVAILABILITY="AFTER" />
|
<RETURN NAME="QUERY" TYPE="id_String" AVAILABILITY="FLOW" SHOW_IF="ENABLE_DEBUG_MODE=='true'"/>
|
||||||
</RETURNS>
|
</RETURNS>
|
||||||
</COMPONENT>
|
</COMPONENT>
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<%
|
||||||
|
class MappingTouchXMLNode extends TouchXMLNode {
|
||||||
|
|
||||||
|
void getXMLNode(String currEleName) {
|
||||||
|
%>
|
||||||
|
nameToElement_<%=cid%>.get("<%=currEleName%>")
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
|
||||||
|
void getXMLElement(String currEleName) {
|
||||||
|
%>
|
||||||
|
((org.dom4j.Element)(nameToElement_<%=cid%>.get("<%=currEleName%>")))
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
|
||||||
|
void putCurrentComplexTypeElement(String currEleName) {
|
||||||
|
%>
|
||||||
|
nameToElement_<%=cid%>.put("<%=currEleName%>_c",<%getXMLNode(currEleName);%>.addElement("xsd:complexType"));
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
|
||||||
|
void putCurrentSequenceElement(String currEleName) {
|
||||||
|
%>
|
||||||
|
nameToElement_<%=cid%>.put("<%=currEleName%>_s",<%getXMLNode(currEleName + "_c");%>.addElement("xsd:sequence"));
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
|
||||||
|
void putCurrentElement(String currEleName,String parent) {
|
||||||
|
%>
|
||||||
|
nameToElement_<%=cid%>.put("<%=currEleName%>",<%getXMLNode(parent);%>.addElement("xsd:element"));
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
|
||||||
|
void putRootElement() {
|
||||||
|
%>
|
||||||
|
nameToElement_<%=cid%>.put("root_xsd",root_xsd_<%=cid%>);
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%>
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<%
|
||||||
|
//get mean reference
|
||||||
|
//put mean declare,assign action
|
||||||
|
class ReferenceTouchXMLNode extends TouchXMLNode {
|
||||||
|
|
||||||
|
void getXMLNode(String currEleName) {
|
||||||
|
%>
|
||||||
|
|
||||||
|
<%=currEleName%>_<%=cid%>
|
||||||
|
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
|
||||||
|
void getXMLElement(String currEleName) {
|
||||||
|
getXMLNode(currEleName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void putCurrentComplexTypeElement(String currEleName) {
|
||||||
|
%>
|
||||||
|
|
||||||
|
org.dom4j.Element <%=currEleName%>_c_<%=cid%> = <%getXMLNode(currEleName);%>.addElement("xsd:complexType");
|
||||||
|
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
|
||||||
|
void putCurrentSequenceElement(String currEleName) {
|
||||||
|
%>
|
||||||
|
|
||||||
|
org.dom4j.Element <%=currEleName%>_s_<%=cid%> = <%getXMLNode(currEleName + "_c");%>.addElement("xsd:sequence");
|
||||||
|
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
|
||||||
|
void putCurrentElement(String currEleName,String parent) {
|
||||||
|
%>
|
||||||
|
|
||||||
|
org.dom4j.Element <%=currEleName%>_<%=cid%> = <%getXMLNode(parent);%>.addElement("xsd:element");
|
||||||
|
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
|
||||||
|
void putRootElement() {
|
||||||
|
//do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<%
|
||||||
|
abstract class TouchXMLNode {
|
||||||
|
protected String cid = null;
|
||||||
|
|
||||||
|
abstract void getXMLNode(String currEleName);
|
||||||
|
|
||||||
|
abstract void getXMLElement(String currEleName);
|
||||||
|
|
||||||
|
abstract void putCurrentComplexTypeElement(String currEleName);
|
||||||
|
|
||||||
|
abstract void putCurrentSequenceElement(String currEleName);
|
||||||
|
|
||||||
|
abstract void putCurrentElement(String currEleName,String parent);
|
||||||
|
|
||||||
|
abstract void putRootElement();
|
||||||
|
}
|
||||||
|
%>
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
<%
|
||||||
|
// ------------------- *** Dom4j generation mode start *** ------------------- //
|
||||||
|
class XSDToolByDom4j{
|
||||||
|
String cid = null;
|
||||||
|
|
||||||
|
//opt for big xml config tree
|
||||||
|
BigMethodHelper bigMethodHelper = null;
|
||||||
|
TouchXMLNode touchXMLNode = null;
|
||||||
|
|
||||||
|
public XSDToolByDom4j() {
|
||||||
|
bigMethodHelper = new BigMethodHelper();
|
||||||
|
touchXMLNode = bigMethodHelper.getTouchXMLNode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void generateXSD(String parent, String currEleName, XMLNode root){
|
||||||
|
if(!("ELEMENT").equals(root.type)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bigMethodHelper.setGenerateId(currEleName);
|
||||||
|
//start the class
|
||||||
|
bigMethodHelper.generateClassNameWithRBlock();
|
||||||
|
|
||||||
|
bigMethodHelper.resetIndex();
|
||||||
|
|
||||||
|
generateMainCode(parent,currEleName,root);
|
||||||
|
|
||||||
|
//end the last method
|
||||||
|
bigMethodHelper.generateLeftBlock();
|
||||||
|
|
||||||
|
//end the class
|
||||||
|
bigMethodHelper.generateLeftBlock();
|
||||||
|
|
||||||
|
bigMethodHelper.generateMethodCall();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void generateMainCode(String parent, String currEleName, XMLNode root){
|
||||||
|
if(("ELEMENT").equals(root.type)){
|
||||||
|
bigMethodHelper.generateMethod();
|
||||||
|
|
||||||
|
createElement(parent,currEleName,root);
|
||||||
|
|
||||||
|
if(root.elements!=null && root.elements.size()>0
|
||||||
|
|| root.attributes!=null && root.attributes.size()>0){
|
||||||
|
|
||||||
|
touchXMLNode.putCurrentComplexTypeElement(currEleName);
|
||||||
|
touchXMLNode.putCurrentSequenceElement(currEleName);
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
for(XMLNode child:root.elements){
|
||||||
|
generateMainCode(currEleName+"_s", currEleName+"_"+index++, child);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(XMLNode attri:root.attributes){
|
||||||
|
createAttribute(currEleName+"_c",attri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createElement(String parent, String currEleName, XMLNode node){
|
||||||
|
touchXMLNode.putCurrentElement(currEleName,parent);
|
||||||
|
%>
|
||||||
|
<%touchXMLNode.getXMLElement(currEleName);%>.addAttribute("name","<%=node.name%>");
|
||||||
|
<%touchXMLNode.getXMLElement(currEleName);%>.addAttribute("nillable","true");
|
||||||
|
<%
|
||||||
|
if(node.parent != null){
|
||||||
|
%>
|
||||||
|
<%touchXMLNode.getXMLElement(currEleName);%>.addAttribute("minOccurs","0");
|
||||||
|
<%touchXMLNode.getXMLElement(currEleName);%>.addAttribute("maxOccurs","unbounded");
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createAttribute(String parent, XMLNode node){
|
||||||
|
%>
|
||||||
|
<%touchXMLNode.getXMLNode(parent);%>.addElement("xsd:attribute").addAttribute("name","<%=node.name%>");
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ------------------- *** Dom4j generation mode end *** ------------------- //
|
||||||
|
%>
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
<%
|
||||||
|
// ------------------- *** Null generation mode start *** ------------------- //
|
||||||
|
class XSDToolByNull{
|
||||||
|
String cid = null;
|
||||||
|
public void generateXSD(String emptyspace, XMLNode root){
|
||||||
|
if(("ELEMENT").equals(root.type)){
|
||||||
|
createElement(emptyspace, root);
|
||||||
|
|
||||||
|
if(root.elements!=null && root.elements.size()>0
|
||||||
|
|| root.attributes!=null && root.attributes.size()>0){
|
||||||
|
%>
|
||||||
|
out_xsd_<%=cid%>.write("<%=emptyspace%> <xsd:complexType>");
|
||||||
|
out_xsd_<%=cid%>.newLine();
|
||||||
|
out_xsd_<%=cid%>.write("<%=emptyspace%> <xsd:sequence>");
|
||||||
|
out_xsd_<%=cid%>.newLine();
|
||||||
|
<%
|
||||||
|
XMLNode mainNode = null;
|
||||||
|
for(XMLNode child:root.elements){
|
||||||
|
if( 1==(child.special & 4)){
|
||||||
|
mainNode = child;
|
||||||
|
}else{
|
||||||
|
generateXSD(emptyspace+" ", child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(mainNode!= null){
|
||||||
|
generateXSD(emptyspace+" ", mainNode);
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
out_xsd_<%=cid%>.write("<%=emptyspace%> </xsd:sequence>");
|
||||||
|
out_xsd_<%=cid%>.newLine();
|
||||||
|
<%
|
||||||
|
for(XMLNode attri:root.attributes){
|
||||||
|
createAttribute(emptyspace+" ",attri);
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
out_xsd_<%=cid%>.write("<%=emptyspace%> </xsd:complexType>");
|
||||||
|
out_xsd_<%=cid%>.newLine();
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
out_xsd_<%=cid%>.write("<%=emptyspace%></xsd:element>");
|
||||||
|
out_xsd_<%=cid%>.newLine();
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createElement(String emptyspace, XMLNode node){
|
||||||
|
%>
|
||||||
|
out_xsd_<%=cid%>.write("<%=emptyspace%><xsd:element name=\"<%=node.name%>\" nillable=\"true\" "+
|
||||||
|
<%
|
||||||
|
if(node.parent != null){
|
||||||
|
%>
|
||||||
|
"minOccurs=\"0\" maxOccurs=\"unbounded\""+
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
">");
|
||||||
|
out_xsd_<%=cid%>.newLine();
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createAttribute(String emptyspace, XMLNode node){
|
||||||
|
%>
|
||||||
|
out_xsd_<%=cid%>.write("<%=emptyspace%><xsd:attribute name= \"<%=node.name%>\"/>");
|
||||||
|
out_xsd_<%=cid%>.newLine();
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%>
|
||||||
@@ -67,6 +67,10 @@ if ((metadatas != null) && (metadatas.size() > 0)) {
|
|||||||
(List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__GROUP__");
|
(List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__GROUP__");
|
||||||
List<Map<String, String>> loopTable =
|
List<Map<String, String>> loopTable =
|
||||||
(List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__LOOP__");
|
(List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__LOOP__");
|
||||||
|
|
||||||
|
if(isMerge){
|
||||||
|
mode = "Dom4j";
|
||||||
|
}
|
||||||
|
|
||||||
if (!useStream) {
|
if (!useStream) {
|
||||||
%>
|
%>
|
||||||
@@ -376,7 +380,8 @@ if ((metadatas != null) && (metadatas.size() > 0)) {
|
|||||||
XMLNode root = mainList.get(0);
|
XMLNode root = mainList.get(0);
|
||||||
XMLNode loop = (XMLNode)treeObjs[2];
|
XMLNode loop = (XMLNode)treeObjs[2];
|
||||||
|
|
||||||
if(!("true").equals(allowEmpty)){
|
boolean isAppend = !useStream && isMerge;
|
||||||
|
if(!"true".equals(allowEmpty) && !(groupTable.size()>0 && isAppend)){
|
||||||
removeEmptyElement(root);
|
removeEmptyElement(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,253 +17,21 @@ skeleton="tAdvancedFileOutputXML_java.skeleton"
|
|||||||
<%
|
<%
|
||||||
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
|
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
|
||||||
final INode node = (INode)codeGenArgument.getArgument();
|
final INode node = (INode)codeGenArgument.getArgument();
|
||||||
|
%>
|
||||||
|
|
||||||
abstract class TouchXMLNode {
|
<%@ include file="./TouchXMLNode.javajet"%>
|
||||||
protected String cid = null;
|
|
||||||
|
|
||||||
abstract void getXMLNode(String currEleName);
|
|
||||||
|
|
||||||
abstract void getXMLElement(String currEleName);
|
|
||||||
|
|
||||||
abstract void putCurrentComplexTypeElement(String currEleName);
|
|
||||||
|
|
||||||
abstract void putCurrentSequenceElement(String currEleName);
|
|
||||||
|
|
||||||
abstract void putCurrentElement(String currEleName,String parent);
|
|
||||||
|
|
||||||
abstract void putRootElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
//get mean reference
|
<%@ include file="./ReferenceTouchXMLNode.javajet"%>
|
||||||
//put mean declare,assign action
|
|
||||||
class ReferenceTouchXMLNode extends TouchXMLNode {
|
|
||||||
|
|
||||||
void getXMLNode(String currEleName) {
|
<%@ include file="./MappingTouchXMLNode.javajet"%>
|
||||||
%>
|
|
||||||
<%=currEleName%>_<%=cid%>
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
|
|
||||||
void getXMLElement(String currEleName) {
|
|
||||||
getXMLNode(currEleName);
|
|
||||||
}
|
|
||||||
|
|
||||||
void putCurrentComplexTypeElement(String currEleName) {
|
|
||||||
%>
|
|
||||||
org.dom4j.Element <%=currEleName%>_c_<%=cid%> = <%getXMLNode(currEleName);%>.addElement("xsd:complexType");
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
|
|
||||||
void putCurrentSequenceElement(String currEleName) {
|
|
||||||
%>
|
|
||||||
org.dom4j.Element <%=currEleName%>_s_<%=cid%> = <%getXMLNode(currEleName + "_c");%>.addElement("xsd:sequence");
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
|
|
||||||
void putCurrentElement(String currEleName,String parent) {
|
|
||||||
%>
|
|
||||||
org.dom4j.Element <%=currEleName%>_<%=cid%> = <%getXMLNode(parent);%>.addElement("xsd:element");
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
|
|
||||||
void putRootElement() {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class MappingTouchXMLNode extends TouchXMLNode {
|
|
||||||
|
|
||||||
void getXMLNode(String currEleName) {
|
|
||||||
%>
|
|
||||||
nameToElement_<%=cid%>.get("<%=currEleName%>")
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
|
|
||||||
void getXMLElement(String currEleName) {
|
|
||||||
%>
|
|
||||||
((org.dom4j.Element)(nameToElement_<%=cid%>.get("<%=currEleName%>")))
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
|
|
||||||
void putCurrentComplexTypeElement(String currEleName) {
|
|
||||||
%>
|
|
||||||
nameToElement_<%=cid%>.put("<%=currEleName%>_c",<%getXMLNode(currEleName);%>.addElement("xsd:complexType"));
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
|
|
||||||
void putCurrentSequenceElement(String currEleName) {
|
|
||||||
%>
|
|
||||||
nameToElement_<%=cid%>.put("<%=currEleName%>_s",<%getXMLNode(currEleName + "_c");%>.addElement("xsd:sequence"));
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
|
|
||||||
void putCurrentElement(String currEleName,String parent) {
|
|
||||||
%>
|
|
||||||
nameToElement_<%=cid%>.put("<%=currEleName%>",<%getXMLNode(parent);%>.addElement("xsd:element"));
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
|
|
||||||
void putRootElement() {
|
|
||||||
%>
|
|
||||||
nameToElement_<%=cid%>.put("root_xsd",root_xsd_<%=cid%>);
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
|
|
||||||
<%@ include file="./BigMethodHelper.javajet"%>
|
<%@ include file="./BigMethodHelper.javajet"%>
|
||||||
|
|
||||||
<%
|
<%@ include file="./XSDToolByDom4j.javajet"%>
|
||||||
// ------------------- *** Dom4j generation mode start *** ------------------- //
|
|
||||||
class XSDToolByDom4j{
|
|
||||||
String cid = null;
|
|
||||||
|
|
||||||
//opt for big xml config tree
|
|
||||||
BigMethodHelper bigMethodHelper = null;
|
|
||||||
TouchXMLNode touchXMLNode = null;
|
|
||||||
|
|
||||||
public XSDToolByDom4j() {
|
|
||||||
bigMethodHelper = new BigMethodHelper();
|
|
||||||
touchXMLNode = bigMethodHelper.getTouchXMLNode();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void generateXSD(String parent, String currEleName, XMLNode root){
|
|
||||||
if(!("ELEMENT").equals(root.type)){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bigMethodHelper.setGenerateId(currEleName);
|
|
||||||
//start the class
|
|
||||||
bigMethodHelper.generateClassNameWithRBlock();
|
|
||||||
|
|
||||||
bigMethodHelper.resetIndex();
|
|
||||||
|
|
||||||
generateMainCode(parent,currEleName,root);
|
|
||||||
|
|
||||||
//end the last method
|
|
||||||
bigMethodHelper.generateLeftBlock();
|
|
||||||
|
|
||||||
//end the class
|
|
||||||
bigMethodHelper.generateLeftBlock();
|
|
||||||
|
|
||||||
bigMethodHelper.generateMethodCall();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void generateMainCode(String parent, String currEleName, XMLNode root){
|
|
||||||
if(("ELEMENT").equals(root.type)){
|
|
||||||
bigMethodHelper.generateMethod();
|
|
||||||
|
|
||||||
createElement(parent,currEleName,root);
|
|
||||||
|
|
||||||
if(root.elements!=null && root.elements.size()>0
|
|
||||||
|| root.attributes!=null && root.attributes.size()>0){
|
|
||||||
|
|
||||||
touchXMLNode.putCurrentComplexTypeElement(currEleName);
|
|
||||||
touchXMLNode.putCurrentSequenceElement(currEleName);
|
|
||||||
|
|
||||||
int index = 0;
|
|
||||||
for(XMLNode child:root.elements){
|
|
||||||
generateMainCode(currEleName+"_s", currEleName+"_"+index++, child);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(XMLNode attri:root.attributes){
|
|
||||||
createAttribute(currEleName+"_c",attri);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createElement(String parent, String currEleName, XMLNode node){
|
|
||||||
touchXMLNode.putCurrentElement(currEleName,parent);
|
|
||||||
%>
|
|
||||||
<%touchXMLNode.getXMLElement(currEleName);%>.addAttribute("name","<%=node.name%>");
|
|
||||||
<%touchXMLNode.getXMLElement(currEleName);%>.addAttribute("nillable","true");
|
|
||||||
<%
|
|
||||||
if(node.parent != null){
|
|
||||||
%>
|
|
||||||
<%touchXMLNode.getXMLElement(currEleName);%>.addAttribute("minOccurs","0");
|
|
||||||
<%touchXMLNode.getXMLElement(currEleName);%>.addAttribute("maxOccurs","unbounded");
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createAttribute(String parent, XMLNode node){
|
|
||||||
%>
|
|
||||||
<%touchXMLNode.getXMLNode(parent);%>.addElement("xsd:attribute").addAttribute("name","<%=node.name%>");
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ------------------- *** Dom4j generation mode end *** ------------------- //
|
|
||||||
|
|
||||||
// ------------------- *** Null generation mode start *** ------------------- //
|
<%@ include file="./XSDToolByNull.javajet"%>
|
||||||
class XSDToolByNull{
|
|
||||||
String cid = null;
|
|
||||||
public void generateXSD(String emptyspace, XMLNode root){
|
|
||||||
if(("ELEMENT").equals(root.type)){
|
|
||||||
createElement(emptyspace, root);
|
|
||||||
|
|
||||||
if(root.elements!=null && root.elements.size()>0
|
|
||||||
|| root.attributes!=null && root.attributes.size()>0){
|
|
||||||
%>
|
|
||||||
out_xsd_<%=cid%>.write("<%=emptyspace%> <xsd:complexType>");
|
|
||||||
out_xsd_<%=cid%>.newLine();
|
|
||||||
out_xsd_<%=cid%>.write("<%=emptyspace%> <xsd:sequence>");
|
|
||||||
out_xsd_<%=cid%>.newLine();
|
|
||||||
<%
|
|
||||||
XMLNode mainNode = null;
|
|
||||||
for(XMLNode child:root.elements){
|
|
||||||
if( 1==(child.special & 4)){
|
|
||||||
mainNode = child;
|
|
||||||
}else{
|
|
||||||
generateXSD(emptyspace+" ", child);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(mainNode!= null){
|
|
||||||
generateXSD(emptyspace+" ", mainNode);
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
out_xsd_<%=cid%>.write("<%=emptyspace%> </xsd:sequence>");
|
|
||||||
out_xsd_<%=cid%>.newLine();
|
|
||||||
<%
|
|
||||||
for(XMLNode attri:root.attributes){
|
|
||||||
createAttribute(emptyspace+" ",attri);
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
out_xsd_<%=cid%>.write("<%=emptyspace%> </xsd:complexType>");
|
|
||||||
out_xsd_<%=cid%>.newLine();
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
out_xsd_<%=cid%>.write("<%=emptyspace%></xsd:element>");
|
|
||||||
out_xsd_<%=cid%>.newLine();
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createElement(String emptyspace, XMLNode node){
|
|
||||||
%>
|
|
||||||
out_xsd_<%=cid%>.write("<%=emptyspace%><xsd:element name=\"<%=node.name%>\" nillable=\"true\" "+
|
|
||||||
<%
|
|
||||||
if(node.parent != null){
|
|
||||||
%>
|
|
||||||
"minOccurs=\"0\" maxOccurs=\"unbounded\""+
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
">");
|
|
||||||
out_xsd_<%=cid%>.newLine();
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createAttribute(String emptyspace, XMLNode node){
|
|
||||||
%>
|
|
||||||
out_xsd_<%=cid%>.write("<%=emptyspace%><xsd:attribute name= \"<%=node.name%>\"/>");
|
|
||||||
out_xsd_<%=cid%>.newLine();
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ------------------- *** Dom4j generation mode end *** ------------------- //
|
|
||||||
|
|
||||||
|
<%
|
||||||
// ------------------- *** Common code start *** ------------------- //
|
// ------------------- *** Common code start *** ------------------- //
|
||||||
String allowEmpty = ElementParameterParser.getValue(node, "__CREATE_EMPTY_ELEMENT__");
|
String allowEmpty = ElementParameterParser.getValue(node, "__CREATE_EMPTY_ELEMENT__");
|
||||||
String outputAsXSD = ElementParameterParser.getValue(node, "__OUTPUT_AS_XSD__");
|
String outputAsXSD = ElementParameterParser.getValue(node, "__OUTPUT_AS_XSD__");
|
||||||
@@ -288,6 +56,11 @@ boolean useStream = ("true").equals(ElementParameterParser.getValue(node,"__USES
|
|||||||
String outStream = ElementParameterParser.getValue(node,"__STREAMNAME__");
|
String outStream = ElementParameterParser.getValue(node,"__STREAMNAME__");
|
||||||
//*******************add for feature:8873 end ****************
|
//*******************add for feature:8873 end ****************
|
||||||
|
|
||||||
|
boolean isMerge= ("true").equals(ElementParameterParser.getValue(node, "__MERGE__"));
|
||||||
|
if(isMerge){
|
||||||
|
mode = "Dom4j";
|
||||||
|
}
|
||||||
|
|
||||||
List<IMetadataTable> metadatas = node.getMetadataList();
|
List<IMetadataTable> metadatas = node.getMetadataList();
|
||||||
if ((metadatas!=null)&&(metadatas.size()>0)) {
|
if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||||
if("Dom4j".equals(mode)){
|
if("Dom4j".equals(mode)){
|
||||||
@@ -425,8 +198,9 @@ globalMap.put("<%=cid_original %>_NB_LINE",nb_line_<%=cid %>);
|
|||||||
Object[] treeObjs = getTree(rootTable, groupTable, loopTable, metadatas.get(0).getListColumns());
|
Object[] treeObjs = getTree(rootTable, groupTable, loopTable, metadatas.get(0).getListColumns());
|
||||||
List<XMLNode> mainList = (ArrayList<XMLNode>)treeObjs[0];
|
List<XMLNode> mainList = (ArrayList<XMLNode>)treeObjs[0];
|
||||||
XMLNode root = mainList.get(0);
|
XMLNode root = mainList.get(0);
|
||||||
|
|
||||||
if(!("true").equals(allowEmpty)){
|
boolean isAppend = "true".equals(ElementParameterParser.getValue(node, "__MERGE__"));
|
||||||
|
if(!"true".equals(allowEmpty) && !(groupTable.size()>0 && isAppend)){
|
||||||
removeEmptyElement(root);
|
removeEmptyElement(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
<PARAMETER NAME="MERGE" FIELD="CHECK" REQUIRED="true"
|
<PARAMETER NAME="MERGE" FIELD="CHECK" REQUIRED="true"
|
||||||
NUM_ROW="60" NOT_SHOW_IF="USESTREAM=='true'">
|
NUM_ROW="60" NOT_SHOW_IF="USESTREAM=='true'" SHOW_IF="GENERATION_MODE=='DOM4J'">
|
||||||
<DEFAULT>false</DEFAULT>
|
<DEFAULT>false</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,10 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
|||||||
String xslType = ElementParameterParser.getValue(node, "__XSL_TYPE__");
|
String xslType = ElementParameterParser.getValue(node, "__XSL_TYPE__");
|
||||||
String xslHref = ElementParameterParser.getValue(node, "__XSL_HREF__");
|
String xslHref = ElementParameterParser.getValue(node, "__XSL_HREF__");
|
||||||
|
|
||||||
|
if(isMerge){
|
||||||
|
mode = "Dom4j";
|
||||||
|
}
|
||||||
|
|
||||||
int schemaOptNum=100;
|
int schemaOptNum=100;
|
||||||
boolean isOptimizeCode=false;
|
boolean isOptimizeCode=false;
|
||||||
String schemaOptNumStr=ElementParameterParser.getValue(node, "__SCHEMA_OPT_NUM__");
|
String schemaOptNumStr=ElementParameterParser.getValue(node, "__SCHEMA_OPT_NUM__");
|
||||||
@@ -112,7 +116,8 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
|||||||
XMLNode root = mainList.get(0);
|
XMLNode root = mainList.get(0);
|
||||||
XMLNode loop = (XMLNode)treeObjs[2];
|
XMLNode loop = (XMLNode)treeObjs[2];
|
||||||
|
|
||||||
if(!("true").equals(allowEmpty)){
|
boolean isAppend = !useStream && isMerge;
|
||||||
|
if(!"true".equals(allowEmpty) && !(groupTable.size()>0 && isAppend)){
|
||||||
removeEmptyElement(root);
|
removeEmptyElement(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -95,10 +95,10 @@
|
|||||||
boolean isAllRows = "ALL_ROWS".equals(matchingModeStr);
|
boolean isAllRows = "ALL_ROWS".equals(matchingModeStr);
|
||||||
|
|
||||||
boolean includeParallelComps = false;
|
boolean includeParallelComps = false;
|
||||||
List<? extends INode> listPartitions= node.getProcess().getNodesOfType("tPartitioner");
|
INode collectorNode = validTarget.getDesignSubjobStartNode();
|
||||||
if (listPartitions!=null && listPartitions.size() > 0 ) {
|
if ("tCollector".equals(collectorNode.getComponent().getName())) {
|
||||||
includeParallelComps = true;
|
includeParallelComps = true;
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
org.talend.designer.components.lookup.common.ICommonLookup.MATCHING_MODE matchingModeEnum_<%=connectionName%> =
|
org.talend.designer.components.lookup.common.ICommonLookup.MATCHING_MODE matchingModeEnum_<%=connectionName%> =
|
||||||
org.talend.designer.components.lookup.common.ICommonLookup.MATCHING_MODE.<%= matchingModeStr %>;
|
org.talend.designer.components.lookup.common.ICommonLookup.MATCHING_MODE.<%= matchingModeStr %>;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||||
org.talend.core.model.process.ElementParameterParser
|
org.talend.core.model.process.ElementParameterParser
|
||||||
java.util.List
|
java.util.List
|
||||||
|
org.talend.core.model.process.EConnectionType
|
||||||
org.talend.core.model.process.IHashableInputConnections
|
org.talend.core.model.process.IHashableInputConnections
|
||||||
org.talend.core.model.process.IHashConfiguration
|
org.talend.core.model.process.IHashConfiguration
|
||||||
org.talend.core.model.process.IDataConnection
|
org.talend.core.model.process.IDataConnection
|
||||||
@@ -49,24 +50,24 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
memoryStorage = !(hashConfiguration != null && hashConfiguration.isPersistent() || bSortOnDisk);
|
memoryStorage = !(hashConfiguration != null && hashConfiguration.isPersistent() || bSortOnDisk);
|
||||||
}
|
|
||||||
|
|
||||||
boolean includeParallelComps = false;
|
boolean includeParallelComps = false;
|
||||||
List<? extends INode> listPartitions= node.getProcess().getNodesOfType("tPartitioner");
|
INode partitionNode = validTarget.getDesignSubjobStartNode();
|
||||||
if (listPartitions!=null && listPartitions.size() > 0 ) {
|
if ("tCollector".equals(partitionNode.getComponent().getName())) {
|
||||||
includeParallelComps = true;
|
includeParallelComps = true;
|
||||||
|
partitionNode = partitionNode.getIncomingConnections(EConnectionType.STARTS).get(0).getSource();
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
tHash_Lookup_<%=connectionName%>.endPut();
|
tHash_Lookup_<%=connectionName%>.endPut();
|
||||||
<%
|
<%
|
||||||
if (includeParallelComps && memoryStorage && !isOneOfReloadLookupMode) {
|
if (includeParallelComps && memoryStorage && !isOneOfReloadLookupMode) {
|
||||||
%>
|
%>
|
||||||
java.util.List<java.util.concurrent.ConcurrentHashMap<String,Object>> mapsList_<%=cid%> =
|
java.util.List<java.util.Map<String,Object>> mapsList_<%=cid%> =
|
||||||
(java.util.List<java.util.concurrent.ConcurrentHashMap<String,Object>>)globalMap.get("THREAD_MAPS_"+jobName);
|
(java.util.List<java.util.Map<String,Object>>)globalMap.get("THREAD_MAPS_<%=partitionNode.getUniqueName()%>_"+jobName);
|
||||||
if (mapsList_<%=cid%> != null) {
|
if (mapsList_<%=cid%> != null) {
|
||||||
|
|
||||||
|
|
||||||
for (java.util.concurrent.ConcurrentHashMap<String,Object> map : mapsList_<%=cid%>) {
|
for (java.util.Map<String,Object> map : mapsList_<%=cid%>) {
|
||||||
org.talend.designer.components.lookup.memory.ConcurrentAdvancedMemoryLookup
|
org.talend.designer.components.lookup.memory.ConcurrentAdvancedMemoryLookup
|
||||||
<<%=connectionName%>Struct> tmp = (org.talend.designer.components.lookup.memory.ConcurrentAdvancedMemoryLookup
|
<<%=connectionName%>Struct> tmp = (org.talend.designer.components.lookup.memory.ConcurrentAdvancedMemoryLookup
|
||||||
<<%=connectionName%>Struct>)tHash_Lookup_<%=connectionName%>;
|
<<%=connectionName%>Struct>)tHash_Lookup_<%=connectionName%>;
|
||||||
@@ -101,6 +102,8 @@ java.util.List<java.util.concurrent.ConcurrentHashMap<String,Object>> mapsList_<
|
|||||||
<%
|
<%
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
|
|||||||
@@ -431,6 +431,6 @@
|
|||||||
<RETURN NAME="NB_LINE_INSERTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
<RETURN NAME="NB_LINE_INSERTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
||||||
<RETURN NAME="NB_LINE_DELETED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
<RETURN NAME="NB_LINE_DELETED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
||||||
<RETURN NAME="NB_LINE_REJECTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
<RETURN NAME="NB_LINE_REJECTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
||||||
<RETURN NAME="QUERY" TYPE="id_String" AVAILABILITY="AFTER" />
|
<RETURN NAME="QUERY" TYPE="id_String" AVAILABILITY="FLOW" SHOW_IF="ENABLE_DEBUG_MODE=='true'"/>
|
||||||
</RETURNS>
|
</RETURNS>
|
||||||
</COMPONENT>
|
</COMPONENT>
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ imports="
|
|||||||
org.talend.core.model.process.INode
|
org.talend.core.model.process.INode
|
||||||
org.talend.core.model.process.ElementParameterParser
|
org.talend.core.model.process.ElementParameterParser
|
||||||
org.talend.core.model.process.IConnection
|
org.talend.core.model.process.IConnection
|
||||||
org.talend.core.model.metadata.IMetadataTable
|
org.talend.core.model.metadata.IMetadataTable
|
||||||
|
org.talend.core.model.metadata.types.JavaTypesManager
|
||||||
org.talend.core.model.metadata.MappingTypeRetriever
|
org.talend.core.model.metadata.MappingTypeRetriever
|
||||||
org.talend.core.model.metadata.MetadataTalendType
|
org.talend.core.model.metadata.MetadataTalendType
|
||||||
java.util.List
|
java.util.List
|
||||||
@@ -97,12 +98,17 @@ if(columnList != null && columnList.size() > 0) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean xmlTypeExist = false;
|
boolean xmlTypeExist = false;
|
||||||
|
boolean clobTypeExist = false;
|
||||||
for(Column column : stmtStructure) {
|
for(Column column : stmtStructure) {
|
||||||
//when use Additional column column.getColumn() == null
|
//when use Additional column column.getColumn() == null
|
||||||
if (column.getColumn()!= null && "XMLTYPE".equals(column.getColumn().getType()) && !column.isDynamic()) {
|
if (column.getColumn()!= null && "XMLTYPE".equals(column.getColumn().getType()) && !column.isDynamic()) {
|
||||||
column.setSqlStmt("XMLType(?)");
|
column.setSqlStmt("XMLType(?)");
|
||||||
xmlTypeExist = true;
|
xmlTypeExist = true;
|
||||||
}
|
}
|
||||||
|
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||||
|
if (column.getColumn()!= null && "CLOB".equals(column.getColumn().getType()) && typeToGenerate.equals("Object") && !column.isDynamic()) {
|
||||||
|
clobTypeExist = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
|
|
||||||
@@ -409,42 +415,51 @@ if(columnList != null && columnList.size()>0) {
|
|||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
<%
|
<%
|
||||||
if (xmlTypeExist) {
|
}
|
||||||
|
if (xmlTypeExist || clobTypeExist) {
|
||||||
%>
|
%>
|
||||||
class XMLTypeUtil_<%=cid%> {
|
|
||||||
public oracle.sql.CLOB getCLOB(String xmlData, java.sql.Connection conn) throws java.sql.SQLException{
|
class ClobTypeUtil_<%=cid%> {
|
||||||
oracle.sql.CLOB tempClob = null;
|
public Object getCLOB(Object data, java.sql.Connection conn) throws java.sql.SQLException{
|
||||||
try{
|
oracle.sql.CLOB tempClob = null;
|
||||||
// If the temporary CLOB has not yet been created, create one
|
try{
|
||||||
tempClob = oracle.sql.CLOB.createTemporary(conn, true, oracle.sql.CLOB.DURATION_SESSION);
|
// If the temporary CLOB has not yet been created, create one
|
||||||
|
tempClob = oracle.sql.CLOB.createTemporary(conn, true, oracle.sql.CLOB.DURATION_SESSION);
|
||||||
// Open the temporary CLOB in readwrite mode, to enable writing
|
// Open the temporary CLOB in readwrite mode, to enable writing
|
||||||
tempClob.open(oracle.sql.CLOB.MODE_READWRITE);
|
tempClob.open(oracle.sql.CLOB.MODE_READWRITE);
|
||||||
// Get the output stream to write
|
// Get the output stream to write
|
||||||
java.io.Writer tempClobWriter = tempClob.getCharacterOutputStream();
|
java.io.Writer tempClobWriter = tempClob.getCharacterOutputStream();
|
||||||
// Write the data into the temporary CLOB
|
if(data instanceof oracle.sql.CLOB) {
|
||||||
tempClobWriter.write(xmlData);
|
oracle.sql.CLOB inClob = (oracle.sql.CLOB) data;
|
||||||
|
java.io.Reader inReader = inClob.getCharacterStream();
|
||||||
// Flush and close the stream
|
char[] chs = new char[128];
|
||||||
tempClobWriter.flush();
|
int len = 0;
|
||||||
tempClobWriter.close();
|
while ((len = inReader.read(chs)) != -1) {
|
||||||
|
tempClobWriter.write(chs, 0, len);
|
||||||
// Close the temporary CLOB
|
}
|
||||||
tempClob.close();
|
}else if(data instanceof String) {
|
||||||
} catch( java.sql.SQLException sqlexp){
|
// Write the data into the temporary CLOB
|
||||||
tempClob.freeTemporary();
|
tempClobWriter.write((String)data);
|
||||||
sqlexp.printStackTrace();
|
}else{
|
||||||
} catch(java.lang.Exception exp){
|
return data;
|
||||||
tempClob.freeTemporary();
|
}
|
||||||
exp.printStackTrace();
|
// Flush and close the stream
|
||||||
}
|
tempClobWriter.flush();
|
||||||
return tempClob;
|
tempClobWriter.close();
|
||||||
|
// Close the temporary CLOB
|
||||||
|
tempClob.close();
|
||||||
|
} catch( java.sql.SQLException sqlexp){
|
||||||
|
tempClob.freeTemporary();
|
||||||
|
sqlexp.printStackTrace();
|
||||||
|
} catch(java.lang.Exception exp){
|
||||||
|
tempClob.freeTemporary();
|
||||||
|
exp.printStackTrace();
|
||||||
|
}
|
||||||
|
return tempClob;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
XMLTypeUtil_<%=cid%> xmlTypeUtil_<%=cid%> = null;
|
ClobTypeUtil_<%=cid%> clobTypeUtil_<%=cid%>=new ClobTypeUtil_<%=cid%>();
|
||||||
xmlTypeUtil_<%=cid%> = new XMLTypeUtil_<%=cid%>();
|
|
||||||
<%
|
<%
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isDynamic) {
|
if(isDynamic) {
|
||||||
|
|||||||
@@ -448,6 +448,6 @@
|
|||||||
<RETURN NAME="NB_LINE_INSERTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
<RETURN NAME="NB_LINE_INSERTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
||||||
<RETURN NAME="NB_LINE_DELETED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
<RETURN NAME="NB_LINE_DELETED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
||||||
<RETURN NAME="NB_LINE_REJECTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
<RETURN NAME="NB_LINE_REJECTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
||||||
<RETURN NAME="QUERY" TYPE="id_String" AVAILABILITY="AFTER" />
|
<RETURN NAME="QUERY" TYPE="id_String" AVAILABILITY="FLOW" SHOW_IF="ENABLE_DEBUG_MODE=='true'"/>
|
||||||
</RETURNS>
|
</RETURNS>
|
||||||
</COMPONENT>
|
</COMPONENT>
|
||||||
|
|||||||
@@ -181,17 +181,12 @@ IMetadataColumn talendDynCol = null;
|
|||||||
|
|
||||||
if(!("".equals(insertColName.toString()))) {
|
if(!("".equals(insertColName.toString()))) {
|
||||||
%>
|
%>
|
||||||
String insert_<%=cid%> = "INSERT INTO " + tableName_<%=cid%> + " (<%=insertColName.toString()%>, "+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>,"<%=dbmsId %>")+") VALUES (<%=insertValueStmt.toString()%>, "+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
String insert_<%=cid%> = "INSERT INTO " + tableName_<%=cid%> + " (<%=insertColName.toString()%>, "+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>,"<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+") VALUES (<%=insertValueStmt.toString()%>, "+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
||||||
<% } else {
|
<% } else {
|
||||||
%>
|
%>
|
||||||
String insert_<%=cid%> = "INSERT INTO " + tableName_<%=cid%> + " ("+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+") VALUES ("+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
String insert_<%=cid%> = "INSERT INTO " + tableName_<%=cid%> + " ("+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+") VALUES ("+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if(convertToUppercase){
|
|
||||||
%>
|
|
||||||
insert_<%=cid%> = insert_<%=cid%>.toUpperCase();
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
<%@ include file="../templates/_hintInsert.javajet" %>
|
<%@ include file="../templates/_hintInsert.javajet" %>
|
||||||
@@ -223,17 +218,12 @@ IMetadataColumn talendDynCol = null;
|
|||||||
IConnection conn = conns_dynamic.get(0);
|
IConnection conn = conns_dynamic.get(0);
|
||||||
if(!("".equals(updateSetStmt.toString()))) {
|
if(!("".equals(updateSetStmt.toString()))) {
|
||||||
%>
|
%>
|
||||||
String update_<%=cid%> = "UPDATE " + tableName_<%=cid%> + " SET <%=updateSetStmt.toString()%>, "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+" WHERE <%=updateWhereStmt.toString()%>";
|
String update_<%=cid%> = "UPDATE " + tableName_<%=cid%> + " SET <%=updateSetStmt.toString()%>, "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+" WHERE <%=updateWhereStmt.toString()%>";
|
||||||
<% } else {
|
<% } else {
|
||||||
%>
|
%>
|
||||||
String update_<%=cid%> = "UPDATE " + tableName_<%=cid%> + " SET "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+" WHERE <%=updateWhereStmt.toString()%>";
|
String update_<%=cid%> = "UPDATE " + tableName_<%=cid%> + " SET "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+" WHERE <%=updateWhereStmt.toString()%>";
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if(convertToUppercase){
|
|
||||||
%>
|
|
||||||
update_<%=cid%> = update_<%=cid%>.toUpperCase();
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
<%@ include file="../templates/_hintUpdate.javajet" %>
|
<%@ include file="../templates/_hintUpdate.javajet" %>
|
||||||
@@ -241,7 +231,7 @@ IMetadataColumn talendDynCol = null;
|
|||||||
<%
|
<%
|
||||||
} else if (("INSERT_OR_UPDATE").equals(dataAction)) {
|
} else if (("INSERT_OR_UPDATE").equals(dataAction)) {
|
||||||
%>
|
%>
|
||||||
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(("SELECT COUNT(1) FROM " + tableName_<%=cid%> + " WHERE <%=updateWhereStmt.toString()%>")<%if(convertToUppercase){%>.toUpperCase()<%}%>);
|
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement("SELECT COUNT(1) FROM " + tableName_<%=cid%> + " WHERE <%=updateWhereStmt.toString()%>");
|
||||||
<%
|
<%
|
||||||
List< ? extends IConnection> conns_dynamic = node.getIncomingConnections();
|
List< ? extends IConnection> conns_dynamic = node.getIncomingConnections();
|
||||||
if(conns_dynamic!=null && conns_dynamic.size()>0){
|
if(conns_dynamic!=null && conns_dynamic.size()>0){
|
||||||
@@ -249,26 +239,20 @@ IMetadataColumn talendDynCol = null;
|
|||||||
|
|
||||||
if(!("".equals(insertColName.toString()))) {
|
if(!("".equals(insertColName.toString()))) {
|
||||||
%>
|
%>
|
||||||
String insert_<%=cid%> = "INSERT INTO " + tableName_<%=cid%> + " (<%=insertColName.toString()%>, "+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+") VALUES (<%=insertValueStmt.toString()%>, "+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
String insert_<%=cid%> = "INSERT INTO " + tableName_<%=cid%> + " (<%=insertColName.toString()%>, "+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+") VALUES (<%=insertValueStmt.toString()%>, "+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
||||||
<% } else {
|
<% } else {
|
||||||
%>
|
%>
|
||||||
String insert_<%=cid%> = "INSERT INTO " + tableName_<%=cid%> + " ("+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+") VALUES ("+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
String insert_<%=cid%> = "INSERT INTO " + tableName_<%=cid%> + " ("+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+") VALUES ("+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if(!("".equals(updateSetStmt.toString()))) {
|
if(!("".equals(updateSetStmt.toString()))) {
|
||||||
%>
|
%>
|
||||||
String update_<%=cid%> = "UPDATE " + tableName_<%=cid%> + " SET <%=updateSetStmt.toString()%>, "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+" WHERE <%=updateWhereStmt.toString()%>";
|
String update_<%=cid%> = "UPDATE " + tableName_<%=cid%> + " SET <%=updateSetStmt.toString()%>, "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+" WHERE <%=updateWhereStmt.toString()%>";
|
||||||
<% } else {
|
<% } else {
|
||||||
%>
|
%>
|
||||||
String update_<%=cid%> = "UPDATE " + tableName_<%=cid%> + " SET "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+" WHERE <%=updateWhereStmt.toString()%>";
|
String update_<%=cid%> = "UPDATE " + tableName_<%=cid%> + " SET "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+" WHERE <%=updateWhereStmt.toString()%>";
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if(convertToUppercase){
|
|
||||||
%>
|
|
||||||
insert_<%=cid%> = insert_<%=cid%>.toUpperCase();
|
|
||||||
update_<%=cid%> = update_<%=cid%>.toUpperCase();
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
<%@ include file="../templates/_hintInsert.javajet" %>
|
<%@ include file="../templates/_hintInsert.javajet" %>
|
||||||
@@ -283,26 +267,20 @@ IMetadataColumn talendDynCol = null;
|
|||||||
|
|
||||||
if(!("".equals(insertColName.toString()))) {
|
if(!("".equals(insertColName.toString()))) {
|
||||||
%>
|
%>
|
||||||
String insert_<%=cid%> = "INSERT INTO " + tableName_<%=cid%> + " (<%=insertColName.toString()%>, "+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+") VALUES (<%=insertValueStmt.toString()%>, "+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
String insert_<%=cid%> = "INSERT INTO " + tableName_<%=cid%> + " (<%=insertColName.toString()%>, "+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+") VALUES (<%=insertValueStmt.toString()%>, "+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
||||||
<% } else {
|
<% } else {
|
||||||
%>
|
%>
|
||||||
String insert_<%=cid%> = "INSERT INTO " + tableName_<%=cid%> + " ("+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+") VALUES ("+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
String insert_<%=cid%> = "INSERT INTO " + tableName_<%=cid%> + " ("+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+") VALUES ("+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if(!("".equals(updateSetStmt.toString()))) {
|
if(!("".equals(updateSetStmt.toString()))) {
|
||||||
%>
|
%>
|
||||||
String update_<%=cid%> = "UPDATE " + tableName_<%=cid%> + " SET <%=updateSetStmt.toString()%>, "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+" WHERE <%=updateWhereStmt.toString()%>";
|
String update_<%=cid%> = "UPDATE " + tableName_<%=cid%> + " SET <%=updateSetStmt.toString()%>, "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+" WHERE <%=updateWhereStmt.toString()%>";
|
||||||
<% } else {
|
<% } else {
|
||||||
%>
|
%>
|
||||||
String update_<%=cid%> = "UPDATE " + tableName_<%=cid%> + " SET "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+" WHERE <%=updateWhereStmt.toString()%>";
|
String update_<%=cid%> = "UPDATE " + tableName_<%=cid%> + " SET "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+" WHERE <%=updateWhereStmt.toString()%>";
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if(convertToUppercase){
|
|
||||||
%>
|
|
||||||
insert_<%=cid%> = insert_<%=cid%>.toUpperCase();
|
|
||||||
update_<%=cid%> = update_<%=cid%>.toUpperCase();
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
<%@ include file="../templates/_hintUpdate.javajet" %>
|
<%@ include file="../templates/_hintUpdate.javajet" %>
|
||||||
@@ -313,13 +291,6 @@ IMetadataColumn talendDynCol = null;
|
|||||||
} else if (("DELETE").equals(dataAction)) {
|
} else if (("DELETE").equals(dataAction)) {
|
||||||
%>
|
%>
|
||||||
String delete_<%=cid%> = "DELETE FROM " + tableName_<%=cid%> + " WHERE <%=deleteWhereStmt.toString()%>";
|
String delete_<%=cid%> = "DELETE FROM " + tableName_<%=cid%> + " WHERE <%=deleteWhereStmt.toString()%>";
|
||||||
<%
|
|
||||||
if(convertToUppercase){
|
|
||||||
%>
|
|
||||||
delete_<%=cid%> = delete_<%=cid%>.toUpperCase();
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
<%@ include file="../templates/_hintDelete.javajet" %>
|
<%@ include file="../templates/_hintDelete.javajet" %>
|
||||||
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(delete_<%=cid%>);
|
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(delete_<%=cid%>);
|
||||||
<%
|
<%
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ COMPATIBILITY="ALL"
|
|||||||
<COLUMN NAME="moment" TYPE="id_Date" PATTERN='"yyyy-MM-dd HH:mm:ss"'/>
|
<COLUMN NAME="moment" TYPE="id_Date" PATTERN='"yyyy-MM-dd HH:mm:ss"'/>
|
||||||
<COLUMN NAME="pid" TYPE="id_String" LENGTH="20"/>
|
<COLUMN NAME="pid" TYPE="id_String" LENGTH="20"/>
|
||||||
<COLUMN NAME="project" TYPE="id_String" LENGTH="50"/>
|
<COLUMN NAME="project" TYPE="id_String" LENGTH="50"/>
|
||||||
<COLUMN NAME="job" TYPE="id_String" LENGTH="50"/>
|
<COLUMN NAME="job" TYPE="id_String" LENGTH="255"/>
|
||||||
<COLUMN NAME="language" TYPE="id_String" LENGTH="5"/>
|
<COLUMN NAME="language" TYPE="id_String" LENGTH="5"/>
|
||||||
<COLUMN NAME="origin" TYPE="id_String" LENGTH="50"/>
|
<COLUMN NAME="origin" TYPE="id_String" LENGTH="50"/>
|
||||||
<COLUMN NAME="status" TYPE="id_String" LENGTH="10"/>
|
<COLUMN NAME="status" TYPE="id_String" LENGTH="10"/>
|
||||||
@@ -48,7 +48,7 @@ COMPATIBILITY="ALL"
|
|||||||
<COLUMN NAME="moment" TYPE="id_Date" PATTERN='"yyyy-MM-dd HH:mm:ss"'/>
|
<COLUMN NAME="moment" TYPE="id_Date" PATTERN='"yyyy-MM-dd HH:mm:ss"'/>
|
||||||
<COLUMN NAME="pid" TYPE="id_String" LENGTH="20"/>
|
<COLUMN NAME="pid" TYPE="id_String" LENGTH="20"/>
|
||||||
<COLUMN NAME="project" TYPE="id_String" LENGTH="50"/>
|
<COLUMN NAME="project" TYPE="id_String" LENGTH="50"/>
|
||||||
<COLUMN NAME="job" TYPE="id_String" LENGTH="50"/>
|
<COLUMN NAME="job" TYPE="id_String" LENGTH="255"/>
|
||||||
<COLUMN NAME="language" TYPE="id_String" LENGTH="5"/>
|
<COLUMN NAME="language" TYPE="id_String" LENGTH="5"/>
|
||||||
<COLUMN NAME="origin" TYPE="id_String" LENGTH="50"/>
|
<COLUMN NAME="origin" TYPE="id_String" LENGTH="50"/>
|
||||||
<COLUMN NAME="status" TYPE="id_String" LENGTH="10"/>
|
<COLUMN NAME="status" TYPE="id_String" LENGTH="10"/>
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
org.talend.core.model.process.INode
|
org.talend.core.model.process.INode
|
||||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||||
org.talend.core.model.process.ElementParameterParser
|
org.talend.core.model.process.ElementParameterParser
|
||||||
|
org.talend.core.model.process.IContextParameter
|
||||||
|
java.util.List
|
||||||
"
|
"
|
||||||
%>
|
%>
|
||||||
|
|
||||||
@@ -76,10 +78,22 @@
|
|||||||
globalMap.put("<%=cid%>_KEY_NOT_LOADED", noAssign_<%=cid %>);
|
globalMap.put("<%=cid%>_KEY_NOT_LOADED", noAssign_<%=cid %>);
|
||||||
|
|
||||||
globalMap.put("<%=cid %>_NB_LINE",nb_line_<%=cid %>);
|
globalMap.put("<%=cid %>_NB_LINE",nb_line_<%=cid %>);
|
||||||
|
|
||||||
resumeUtil.addLog("NODE", "NODE:<%=cid %>", "", Thread.currentThread().getId() + "", "","","","",resumeUtil.convertToJsonText(context));
|
List<String> parametersToEncrypt_<%=cid%> = new java.util.ArrayList<String>();
|
||||||
|
<%
|
||||||
|
List<IContextParameter> params = node.getProcess().getContextManager().getDefaultContext().getContextParameterList();
|
||||||
|
for(IContextParameter ctxParam :params) {
|
||||||
|
if ("id_Password".equals(ctxParam.getType())) {
|
||||||
|
%>
|
||||||
|
parametersToEncrypt_<%=cid%>.add("<%=ctxParam.getName()%>");
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
|
||||||
|
resumeUtil.addLog("NODE", "NODE:<%=cid %>", "", Thread.currentThread().getId() + "", "","","","",resumeUtil.convertToJsonText(context,parametersToEncrypt_<%=cid%>));
|
||||||
<%if(isLog4jEnabled){%>
|
<%if(isLog4jEnabled){%>
|
||||||
log.info("<%=cid%> - Loaded contexts count: " + nb_line_<%=cid %> + ".");
|
log.info("<%=cid%> - Loaded contexts count: " + nb_line_<%=cid %> + ".");
|
||||||
log.info("<%=cid%> - Done.");
|
log.info("<%=cid%> - Done.");
|
||||||
<%}%>
|
<%}%>
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ imports="
|
|||||||
org.talend.core.model.metadata.IMetadataTable
|
org.talend.core.model.metadata.IMetadataTable
|
||||||
org.talend.core.model.metadata.MappingTypeRetriever
|
org.talend.core.model.metadata.MappingTypeRetriever
|
||||||
org.talend.core.model.metadata.MetadataTalendType
|
org.talend.core.model.metadata.MetadataTalendType
|
||||||
|
org.talend.core.model.metadata.types.JavaTypesManager
|
||||||
|
org.talend.core.model.process.IConnectionCategory
|
||||||
org.talend.core.model.process.IConnection
|
org.talend.core.model.process.IConnection
|
||||||
|
org.talend.core.model.utils.NodeUtil
|
||||||
java.util.List
|
java.util.List
|
||||||
java.util.ArrayList
|
java.util.ArrayList
|
||||||
java.util.Map
|
java.util.Map
|
||||||
@@ -41,6 +44,15 @@ String batchSize=ElementParameterParser.getValue(node,"__BATCH_SIZE__");
|
|||||||
<%
|
<%
|
||||||
getManager(dbmsId, cid, node);
|
getManager(dbmsId, cid, node);
|
||||||
|
|
||||||
|
IConnection inputConn = null;
|
||||||
|
String incomingConnName = null;
|
||||||
|
|
||||||
|
List< ? extends IConnection> conns = node.getIncomingConnections();
|
||||||
|
if(conns!=null && conns.size()>0){
|
||||||
|
inputConn = conns.get(0);
|
||||||
|
incomingConnName = inputConn.getName();
|
||||||
|
}
|
||||||
|
|
||||||
boolean isDynamic = false;
|
boolean isDynamic = false;
|
||||||
List<IMetadataTable> metadatas = node.getMetadataList();
|
List<IMetadataTable> metadatas = node.getMetadataList();
|
||||||
if ((metadatas!=null)&&(metadatas.size()>0)) {
|
if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||||
@@ -66,6 +78,13 @@ if(columnList != null && columnList.size() > 0) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Column> colStruct = new ArrayList();
|
||||||
|
for(Column colStmt:stmtStructure) {
|
||||||
|
if(!colStmt.isReplaced()&&!colStmt.isAddCol()&&!colStmt.isDynamic()) {
|
||||||
|
colStruct.add(colStmt);
|
||||||
|
}
|
||||||
|
}
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<%
|
<%
|
||||||
@@ -185,7 +204,7 @@ if(!isDynamic) {
|
|||||||
%>
|
%>
|
||||||
int count_<%=cid%>=0;
|
int count_<%=cid%>=0;
|
||||||
<%
|
<%
|
||||||
if(columnList != null && columnList.size() > 0) {
|
if(columnList != null && columnList.size() > 0) {
|
||||||
Manager manager = null;
|
Manager manager = null;
|
||||||
%>
|
%>
|
||||||
<%@ include file="../templates/_tableActionForOutput.javajet"%>
|
<%@ include file="../templates/_tableActionForOutput.javajet"%>
|
||||||
@@ -235,7 +254,8 @@ if(columnList != null && columnList.size() > 0) {
|
|||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}// end isDynamic
|
}// end !isDynamic
|
||||||
|
|
||||||
if(isDynamic) {
|
if(isDynamic) {
|
||||||
%>
|
%>
|
||||||
java.sql.PreparedStatement pstmt_<%=cid %> =null;
|
java.sql.PreparedStatement pstmt_<%=cid %> =null;
|
||||||
@@ -247,7 +267,207 @@ if(isDynamic) {
|
|||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(incomingConnName==null || columnList == null || columnList.isEmpty()) {
|
||||||
|
return stringBuffer.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
int schemaOptNum = 100;
|
||||||
|
String schemaOptNumStr=ElementParameterParser.getValue(node, "__SCHEMA_OPT_NUM__");
|
||||||
|
if(schemaOptNumStr!=null && !"".equals(schemaOptNumStr) && !"\"\"".equals(schemaOptNumStr)){
|
||||||
|
schemaOptNum = Integer.parseInt(schemaOptNumStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(columnList.size() <= schemaOptNum) {//optimize for 65535 method size issue in java
|
||||||
|
return stringBuffer.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
%>
|
||||||
|
class SetPrepareStatementUtil_<%=cid%> {
|
||||||
|
<%
|
||||||
|
List<String> types = new ArrayList<String>();
|
||||||
|
if(dataAction!=null && dataAction.contains("INSERT")) {
|
||||||
|
types.add("Insert");
|
||||||
|
}
|
||||||
|
if(dataAction!=null && dataAction.contains("UPDATE")) {
|
||||||
|
types.add("Update");
|
||||||
|
}
|
||||||
|
for(String type : types) {
|
||||||
|
int counter = 1;
|
||||||
|
for(Column column : colStruct) {
|
||||||
|
if("Insert".equals(type) && !column.isInsertable()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if("Update".equals(type) && !column.isUpdatable()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||||
|
|
||||||
|
int actionType = NORMAL_TYPE;
|
||||||
|
String splits = "insertSQLSplits_";
|
||||||
|
|
||||||
|
if("INSERT_OR_UPDATE".equals(dataAction) || "UPDATE_OR_INSERT".equals(dataAction)) {
|
||||||
|
if("Insert".equals(type)) {
|
||||||
|
actionType = INSERT_TYPE;
|
||||||
|
} else if("Update".equals(type)) {
|
||||||
|
actionType = UPDATE_TYPE;
|
||||||
|
splits = "updateSQLSplits_";
|
||||||
|
}
|
||||||
|
} else if("UPDATE".equals(dataAction)) {
|
||||||
|
splits = "updateSQLSplits_";
|
||||||
|
}
|
||||||
|
|
||||||
|
if((counter-1)%schemaOptNum==0){//begin method
|
||||||
|
%>
|
||||||
|
void set<%=type%>_<%=(counter-1)/schemaOptNum%>(
|
||||||
|
final <%=NodeUtil.getPrivateConnClassName(inputConn) %>Struct <%=inputConn.getName() %>,
|
||||||
|
final java.sql.PreparedStatement
|
||||||
|
<%
|
||||||
|
if(actionType == NORMAL_TYPE) {
|
||||||
|
%>
|
||||||
|
pstmt_<%=cid%>
|
||||||
|
<%
|
||||||
|
} else if(actionType == INSERT_TYPE) {
|
||||||
|
%>
|
||||||
|
pstmtInsert_<%=cid%>
|
||||||
|
<%
|
||||||
|
} else {
|
||||||
|
%>
|
||||||
|
pstmtUpdate_<%=cid%>
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isEnableDebug) {
|
||||||
|
%>
|
||||||
|
,
|
||||||
|
final StringBuffer query_<%=cid%>
|
||||||
|
,
|
||||||
|
final String[] <%=splits%><%=cid%>
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
) throws java.sql.SQLException {
|
||||||
|
//}
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, column, counter, incomingConnName, cid, actionType)%>
|
||||||
|
<%
|
||||||
|
if(isEnableDebug) {
|
||||||
|
%>
|
||||||
|
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counter, splits)%>;
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
|
||||||
|
if(counter%schemaOptNum==0) {//close method
|
||||||
|
%>
|
||||||
|
//{
|
||||||
|
}
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((counter-1) >0&&((counter-1)%schemaOptNum)>0){//close method
|
||||||
|
%>
|
||||||
|
//{
|
||||||
|
}
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
}
|
||||||
|
|
||||||
|
SetPrepareStatementUtil_<%=cid%> setPrepareStatementUtil_<%=cid%> = new SetPrepareStatementUtil_<%=cid%>();
|
||||||
|
|
||||||
|
<%
|
||||||
|
IConnection rejectConn = null;
|
||||||
|
List<? extends IConnection> rejectConns = node.getOutgoingConnections("REJECT");
|
||||||
|
if(rejectConns != null && rejectConns.size() > 0) {
|
||||||
|
rejectConn = rejectConns.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<? extends IConnection> outgoingConns = node.getOutgoingSortedConnections();
|
||||||
|
|
||||||
|
IConnection outputConn = null;
|
||||||
|
|
||||||
|
for(IConnection outgoingConn : outgoingConns) {
|
||||||
|
if(rejectConn == null || (rejectConn != null && !outgoingConn.getName().equals(rejectConn.getName()))) {
|
||||||
|
if(outgoingConn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||||
|
outputConn = outgoingConn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<IConnection> outputConns = new ArrayList<IConnection>();
|
||||||
|
|
||||||
|
if(outputConn!=null) {
|
||||||
|
outputConns.add(outputConn);
|
||||||
|
}
|
||||||
|
|
||||||
|
String dieOnError = ElementParameterParser.getValue(node, "__DIE_ON_ERROR__");
|
||||||
|
List<IMetadataColumn> rejectColumnList = null;
|
||||||
|
IMetadataTable metadataTable = node.getMetadataFromConnector("REJECT");
|
||||||
|
if(metadataTable != null) {
|
||||||
|
rejectColumnList = metadataTable.getListColumns();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!"true".equals(dieOnError) && rejectConn != null && rejectColumnList != null && rejectColumnList.size() > 0) {
|
||||||
|
outputConns.add(rejectConn);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(outputConns.isEmpty()) {
|
||||||
|
return stringBuffer.toString();
|
||||||
|
}
|
||||||
%>
|
%>
|
||||||
|
|
||||||
|
class DataPropagateUtil_<%=cid%> {
|
||||||
|
<%
|
||||||
|
for(IConnection outputConnection : outputConns) {
|
||||||
|
String sourceObjectName = incomingConnName;
|
||||||
|
String sourceObjectType = NodeUtil.getPrivateConnClassName(inputConn);
|
||||||
|
|
||||||
|
String targetObjectName = outputConnection.getName();
|
||||||
|
String targetObjectType = NodeUtil.getPrivateConnClassName(outputConnection);
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
for(IMetadataColumn column : columnList) {
|
||||||
|
if(index%schemaOptNum==0){//begin method
|
||||||
|
%>
|
||||||
|
void assign_<%=targetObjectName%>_<%=index/schemaOptNum%>(final <%=sourceObjectType%>Struct <%=sourceObjectName%>,final <%=targetObjectType%>Struct <%=targetObjectName%>) {
|
||||||
|
//}
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
|
||||||
|
//do assign
|
||||||
|
%>
|
||||||
|
<%=targetObjectName%>.<%=column.getLabel()%> = <%=sourceObjectName%>.<%=column.getLabel()%>;
|
||||||
|
<%
|
||||||
|
|
||||||
|
if((index+1)%schemaOptNum==0) {//close method
|
||||||
|
%>
|
||||||
|
//{
|
||||||
|
}
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(index>0&&(index%schemaOptNum)>0){//close method
|
||||||
|
%>
|
||||||
|
//{
|
||||||
|
}
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
}
|
||||||
|
|
||||||
|
DataPropagateUtil_<%=cid%> dataPropagateUtil_<%=cid%> = new DataPropagateUtil_<%=cid%>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -179,7 +179,7 @@
|
|||||||
</ITEMS>
|
</ITEMS>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
<PARAMETER NAME="NOTE_CUSTOMER" FIELD="LABEL" REQUIRED="true" NUM_ROW="36" COLOR="255;0;0" SHOW_IF="(PARALLELIZE == 'false') AND ((TABLE_ACTION == 'TRUNCATE') OR (TABLE_ACTION == 'TRUNCATE_REUSE_STORAGE')) AND (USE_EXISTING_CONNECTION == 'true')">
|
<PARAMETER NAME="NOTE_CUSTOMER" FIELD="LABEL" REQUIRED="true" NUM_ROW="36" COLOR="255;0;0" NOT_SHOW_IF="(PARALLELIZE == 'true') OR ((TABLE_ACTION != 'TRUNCATE') AND (TABLE_ACTION != 'TRUNCATE_REUSE_STORAGE')) OR (USE_EXISTING_CONNECTION == 'false')">
|
||||||
<DEFAULT>Please note: The Truncate statement must be the first statement in a transaction, so it will invoke commit statement before truncate</DEFAULT>
|
<DEFAULT>Please note: The Truncate statement must be the first statement in a transaction, so it will invoke commit statement before truncate</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
@@ -346,6 +346,10 @@
|
|||||||
>
|
>
|
||||||
<DEFAULT>10000</DEFAULT>
|
<DEFAULT>10000</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER NAME="SCHEMA_OPT_NUM" FIELD="TEXT" NUM_ROW="40" SHOW="false">
|
||||||
|
<DEFAULT>100</DEFAULT>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
</ADVANCED_PARAMETERS>
|
</ADVANCED_PARAMETERS>
|
||||||
|
|
||||||
@@ -363,6 +367,6 @@
|
|||||||
<RETURN NAME="NB_LINE_INSERTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
<RETURN NAME="NB_LINE_INSERTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
||||||
<RETURN NAME="NB_LINE_DELETED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
<RETURN NAME="NB_LINE_DELETED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
||||||
<RETURN NAME="NB_LINE_REJECTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
<RETURN NAME="NB_LINE_REJECTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
||||||
<RETURN NAME="QUERY" TYPE="id_String" AVAILABILITY="AFTER" />
|
<RETURN NAME="QUERY" TYPE="id_String" AVAILABILITY="FLOW" SHOW_IF="ENABLE_DEBUG_MODE=='true'"/>
|
||||||
</RETURNS>
|
</RETURNS>
|
||||||
</COMPONENT>
|
</COMPONENT>
|
||||||
|
|||||||
@@ -85,8 +85,24 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
isDynamic = metadata.isDynamicSchema();
|
isDynamic = metadata.isDynamicSchema();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Column> stmtStructure = getManager(dbmsId, cid).createColumnList(columnList, useFieldOptions, fieldOptions, addCols);
|
List<Column> stmtStructure = null;
|
||||||
isDynamic = isDynamic && !getManager(dbmsId, cid).isDynamicColumnReplaced();
|
if(columnList != null && columnList.size() > 0) {
|
||||||
|
stmtStructure = getManager(dbmsId, cid).createColumnList(columnList, useFieldOptions, fieldOptions, addCols);
|
||||||
|
isDynamic = isDynamic && !getManager(dbmsId, cid).isDynamicColumnReplaced();
|
||||||
|
|
||||||
|
if(convertToUppercase) {
|
||||||
|
for(Column column : stmtStructure) {
|
||||||
|
if(column.isReplaced()) {
|
||||||
|
for (Column replacedColumn : column.getReplacement()) {
|
||||||
|
replacedColumn.setColumnName(replacedColumn.getColumnName().toUpperCase());
|
||||||
|
}
|
||||||
|
} else if(!column.isDynamic()){
|
||||||
|
column.setColumnName(column.getColumnName().toUpperCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IMetadataColumn talendDynCol = null;
|
IMetadataColumn talendDynCol = null;
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
List<Column> colStruct = new ArrayList();
|
List<Column> colStruct = new ArrayList();
|
||||||
@@ -125,17 +141,12 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
IConnection conn = conns_dynamic.get(0);
|
IConnection conn = conns_dynamic.get(0);
|
||||||
if(!("".equals(insertColName.toString()))) {
|
if(!("".equals(insertColName.toString()))) {
|
||||||
%>
|
%>
|
||||||
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\" (<%=insertColName.toString()%>, "+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+") VALUES (<%=insertValueStmt.toString()%>, "+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\" (<%=insertColName.toString()%>, "+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+") VALUES (<%=insertValueStmt.toString()%>, "+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
||||||
<% } else {
|
<% } else {
|
||||||
%>
|
%>
|
||||||
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\" ("+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+") VALUES ("+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\" ("+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+") VALUES ("+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if(convertToUppercase){
|
|
||||||
%>
|
|
||||||
insert_<%=cid%> = insert_<%=cid%>.toUpperCase();
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(insert_<%=cid%>);
|
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(insert_<%=cid%>);
|
||||||
@@ -146,17 +157,12 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
IConnection conn = conns_dynamic.get(0);
|
IConnection conn = conns_dynamic.get(0);
|
||||||
if(!("".equals(updateSetStmt.toString()))) {
|
if(!("".equals(updateSetStmt.toString()))) {
|
||||||
%>
|
%>
|
||||||
String update_<%=cid%> = "UPDATE \"" + tableName_<%=cid%> + "\" SET <%=updateSetStmt.toString()%>, "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+" WHERE <%=updateWhereStmt.toString()%>";
|
String update_<%=cid%> = "UPDATE \"" + tableName_<%=cid%> + "\" SET <%=updateSetStmt.toString()%>, "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+" WHERE <%=updateWhereStmt.toString()%>";
|
||||||
<% } else {
|
<% } else {
|
||||||
%>
|
%>
|
||||||
String update_<%=cid%> = "UPDATE \"" + tableName_<%=cid%> + "\" SET "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+" WHERE <%=updateWhereStmt.toString()%>";
|
String update_<%=cid%> = "UPDATE \"" + tableName_<%=cid%> + "\" SET "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+" WHERE <%=updateWhereStmt.toString()%>";
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if(convertToUppercase){
|
|
||||||
%>
|
|
||||||
update_<%=cid%> = update_<%=cid%>.toUpperCase();
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(update_<%=cid%>);
|
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(update_<%=cid%>);
|
||||||
@@ -167,29 +173,23 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
IConnection conn = conns_dynamic.get(0);
|
IConnection conn = conns_dynamic.get(0);
|
||||||
if(!("".equals(insertColName.toString()))) {
|
if(!("".equals(insertColName.toString()))) {
|
||||||
%>
|
%>
|
||||||
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\" (<%=insertColName.toString()%>, "+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+") VALUES (<%=insertValueStmt.toString()%>, "+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\" (<%=insertColName.toString()%>, "+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+") VALUES (<%=insertValueStmt.toString()%>, "+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
||||||
<% } else {
|
<% } else {
|
||||||
%>
|
%>
|
||||||
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\" ("+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+") VALUES ("+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\" ("+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+") VALUES ("+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if(!("".equals(updateSetStmt.toString()))) {
|
if(!("".equals(updateSetStmt.toString()))) {
|
||||||
%>
|
%>
|
||||||
String update_<%=cid%> = "UPDATE \"" + tableName_<%=cid%> + "\" SET <%=updateSetStmt.toString()%>, "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+" WHERE <%=updateWhereStmt.toString()%>";
|
String update_<%=cid%> = "UPDATE \"" + tableName_<%=cid%> + "\" SET <%=updateSetStmt.toString()%>, "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+" WHERE <%=updateWhereStmt.toString()%>";
|
||||||
<% } else {
|
<% } else {
|
||||||
%>
|
%>
|
||||||
String update_<%=cid%> = "UPDATE \"" + tableName_<%=cid%> + "\" SET "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+" WHERE <%=updateWhereStmt.toString()%>";
|
String update_<%=cid%> = "UPDATE \"" + tableName_<%=cid%> + "\" SET "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+" WHERE <%=updateWhereStmt.toString()%>";
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if(convertToUppercase){
|
|
||||||
%>
|
|
||||||
insert_<%=cid%> = insert_<%=cid%>.toUpperCase();
|
|
||||||
update_<%=cid%> = update_<%=cid%>.toUpperCase();
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(("SELECT COUNT(1) FROM \"" + tableName_<%=cid%> + "\" WHERE <%=updateWhereStmt.toString()%>")<%if(convertToUppercase){%>.toUpperCase()<%}%>);
|
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement("SELECT COUNT(1) FROM \"" + tableName_<%=cid%> + "\" WHERE <%=updateWhereStmt.toString()%>");
|
||||||
pstmtInsert_<%=cid %> = conn_<%=cid%>.prepareStatement(insert_<%=cid%>);
|
pstmtInsert_<%=cid %> = conn_<%=cid%>.prepareStatement(insert_<%=cid%>);
|
||||||
pstmtUpdate_<%=cid %> = conn_<%=cid%>.prepareStatement(update_<%=cid%>);
|
pstmtUpdate_<%=cid %> = conn_<%=cid%>.prepareStatement(update_<%=cid%>);
|
||||||
<%
|
<%
|
||||||
@@ -199,26 +199,20 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
IConnection conn = conns_dynamic.get(0);
|
IConnection conn = conns_dynamic.get(0);
|
||||||
if(!("".equals(insertColName.toString()))) {
|
if(!("".equals(insertColName.toString()))) {
|
||||||
%>
|
%>
|
||||||
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\" (<%=insertColName.toString()%>, "+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+") VALUES (<%=insertValueStmt.toString()%>, "+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\" (<%=insertColName.toString()%>, "+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+") VALUES (<%=insertValueStmt.toString()%>, "+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
||||||
<% } else {
|
<% } else {
|
||||||
%>
|
%>
|
||||||
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\" ("+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+") VALUES ("+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\" ("+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+") VALUES ("+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if(!("".equals(updateSetStmt.toString()))) {
|
if(!("".equals(updateSetStmt.toString()))) {
|
||||||
%>
|
%>
|
||||||
String update_<%=cid%> = "UPDATE \"" + tableName_<%=cid%> + "\" SET <%=updateSetStmt.toString()%>, "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+" WHERE <%=updateWhereStmt.toString()%>";
|
String update_<%=cid%> = "UPDATE \"" + tableName_<%=cid%> + "\" SET <%=updateSetStmt.toString()%>, "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+" WHERE <%=updateWhereStmt.toString()%>";
|
||||||
<% } else {
|
<% } else {
|
||||||
%>
|
%>
|
||||||
String update_<%=cid%> = "UPDATE \"" + tableName_<%=cid%> + "\" SET "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+" WHERE <%=updateWhereStmt.toString()%>";
|
String update_<%=cid%> = "UPDATE \"" + tableName_<%=cid%> + "\" SET "+DynamicUtils.getUpdateSet(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToUppercase){%>.toUpperCase()<%}%>+" WHERE <%=updateWhereStmt.toString()%>";
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if(convertToUppercase){
|
|
||||||
%>
|
|
||||||
insert_<%=cid%> = insert_<%=cid%>.toUpperCase();
|
|
||||||
update_<%=cid%> = update_<%=cid%>.toUpperCase();
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
pstmtUpdate_<%=cid %> = conn_<%=cid%>.prepareStatement(update_<%=cid%>);
|
pstmtUpdate_<%=cid %> = conn_<%=cid%>.prepareStatement(update_<%=cid%>);
|
||||||
@@ -226,14 +220,7 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
<%
|
<%
|
||||||
} else if (("DELETE").equals(dataAction)) {
|
} else if (("DELETE").equals(dataAction)) {
|
||||||
%>
|
%>
|
||||||
String delete_<%=cid%> = "DELETE FROM \"" + tableName_<%=cid%> + "\" WHERE <%=deleteWhereStmt.toString()%>";
|
String delete_<%=cid%> = "DELETE FROM \"" + tableName_<%=cid%> + "\" WHERE <%=deleteWhereStmt.toString()%>";
|
||||||
<%
|
|
||||||
if(convertToUppercase){
|
|
||||||
%>
|
|
||||||
delete_<%=cid%> = delete_<%=cid%>.toUpperCase();
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(delete_<%=cid%>);
|
pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(delete_<%=cid%>);
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
@@ -272,24 +259,44 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
} // end bug0014422
|
} // end bug0014422
|
||||||
|
|
||||||
if(incomingConnName != null && columnList != null){
|
if(incomingConnName != null && columnList != null){
|
||||||
|
int schemaOptNum = 100;
|
||||||
|
String schemaOptNumStr=ElementParameterParser.getValue(node, "__SCHEMA_OPT_NUM__");
|
||||||
|
if(schemaOptNumStr!=null && !"".equals(schemaOptNumStr) && !"\"\"".equals(schemaOptNumStr)){
|
||||||
|
schemaOptNum = Integer.parseInt(schemaOptNumStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean optimize65535 = columnList.size() > schemaOptNum;//optimize for 65535 method size issue in java
|
||||||
%>
|
%>
|
||||||
whetherReject_<%=cid%> = false;
|
whetherReject_<%=cid%> = false;
|
||||||
<%
|
<%
|
||||||
if(("INSERT").equals(dataAction)) {
|
if(("INSERT").equals(dataAction)) {
|
||||||
int counter = 1;
|
int counter = 1;
|
||||||
for(Column column : colStruct) {
|
for(Column column : colStruct) {
|
||||||
if(column.isInsertable()) {
|
if(!column.isInsertable()) {
|
||||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(optimize65535) {
|
||||||
|
if((counter-1)%schemaOptNum==0){
|
||||||
|
%>
|
||||||
|
setPrepareStatementUtil_<%=cid%>.setInsert_<%=(counter-1)/schemaOptNum%>(<%=incomingConnName%>,pstmt_<%=cid%>
|
||||||
|
<%if(isEnableDebug) {%>,query_<%=cid%>,insertSQLSplits_<%=cid%><%}%>
|
||||||
|
);
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||||
%>
|
%>
|
||||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, column, counter, incomingConnName, cid, NORMAL_TYPE)%>
|
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, column, counter, incomingConnName, cid, NORMAL_TYPE)%>
|
||||||
<%
|
<%
|
||||||
if(isEnableDebug) {
|
if(isEnableDebug) {
|
||||||
%>
|
%>
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counter, "insertSQLSplits_")%>;
|
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counter, "insertSQLSplits_")%>;
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
counter++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
counter++;
|
||||||
}
|
}
|
||||||
if(isDynamic) {
|
if(isDynamic) {
|
||||||
Column dynamicColumn = getColumn(getDynamicColumn());
|
Column dynamicColumn = getColumn(getDynamicColumn());
|
||||||
@@ -339,11 +346,21 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
%>
|
%>
|
||||||
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
||||||
<%
|
<%
|
||||||
|
int index = 0;
|
||||||
for(IMetadataColumn column : columnList) {
|
for(IMetadataColumn column : columnList) {
|
||||||
%>
|
if(optimize65535) {
|
||||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
if(index%schemaOptNum==0) {
|
||||||
<%
|
%>
|
||||||
}
|
dataPropagateUtil_<%=cid%>.assign_<%=rejectConnName%>_<%=index/schemaOptNum%>(<%=incomingConnName%>,<%=rejectConnName%>);
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
} else {
|
||||||
|
%>
|
||||||
|
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
}
|
||||||
%>
|
%>
|
||||||
rejectedCount_<%=cid%> = rejectedCount_<%=cid%> + 1;
|
rejectedCount_<%=cid%> = rejectedCount_<%=cid%> + 1;
|
||||||
<%=rejectConnName%>.errorCode = ((java.sql.SQLException)e).getSQLState();
|
<%=rejectConnName%>.errorCode = ((java.sql.SQLException)e).getSQLState();
|
||||||
@@ -364,18 +381,31 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
} else if(("UPDATE").equals(dataAction)) {
|
} else if(("UPDATE").equals(dataAction)) {
|
||||||
int counterCol = 1;
|
int counterCol = 1;
|
||||||
for(Column column : colStruct) {
|
for(Column column : colStruct) {
|
||||||
if(column.isUpdatable()) {
|
if(!column.isUpdatable()) {
|
||||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
continue;
|
||||||
%>
|
|
||||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, column, counterCol, incomingConnName, cid, NORMAL_TYPE)%>
|
|
||||||
<%
|
|
||||||
if(isEnableDebug) {
|
|
||||||
%>
|
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
counterCol++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(optimize65535) {
|
||||||
|
if((counterCol-1)%schemaOptNum==0){
|
||||||
|
%>
|
||||||
|
setPrepareStatementUtil_<%=cid%>.setUpdate_<%=(counterCol-1)/schemaOptNum%>(<%=incomingConnName%>,pstmt_<%=cid%>
|
||||||
|
<%if(isEnableDebug) {%>,query_<%=cid%>,updateSQLSplits_<%=cid%><%}%>
|
||||||
|
);
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||||
|
%>
|
||||||
|
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, column, counterCol, incomingConnName, cid, NORMAL_TYPE)%>
|
||||||
|
<%
|
||||||
|
if(isEnableDebug) {
|
||||||
|
%>
|
||||||
|
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
counterCol++;
|
||||||
}
|
}
|
||||||
if(isDynamic) {
|
if(isDynamic) {
|
||||||
Column dynamicColumn = getColumn(talendDynCol);
|
Column dynamicColumn = getColumn(talendDynCol);
|
||||||
@@ -409,11 +439,11 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
if(isEnableDebug) {
|
if(isEnableDebug) {
|
||||||
if(isDynamic){
|
if(isDynamic){
|
||||||
%>
|
%>
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
<%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
||||||
<%
|
<%
|
||||||
}else{
|
}else{
|
||||||
%>
|
%>
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
<%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -427,11 +457,11 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
|
|
||||||
if(isDynamic){
|
if(isDynamic){
|
||||||
%>
|
%>
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
<%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||||
<%
|
<%
|
||||||
}else{
|
}else{
|
||||||
%>
|
%>
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
<%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -472,11 +502,21 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
%>
|
%>
|
||||||
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
||||||
<%
|
<%
|
||||||
|
int index = 0;
|
||||||
for(IMetadataColumn column : columnList) {
|
for(IMetadataColumn column : columnList) {
|
||||||
%>
|
if(optimize65535) {
|
||||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
if(index%schemaOptNum==0) {
|
||||||
<%
|
%>
|
||||||
}
|
dataPropagateUtil_<%=cid%>.assign_<%=rejectConnName%>_<%=index/schemaOptNum%>(<%=incomingConnName%>,<%=rejectConnName%>);
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
} else {
|
||||||
|
%>
|
||||||
|
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
}
|
||||||
%>
|
%>
|
||||||
rejectedCount_<%=cid%> = rejectedCount_<%=cid%> + 1;
|
rejectedCount_<%=cid%> = rejectedCount_<%=cid%> + 1;
|
||||||
<%=rejectConnName%>.errorCode = ((java.sql.SQLException)e).getSQLState();
|
<%=rejectConnName%>.errorCode = ((java.sql.SQLException)e).getSQLState();
|
||||||
@@ -526,18 +566,31 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
<%
|
<%
|
||||||
int counterCol = 1;
|
int counterCol = 1;
|
||||||
for(Column column : colStruct) {
|
for(Column column : colStruct) {
|
||||||
if(column.isUpdatable()) {
|
if(!column.isUpdatable()) {
|
||||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(optimize65535) {
|
||||||
|
if((counterCol-1)%schemaOptNum==0){
|
||||||
|
%>
|
||||||
|
setPrepareStatementUtil_<%=cid%>.setUpdate_<%=(counterCol-1)/schemaOptNum%>(<%=incomingConnName%>,pstmtUpdate_<%=cid%>
|
||||||
|
<%if(isEnableDebug) {%>,query_<%=cid%>,updateSQLSplits_<%=cid%><%}%>
|
||||||
|
);
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||||
%>
|
%>
|
||||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, column, counterCol, incomingConnName, cid, UPDATE_TYPE)%>
|
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, column, counterCol, incomingConnName, cid, UPDATE_TYPE)%>
|
||||||
<%
|
<%
|
||||||
if(isEnableDebug) {
|
if(isEnableDebug) {
|
||||||
%>
|
%>
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
counterCol++;
|
}
|
||||||
}
|
|
||||||
|
counterCol++;
|
||||||
}
|
}
|
||||||
if(isDynamic) {
|
if(isDynamic) {
|
||||||
Column dynamicColumn = getColumn(getDynamicColumn());
|
Column dynamicColumn = getColumn(getDynamicColumn());
|
||||||
@@ -571,11 +624,11 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
if(isEnableDebug) {
|
if(isEnableDebug) {
|
||||||
if(isDynamic){
|
if(isDynamic){
|
||||||
%>
|
%>
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
<%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
||||||
<%
|
<%
|
||||||
}else{
|
}else{
|
||||||
%>
|
%>
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
<%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -589,11 +642,11 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
if(isEnableDebug) {
|
if(isEnableDebug) {
|
||||||
if(isDynamic){
|
if(isDynamic){
|
||||||
%>
|
%>
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
<%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||||
<%
|
<%
|
||||||
}else{
|
}else{
|
||||||
%>
|
%>
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
<%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counterCol, "updateSQLSplits_")%>;
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -620,11 +673,21 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
%>
|
%>
|
||||||
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
||||||
<%
|
<%
|
||||||
|
int index = 0;
|
||||||
for(IMetadataColumn column : columnList) {
|
for(IMetadataColumn column : columnList) {
|
||||||
%>
|
if(optimize65535) {
|
||||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
if(index%schemaOptNum==0) {
|
||||||
<%
|
%>
|
||||||
}
|
dataPropagateUtil_<%=cid%>.assign_<%=rejectConnName%>_<%=index/schemaOptNum%>(<%=incomingConnName%>,<%=rejectConnName%>);
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
} else {
|
||||||
|
%>
|
||||||
|
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
}
|
||||||
%>
|
%>
|
||||||
rejectedCount_<%=cid%> = rejectedCount_<%=cid%> + 1;
|
rejectedCount_<%=cid%> = rejectedCount_<%=cid%> + 1;
|
||||||
<%=rejectConnName%>.errorCode = ((java.sql.SQLException)e).getSQLState();
|
<%=rejectConnName%>.errorCode = ((java.sql.SQLException)e).getSQLState();
|
||||||
@@ -642,19 +705,32 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
<%
|
<%
|
||||||
int counterInsert = 1;
|
int counterInsert = 1;
|
||||||
for(Column columnInsert : colStruct) {
|
for(Column columnInsert : colStruct) {
|
||||||
if(columnInsert.isInsertable()) {
|
if(!columnInsert.isInsertable()) {
|
||||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(columnInsert.getColumn().getTalendType(), columnInsert.getColumn().isNullable());
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(optimize65535) {
|
||||||
|
if((counterInsert-1)%schemaOptNum==0){
|
||||||
|
%>
|
||||||
|
setPrepareStatementUtil_<%=cid%>.setInsert_<%=(counterInsert-1)/schemaOptNum%>(<%=incomingConnName%>,pstmtInsert_<%=cid%>
|
||||||
|
<%if(isEnableDebug) {%>,query_<%=cid%>,insertSQLSplits_<%=cid%><%}%>
|
||||||
|
);
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String typeToGenerate = JavaTypesManager.getTypeToGenerate(columnInsert.getColumn().getTalendType(), columnInsert.getColumn().isNullable());
|
||||||
%>
|
%>
|
||||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, columnInsert, counterInsert, incomingConnName, cid, INSERT_TYPE)%>
|
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, columnInsert, counterInsert, incomingConnName, cid, INSERT_TYPE)%>
|
||||||
<%
|
<%
|
||||||
if(isEnableDebug) {
|
if(isEnableDebug) {
|
||||||
%>
|
%>
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, columnInsert, incomingConnName, cid, "query_" , counterInsert, "insertSQLSplits_")%>;
|
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, columnInsert, incomingConnName, cid, "query_" , counterInsert, "insertSQLSplits_")%>;
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
counterInsert++;
|
}
|
||||||
}
|
|
||||||
}
|
counterInsert++;
|
||||||
|
}
|
||||||
if(isDynamic) {
|
if(isDynamic) {
|
||||||
Column dynamicColumn = getColumn(getDynamicColumn());
|
Column dynamicColumn = getColumn(getDynamicColumn());
|
||||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(dynamicColumn.getColumn().getTalendType(), dynamicColumn.getColumn().isNullable());
|
String typeToGenerate = JavaTypesManager.getTypeToGenerate(dynamicColumn.getColumn().getTalendType(), dynamicColumn.getColumn().isNullable());
|
||||||
@@ -689,11 +765,21 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
%>
|
%>
|
||||||
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
||||||
<%
|
<%
|
||||||
|
int index = 0;
|
||||||
for(IMetadataColumn column : columnList) {
|
for(IMetadataColumn column : columnList) {
|
||||||
%>
|
if(optimize65535) {
|
||||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
if(index%schemaOptNum==0) {
|
||||||
<%
|
%>
|
||||||
}
|
dataPropagateUtil_<%=cid%>.assign_<%=rejectConnName%>_<%=index/schemaOptNum%>(<%=incomingConnName%>,<%=rejectConnName%>);
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
} else {
|
||||||
|
%>
|
||||||
|
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
}
|
||||||
%>
|
%>
|
||||||
rejectedCount_<%=cid%> = rejectedCount_<%=cid%> + 1;
|
rejectedCount_<%=cid%> = rejectedCount_<%=cid%> + 1;
|
||||||
<%=rejectConnName%>.errorCode = ((java.sql.SQLException)e).getSQLState();
|
<%=rejectConnName%>.errorCode = ((java.sql.SQLException)e).getSQLState();
|
||||||
@@ -716,18 +802,31 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
<%
|
<%
|
||||||
int counterColUpdate = 1;
|
int counterColUpdate = 1;
|
||||||
for(Column columnUpdate : colStruct) {
|
for(Column columnUpdate : colStruct) {
|
||||||
if(columnUpdate.isUpdatable()) {
|
if(!columnUpdate.isUpdatable()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(optimize65535) {
|
||||||
|
if((counterColUpdate-1)%schemaOptNum==0){
|
||||||
|
%>
|
||||||
|
setPrepareStatementUtil_<%=cid%>.setUpdate_<%=(counterColUpdate-1)/schemaOptNum%>(<%=incomingConnName%>,pstmtUpdate_<%=cid%>
|
||||||
|
<%if(isEnableDebug) {%>,query_<%=cid%>,updateSQLSplits_<%=cid%><%}%>
|
||||||
|
);
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
} else {
|
||||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(columnUpdate.getColumn().getTalendType(), columnUpdate.getColumn().isNullable());
|
String typeToGenerate = JavaTypesManager.getTypeToGenerate(columnUpdate.getColumn().getTalendType(), columnUpdate.getColumn().isNullable());
|
||||||
%>
|
%>
|
||||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, columnUpdate, counterColUpdate, incomingConnName, cid, UPDATE_TYPE)%>
|
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, columnUpdate, counterColUpdate, incomingConnName, cid, UPDATE_TYPE)%>
|
||||||
<%
|
<%
|
||||||
if(isEnableDebug) {
|
if(isEnableDebug) {
|
||||||
%>
|
%>
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_")%>;
|
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_")%>;
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
counterColUpdate++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
counterColUpdate++;
|
||||||
}
|
}
|
||||||
if(isDynamic) {
|
if(isDynamic) {
|
||||||
Column dynamicColumn = getColumn(getDynamicColumn());
|
Column dynamicColumn = getColumn(getDynamicColumn());
|
||||||
@@ -762,11 +861,11 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
if(isEnableDebug) {
|
if(isEnableDebug) {
|
||||||
if(isDynamic){
|
if(isDynamic){
|
||||||
%>
|
%>
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_", "(("+incomingConnName+"."+columnUpdate.getName()+"==null)?1:0)")%>;
|
<%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_", "(("+incomingConnName+"."+columnUpdate.getName()+"==null)?1:0)")%>;
|
||||||
<%
|
<%
|
||||||
}else{
|
}else{
|
||||||
%>
|
%>
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_", "(("+incomingConnName+"."+columnUpdate.getName()+"==null)?1:0)")%>;
|
<%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_", "(("+incomingConnName+"."+columnUpdate.getName()+"==null)?1:0)")%>;
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -780,11 +879,11 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
if(isEnableDebug) {
|
if(isEnableDebug) {
|
||||||
if(isDynamic){
|
if(isDynamic){
|
||||||
%>
|
%>
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_")%>;
|
<%=getManager(dbmsId, cid, node).retrieveSQL(talendDynCol.getLabel(),typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_")%>;
|
||||||
<%
|
<%
|
||||||
}else{
|
}else{
|
||||||
%>
|
%>
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_")%>;
|
<%=getManager(dbmsId, cid, node).retrieveSQL(typeToGenerate, columnUpdate, incomingConnName, cid, "query_" , counterColUpdate, "updateSQLSplits_")%>;
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -810,18 +909,30 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
}
|
}
|
||||||
int counter = 1;
|
int counter = 1;
|
||||||
for(Column column : colStruct) {
|
for(Column column : colStruct) {
|
||||||
if(column.isInsertable()) {
|
if(!column.isInsertable()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(optimize65535) {
|
||||||
|
if((counter-1)%schemaOptNum==0){
|
||||||
|
%>
|
||||||
|
setPrepareStatementUtil_<%=cid%>.setInsert_<%=(counter-1)/schemaOptNum%>(<%=incomingConnName%>,pstmtInsert_<%=cid%>
|
||||||
|
<%if(isEnableDebug) {%>,query_<%=cid%>,insertSQLSplits_<%=cid%><%}%>
|
||||||
|
);
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
} else {
|
||||||
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getColumn().getTalendType(), column.getColumn().isNullable());
|
||||||
%>
|
%>
|
||||||
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, column, counter, incomingConnName, cid, INSERT_TYPE)%>
|
<%=getManager(dbmsId, cid).generateSetStmt(typeToGenerate, column, counter, incomingConnName, cid, INSERT_TYPE)%>
|
||||||
<%
|
<%
|
||||||
if(isEnableDebug) {
|
if(isEnableDebug) {
|
||||||
%>
|
%>
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counter, "insertSQLSplits_")%>;
|
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , counter, "insertSQLSplits_")%>;
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
counter++;
|
}
|
||||||
}
|
counter++;
|
||||||
}
|
}
|
||||||
if(isDynamic) {
|
if(isDynamic) {
|
||||||
Column dynamicColumn = getColumn(talendDynCol);
|
Column dynamicColumn = getColumn(talendDynCol);
|
||||||
@@ -857,11 +968,21 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
%>
|
%>
|
||||||
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
||||||
<%
|
<%
|
||||||
|
int index = 0;
|
||||||
for(IMetadataColumn column : columnList) {
|
for(IMetadataColumn column : columnList) {
|
||||||
%>
|
if(optimize65535) {
|
||||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
if(index%schemaOptNum==0) {
|
||||||
<%
|
%>
|
||||||
}
|
dataPropagateUtil_<%=cid%>.assign_<%=rejectConnName%>_<%=index/schemaOptNum%>(<%=incomingConnName%>,<%=rejectConnName%>);
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
} else {
|
||||||
|
%>
|
||||||
|
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
}
|
||||||
%>
|
%>
|
||||||
rejectedCount_<%=cid%> = rejectedCount_<%=cid%> + 1;
|
rejectedCount_<%=cid%> = rejectedCount_<%=cid%> + 1;
|
||||||
<%=rejectConnName%>.errorCode = ((java.sql.SQLException)e).getSQLState();
|
<%=rejectConnName%>.errorCode = ((java.sql.SQLException)e).getSQLState();
|
||||||
@@ -893,7 +1014,7 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
<%
|
<%
|
||||||
if(isEnableDebug) {
|
if(isEnableDebug) {
|
||||||
%>
|
%>
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , keyCounter, "deleteSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , keyCounter, "deleteSQLSplits_", "(("+incomingConnName+"."+column.getName()+"==null)?1:0)")%>;
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
keyCounter++;
|
keyCounter++;
|
||||||
@@ -905,7 +1026,7 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
<%
|
<%
|
||||||
if(isEnableDebug) {
|
if(isEnableDebug) {
|
||||||
%>
|
%>
|
||||||
query_<%=cid%> = <%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , keyCounter, "deleteSQLSplits_")%>;
|
<%=getManager(dbmsId, cid).retrieveSQL(typeToGenerate, column, incomingConnName, cid, "query_" , keyCounter, "deleteSQLSplits_")%>;
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
keyCounter++;
|
keyCounter++;
|
||||||
@@ -943,10 +1064,20 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
%>
|
%>
|
||||||
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
|
||||||
<%
|
<%
|
||||||
|
int index = 0;
|
||||||
for(IMetadataColumn column : columnList) {
|
for(IMetadataColumn column : columnList) {
|
||||||
%>
|
if(optimize65535) {
|
||||||
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
if(index%schemaOptNum==0) {
|
||||||
<%
|
%>
|
||||||
|
dataPropagateUtil_<%=cid%>.assign_<%=rejectConnName%>_<%=index/schemaOptNum%>(<%=incomingConnName%>,<%=rejectConnName%>);
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
} else {
|
||||||
|
%>
|
||||||
|
<%=rejectConnName%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||||
|
<%
|
||||||
|
}
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
rejectedCount_<%=cid%> = rejectedCount_<%=cid%> + 1;
|
rejectedCount_<%=cid%> = rejectedCount_<%=cid%> + 1;
|
||||||
@@ -978,10 +1109,20 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
%>
|
%>
|
||||||
<%=outgoingConn.getName()%> = new <%=outgoingConn.getName()%>Struct();
|
<%=outgoingConn.getName()%> = new <%=outgoingConn.getName()%>Struct();
|
||||||
<%
|
<%
|
||||||
|
int index = 0;
|
||||||
for(IMetadataColumn column : columnList) {
|
for(IMetadataColumn column : columnList) {
|
||||||
%>
|
if(optimize65535) {
|
||||||
<%=outgoingConn.getName()%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
if(index%schemaOptNum==0) {
|
||||||
<%
|
%>
|
||||||
|
dataPropagateUtil_<%=cid%>.assign_<%=outgoingConn.getName()%>_<%=index/schemaOptNum%>(<%=incomingConnName%>,<%=outgoingConn.getName()%>);
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
} else {
|
||||||
|
%>
|
||||||
|
<%=outgoingConn.getName()%>.<%=column.getLabel()%> = <%=incomingConnName%>.<%=column.getLabel()%>;
|
||||||
|
<%
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,4 +88,6 @@ SUPPORT_NULL_WHERE.NAME=Support null in "SQL WHERE" statement
|
|||||||
|
|
||||||
USE_BATCH_SIZE.NAME=Use Batch Size
|
USE_BATCH_SIZE.NAME=Use Batch Size
|
||||||
BATCH_SIZE.NAME= Batch Size
|
BATCH_SIZE.NAME= Batch Size
|
||||||
PROPERTIES.NAME=Additional JDBC Parameters
|
PROPERTIES.NAME=Additional JDBC Parameters
|
||||||
|
|
||||||
|
SCHEMA_OPT_NUM.NAME=Schema Optimize Number
|
||||||
@@ -247,8 +247,15 @@ if(inputSchema != null && inputSchema.size() > 0 && outputSchema != null && outp
|
|||||||
insertionStatement_<%=cid%>.setNull(<%=paramIndex + 1%>, java.sql.Types.DATE);
|
insertionStatement_<%=cid%>.setNull(<%=paramIndex + 1%>, java.sql.Types.DATE);
|
||||||
<%
|
<%
|
||||||
} else {
|
} else {
|
||||||
|
String endDateTimeString = ElementParameterParser.getValue(node, "__L2_ENDDATE_TIME_DETAILS__");
|
||||||
%>
|
%>
|
||||||
insertionStatement_<%=cid%>.setTimestamp(<%=paramIndex + 1%>, new java.sql.Timestamp(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(<%=scdConfiger.getDimensionType2Configer().getEndDateValue()%> + "-01-01 12:00:00").getTime()));
|
String endDateTimeDetail_<%=cid%> = <%=endDateTimeString.length()>0?endDateTimeString:"\"\""%>;
|
||||||
|
String datePattern_<%=cid%> = "yyyy-MM-dd";
|
||||||
|
if(endDateTimeDetail_<%=cid%>.length()>0){
|
||||||
|
endDateTimeDetail_<%=cid%> = " "+endDateTimeDetail_<%=cid%>;
|
||||||
|
datePattern_<%=cid%> = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
}
|
||||||
|
insertionStatement_<%=cid%>.setTimestamp(<%=paramIndex + 1%>, new java.sql.Timestamp(new java.text.SimpleDateFormat(datePattern_<%=cid%>).parse(<%=scdConfiger.getDimensionType2Configer().getEndDateValue()%> + "-01-01"+endDateTimeDetail_<%=cid%>).getTime()));
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -477,6 +477,24 @@
|
|||||||
NUM_ROW="4">
|
NUM_ROW="4">
|
||||||
<DEFAULT>*Note: Example for Additional JDBC Parameters: "parameterName1=value1;parameterName2=value2;"</DEFAULT>
|
<DEFAULT>*Note: Example for Additional JDBC Parameters: "parameterName1=value1;parameterName2=value2;"</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER
|
||||||
|
NAME="L2_ENDDATE_TIME_DETAILS"
|
||||||
|
FIELD="TEXT"
|
||||||
|
NUM_ROW="10"
|
||||||
|
SHOW_IF="(USE_L2 == 'true' and L2_ENDDATE_VALUE == 'FIXED_VALUE')"
|
||||||
|
>
|
||||||
|
<DEFAULT>"12:00:00"</DEFAULT>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER
|
||||||
|
NAME="NOICE"
|
||||||
|
FIELD="LABEL"
|
||||||
|
NUM_ROW="10"
|
||||||
|
SHOW_IF="(USE_L2 == 'true' and L2_ENDDATE_VALUE == 'FIXED_VALUE')"
|
||||||
|
>
|
||||||
|
<DEFAULT>(Time pattern: 'HH:mm:ss')</DEFAULT>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
<PARAMETER
|
<PARAMETER
|
||||||
NAME="DEBUG"
|
NAME="DEBUG"
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ L2_ENDDATE_VALUE.NAME=Value
|
|||||||
L2_ENDDATE_VALUE.ITEM.NULL_VALUE=NULL
|
L2_ENDDATE_VALUE.ITEM.NULL_VALUE=NULL
|
||||||
L2_ENDDATE_VALUE.ITEM.FIXED_VALUE=Fixed year value
|
L2_ENDDATE_VALUE.ITEM.FIXED_VALUE=Fixed year value
|
||||||
L2_ENDDATE_FIXED_VALUE.NAME=Year
|
L2_ENDDATE_FIXED_VALUE.NAME=Year
|
||||||
|
L2_ENDDATE_TIME_DETAILS.NAME=End date time details
|
||||||
USE_L3.NAME=Use SCD type 3 fields
|
USE_L3.NAME=Use SCD type 3 fields
|
||||||
L3_FIELDS.NAME=SCD type 3 fields
|
L3_FIELDS.NAME=SCD type 3 fields
|
||||||
L3_FIELDS.ITEM.CURRENT_VALUE=Current value field
|
L3_FIELDS.ITEM.CURRENT_VALUE=Current value field
|
||||||
|
|||||||
@@ -151,7 +151,15 @@ if(dbProperties_<%=cid%> == null || dbProperties_<%=cid%>.trim().length() == 0)
|
|||||||
conn_<%=cid%> = java.sql.DriverManager.getConnection(url_<%=cid%>, atnParamsPrope_<%=cid%>);
|
conn_<%=cid%> = java.sql.DriverManager.getConnection(url_<%=cid%>, atnParamsPrope_<%=cid%>);
|
||||||
}
|
}
|
||||||
resourceMap.put("conn_<%=cid%>", conn_<%=cid%>);
|
resourceMap.put("conn_<%=cid%>", conn_<%=cid%>);
|
||||||
conn_<%=cid%>.setAutoCommit(false);
|
|
||||||
|
<%
|
||||||
|
if(!("").equals(commitEvery)&&!("0").equals(commitEvery)){
|
||||||
|
%>
|
||||||
|
conn_<%=cid%>.setAutoCommit(false);
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
|
||||||
<%
|
<%
|
||||||
if(("true").equals(tableAction)) {
|
if(("true").equals(tableAction)) {
|
||||||
%>
|
%>
|
||||||
|
|||||||
@@ -265,6 +265,6 @@
|
|||||||
<RETURN NAME="NB_LINE_INSERTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
<RETURN NAME="NB_LINE_INSERTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
||||||
<RETURN NAME="NB_LINE_DELETED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
<RETURN NAME="NB_LINE_DELETED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
||||||
<RETURN NAME="NB_LINE_REJECTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
<RETURN NAME="NB_LINE_REJECTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
||||||
<RETURN NAME="QUERY" TYPE="id_String" AVAILABILITY="AFTER" />
|
<RETURN NAME="QUERY" TYPE="id_String" AVAILABILITY="FLOW" SHOW_IF="ENABLE_DEBUG_MODE=='true'"/>
|
||||||
</RETURNS>
|
</RETURNS>
|
||||||
</COMPONENT>
|
</COMPONENT>
|
||||||
@@ -496,14 +496,13 @@ pstmt_<%=cid %> = conn_<%=cid%>.prepareStatement(deleteQuery);
|
|||||||
boolean isfirstInsertWhere = true;
|
boolean isfirstInsertWhere = true;
|
||||||
String keyColumnName=null;
|
String keyColumnName=null;
|
||||||
for(Map<String, String> keyColumn:insertColumns){
|
for(Map<String, String> keyColumn:insertColumns){
|
||||||
if (isfirstInsertWhere) {
|
|
||||||
isfirstInsertWhere = false;
|
|
||||||
}else {
|
|
||||||
mergeInsertName.append(",");
|
|
||||||
mergeInsertValue.append(",");
|
|
||||||
|
|
||||||
}
|
|
||||||
if (keyColumn.get("INSERT").equals("true")) {
|
if (keyColumn.get("INSERT").equals("true")) {
|
||||||
|
if (isfirstInsertWhere) {
|
||||||
|
isfirstInsertWhere = false;
|
||||||
|
}else {
|
||||||
|
mergeInsertName.append(",");
|
||||||
|
mergeInsertValue.append(",");
|
||||||
|
}
|
||||||
keyColumnName=keyColumn.get("SCHEMA_COLUMN");
|
keyColumnName=keyColumn.get("SCHEMA_COLUMN");
|
||||||
keyColumnName = new Column(metadata.getColumn(keyColumnName)).getName();
|
keyColumnName = new Column(metadata.getColumn(keyColumnName)).getName();
|
||||||
mergeInsertName.append(keyColumnName);
|
mergeInsertName.append(keyColumnName);
|
||||||
|
|||||||
@@ -100,7 +100,9 @@ if(useExistingConn) {
|
|||||||
|
|
||||||
String dbPwd_<%=cid %> = decryptedPassword_<%=cid%>;
|
String dbPwd_<%=cid %> = decryptedPassword_<%=cid%>;
|
||||||
<%
|
<%
|
||||||
log4jCodeGenerateUtil.debugConnectionParams(previousNode,"com.teradata.jdbc.TeraDriver");
|
if(previousNode!=null){
|
||||||
|
log4jCodeGenerateUtil.debugConnectionParams(previousNode,"com.teradata.jdbc.TeraDriver");
|
||||||
|
}
|
||||||
%>
|
%>
|
||||||
<%if(isLog4jEnabled){%>
|
<%if(isLog4jEnabled){%>
|
||||||
log.info("<%=cid%> - Connection attempt to '" + url_<%=cid %> + "' with the username '" + dbUser_<%=cid%> + "'.");
|
log.info("<%=cid%> - Connection attempt to '" + url_<%=cid %> + "' with the username '" + dbUser_<%=cid%> + "'.");
|
||||||
|
|||||||
@@ -282,7 +282,7 @@
|
|||||||
<RETURN NAME="NB_LINE" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
<RETURN NAME="NB_LINE" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
||||||
<RETURN NAME="NB_LINE_UPDATED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
<RETURN NAME="NB_LINE_UPDATED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
||||||
<RETURN NAME="NB_LINE_INSERTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
<RETURN NAME="NB_LINE_INSERTED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
||||||
<RETURN NAME="NB_LINE_DELETED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
<RETURN NAME="NB_LINE_DELETED" TYPE="id_Integer" AVAILABILITY="AFTER"/>
|
||||||
<RETURN NAME="QUERY" TYPE="id_String" AVAILABILITY="AFTER" />
|
<RETURN NAME="QUERY" TYPE="id_String" AVAILABILITY="FLOW" SHOW_IF="ENABLE_DEBUG_MODE=='true'"/>
|
||||||
</RETURNS>
|
</RETURNS>
|
||||||
</COMPONENT>
|
</COMPONENT>
|
||||||
@@ -151,7 +151,7 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
<%
|
<%
|
||||||
} else {
|
} else {
|
||||||
%>
|
%>
|
||||||
throw new RuntimeException("Execution failure, there might be an error in your SQL syntax.");
|
System.err.print(e.getMessage());
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -226,7 +226,7 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
<%
|
<%
|
||||||
} else {
|
} else {
|
||||||
%>
|
%>
|
||||||
throw new RuntimeException("Execution failure, there might be an error in your SQL syntax.");
|
System.err.print(e.getMessage());
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -320,7 +320,7 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
<%
|
<%
|
||||||
} else {
|
} else {
|
||||||
%>
|
%>
|
||||||
throw new RuntimeException("Execution failure, there might be an error in your SQL syntax.");
|
System.err.print(e.getMessage());
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -379,7 +379,7 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
<%
|
<%
|
||||||
} else {
|
} else {
|
||||||
%>
|
%>
|
||||||
throw new RuntimeException("Execution failure, there might be an error in your SQL syntax.");
|
System.err.print(e.getMessage());
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -460,7 +460,7 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
<%
|
<%
|
||||||
} else {
|
} else {
|
||||||
%>
|
%>
|
||||||
throw new RuntimeException("Execution failure, there might be an error in your SQL syntax.");
|
System.err.print(e.getMessage());
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -520,7 +520,7 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
<%
|
<%
|
||||||
} else {
|
} else {
|
||||||
%>
|
%>
|
||||||
throw new RuntimeException("Execution failure, there might be an error in your SQL syntax.");
|
System.err.print(e.getMessage());
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -581,7 +581,7 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
<%
|
<%
|
||||||
} else {
|
} else {
|
||||||
%>
|
%>
|
||||||
throw new RuntimeException("Execution failure, there might be an error in your SQL syntax.");
|
System.err.print(e.getMessage());
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -626,4 +626,4 @@ skeleton="../templates/db_output_bulk.skeleton"
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
|
|||||||
@@ -88,6 +88,7 @@
|
|||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
if(contentName_<%=cid%>.matches(finalMask_<%=cid%>)){
|
if(contentName_<%=cid%>.matches(finalMask_<%=cid%>)){
|
||||||
|
nb_file_<%=cid%>++;
|
||||||
globalMap.put("<%=cid%>_CURRENT_FILE", contentName_<%=cid%>);
|
globalMap.put("<%=cid%>_CURRENT_FILE", contentName_<%=cid%>);
|
||||||
globalMap.put("<%=cid%>_CURRENT_FILEPATH", <%=collection%> + contentName_<%=cid%>);
|
globalMap.put("<%=cid%>_CURRENT_FILEPATH", <%=collection%> + contentName_<%=cid%>);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,10 +19,8 @@
|
|||||||
String remotedir = ElementParameterParser.getValue(node, "__REMOTEDIR__");
|
String remotedir = ElementParameterParser.getValue(node, "__REMOTEDIR__");
|
||||||
List<Map<String, String>> files = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__FILES__");
|
List<Map<String, String>> files = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__FILES__");
|
||||||
%>
|
%>
|
||||||
}
|
} <% /* "for String contentName" end */ %>
|
||||||
nb_file_<%=cid%>++;
|
} <% /* "for String key_" end */ %>
|
||||||
}
|
} <% /* "for java.util.Map" end */ %>
|
||||||
}
|
|
||||||
col_<%=cid%>.close();
|
col_<%=cid%>.close();
|
||||||
globalMap.put("<%=cid %>_NB_FILE",nb_file_<%=cid%>);
|
globalMap.put("<%=cid %>_NB_FILE",nb_file_<%=cid%>);
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
|||||||
|
|
||||||
String firstConnName = "";
|
String firstConnName = "";
|
||||||
IConnection outConn = null;
|
IConnection outConn = null;
|
||||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||||
if(outConns!=null){
|
if(outConns!=null){
|
||||||
for (IConnection conn : outConns) {
|
for (IConnection conn : outConns) {
|
||||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
|||||||
|
|
||||||
String firstConnName = "";
|
String firstConnName = "";
|
||||||
IConnection outConn = null;
|
IConnection outConn = null;
|
||||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||||
if(outConns!=null){
|
if(outConns!=null){
|
||||||
for (IConnection conn : outConns) {
|
for (IConnection conn : outConns) {
|
||||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<%@ jet
|
<%@ jet
|
||||||
imports="
|
imports="
|
||||||
|
|
||||||
org.talend.core.model.metadata.IMetadataColumn
|
org.talend.core.model.metadata.IMetadataColumn
|
||||||
@@ -8,10 +8,10 @@ imports="
|
|||||||
org.talend.core.model.process.ElementParameterParser
|
org.talend.core.model.process.ElementParameterParser
|
||||||
org.talend.core.model.process.IConnection
|
org.talend.core.model.process.IConnection
|
||||||
org.talend.core.model.process.IConnectionCategory
|
org.talend.core.model.process.IConnectionCategory
|
||||||
org.talend.core.model.process.INode
|
org.talend.core.model.process.INode
|
||||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||||
org.talend.core.model.utils.NodeUtil
|
org.talend.core.model.utils.NodeUtil
|
||||||
|
|
||||||
java.util.ArrayList
|
java.util.ArrayList
|
||||||
java.util.List
|
java.util.List
|
||||||
java.util.Map
|
java.util.Map
|
||||||
@@ -58,7 +58,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
|||||||
|
|
||||||
IConnection outConn = null;
|
IConnection outConn = null;
|
||||||
String firstConnName = "";
|
String firstConnName = "";
|
||||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||||
if(outConns!=null){
|
if(outConns!=null){
|
||||||
for (IConnection conn : outConns) {
|
for (IConnection conn : outConns) {
|
||||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||||
@@ -72,7 +72,7 @@ if(outConns!=null){
|
|||||||
%>
|
%>
|
||||||
int nb_line_<%=cid%>=0;
|
int nb_line_<%=cid%>=0;
|
||||||
java.nio.ByteBuffer bbRecord_<%=cid %> = null;
|
java.nio.ByteBuffer bbRecord_<%=cid %> = null;
|
||||||
|
|
||||||
<%
|
<%
|
||||||
//set original columns
|
//set original columns
|
||||||
List<IMetadataColumn> newColumnList = new ArrayList<IMetadataColumn>();
|
List<IMetadataColumn> newColumnList = new ArrayList<IMetadataColumn>();
|
||||||
@@ -89,7 +89,7 @@ if(outConn!=null && inConn!=null){
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
boolean isOirginalColumn = false;
|
boolean isOirginalColumn = false;
|
||||||
for(IMetadataColumn inputCol : inputMetadataTable.getListColumns()){
|
for(IMetadataColumn inputCol : inputMetadataTable.getListColumns()){
|
||||||
JavaType stringType = JavaTypesManager.getJavaTypeFromId(inputCol.getTalendType());
|
JavaType stringType = JavaTypesManager.getJavaTypeFromId(inputCol.getTalendType());
|
||||||
if( outputCol.getLabel().equals( inputCol.getLabel()) ){
|
if( outputCol.getLabel().equals( inputCol.getLabel()) ){
|
||||||
if(oirginalColumnsSize%schemaOptNum==0){
|
if(oirginalColumnsSize%schemaOptNum==0){
|
||||||
@@ -143,6 +143,7 @@ if(outConn!=null && inConn!=null){
|
|||||||
Integer orgainLength = column.getOriginalLength();
|
Integer orgainLength = column.getOriginalLength();
|
||||||
String orgainType = column.getType();
|
String orgainType = column.getType();
|
||||||
Integer precision = column.getPrecision();
|
Integer precision = column.getPrecision();
|
||||||
|
String defaultStrValue = column.getDefault();
|
||||||
if(precision==null) precision = 0;
|
if(precision==null) precision = 0;
|
||||||
if(valueN%schemaOptNum==0){
|
if(valueN%schemaOptNum==0){
|
||||||
%>
|
%>
|
||||||
@@ -171,7 +172,7 @@ the original size in the column:<%=column.getLabel()%> in the schema should be b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
<%=outConn.getName() %>.<%=column.getLabel()%> = new String(bb_<%=outConn.getName() %>_<%=column.getLabel()%>,<%=encoding%>)<%=(isTrimAll || (!trimSelects.isEmpty() && (trimStr)))?".trim()":"" %>;
|
<%=outConn.getName() %>.<%=column.getLabel()%> = new String(bb_<%=outConn.getName() %>_<%=column.getLabel()%>,<%=encoding%>)<%=(isTrimAll || (!trimSelects.isEmpty() && (trimStr)))?".trim()":"" %>;
|
||||||
<%
|
<%
|
||||||
}else if(orgainType.equals("1")) {
|
}else if(orgainType.equals("1")) {
|
||||||
@@ -187,7 +188,13 @@ the original size in the column:<%=column.getLabel()%> in the schema should be b
|
|||||||
boolean isImpliedDecimal = (isImpliedDecimalStr!=null&&!("").equals(isImpliedDecimalStr))?("true").equals(isImpliedDecimalStr):true;
|
boolean isImpliedDecimal = (isImpliedDecimalStr!=null&&!("").equals(isImpliedDecimalStr))?("true").equals(isImpliedDecimalStr):true;
|
||||||
if(orgainType.equals("3")){
|
if(orgainType.equals("3")){
|
||||||
%>
|
%>
|
||||||
<%=outConn.getName() %>.<%=column.getLabel()%> = cobolConversion.EBCDICType3.readType3Value(bb_<%=outConn.getName() %>_<%=column.getLabel()%>,<%=precision %>,<%=isImpliedDecimal %>);
|
<%=outConn.getName() %>.<%=column.getLabel()%> = cobolConversion.EBCDICType3.readType3(bb_<%=outConn.getName() %>_<%=column.getLabel()%>,<%=precision %>,<%=isImpliedDecimal %>
|
||||||
|
,<% if(defaultStrValue == null || "".equals(defaultStrValue)){%>
|
||||||
|
null
|
||||||
|
<%}else{%>
|
||||||
|
""+<%= defaultStrValue %>
|
||||||
|
<%} %>
|
||||||
|
);
|
||||||
<%
|
<%
|
||||||
}else {
|
}else {
|
||||||
%>
|
%>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<%@ jet
|
<%@ jet
|
||||||
imports="
|
imports="
|
||||||
org.talend.core.model.process.INode
|
org.talend.core.model.process.INode
|
||||||
org.talend.core.model.process.IConnection
|
org.talend.core.model.process.IConnection
|
||||||
org.talend.core.model.process.ElementParameterParser
|
org.talend.core.model.process.ElementParameterParser
|
||||||
org.talend.core.model.process.IConnectionCategory
|
org.talend.core.model.process.IConnectionCategory
|
||||||
@@ -58,7 +58,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
|||||||
|
|
||||||
IConnection outConn = null;
|
IConnection outConn = null;
|
||||||
String firstConnName = "";
|
String firstConnName = "";
|
||||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||||
if(outConns!=null){
|
if(outConns!=null){
|
||||||
for (IConnection conn : outConns) {
|
for (IConnection conn : outConns) {
|
||||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||||
@@ -112,7 +112,7 @@ try{
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
boolean isOirginalColumn = false;
|
boolean isOirginalColumn = false;
|
||||||
for(IMetadataColumn inputCol : inputMetadataTable.getListColumns()){
|
for(IMetadataColumn inputCol : inputMetadataTable.getListColumns()){
|
||||||
JavaType stringType = JavaTypesManager.getJavaTypeFromId(inputCol.getTalendType());
|
JavaType stringType = JavaTypesManager.getJavaTypeFromId(inputCol.getTalendType());
|
||||||
if( outputCol.getLabel().equals( inputCol.getLabel()) ){
|
if( outputCol.getLabel().equals( inputCol.getLabel()) ){
|
||||||
isOirginalColumn = true;
|
isOirginalColumn = true;
|
||||||
@@ -134,7 +134,7 @@ try{
|
|||||||
%>
|
%>
|
||||||
<%=outConn.getName()%>.<%=outputCol.getLabel()%> = <%=inConn.getName()%>.<%=inputCol.getLabel()%>;
|
<%=outConn.getName()%>.<%=outputCol.getLabel()%> = <%=inConn.getName()%>.<%=inputCol.getLabel()%>;
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(oirginalColumnsSize%schemaOptNum==0){
|
if(oirginalColumnsSize%schemaOptNum==0){
|
||||||
isOirginalColumn = true;
|
isOirginalColumn = true;
|
||||||
@@ -147,7 +147,7 @@ try{
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isOirginalColumn){
|
if(!isOirginalColumn){
|
||||||
if(!("").equals(rejectConnName)&&rejectConnName.equals(firstConnName)
|
if(!("").equals(rejectConnName)&&rejectConnName.equals(firstConnName)
|
||||||
&& (outputCol.getLabel().equals("errorMessage") || outputCol.getLabel().equals("errorCode"))){
|
&& (outputCol.getLabel().equals("errorMessage") || outputCol.getLabel().equals("errorCode"))){
|
||||||
@@ -164,6 +164,7 @@ try{
|
|||||||
Integer orgainLength = column.getOriginalLength();
|
Integer orgainLength = column.getOriginalLength();
|
||||||
String orgainType = column.getType();
|
String orgainType = column.getType();
|
||||||
Integer precision = column.getPrecision();
|
Integer precision = column.getPrecision();
|
||||||
|
String defaultStrValue = column.getDefault();
|
||||||
if(precision==null) precision = 0;
|
if(precision==null) precision = 0;
|
||||||
if(outputMetadataTable.getListColumns().size() <= schemaOptNum){
|
if(outputMetadataTable.getListColumns().size() <= schemaOptNum){
|
||||||
if(orgainLength==null || orgainLength.intValue()==0 || orgainType==null || "".endsWith(orgainType.trim())) {
|
if(orgainLength==null || orgainLength.intValue()==0 || orgainType==null || "".endsWith(orgainType.trim())) {
|
||||||
@@ -188,23 +189,29 @@ the original size in the column:<%=column.getLabel()%> in the schema should be b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%>
|
|
||||||
<%=outConn.getName() %>.<%=column.getLabel()%> = new String(bb_<%=outConn.getName() %>_<%=column.getLabel()%>,<%=encoding%>)<%=(isTrimAll || (!trimSelects.isEmpty() && (trimStr)))?".trim()":"" %>;
|
|
||||||
<%
|
|
||||||
}else if(orgainType.equals("1")) {
|
|
||||||
%>
|
%>
|
||||||
<%=outConn.getName() %>.<%=column.getLabel()%> = new java.lang.Float(java.nio.ByteBuffer.wrap(bb_<%=outConn.getName() %>_<%=column.getLabel()%>).order(java.nio.ByteOrder.BIG_ENDIAN).getFloat());
|
<%=outConn.getName() %>.<%=column.getLabel()%> = new String(bb_<%=outConn.getName() %>_<%=column.getLabel()%>,<%=encoding%>)<%=(isTrimAll || (!trimSelects.isEmpty() && (trimStr)))?".trim()":"" %>;
|
||||||
<%
|
<%
|
||||||
}else if(orgainType.equals("2")) {
|
}else if(orgainType.equals("1")) {
|
||||||
%>
|
%>
|
||||||
<%=outConn.getName() %>.<%=column.getLabel()%> = new java.lang.Double(java.nio.ByteBuffer.wrap(bb_<%=outConn.getName() %>_<%=column.getLabel()%>).order(java.nio.ByteOrder.BIG_ENDIAN).getDouble());
|
<%=outConn.getName() %>.<%=column.getLabel()%> = new java.lang.Float(java.nio.ByteBuffer.wrap(bb_<%=outConn.getName() %>_<%=column.getLabel()%>).order(java.nio.ByteOrder.BIG_ENDIAN).getFloat());
|
||||||
<%
|
<%
|
||||||
}else if(orgainType.equals("3") || orgainType.equals("9")) {
|
}else if(orgainType.equals("2")) {
|
||||||
String isImpliedDecimalStr = column.getAdditionalField().get("ImpliedDecimal");
|
|
||||||
boolean isImpliedDecimal = (isImpliedDecimalStr!=null&&!("").equals(isImpliedDecimalStr))?("true").equals(isImpliedDecimalStr):true;
|
|
||||||
if(orgainType.equals("3")){
|
|
||||||
%>
|
%>
|
||||||
<%=outConn.getName() %>.<%=column.getLabel()%> = cobolConversion.EBCDICType3.readType3Value(bb_<%=outConn.getName() %>_<%=column.getLabel()%>,<%=precision %>,<%=isImpliedDecimal %>);
|
<%=outConn.getName() %>.<%=column.getLabel()%> = new java.lang.Double(java.nio.ByteBuffer.wrap(bb_<%=outConn.getName() %>_<%=column.getLabel()%>).order(java.nio.ByteOrder.BIG_ENDIAN).getDouble());
|
||||||
|
<%
|
||||||
|
}else if(orgainType.equals("3") || orgainType.equals("9")) {
|
||||||
|
String isImpliedDecimalStr = column.getAdditionalField().get("ImpliedDecimal");
|
||||||
|
boolean isImpliedDecimal = (isImpliedDecimalStr!=null&&!("").equals(isImpliedDecimalStr))?("true").equals(isImpliedDecimalStr):true;
|
||||||
|
if(orgainType.equals("3")){
|
||||||
|
%>
|
||||||
|
<%=outConn.getName() %>.<%=column.getLabel()%> = cobolConversion.EBCDICType3.readType3(bb_<%=outConn.getName() %>_<%=column.getLabel()%>,<%=precision %>,<%=isImpliedDecimal %>
|
||||||
|
,<% if(defaultStrValue == null || "".equals(defaultStrValue)){%>
|
||||||
|
null
|
||||||
|
<%}else{%>
|
||||||
|
""+<%= defaultStrValue %>
|
||||||
|
<%} %>
|
||||||
|
);
|
||||||
<%
|
<%
|
||||||
}else {
|
}else {
|
||||||
%>
|
%>
|
||||||
@@ -268,7 +275,7 @@ DB Type of the column:<%=column.getLabel()%> should be X, 1, 2, 3, 9, B, T
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
<%=rejectConnName%>.errorMessage = ex_<%=cid %>.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
|
<%=rejectConnName%>.errorMessage = ex_<%=cid %>.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
|
||||||
<%=firstConnName %> = null;
|
<%=firstConnName %> = null;
|
||||||
<%
|
<%
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
|||||||
|
|
||||||
IConnection outConn = null;
|
IConnection outConn = null;
|
||||||
String firstConnName = "";
|
String firstConnName = "";
|
||||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||||
if(outConns!=null){
|
if(outConns!=null){
|
||||||
for (IConnection conn : outConns) {
|
for (IConnection conn : outConns) {
|
||||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
|||||||
|
|
||||||
IConnection outConn = null;
|
IConnection outConn = null;
|
||||||
String firstConnName = "";
|
String firstConnName = "";
|
||||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||||
if(outConns!=null){
|
if(outConns!=null){
|
||||||
for (IConnection conn : outConns) {
|
for (IConnection conn : outConns) {
|
||||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
|||||||
|
|
||||||
IConnection outConn = null;
|
IConnection outConn = null;
|
||||||
String firstConnName = "";
|
String firstConnName = "";
|
||||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||||
if(outConns!=null){
|
if(outConns!=null){
|
||||||
for (IConnection conn : outConns) {
|
for (IConnection conn : outConns) {
|
||||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
|||||||
|
|
||||||
IConnection outConn = null;
|
IConnection outConn = null;
|
||||||
String firstConnName = "";
|
String firstConnName = "";
|
||||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||||
if(outConns!=null){
|
if(outConns!=null){
|
||||||
for (IConnection conn : outConns) {
|
for (IConnection conn : outConns) {
|
||||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
|||||||
|
|
||||||
IConnection outConn = null;
|
IConnection outConn = null;
|
||||||
String firstConnName = "";
|
String firstConnName = "";
|
||||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||||
if(outConns!=null){
|
if(outConns!=null){
|
||||||
for (IConnection conn : outConns) {
|
for (IConnection conn : outConns) {
|
||||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||||
@@ -499,4 +499,4 @@ if (outConn!=null) {
|
|||||||
%>
|
%>
|
||||||
}
|
}
|
||||||
|
|
||||||
XML_API_<%=cid%> xml_api_<%=cid%> = new XML_API_<%=cid%>();
|
XML_API_<%=cid%> xml_api_<%=cid%> = new XML_API_<%=cid%>();
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ if (inConns!=null) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
boolean isDocumentType = false;
|
||||||
if(useXMLField){
|
if(useXMLField){
|
||||||
%>
|
%>
|
||||||
String xmlStr_<%=cid%> = <%=strXMLText %>;
|
String xmlStr_<%=cid%> = <%=strXMLText %>;
|
||||||
@@ -77,17 +78,35 @@ if(useXMLField){
|
|||||||
{
|
{
|
||||||
%>
|
%>
|
||||||
String xmlStr_<%=cid%> = null;
|
String xmlStr_<%=cid%> = null;
|
||||||
|
routines.system.Document xmlDocument_<%=cid%> = null;
|
||||||
if(<%=inConn.getName()%>.<%=xmlField%>!=null){
|
if(<%=inConn.getName()%>.<%=xmlField%>!=null){
|
||||||
xmlStr_<%=cid%> = <%=inConn.getName()%>.<%=xmlField%><%="id_Document".equals(inputCol.getTalendType())?".toString()":""%>;
|
<%
|
||||||
|
if("id_Document".equals(inputCol.getTalendType())) {
|
||||||
|
isDocumentType = true;
|
||||||
|
%>
|
||||||
|
xmlDocument_<%=cid%> = <%=inConn.getName()%>.<%=xmlField%>;
|
||||||
|
<%
|
||||||
|
} else {
|
||||||
|
%>
|
||||||
|
xmlStr_<%=cid%> = <%=inConn.getName()%>.<%=xmlField%>;
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
}
|
}
|
||||||
<%
|
<%
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(isDocumentType) {
|
||||||
|
%>
|
||||||
|
if(xmlDocument_<%=cid%>!=null && xmlDocument_<%=cid%>.getDocument()!=null){// C_01
|
||||||
|
<%
|
||||||
|
} else {
|
||||||
%>
|
%>
|
||||||
if(xmlStr_<%=cid%>!=null){// C_01
|
if(xmlStr_<%=cid%>!=null){// C_01
|
||||||
<%
|
<%
|
||||||
|
}
|
||||||
List<BlockCode> blockCodes = new java.util.ArrayList<BlockCode>(1);
|
List<BlockCode> blockCodes = new java.util.ArrayList<BlockCode>(1);
|
||||||
blockCodes.add(new BlockCode("C_01"));
|
blockCodes.add(new BlockCode("C_01"));
|
||||||
((org.talend.core.model.process.AbstractNode) node).setBlocksCodeToClose(blockCodes);
|
((org.talend.core.model.process.AbstractNode) node).setBlocksCodeToClose(blockCodes);
|
||||||
@@ -105,7 +124,7 @@ if(rejectConns != null && rejectConns.size() > 0) {
|
|||||||
|
|
||||||
IConnection outConn = null;
|
IConnection outConn = null;
|
||||||
String firstConnName = "";
|
String firstConnName = "";
|
||||||
List< ? extends IConnection> outConns = node.getOutgoingConnections();
|
List< ? extends IConnection> outConns = node.getOutgoingSortedConnections();
|
||||||
if(outConns!=null){
|
if(outConns!=null){
|
||||||
for (IConnection conn : outConns) {
|
for (IConnection conn : outConns) {
|
||||||
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
|
||||||
@@ -154,7 +173,17 @@ if (outConn!=null) {
|
|||||||
boolean isStructError_<%=cid %>= true;
|
boolean isStructError_<%=cid %>= true;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
doc_<%=cid%>= reader_<%=cid%>.read(new java.io.StringReader(xmlStr_<%=cid%>));
|
<%
|
||||||
|
if(isDocumentType) {
|
||||||
|
%>
|
||||||
|
doc_<%=cid%>= xmlDocument_<%=cid%>.getDocument();
|
||||||
|
<%
|
||||||
|
} else {
|
||||||
|
%>
|
||||||
|
doc_<%=cid%>= reader_<%=cid%>.read(new java.io.StringReader(xmlStr_<%=cid%>));
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
nsTool_<%=cid%>.countNSMap(doc_<%=cid%>.getRootElement());
|
nsTool_<%=cid%>.countNSMap(doc_<%=cid%>.getRootElement());
|
||||||
xmlNameSpaceMap_<%=cid%> = nsTool_<%=cid%>.xmlNameSpaceMap;
|
xmlNameSpaceMap_<%=cid%> = nsTool_<%=cid%>.xmlNameSpaceMap;
|
||||||
|
|
||||||
@@ -202,7 +231,17 @@ if (outConn!=null) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
<%=rejectConnName %>.errorXMLField = xmlStr_<%=cid%>;
|
<%
|
||||||
|
if(isDocumentType) {
|
||||||
|
%>
|
||||||
|
<%=rejectConnName %>.errorXMLField = xmlDocument_<%=cid%>.toString();
|
||||||
|
<%
|
||||||
|
} else {
|
||||||
|
%>
|
||||||
|
<%=rejectConnName %>.errorXMLField = xmlStr_<%=cid%>;
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
<%=rejectConnName %>.errorMessage = ex_<%=cid %>.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
|
<%=rejectConnName %>.errorMessage = ex_<%=cid %>.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
|
||||||
<%
|
<%
|
||||||
} else if(("").equals(rejectConnName)){
|
} else if(("").equals(rejectConnName)){
|
||||||
@@ -436,8 +475,16 @@ if(outConns!=null){
|
|||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(isDocumentType) {
|
||||||
|
%>
|
||||||
|
<%=rejectConnName %>.errorXMLField = xmlDocument_<%=cid%>.toString();
|
||||||
|
<%
|
||||||
|
} else {
|
||||||
|
%>
|
||||||
|
<%=rejectConnName %>.errorXMLField = xmlStr_<%=cid%>;
|
||||||
|
<%
|
||||||
|
}
|
||||||
%>
|
%>
|
||||||
<%=rejectConnName %>.errorXMLField = xmlStr_<%=cid%>;
|
|
||||||
<%=rejectConnName %>.errorMessage = ex_<%=cid %>.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
|
<%=rejectConnName %>.errorMessage = ex_<%=cid %>.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
|
||||||
<%=firstConnName %> = null;
|
<%=firstConnName %> = null;
|
||||||
<%
|
<%
|
||||||
@@ -447,8 +494,16 @@ if(outConns!=null){
|
|||||||
<%=firstConnName %> = null;
|
<%=firstConnName %> = null;
|
||||||
<%
|
<%
|
||||||
} else if(rejectConnName.equals(firstConnName)){
|
} else if(rejectConnName.equals(firstConnName)){
|
||||||
|
if(isDocumentType) {
|
||||||
|
%>
|
||||||
|
<%=rejectConnName %>.errorXMLField = xmlDocument_<%=cid%>.toString();
|
||||||
|
<%
|
||||||
|
} else {
|
||||||
|
%>
|
||||||
|
<%=rejectConnName %>.errorXMLField = xmlStr_<%=cid%>;
|
||||||
|
<%
|
||||||
|
}
|
||||||
%>
|
%>
|
||||||
<%=rejectConnName %>.errorXMLField = xmlStr_<%=cid%>;
|
|
||||||
<%=rejectConnName %>.errorMessage = ex_<%=cid %>.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
|
<%=rejectConnName %>.errorMessage = ex_<%=cid %>.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,6 +107,19 @@
|
|||||||
>
|
>
|
||||||
<DEFAULT>"123456"</DEFAULT>
|
<DEFAULT>"123456"</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER
|
||||||
|
NAME="AUTH_METHOD"
|
||||||
|
FIELD="CLOSED_LIST"
|
||||||
|
NUM_ROW="7"
|
||||||
|
SHOW_IF="(SFTP=='true')"
|
||||||
|
REPOSITORY_VALUE="AUTH_METHOD"
|
||||||
|
>
|
||||||
|
<ITEMS DEFAULT="PASSWORD">
|
||||||
|
<ITEM NAME="PUBLICKEY" VALUE="PUBLICKEY"/>
|
||||||
|
<ITEM NAME="PASSWORD" VALUE="PASSWORD"/>
|
||||||
|
</ITEMS>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
<PARAMETER
|
<PARAMETER
|
||||||
NAME="PRIVATEKEY"
|
NAME="PRIVATEKEY"
|
||||||
@@ -128,19 +141,6 @@
|
|||||||
<DEFAULT>"secret"</DEFAULT>
|
<DEFAULT>"secret"</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
<PARAMETER
|
|
||||||
NAME="AUTH_METHOD"
|
|
||||||
FIELD="CLOSED_LIST"
|
|
||||||
NUM_ROW="7"
|
|
||||||
SHOW_IF="(SFTP=='true')"
|
|
||||||
REPOSITORY_VALUE="AUTH_METHOD"
|
|
||||||
>
|
|
||||||
<ITEMS DEFAULT="PASSWORD">
|
|
||||||
<ITEM NAME="PUBLICKEY" VALUE="PUBLICKEY"/>
|
|
||||||
<ITEM NAME="PASSWORD" VALUE="PASSWORD"/>
|
|
||||||
</ITEMS>
|
|
||||||
</PARAMETER>
|
|
||||||
|
|
||||||
<PARAMETER NAME="CONNECT_MODE" FIELD="CLOSED_LIST" NUM_ROW="100" REPOSITORY_VALUE="CONNECT_MODE" NOT_SHOW_IF="(SFTP == 'true') OR (FTPS == 'true')">
|
<PARAMETER NAME="CONNECT_MODE" FIELD="CLOSED_LIST" NUM_ROW="100" REPOSITORY_VALUE="CONNECT_MODE" NOT_SHOW_IF="(SFTP == 'true') OR (FTPS == 'true')">
|
||||||
<ITEMS DEFAULT="PASSIVE">
|
<ITEMS DEFAULT="PASSIVE">
|
||||||
<ITEM NAME="PASSIVE" VALUE="PASSIVE" />
|
<ITEM NAME="PASSIVE" VALUE="PASSIVE" />
|
||||||
@@ -194,7 +194,7 @@
|
|||||||
<CODEGENERATION>
|
<CODEGENERATION>
|
||||||
<IMPORTS>
|
<IMPORTS>
|
||||||
<IMPORT NAME="Java-FTP" MODULE="edtftpj.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj.jar" REQUIRED="true" />
|
<IMPORT NAME="Java-FTP" MODULE="edtftpj.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj.jar" REQUIRED="true" />
|
||||||
<IMPORT NAME="Java-SFTP" MODULE="jsch.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/jsch.jar" REQUIRED="true" />
|
<IMPORT NAME="Java-SFTP" MODULE="jsch-0.1.51.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/jsch-0.1.51.jar" REQUIRED="true" />
|
||||||
<IMPORT NAME="Java-FTPS" MODULE="ftp4j-1.5.1.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/ftp4j-1.5.1.jar" REQUIRED="true" />
|
<IMPORT NAME="Java-FTPS" MODULE="ftp4j-1.5.1.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/ftp4j-1.5.1.jar" REQUIRED="true" />
|
||||||
</IMPORTS>
|
</IMPORTS>
|
||||||
</CODEGENERATION>
|
</CODEGENERATION>
|
||||||
|
|||||||
@@ -100,32 +100,6 @@ COMPATIBILITY="ALL"
|
|||||||
<DEFAULT>"suomynona"</DEFAULT>
|
<DEFAULT>"suomynona"</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
<PARAMETER
|
|
||||||
NAME="PRIVATEKEY"
|
|
||||||
FIELD="FILE"
|
|
||||||
NUM_ROW="22"
|
|
||||||
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
|
||||||
>
|
|
||||||
<DEFAULT>"/.ssh/id_dsa"</DEFAULT>
|
|
||||||
</PARAMETER>
|
|
||||||
|
|
||||||
<PARAMETER
|
|
||||||
NAME="PASSPHRASE"
|
|
||||||
FIELD="PASSWORD"
|
|
||||||
NUM_ROW="23"
|
|
||||||
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
|
||||||
>
|
|
||||||
<DEFAULT>"secret"</DEFAULT>
|
|
||||||
</PARAMETER>
|
|
||||||
|
|
||||||
<PARAMETER NAME="REMOTEDIR" FIELD="TEXT" REQUIRED="false" NUM_ROW="31">
|
|
||||||
<DEFAULT>"."</DEFAULT>
|
|
||||||
</PARAMETER>
|
|
||||||
|
|
||||||
<PARAMETER NAME="MOVE_TO_THE_CURRENT_DIRECTORY" FIELD="CHECK" NUM_ROW="31" SHOW_IF="USE_EXISTING_CONNECTION == 'true'">
|
|
||||||
<DEFAULT>true</DEFAULT>
|
|
||||||
</PARAMETER>
|
|
||||||
|
|
||||||
<PARAMETER NAME="SFTP" FIELD="CHECK" REQUIRED="true" NUM_ROW="41" REPOSITORY_VALUE="SFTP" SHOW_IF="USE_EXISTING_CONNECTION == 'false'">
|
<PARAMETER NAME="SFTP" FIELD="CHECK" REQUIRED="true" NUM_ROW="41" REPOSITORY_VALUE="SFTP" SHOW_IF="USE_EXISTING_CONNECTION == 'false'">
|
||||||
<DEFAULT>false</DEFAULT>
|
<DEFAULT>false</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
@@ -143,6 +117,34 @@ COMPATIBILITY="ALL"
|
|||||||
</ITEMS>
|
</ITEMS>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER
|
||||||
|
NAME="PRIVATEKEY"
|
||||||
|
FIELD="FILE"
|
||||||
|
NUM_ROW="22"
|
||||||
|
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
||||||
|
REPOSITORY_VALUE="PRIVATEKEY"
|
||||||
|
>
|
||||||
|
<DEFAULT>"/.ssh/id_dsa"</DEFAULT>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER
|
||||||
|
NAME="PASSPHRASE"
|
||||||
|
FIELD="PASSWORD"
|
||||||
|
NUM_ROW="23"
|
||||||
|
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
||||||
|
REPOSITORY_VALUE="PASSPHRASE"
|
||||||
|
>
|
||||||
|
<DEFAULT>"secret"</DEFAULT>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER NAME="REMOTEDIR" FIELD="TEXT" REQUIRED="false" NUM_ROW="31">
|
||||||
|
<DEFAULT>"."</DEFAULT>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER NAME="MOVE_TO_THE_CURRENT_DIRECTORY" FIELD="CHECK" NUM_ROW="31" SHOW_IF="USE_EXISTING_CONNECTION == 'true'">
|
||||||
|
<DEFAULT>true</DEFAULT>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
<PARAMETER NAME="PERL5_REGEX" FIELD="CHECK" REQUIRED="false" NUM_ROW="50">
|
<PARAMETER NAME="PERL5_REGEX" FIELD="CHECK" REQUIRED="false" NUM_ROW="50">
|
||||||
<DEFAULT>false</DEFAULT>
|
<DEFAULT>false</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
@@ -216,7 +218,7 @@ COMPATIBILITY="ALL"
|
|||||||
<CODEGENERATION>
|
<CODEGENERATION>
|
||||||
<IMPORTS>
|
<IMPORTS>
|
||||||
<IMPORT NAME="Java-FTP" MODULE="edtftpj.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj.jar" REQUIRED="true" />
|
<IMPORT NAME="Java-FTP" MODULE="edtftpj.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj.jar" REQUIRED="true" />
|
||||||
<IMPORT NAME="Java-SFTP" MODULE="jsch.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/jsch.jar" REQUIRED="true" />
|
<IMPORT NAME="Java-SFTP" MODULE="jsch-0.1.51.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/jsch-0.1.51.jar" REQUIRED="true" />
|
||||||
<IMPORT NAME="jakarta-oro" MODULE="jakarta-oro-2.0.8.jar" UrlPath="platform:/plugin/org.talend.libraries.apache/lib/jakarta-oro-2.0.8.jar" REQUIRED="true" />
|
<IMPORT NAME="jakarta-oro" MODULE="jakarta-oro-2.0.8.jar" UrlPath="platform:/plugin/org.talend.libraries.apache/lib/jakarta-oro-2.0.8.jar" REQUIRED="true" />
|
||||||
</IMPORTS>
|
</IMPORTS>
|
||||||
</CODEGENERATION>
|
</CODEGENERATION>
|
||||||
|
|||||||
@@ -93,32 +93,6 @@ COMPATIBILITY="ALL"
|
|||||||
<DEFAULT>"suomynona"</DEFAULT>
|
<DEFAULT>"suomynona"</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
<PARAMETER
|
|
||||||
NAME="PRIVATEKEY"
|
|
||||||
FIELD="FILE"
|
|
||||||
NUM_ROW="22"
|
|
||||||
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
|
||||||
>
|
|
||||||
<DEFAULT>"/.ssh/id_dsa"</DEFAULT>
|
|
||||||
</PARAMETER>
|
|
||||||
|
|
||||||
<PARAMETER
|
|
||||||
NAME="PASSPHRASE"
|
|
||||||
FIELD="PASSWORD"
|
|
||||||
NUM_ROW="23"
|
|
||||||
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
|
||||||
>
|
|
||||||
<DEFAULT>"secret"</DEFAULT>
|
|
||||||
</PARAMETER>
|
|
||||||
|
|
||||||
<PARAMETER NAME="REMOTEDIR" FIELD="TEXT" REQUIRED="false" NUM_ROW="61">
|
|
||||||
<DEFAULT>"."</DEFAULT>
|
|
||||||
</PARAMETER>
|
|
||||||
|
|
||||||
<PARAMETER NAME="FILENAME" FIELD="TEXT" REQUIRED="false" NUM_ROW="71">
|
|
||||||
<DEFAULT>"filename.suffix"</DEFAULT>
|
|
||||||
</PARAMETER>
|
|
||||||
|
|
||||||
<PARAMETER NAME="SFTP" FIELD="CHECK" NUM_ROW="81" REPOSITORY_VALUE="SFTP" SHOW_IF="USE_EXISTING_CONNECTION == 'false'">
|
<PARAMETER NAME="SFTP" FIELD="CHECK" NUM_ROW="81" REPOSITORY_VALUE="SFTP" SHOW_IF="USE_EXISTING_CONNECTION == 'false'">
|
||||||
<DEFAULT>false</DEFAULT>
|
<DEFAULT>false</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
@@ -135,6 +109,35 @@ COMPATIBILITY="ALL"
|
|||||||
<ITEM NAME="PASSWORD" VALUE="PASSWORD"/>
|
<ITEM NAME="PASSWORD" VALUE="PASSWORD"/>
|
||||||
</ITEMS>
|
</ITEMS>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER
|
||||||
|
NAME="PRIVATEKEY"
|
||||||
|
FIELD="FILE"
|
||||||
|
NUM_ROW="22"
|
||||||
|
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
||||||
|
REPOSITORY_VALUE="PRIVATEKEY"
|
||||||
|
>
|
||||||
|
<DEFAULT>"/.ssh/id_dsa"</DEFAULT>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER
|
||||||
|
NAME="PASSPHRASE"
|
||||||
|
FIELD="PASSWORD"
|
||||||
|
NUM_ROW="23"
|
||||||
|
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
||||||
|
REPOSITORY_VALUE="PASSPHRASE"
|
||||||
|
>
|
||||||
|
<DEFAULT>"secret"</DEFAULT>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER NAME="REMOTEDIR" FIELD="TEXT" REQUIRED="false" NUM_ROW="61">
|
||||||
|
<DEFAULT>"."</DEFAULT>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER NAME="FILENAME" FIELD="TEXT" REQUIRED="false" NUM_ROW="71">
|
||||||
|
<DEFAULT>"filename.suffix"</DEFAULT>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
<PARAMETER NAME="CONNECT_MODE" FIELD="CLOSED_LIST" NUM_ROW="101" REPOSITORY_VALUE="CONNECT_MODE" SHOW_IF="(SFTP=='false') AND (USE_EXISTING_CONNECTION == 'false')">
|
<PARAMETER NAME="CONNECT_MODE" FIELD="CLOSED_LIST" NUM_ROW="101" REPOSITORY_VALUE="CONNECT_MODE" SHOW_IF="(SFTP=='false') AND (USE_EXISTING_CONNECTION == 'false')">
|
||||||
<ITEMS DEFAULT="PASSIVE">
|
<ITEMS DEFAULT="PASSIVE">
|
||||||
<ITEM NAME="PASSIVE" VALUE="PASSIVE" />
|
<ITEM NAME="PASSIVE" VALUE="PASSIVE" />
|
||||||
@@ -186,7 +189,7 @@ COMPATIBILITY="ALL"
|
|||||||
<CODEGENERATION>
|
<CODEGENERATION>
|
||||||
<IMPORTS>
|
<IMPORTS>
|
||||||
<IMPORT NAME="Java-FTP" MODULE="edtftpj.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj.jar" REQUIRED="true" />
|
<IMPORT NAME="Java-FTP" MODULE="edtftpj.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj.jar" REQUIRED="true" />
|
||||||
<IMPORT NAME="Java-SFTP" MODULE="jsch.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/jsch.jar" REQUIRED="true" />
|
<IMPORT NAME="Java-SFTP" MODULE="jsch-0.1.51.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/jsch-0.1.51.jar" REQUIRED="true" />
|
||||||
</IMPORTS>
|
</IMPORTS>
|
||||||
</CODEGENERATION>
|
</CODEGENERATION>
|
||||||
|
|
||||||
|
|||||||
@@ -79,12 +79,30 @@
|
|||||||
NUM_ROW="21" REPOSITORY_VALUE="PASSWORD" NOT_SHOW_IF="((SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY')) OR (USE_EXISTING_CONNECTION == 'true')">
|
NUM_ROW="21" REPOSITORY_VALUE="PASSWORD" NOT_SHOW_IF="((SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY')) OR (USE_EXISTING_CONNECTION == 'true')">
|
||||||
<DEFAULT>"suomynona"</DEFAULT>
|
<DEFAULT>"suomynona"</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER NAME="SFTP" FIELD="CHECK" NUM_ROW="81" REPOSITORY_VALUE="SFTP" SHOW_IF="USE_EXISTING_CONNECTION == 'false'">
|
||||||
|
<DEFAULT>false</DEFAULT>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER
|
||||||
|
NAME="AUTH_METHOD"
|
||||||
|
FIELD="CLOSED_LIST"
|
||||||
|
NUM_ROW="81"
|
||||||
|
REPOSITORY_VALUE="AUTH_METHOD"
|
||||||
|
SHOW_IF="(SFTP=='true') AND (USE_EXISTING_CONNECTION == 'false')"
|
||||||
|
>
|
||||||
|
<ITEMS DEFAULT="PASSWORD">
|
||||||
|
<ITEM NAME="PUBLICKEY" VALUE="PUBLICKEY"/>
|
||||||
|
<ITEM NAME="PASSWORD" VALUE="PASSWORD"/>
|
||||||
|
</ITEMS>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
<PARAMETER
|
<PARAMETER
|
||||||
NAME="PRIVATEKEY"
|
NAME="PRIVATEKEY"
|
||||||
FIELD="FILE"
|
FIELD="FILE"
|
||||||
NUM_ROW="22"
|
NUM_ROW="22"
|
||||||
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
||||||
|
REPOSITORY_VALUE="PRIVATEKEY"
|
||||||
>
|
>
|
||||||
<DEFAULT>"/.ssh/id_dsa"</DEFAULT>
|
<DEFAULT>"/.ssh/id_dsa"</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
@@ -94,6 +112,7 @@
|
|||||||
FIELD="PASSWORD"
|
FIELD="PASSWORD"
|
||||||
NUM_ROW="23"
|
NUM_ROW="23"
|
||||||
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
||||||
|
REPOSITORY_VALUE="PASSPHRASE"
|
||||||
>
|
>
|
||||||
<DEFAULT>"secret"</DEFAULT>
|
<DEFAULT>"secret"</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
@@ -111,23 +130,6 @@
|
|||||||
<DEFAULT>false</DEFAULT>
|
<DEFAULT>false</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
<PARAMETER NAME="SFTP" FIELD="CHECK" NUM_ROW="81" REPOSITORY_VALUE="SFTP" SHOW_IF="USE_EXISTING_CONNECTION == 'false'">
|
|
||||||
<DEFAULT>false</DEFAULT>
|
|
||||||
</PARAMETER>
|
|
||||||
|
|
||||||
<PARAMETER
|
|
||||||
NAME="AUTH_METHOD"
|
|
||||||
FIELD="CLOSED_LIST"
|
|
||||||
NUM_ROW="81"
|
|
||||||
REPOSITORY_VALUE="AUTH_METHOD"
|
|
||||||
SHOW_IF="(SFTP=='true') AND (USE_EXISTING_CONNECTION == 'false')"
|
|
||||||
>
|
|
||||||
<ITEMS DEFAULT="PASSWORD">
|
|
||||||
<ITEM NAME="PUBLICKEY" VALUE="PUBLICKEY"/>
|
|
||||||
<ITEM NAME="PASSWORD" VALUE="PASSWORD"/>
|
|
||||||
</ITEMS>
|
|
||||||
</PARAMETER>
|
|
||||||
|
|
||||||
<PARAMETER NAME="FILES" FIELD="TABLE" REQUIRED="false" NUM_ROW="91" NB_LINES="5">
|
<PARAMETER NAME="FILES" FIELD="TABLE" REQUIRED="false" NUM_ROW="91" NB_LINES="5">
|
||||||
<ITEMS>
|
<ITEMS>
|
||||||
<ITEM NAME="FILEMASK" />
|
<ITEM NAME="FILEMASK" />
|
||||||
@@ -185,7 +187,7 @@
|
|||||||
<CODEGENERATION>
|
<CODEGENERATION>
|
||||||
<IMPORTS>
|
<IMPORTS>
|
||||||
<IMPORT NAME="Java-FTP" MODULE="edtftpj.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj.jar" REQUIRED="true" />
|
<IMPORT NAME="Java-FTP" MODULE="edtftpj.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj.jar" REQUIRED="true" />
|
||||||
<IMPORT NAME="Java-SFTP" MODULE="jsch.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/jsch.jar" REQUIRED="true" />
|
<IMPORT NAME="Java-SFTP" MODULE="jsch-0.1.51.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/jsch-0.1.51.jar" REQUIRED="true" />
|
||||||
</IMPORTS>
|
</IMPORTS>
|
||||||
</CODEGENERATION>
|
</CODEGENERATION>
|
||||||
<RETURNS>
|
<RETURNS>
|
||||||
|
|||||||
@@ -82,12 +82,30 @@
|
|||||||
NUM_ROW="20" NOT_SHOW_IF="((SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY')) OR (USE_EXISTING_CONNECTION == 'true')">
|
NUM_ROW="20" NOT_SHOW_IF="((SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY')) OR (USE_EXISTING_CONNECTION == 'true')">
|
||||||
<DEFAULT>"suomynona"</DEFAULT>
|
<DEFAULT>"suomynona"</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER NAME="SFTP" FIELD="CHECK" NUM_ROW="80" REPOSITORY_VALUE="SFTP" SHOW_IF="USE_EXISTING_CONNECTION == 'false'">
|
||||||
|
<DEFAULT>false</DEFAULT>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER
|
||||||
|
NAME="AUTH_METHOD"
|
||||||
|
FIELD="CLOSED_LIST"
|
||||||
|
NUM_ROW="80"
|
||||||
|
REPOSITORY_VALUE="AUTH_METHOD"
|
||||||
|
SHOW_IF="(SFTP=='true') AND (USE_EXISTING_CONNECTION == 'false')"
|
||||||
|
>
|
||||||
|
<ITEMS DEFAULT="PASSWORD">
|
||||||
|
<ITEM NAME="PUBLICKEY" VALUE="PUBLICKEY"/>
|
||||||
|
<ITEM NAME="PASSWORD" VALUE="PASSWORD"/>
|
||||||
|
</ITEMS>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
<PARAMETER
|
<PARAMETER
|
||||||
NAME="PRIVATEKEY"
|
NAME="PRIVATEKEY"
|
||||||
FIELD="FILE"
|
FIELD="FILE"
|
||||||
NUM_ROW="21"
|
NUM_ROW="21"
|
||||||
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
||||||
|
REPOSITORY_VALUE="PRIVATEKEY"
|
||||||
>
|
>
|
||||||
<DEFAULT>"/.ssh/id_dsa"</DEFAULT>
|
<DEFAULT>"/.ssh/id_dsa"</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
@@ -97,6 +115,7 @@
|
|||||||
FIELD="PASSWORD"
|
FIELD="PASSWORD"
|
||||||
NUM_ROW="22"
|
NUM_ROW="22"
|
||||||
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
||||||
|
REPOSITORY_VALUE="PASSPHRASE"
|
||||||
>
|
>
|
||||||
<DEFAULT>"secret"</DEFAULT>
|
<DEFAULT>"secret"</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
@@ -117,22 +136,6 @@
|
|||||||
</ITEMS>
|
</ITEMS>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
<PARAMETER NAME="SFTP" FIELD="CHECK" NUM_ROW="80" REPOSITORY_VALUE="SFTP" SHOW_IF="USE_EXISTING_CONNECTION == 'false'">
|
|
||||||
<DEFAULT>false</DEFAULT>
|
|
||||||
</PARAMETER>
|
|
||||||
|
|
||||||
<PARAMETER
|
|
||||||
NAME="AUTH_METHOD"
|
|
||||||
FIELD="CLOSED_LIST"
|
|
||||||
NUM_ROW="80"
|
|
||||||
REPOSITORY_VALUE="AUTH_METHOD"
|
|
||||||
SHOW_IF="(SFTP=='true') AND (USE_EXISTING_CONNECTION == 'false')"
|
|
||||||
>
|
|
||||||
<ITEMS DEFAULT="PASSWORD">
|
|
||||||
<ITEM NAME="PUBLICKEY" VALUE="PUBLICKEY"/>
|
|
||||||
<ITEM NAME="PASSWORD" VALUE="PASSWORD"/>
|
|
||||||
</ITEMS>
|
|
||||||
</PARAMETER>
|
|
||||||
<PARAMETER NAME="CONNECT_MODE" FIELD="CLOSED_LIST" NUM_ROW="100" REPOSITORY_VALUE="CONNECT_MODE" SHOW_IF="(SFTP=='false') AND (USE_EXISTING_CONNECTION == 'false')">
|
<PARAMETER NAME="CONNECT_MODE" FIELD="CLOSED_LIST" NUM_ROW="100" REPOSITORY_VALUE="CONNECT_MODE" SHOW_IF="(SFTP=='false') AND (USE_EXISTING_CONNECTION == 'false')">
|
||||||
<ITEMS DEFAULT="PASSIVE">
|
<ITEMS DEFAULT="PASSIVE">
|
||||||
<ITEM NAME="PASSIVE" VALUE="PASSIVE" />
|
<ITEM NAME="PASSIVE" VALUE="PASSIVE" />
|
||||||
@@ -187,7 +190,7 @@
|
|||||||
<CODEGENERATION>
|
<CODEGENERATION>
|
||||||
<IMPORTS>
|
<IMPORTS>
|
||||||
<IMPORT NAME="Java-FTP" MODULE="edtftpj.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj.jar" REQUIRED="true" />
|
<IMPORT NAME="Java-FTP" MODULE="edtftpj.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj.jar" REQUIRED="true" />
|
||||||
<IMPORT NAME="Java-SFTP" MODULE="jsch.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/jsch.jar" REQUIRED="true" />
|
<IMPORT NAME="Java-SFTP" MODULE="jsch-0.1.51.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/jsch-0.1.51.jar" REQUIRED="true" />
|
||||||
</IMPORTS>
|
</IMPORTS>
|
||||||
</CODEGENERATION>
|
</CODEGENERATION>
|
||||||
<RETURNS />
|
<RETURNS />
|
||||||
|
|||||||
@@ -83,11 +83,25 @@ COMPATIBILITY="ALL"
|
|||||||
<DEFAULT>false</DEFAULT>
|
<DEFAULT>false</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER
|
||||||
|
NAME="AUTH_METHOD"
|
||||||
|
FIELD="CLOSED_LIST"
|
||||||
|
NUM_ROW="81"
|
||||||
|
REPOSITORY_VALUE="AUTH_METHOD"
|
||||||
|
SHOW_IF="(SFTP=='true') AND (USE_EXISTING_CONNECTION == 'false')"
|
||||||
|
>
|
||||||
|
<ITEMS DEFAULT="PASSWORD">
|
||||||
|
<ITEM NAME="PUBLICKEY" VALUE="PUBLICKEY"/>
|
||||||
|
<ITEM NAME="PASSWORD" VALUE="PASSWORD"/>
|
||||||
|
</ITEMS>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
<PARAMETER
|
<PARAMETER
|
||||||
NAME="PRIVATEKEY"
|
NAME="PRIVATEKEY"
|
||||||
FIELD="FILE"
|
FIELD="FILE"
|
||||||
NUM_ROW="31"
|
NUM_ROW="31"
|
||||||
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
||||||
|
REPOSITORY_VALUE="PRIVATEKEY"
|
||||||
>
|
>
|
||||||
<DEFAULT>"/.ssh/id_dsa"</DEFAULT>
|
<DEFAULT>"/.ssh/id_dsa"</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
@@ -97,6 +111,7 @@ COMPATIBILITY="ALL"
|
|||||||
FIELD="PASSWORD"
|
FIELD="PASSWORD"
|
||||||
NUM_ROW="41"
|
NUM_ROW="41"
|
||||||
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
||||||
|
REPOSITORY_VALUE="PASSPHRASE"
|
||||||
>
|
>
|
||||||
<DEFAULT>"secret"</DEFAULT>
|
<DEFAULT>"secret"</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
@@ -169,20 +184,6 @@ COMPATIBILITY="ALL"
|
|||||||
</ITEMS>
|
</ITEMS>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
<PARAMETER
|
|
||||||
NAME="AUTH_METHOD"
|
|
||||||
FIELD="CLOSED_LIST"
|
|
||||||
NUM_ROW="81"
|
|
||||||
REPOSITORY_VALUE="AUTH_METHOD"
|
|
||||||
SHOW_IF="(SFTP=='true') AND (USE_EXISTING_CONNECTION == 'false')"
|
|
||||||
>
|
|
||||||
<ITEMS DEFAULT="PASSWORD">
|
|
||||||
<ITEM NAME="PUBLICKEY" VALUE="PUBLICKEY"/>
|
|
||||||
<ITEM NAME="PASSWORD" VALUE="PASSWORD"/>
|
|
||||||
</ITEMS>
|
|
||||||
</PARAMETER>
|
|
||||||
|
|
||||||
|
|
||||||
<PARAMETER NAME="PERL5_REGEX" FIELD="CHECK" REQUIRED="false" NUM_ROW="88">
|
<PARAMETER NAME="PERL5_REGEX" FIELD="CHECK" REQUIRED="false" NUM_ROW="88">
|
||||||
<DEFAULT>false</DEFAULT>
|
<DEFAULT>false</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
@@ -263,7 +264,7 @@ COMPATIBILITY="ALL"
|
|||||||
<CODEGENERATION>
|
<CODEGENERATION>
|
||||||
<IMPORTS>
|
<IMPORTS>
|
||||||
<IMPORT NAME="Java-FTP" MODULE="edtftpj.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj.jar" REQUIRED="true" />
|
<IMPORT NAME="Java-FTP" MODULE="edtftpj.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj.jar" REQUIRED="true" />
|
||||||
<IMPORT NAME="Java-SFTP" MODULE="jsch.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/jsch.jar" REQUIRED="true" />
|
<IMPORT NAME="Java-SFTP" MODULE="jsch-0.1.51.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/jsch-0.1.51.jar" REQUIRED="true" />
|
||||||
<IMPORT NAME="jakarta-oro" MODULE="jakarta-oro-2.0.8.jar" UrlPath="platform:/plugin/org.talend.libraries.apache/lib/jakarta-oro-2.0.8.jar" REQUIRED="true" />
|
<IMPORT NAME="jakarta-oro" MODULE="jakarta-oro-2.0.8.jar" UrlPath="platform:/plugin/org.talend.libraries.apache/lib/jakarta-oro-2.0.8.jar" REQUIRED="true" />
|
||||||
<IMPORT NAME="Java-FTPS" MODULE="ftp4j-1.5.1.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/ftp4j-1.5.1.jar" REQUIRED="true" />
|
<IMPORT NAME="Java-FTPS" MODULE="ftp4j-1.5.1.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/ftp4j-1.5.1.jar" REQUIRED="true" />
|
||||||
</IMPORTS>
|
</IMPORTS>
|
||||||
|
|||||||
@@ -101,15 +101,33 @@ COMPATIBILITY="ALL"
|
|||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
|
|
||||||
<PARAMETER NAME="SFTP" FIELD="CHECK" REQUIRED="true" NUM_ROW="10" REPOSITORY_VALUE="SFTP" SHOW_IF="USE_EXISTING_CONNECTION == 'false'">
|
<PARAMETER NAME="SFTP" FIELD="CHECK" REQUIRED="true" NUM_ROW="10" REPOSITORY_VALUE="SFTP" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (FTPS == 'false')">
|
||||||
<DEFAULT>false</DEFAULT>
|
<DEFAULT>false</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER NAME="FTPS" FIELD="CHECK" REQUIRED="true" NUM_ROW="10" SHOW_IF="(USE_EXISTING_CONNECTION == 'false') AND (SFTP == 'false')">
|
||||||
|
<DEFAULT>false</DEFAULT>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER
|
||||||
|
NAME="AUTH_METHOD"
|
||||||
|
FIELD="CLOSED_LIST"
|
||||||
|
NUM_ROW="7"
|
||||||
|
REPOSITORY_VALUE="AUTH_METHOD"
|
||||||
|
SHOW_IF="(SFTP=='true') AND (USE_EXISTING_CONNECTION == 'false')"
|
||||||
|
>
|
||||||
|
<ITEMS DEFAULT="PASSWORD">
|
||||||
|
<ITEM NAME="PUBLICKEY" VALUE="PUBLICKEY"/>
|
||||||
|
<ITEM NAME="PASSWORD" VALUE="PASSWORD"/>
|
||||||
|
</ITEMS>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
<PARAMETER
|
<PARAMETER
|
||||||
NAME="PRIVATEKEY"
|
NAME="PRIVATEKEY"
|
||||||
FIELD="FILE"
|
FIELD="FILE"
|
||||||
NUM_ROW="5"
|
NUM_ROW="5"
|
||||||
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
||||||
|
REPOSITORY_VALUE="PRIVATEKEY"
|
||||||
>
|
>
|
||||||
<DEFAULT>"/.ssh/id_dsa"</DEFAULT>
|
<DEFAULT>"/.ssh/id_dsa"</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
@@ -119,6 +137,7 @@ COMPATIBILITY="ALL"
|
|||||||
FIELD="PASSWORD"
|
FIELD="PASSWORD"
|
||||||
NUM_ROW="6"
|
NUM_ROW="6"
|
||||||
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
||||||
|
REPOSITORY_VALUE="PASSPHRASE"
|
||||||
>
|
>
|
||||||
<DEFAULT>"secret"</DEFAULT>
|
<DEFAULT>"secret"</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
@@ -253,7 +272,7 @@ COMPATIBILITY="ALL"
|
|||||||
<CODEGENERATION>
|
<CODEGENERATION>
|
||||||
<IMPORTS>
|
<IMPORTS>
|
||||||
<IMPORT NAME="Java-FTP" MODULE="edtftpj.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj.jar" REQUIRED="true" />
|
<IMPORT NAME="Java-FTP" MODULE="edtftpj.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj.jar" REQUIRED="true" />
|
||||||
<IMPORT NAME="Java-SFTP" MODULE="jsch.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/jsch.jar" REQUIRED="true" />
|
<IMPORT NAME="Java-SFTP" MODULE="jsch-0.1.51.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/jsch-0.1.51.jar" REQUIRED="true" />
|
||||||
</IMPORTS>
|
</IMPORTS>
|
||||||
</CODEGENERATION>
|
</CODEGENERATION>
|
||||||
<RETURNS>
|
<RETURNS>
|
||||||
|
|||||||
@@ -150,6 +150,16 @@ try{
|
|||||||
|
|
||||||
//do rename
|
//do rename
|
||||||
if(map<%=cid %>.get(key<%=cid %>) != "" && key<%=cid %> != map<%=cid %>.get(key<%=cid %>)){
|
if(map<%=cid %>.get(key<%=cid %>) != "" && key<%=cid %> != map<%=cid %>.get(key<%=cid %>)){
|
||||||
|
<%
|
||||||
|
if(("overwrite").equals(sftpoverwrite) || ("resume").equals(sftpoverwrite)){
|
||||||
|
%>
|
||||||
|
try{
|
||||||
|
c_<%=cid%>.rm(<%=remotedir %>+"/"+map<%=cid %>.get(key<%=cid %>));
|
||||||
|
}catch(com.jcraft.jsch.SftpException e_<%=cid%>){
|
||||||
|
}
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
try{
|
try{
|
||||||
c_<%=cid%>.rename(<%=remotedir %>+"/"+key<%=cid %>, <%=remotedir %>+"/"+map<%=cid %>.get(key<%=cid %>));
|
c_<%=cid%>.rename(<%=remotedir %>+"/"+key<%=cid %>, <%=remotedir %>+"/"+map<%=cid %>.get(key<%=cid %>));
|
||||||
globalMap.put("<%=cid %>_CURRENT_STATUS", "File rename OK.");
|
globalMap.put("<%=cid %>_CURRENT_STATUS", "File rename OK.");
|
||||||
|
|||||||
@@ -76,12 +76,27 @@ COMPATIBILITY="ALL"
|
|||||||
<PARAMETER NAME="SFTP" FIELD="CHECK" REQUIRED="true" NUM_ROW="41" REPOSITORY_VALUE="SFTP" SHOW_IF="USE_EXISTING_CONNECTION == 'false'">
|
<PARAMETER NAME="SFTP" FIELD="CHECK" REQUIRED="true" NUM_ROW="41" REPOSITORY_VALUE="SFTP" SHOW_IF="USE_EXISTING_CONNECTION == 'false'">
|
||||||
<DEFAULT>false</DEFAULT>
|
<DEFAULT>false</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER
|
||||||
|
NAME="AUTH_METHOD"
|
||||||
|
FIELD="CLOSED_LIST"
|
||||||
|
NUM_ROW="41"
|
||||||
|
REPOSITORY_VALUE="AUTH_METHOD"
|
||||||
|
SHOW_IF="(SFTP=='true')"
|
||||||
|
>
|
||||||
|
<ITEMS DEFAULT="PASSWORD">
|
||||||
|
<ITEM NAME="PUBLICKEY" VALUE="PUBLICKEY"/>
|
||||||
|
<ITEM NAME="PASSWORD" VALUE="PASSWORD"/>
|
||||||
|
</ITEMS>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
|
|
||||||
<PARAMETER
|
<PARAMETER
|
||||||
NAME="PRIVATEKEY"
|
NAME="PRIVATEKEY"
|
||||||
FIELD="FILE"
|
FIELD="FILE"
|
||||||
NUM_ROW="22"
|
NUM_ROW="22"
|
||||||
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
||||||
|
REPOSITORY_VALUE="PRIVATEKEY"
|
||||||
>
|
>
|
||||||
<DEFAULT>"/.ssh/id_dsa"</DEFAULT>
|
<DEFAULT>"/.ssh/id_dsa"</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
@@ -91,6 +106,7 @@ COMPATIBILITY="ALL"
|
|||||||
FIELD="PASSWORD"
|
FIELD="PASSWORD"
|
||||||
NUM_ROW="23"
|
NUM_ROW="23"
|
||||||
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
SHOW_IF="(SFTP=='true') AND (AUTH_METHOD == 'PUBLICKEY') AND (USE_EXISTING_CONNECTION == 'false')"
|
||||||
|
REPOSITORY_VALUE="PASSPHRASE"
|
||||||
>
|
>
|
||||||
<DEFAULT>"secret"</DEFAULT>
|
<DEFAULT>"secret"</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
@@ -115,21 +131,6 @@ COMPATIBILITY="ALL"
|
|||||||
</ITEMS>
|
</ITEMS>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<PARAMETER
|
|
||||||
NAME="AUTH_METHOD"
|
|
||||||
FIELD="CLOSED_LIST"
|
|
||||||
NUM_ROW="41"
|
|
||||||
REPOSITORY_VALUE="AUTH_METHOD"
|
|
||||||
SHOW_IF="(SFTP=='true')"
|
|
||||||
>
|
|
||||||
<ITEMS DEFAULT="PASSWORD">
|
|
||||||
<ITEM NAME="PUBLICKEY" VALUE="PUBLICKEY"/>
|
|
||||||
<ITEM NAME="PASSWORD" VALUE="PASSWORD"/>
|
|
||||||
</ITEMS>
|
|
||||||
</PARAMETER>
|
|
||||||
|
|
||||||
<PARAMETER NAME="FILES" FIELD="TABLE" REQUIRED="false" NUM_ROW="51" NB_LINES="4">
|
<PARAMETER NAME="FILES" FIELD="TABLE" REQUIRED="false" NUM_ROW="51" NB_LINES="4">
|
||||||
<ITEMS>
|
<ITEMS>
|
||||||
<ITEM NAME="FILEMASK" />
|
<ITEM NAME="FILEMASK" />
|
||||||
@@ -195,7 +196,7 @@ COMPATIBILITY="ALL"
|
|||||||
<CODEGENERATION>
|
<CODEGENERATION>
|
||||||
<IMPORTS>
|
<IMPORTS>
|
||||||
<IMPORT NAME="Java-FTP" MODULE="edtftpj.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj.jar" REQUIRED="true" />
|
<IMPORT NAME="Java-FTP" MODULE="edtftpj.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/edtftpj.jar" REQUIRED="true" />
|
||||||
<IMPORT NAME="Java-SFTP" MODULE="jsch.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/jsch.jar" REQUIRED="true" />
|
<IMPORT NAME="Java-SFTP" MODULE="jsch-0.1.51.jar" UrlPath="platform:/plugin/org.talend.libraries.ftp/lib/jsch-0.1.51.jar" REQUIRED="true" />
|
||||||
</IMPORTS>
|
</IMPORTS>
|
||||||
</CODEGENERATION>
|
</CODEGENERATION>
|
||||||
<RETURNS>
|
<RETURNS>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user