Compare commits

...

236 Commits

Author SHA1 Message Date
ldong-talend
f6c992b06d TPS-819:commit for TDI-31730. 2015-03-04 14:47:38 +08:00
wchen-talend
3ccc0f0d01 TUP-2548 fixed:Repository Manager - Rule Execution failed for joblets 2015-01-22 16:43:48 +08:00
jzhao
f5007780d9 TDI-30022: NotImplementedException or IllegalArgumentException when
tFileOutputExcel appends content to an Excel file containing formula
https://jira.talendforge.org/browse/TDI-30022
Note:1.Update POI
2.Fixed Hex2Dec problem
3.Rebuild sampleexcel.jar
2015-01-16 10:00:35 +08:00
wang wei
44f2e01da6 TDI-30541: Unable to create table in redshift
https://jira.talendforge.org/browse/TDI-30541
2015-01-15 17:51:33 +08:00
jzhao
3e12fbc758 TDI-31607: tS3 components and Frankfurt AWS region
https://jira.talendforge.org/browse/TDI-31607
Note:Remove useless code.
2015-01-15 14:44:11 +08:00
ycbai
a9e196ebca TDI-29844: "Show the table list for the current connection" buttton is
unuseable for tMysqlInput when use an existing connection
2015-01-15 14:40:16 +08:00
jzhao
2bc2020ece TDI-31607: tS3 components and Frankfurt AWS region
https://jira.talendforge.org/browse/TDI-31607
Note:
1.Update api
2.Add region for s3 components
2015-01-14 14:45:45 +08:00
hwang
8ceb5c5773 TDI-29300:Displaying problem in M/R job editor 2015-01-14 13:29:16 +08:00
wluo-talend
582ea02b7d TDI-31651: Fix tExtractEBCDICFields for the same problem in TDI-31537
https://jira.talendforge.org/browse/TDI-31651
2015-01-14 10:51:27 +08:00
wluo-talend
9a990ff742 TDI-31537: tFileInputEBCDIC component issue
https://jira.talendforge.org/browse/TDI-31537
2015-01-14 10:31:19 +08:00
qyliu
8dd361aeda TDI-29808 : Removing NB_LINE from tMOMConnection
https://jira.talendforge.org/browse/TDI-29808
2015-01-14 09:25:08 +08:00
jzhao
6f937b39da TDI-31284: tELTOracleOutput merge action have problem
https://jira.talendforge.org/browse/TDI-31284
2015-01-13 12:54:57 +08:00
jzhao
4570bd16d6 TDI-31407: Shared connections for tMomConnection
https://jira.talendforge.org/browse/TDI-31407
Note:add talend jar to tMomConnection
2015-01-13 12:50:33 +08:00
jzhao
ff335e14bc TDI-31407: Shared connections for tMomConnection
https://jira.talendforge.org/browse/TDI-31407
2015-01-13 12:11:35 +08:00
hcyi
4c45e5abbb TDI-29171:AS400 db shema:when do edit query studio will throw a
nullpointer error log.
2015-01-12 16:18:32 +08:00
cmeng-talend
a82124b02d TDI-29015 fix bug: DB2 Error on guess schema
https://jira.talendforge.org/browse/TDI-29015
2015-01-12 14:54:29 +08:00
hwang
46a1e87f15 Revert "TDI-31397:radiobox:"Departion row" is missing after joblet when enable"
This reverts commit d68904d156.
2015-01-12 12:49:23 +08:00
wchen-talend
c979fd6755 TDI-29376:The information does not matched with the checked option when
imporing demos in Welcome page.
2015-01-12 11:28:45 +08:00
wchen-talend
68fc96339e TDI-29898 :tXMLMap: import schema from invalid xml 2015-01-12 11:10:30 +08:00
jzhao
65d15e5f52 TDI-31555: lookup in tJoin will be executed the same times as
tPartitioner splits threads
https://jira.talendforge.org/browse/TDI-31555
Note:Fixed tHash
2015-01-07 15:24:41 +08:00
jzhao
ccb1edec7a TDI-31492: Need fix some problem of tMomConnection/tMomInput/tMomOutput
work with tMomCommit/tMomRollback
https://jira.talendforge.org/browse/TDI-31492
2015-01-07 13:39:49 +08:00
jzhao
596cad3214 TDI-31605:error shown logon studio for the first time
https://jira.talendforge.org/browse/TDI-31605
Note:Fixed the compile error in branch 5.5
2015-01-07 11:09:23 +08:00
jzhao
65e4521e36 TDI-31118: "specify identity field" don't work for tmssqloutput when
talend column name is different with talend db name
https://jira.talendforge.org/browse/TDI-31118
Note:Fixed problem with dynamic column
2015-01-05 10:59:42 +08:00
cmeng-talend
717294aad5 TDI-29366 fix bug: limit of rows number can not save successfully
https://jira.talendforge.org/browse/TDI-29366

Before fix, if the obtained value is ""(empty), then Studio will try to
get value from ESB, then if ESB return null, then this value will be set
to null instead of the original empty value; But in fact, user can set
some parameters(which are not from ESB) to empty, then can not set the
value to null simply.

Conflicts:
	main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/editor/process/ProcessUpdateManager.java
2015-01-04 17:30:58 +08:00
CHEN Bin
b27a6a21b9 TUP-2478: Heap space error hangs job with parallel iterations
https://jira.talendforge.org/browse/TUP-2478
handle java.lang.Error when iterator enable parallel
2014-12-31 14:26:48 +08:00
CHEN Bin
025e308eef TDI-31266: OutputFIleDelimited having issues with records over 8K when used with other components
https://jira.talendforge.org/browse/TDI-31266
correct ON_SUBJOB_OK
2014-12-30 11:45:08 +08:00
hwang
dce19f15a2 TDI-31336:Broken trigger link ‘OnComponentOk’ to joblet 2014-12-29 10:46:58 +08:00
hcyi
2de01a369f TDI-30894:Repository Content is empty in Stats & Logs. 2014-12-26 18:29:29 +08:00
cmeng-talend
383537d9d8 TDI-31531 fix bug: Bug with txmlmap used in a joblet
https://jira.talendforge.org/browse/TDI-31531
2014-12-26 17:54:23 +08:00
CHEN Bin
ae00ffa110 TDI-31266: OutputFIleDelimited having issues with records over 8K when used with other components
https://jira.talendforge.org/browse/TDI-31266
consider rows_end
2014-12-25 10:36:48 +08:00
wang wei
420d0a777f TDI-31405: tExtractJSONField generate the wrong code if adjust the order
of main line and reject line
https://jira.talendforge.org/browse/TDI-31405
2014-12-24 17:11:08 +08:00
wang wei
486d8db790 TDI-31455: tFileInputProperties return wrong row number
https://jira.talendforge.org/browse/TDI-31455
2014-12-24 15:37:48 +08:00
jzhao
4f23104649 TDI-31501: Parallelization of data flows and using tjavarow causes Null
Pointer Exception
https://jira.talendforge.org/browse/TDI-31501
Note:Fixed tHash and tAdvancedHash
2014-12-24 14:31:17 +08:00
jzhao
3fbf8176f4 View full commit
TDI-29203: Add the Websphere MQ in the tMomConnection
https://jira.talendforge.org/browse/TDI-29203 
Note:
1.Add the Websphere MQ in the tMomConnection 
2.Add use_exist_connection for tMommessageIdList 
3.Remove sepecify "Server" in tMomCommit/tMomRollback 
4.Fixed the wrong jar config
2014-12-24 13:46:14 +08:00
ldong-talend
e682cd204b TDI-31436:fix the pb of infinite folder. 2014-12-24 11:16:08 +08:00
CHEN Bin
6a74149210 TDI-31545: Parsing exceptions in tSalesforceInput component in bulk query mode
https://jira.talendforge.org/browse/TDI-31545
2014-12-23 17:21:51 +08:00
wang wei
499b100fce TDI-31486: fix 65535 issue for tDB2Output
https://jira.talendforge.org/browse/TDI-31486
2014-12-23 14:23:04 +08:00
hwang
02132228fb TDI-31064:Job Setting: The Password in Stats&Logs should be read-only 2014-12-22 19:01:32 +08:00
lwang-talend
74aff65037 TDI-30633: tAdvancedFileOutputXML output file append data incorrect
https://jira.talendforge.org/browse/TDI-30633
set the generation mode to dom4j if 'append file' option checked, and
extract five class definition to five standalone file, hidden option
'append file' if not choose 'dom4j' as generation mode
2014-12-22 18:06:14 +08:00
jzhao
73f417e4b5 TDI-31315: MDM transaction handling is wrong in multithreaded
environment
https://jira.talendforge.org/browse/TDI-31315
Note: add generate transaction id in client side.
2014-12-22 18:00:48 +08:00
cmeng-talend
623fb53054 TDI-29234 fix bug: #LINK@NODE doesn't work well as the condition when
TABLE IF in the schema
https://jira.talendforge.org/browse/TDI-29234
2014-12-22 12:01:40 +08:00
nrousseau
88c9b762b9 TDI-29234: revert change done on the DataProcess class since it blocks
all the tujs execution
2014-12-22 11:57:27 +08:00
cmeng-talend
524318aee8 TDI-29234 fix bug: #LINK@NODE doesn't work well as the condition when
TABLE IF in the schema
https://jira.talendforge.org/browse/TDI-29234

Do some more reasonable modifications
2014-12-22 11:55:59 +08:00
cmeng-talend
29de16fe5b TDI-29234 fix bug: #LINK@NODE doesn't work well as the condition when
TABLE IF in the schema
https://jira.talendforge.org/browse/TDI-29234

Conflicts:
	main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/model/components/Expression.java
	main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/model/process/DataProcess.java
2014-12-22 11:54:41 +08:00
cmeng-talend
799fa946df TDI-29298 fix bug: Several places to improve on displaying when you use
a big screen resolution and making text bigger than usual
https://jira.talendforge.org/browse/TDI-29298

TDI-28943 fix bug: debug button missing on Windows8.1 using TOS
2014-12-22 11:17:42 +08:00
cmeng-talend
6cd53357c0 TDI-29298 fix bug: Several places to improve on displaying when you use
a big screen resolution and making text bigger than usual
https://jira.talendforge.org/browse/TDI-29298

Fix display problems with JavaScdDialog
2014-12-22 11:17:35 +08:00
cmeng-talend
d4c5db24bd TDI-29298 fix bug: Several places to improve on displaying when you use
a big screen resolution and making text bigger than usual
https://jira.talendforge.org/browse/TDI-29298
2014-12-22 11:16:42 +08:00
lwang-talend
59bbc2493b TDI-30602: tSendMail compile error when multiple lines in Message on
non-windows OS
https://jira.talendforge.org/browse/TDI-30602
the line separator be converted just for windows, use a regular
expression(replaceAll("(\r\n|\r|\n)","\\\\n")) to convert the line
separator including unix-like(line break is '\n') and old mac(line break
is '\r')
2014-12-19 18:18:58 +08:00
jzhao
80faef72a4 TDI-30358: tGSConnection and tS3Connection returns NoSuchMethodError
https://jira.talendforge.org/browse/TDI-30358
2014-12-19 12:29:01 +08:00
jzhao
951c4204e9 TDI-31118: "specify identity field" don't work for tmssqloutput when
talend column name is different with talend db name
https://jira.talendforge.org/browse/TDI-31118
Note:
1.Fixed when column label and db column name is different, create table
error problem
2.Fixed when create table with identity column would have insert problem
2014-12-19 11:03:05 +08:00
GGu
2a9be6e310 Merge pull request #65 from zshen-talend/maintenance/5.5
bug fixed TDQ-9487change input columns' name, transfer changes to
2014-12-19 10:02:29 +08:00
zshen-talend
19c84499ed bug fixed TDQ-9487change input columns' name, transfer changes to
tMatchGroup, but when open the "Configuration wizard" still use the old
name.

fixed one logic error
2014-12-18 19:05:16 +08:00
GGu
62f92ee8ce Merge pull request #60 from zshen-talend/maintenance/5.5
bugfixed TDQ-9487 change input columns' name, transfer changes to
2014-12-18 14:56:34 +08:00
zshen-talend
8928c62fac bugfixed TDQ-9487 change input columns' name, transfer changes to
tMatchGroup, but when open the "Configuration wizard" still use the old
name.

tmatchGroup need to propagate change too
2014-12-18 11:47:29 +08:00
CHEN Bin
699fc5fc38 TDI-31266: OutputFIleDelimited having issues with records over 8K when used with other components
https://jira.talendforge.org/browse/TDI-31266
use @Deprecated instead of remove subTreeContainsParallelIterate
2014-12-17 09:59:07 +08:00
CHEN Bin
782f80150d TDI-31266: OutputFIleDelimited having issues with records over 8K when used with other components
https://jira.talendforge.org/browse/TDI-31266
use @Deprecated instead of remove subTreeContainsParallelIterate
2014-12-16 18:21:56 +08:00
wang wei
5b5b0bf9f7 TDI-31437: Incorrect processing of LIMIT and NB_LINES on tFileInputExcel
Component in Event Mode (Advance Settings)
https://jira.talendforge.org/browse/TDI-31437
2014-12-16 11:17:57 +08:00
CHEN Bin
a5d0a11612 TDI-31457: Compile Error when two Iterator enable parallel from one component
https://jira.talendforge.org/browse/TDI-31457
2014-12-15 17:11:30 +08:00
CHEN Bin
19ed3062ca TDI-31266: OutputFIleDelimited having issues with records over 8K when used with other components
https://jira.talendforge.org/browse/TDI-31266
change the tag about Iterator enable parallel from subtree to each component, which can fix the problem if the component is after onComponent/Subjob/RunIf

Conflicts:
	main/plugins/org.talend.designer.components.localprovider/components/tFileOutputDelimited/tFileOutputDelimited_begin.javajet
	main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/model/process/DataProcess.java
2014-12-15 16:47:10 +08:00
hwang
d68904d156 TDI-31397:radiobox:"Departion row" is missing after joblet when enable 2014-12-15 15:49:05 +08:00
hcyi
55caf730d9 TDI-31099:Shared components not in sync with SVN. 2014-12-15 14:15:31 +08:00
ldong-talend
39ed6bc995 TDI-27279:backport on 5.5. 2014-12-12 18:19:34 +08:00
CHEN Bin
1eb1390037 TDI-31321: commit on 5.3&5.4&5.5
https://jira.talendforge.org/browse/TDI-31321
for TDI-30309
2014-12-11 11:51:45 +08:00
lwang-talend
383034102b TDI-31329: In branch 5.5 tSybaseIQOutputBulkExec still have a compile
error ,branch 5.6 is ok
https://jira.talendforge.org/browse/TDI-31329
lack of cid as suffix for the variable 'dirverName'
2014-12-09 17:02:46 +08:00
wluo-talend
805bbeccb8 TDI-30863: There is no code to count the variable nb_line_XX of
tTeradataFastLoad
https://jira.talendforge.org/browse/TDI-30863
2014-12-08 15:36:36 +08:00
wang wei
9c8b5ecc7b TDI-31200: Talend Web Service(DataService) response ignores order of
elements
https://jira.talendforge.org/browse/TDI-31200
2014-12-08 10:27:59 +08:00
hwang
d8d650a031 TDI-31413:Click on any folder will show "null" after the folder name. 2014-12-05 18:43:23 +08:00
hcyi
5e7e0344a9 TDI-31208:NPE error occur when I click cancel button on the export
project seeting page
2014-12-05 16:46:01 +08:00
wchen-talend
5e04476b26 TDI-31214:Renaming an output row name from tXMLMap to the next component
does not get updated in the schema name
2014-12-04 18:49:21 +08:00
wluo-talend
a1c5b1935c Fix bug TDI-30362 : tSCPDelete: No error if file can't be deleted
https://jira.talendforge.org/browse/TDI-30362
2014-12-04 14:28:27 +08:00
Wu Liu
c3bbac2bf0 TDI-31380 : Unparseable date when DB2 using parallel execution option
the tAsynIn and tAsynOut used to have the metadatatable from the input
connector, now clone the metadatatable from the output component with
parallelizing is enabled.
Conflicts:
	main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/model/process/DataProcess.java
2014-12-04 11:29:18 +08:00
Wu Liu
9f74c2b355 TDI-31393 : lookup in tMap will be executed the same times as
tPartitioner splits threads
2014-12-04 10:57:34 +08:00
ldong-talend
d6afdea9b4 TDI-28452:backport the TDI-30951 on 5.4. 2014-12-03 15:33:17 +08:00
wchen-talend
0f52298b0d TDI-30111: refix bug TDI-30287
Conflicts:
	main/plugins/org.talend.designer.core/src/main/java/org/talend/designer/core/ui/editor/properties/controllers/ProcessController.java
2014-12-03 10:43:03 +08:00
wchen-talend
24ebe4c5ff bug TDI-30111 fixed: refactor repository review dialog, fix
ClassCastException if has repository.example plugin
2014-12-03 10:35:59 +08:00
wchen-talend
46bd13203e TDI-30111:refactor repository review dialog
Conflicts:
	main/plugins/org.talend.repository/src/main/java/org/talend/repository/ui/dialog/RepositoryReviewDialog.java
2014-12-03 10:35:38 +08:00
wluo-talend
eb33166638 TDI-30523: For mysql4, the exception is always thrown even "Die on
Error" is not checked.
https://jira.talendforge.org/browse/TDI-30523
2014-12-01 19:00:03 +08:00
wluo-talend
94c608bfd1 Revert "TDI-30605: ArrayIndexOutOfBoundsException in tPaloDimension https://jira.talendforge.org/browse/TDI-30605"
This reverts commit 2e7efdb9e7.
2014-11-27 14:18:55 -08:00
wluo
1eb310e587 TDI-30605: ArrayIndexOutOfBoundsException in tPaloDimension
https://jira.talendforge.org/browse/TDI-30605
2014-11-28 15:08:23 +08:00
wchen-talend
22b7121ee6 TDI-31317:Compile error when modify OnComponentOk links order coming
from tSSH
2014-11-26 11:09:34 +08:00
wang wei
e201c056a2 Bug TDI-28503 : data missing when use an Iterate between the tCollector
and the tDepartitioner
https://jira.talendforge.org/browse/TDI-28503
2014-11-26 09:53:51 +08:00
wchen-talend
8295aed1f1 TDI-31201:Routines->Pig UDF: Jars won't be imported when import routines
with linked jars
2014-11-25 18:01:12 +08:00
CHEN Bin
cc9adf9571 TDI-30996: Duplicate variable names when enabling parallel execution on iterations within the same subjob
https://jira.talendforge.org/browse/TDI-30996
lockWrite is the lock provided by iterate with parallel, one lockWrite for one Iterate connector
2014-11-25 16:51:49 +08:00
hcyi
92a3236084 TDI-31257:Got NPE when editing a new added column during retrieving MDM
Entity in Metadata.
2014-11-24 15:52:40 +08:00
jzhao
32d2c9949d TDI-31223: tOracleBulkExec global map variables return 0 count with
DIRECT = TRUE
https://jira.talendforge.org/browse/TDI-31223
Note:Return count incorrect
2014-11-21 16:06:27 +08:00
hcyi
c57859e6ae TDI-31173:Joblet "Output" schema shows same columns as "Input" schema. 2014-11-21 14:38:06 +08:00
wluo
2e7efdb9e7 TDI-30605: ArrayIndexOutOfBoundsException in tPaloDimension
https://jira.talendforge.org/browse/TDI-30605
2014-11-21 14:36:17 +08:00
ycbai
a81845446f TBD-1206: M/R Job is not saved before executing 2014-11-21 13:50:01 +08:00
wluo
035a8e9eb6 TDI-31275: backport on 5.3, 5.4, 5.5
https://jira.talendforge.org/browse/TDI-31275
2014-11-20 17:11:51 +08:00
CHEN Bin
e97dad1ba2 TDI-30996: Duplicate variable names when enabling parallel execution on iterations within the same subjob
https://jira.talendforge.org/browse/TDI-30996
2014-11-20 14:25:54 +08:00
wluo
3ba59befcc TDI-30532: The variable commitCounter_tInformixOutput_1 is always
zero,when use existing connection and auto commit is true.
https://jira.talendforge.org/browse/TDI-30532
2014-11-20 14:03:21 +08:00
cmeng-talend
b184f79d79 TUP-2188 fix bug: generate task failed of task with commandline command
created job
https://jira.talendforge.org/browse/TUP-2188

Conflicts:
	main/plugins/org.talend.designer.publish.core/src/org/talend/designer/publish/core/filters/AbstractJobNodeFilter.java
	main/plugins/org.talend.repository/src/main/java/org/talend/repository/ui/wizards/exportjob/extrachecker/AbstractJobNodeChecker.java
2014-11-19 19:28:25 +08:00
wluo
075bfe212b TDI-30532: The variable commitCounter_tInformixOutput_1 is always
zero,when use existing connection and auto commit is true.
https://jira.talendforge.org/browse/TDI-30532
2014-11-19 15:23:21 +08:00
ldong-talend
b02ea77a65 TDI-31013:recollector code error for merge sort parameter. 2014-11-18 16:27:48 +08:00
jzhao
e113071eb8 TDI-30999: Cannot use 2 or more tsendmail with different connection
parameters
https://jira.talendforge.org/browse/TDI-30999
Note:Remove custom properties
2014-11-18 16:24:03 +08:00
wang wei
e063526e4a TDI-31034: If the namespace is declared, unable to retrieve the element
of the upper level if the attribute is contained in the XPATH query
https://jira.talendforge.org/browse/TDI-31034
2014-11-18 10:03:52 +08:00
yshamin
7cddcf0c2e - TESB-13614: fixed 2014-11-13 16:18:35 +01:00
hcyi
cd12584459 TDI-30610:tOracleSCD changes surrogate key datatype from BigDecimal to
String
2014-11-13 17:34:26 +08:00
hcyi
787bb79340 TDI-30934:tOracleSCD Reorders Defined Schema Alphabetically 2014-11-13 17:02:42 +08:00
Wu Liu
5f2e621653 TDI-31194 : tMap doesn't work well in partitioning with "store temp
data"=true in lookup table
https://jira.talendforge.org/browse/TDI-31194
2014-11-13 16:34:59 +08:00
Wu Liu
6c42742a6f TDI-31013 : tRecollector gives code error when using parrelization
https://jira.talendforge.org/browse/TDI-31013
tSortRow doesn't work well in partition with "sort on disk" is enabled.
2014-11-13 14:40:32 +08:00
CHEN Bin
fd3e879e49 TDI-30530: A compile error occurs when parallel execution are checked for tInfomixtOutput without using existing connection no matter use batch size is checked or not.
https://jira.talendforge.org/browse/TDI-30530
2014-11-12 15:28:27 +08:00
wluo
4d5f5db43c TDI-30733 : tOracleInput and tPostgresqlInput fail with NPE on null
geometry
https://jira.talendforge.org/browse/TDI-30733
#merge pull request #42
2014-11-12 14:34:30 +08:00
CHEN Bin
8c7feb17df TDI-31131: Variable decryptedPassword_<%=cid%> shouldn't be assigned value when tSAPInput/tSAPOutput/tSAPTableInput/tSAPBapi checked use an existing connection
https://jira.talendforge.org/browse/TDI-31131
2014-11-11 17:20:03 +08:00
wluo
1cd74840bf TDI-31016: tEXistList return wrong NB_FILE's result
https://jira.talendforge.org/browse/TDI-31016
2014-11-11 17:09:33 +08:00
jzhao
6a53a1850a TDI-31070: Code generation error [tOracleOutputBulExec]
https://jira.talendforge.org/browse/TDI-31070
Note:Fixed tOracleOutputBulExec/tSybaseIQOutputBulkExec
2014-11-11 11:35:08 +08:00
wang wei
fff8025040 TDI-31036: LockWrite can not be resolved as a variable in parallel
iterations
https://jira.talendforge.org/browse/TDI-31036
2014-11-10 17:41:48 +08:00
hwang
9c4306c6cd TDI-30657:Expression Builder for Var in tMap does not show Var name 2014-11-10 11:27:04 +08:00
hcyi
5d25d624c0 TDI-30811:tSalesforcebulkexec/tSalesforceOutput link tLogRow with main
line has compile error.
2014-11-07 18:00:53 +08:00
cmeng-talend
cc4269f3f2 TDI-30475 fix bug: tELTxxxInput: Column in schema with Build-In mode
couldn't be deleted correctly
https://jira.talendforge.org/browse/TDI-30475
2014-11-07 17:47:32 +08:00
CHEN Bin
75dd7e17d6 TDI-30655: Salesforce Relationship Mapping and Null Values
https://jira.talendforge.org/browse/TDI-30655
2014-11-06 18:11:11 +08:00
hcyi
45d1a7f734 TDI-30811:tSalesforcebulkexec/tSalesforceOutput link tLogRow with main
line has compile error.
2014-11-06 16:29:37 +08:00
jzhao
b7ae8a2f40 TDI-30638: tMSSqlBulkExec Update SQL Statement wrong
https://jira.talendforge.org/browse/TDI-30638
Note:genereate update sql with db column name
2014-11-06 14:48:20 +08:00
CHEN Bin
b0b2138fa0 TDI-30639: tSalesforceOutput component is ignoring the commit level parameter
https://jira.talendforge.org/browse/TDI-30639
2014-11-06 11:58:31 +08:00
hwang
5acca4f1c1 TDI-30729:Unable to save setting result in 'Dynamic settings' tab 2014-11-06 10:44:34 +08:00
wchen-talend
1225bbdf8f TDI-29990 fixed :If you create XML metadata which includes numbers and
use it in a tXMLMap, all elements are arbitrarily treated as strings.
2014-11-05 16:16:05 +08:00
jzhao
b73d0c7988 TDI-30918: tS3List component does not seem to return all results for a
folder
https://jira.talendforge.org/browse/TDI-30918
Note:Fixed miss end of the recoreds if revords count > 1000
2014-11-04 15:47:06 +08:00
jzhao
bcd069f1f1 TDI-30885: Milliseconds not being output with TIMESTAMP with TIME ZONE
Db Type Selected
https://jira.talendforge.org/browse/TDI-30885
Note:Insert not a "TalendTimestampWithTZ" type into a "TIMESTAMP with
TIME ZONE" Db Type drop "ms"
2014-11-03 17:19:34 +08:00
wang wei
4f3e0bd3d8 TDI-30984: tWriteJSONField and tWriteXMLField will be blocked when there
is a big iterate loop to start
https://jira.talendforge.org/browse/TDI-30984
2014-10-31 16:58:12 +08:00
wang wei
80b3ac3d6b TDI-30896: password is not encryted for resume log
https://jira.talendforge.org/browse/TDI-30896
2014-10-31 11:05:36 +08:00
CHEN Bin
dca5e42cb0 TDI-30862: 65k issue with tFileInputPositional, 890 fields.
https://jira.talendforge.org/browse/TDI-30862
extract the code into inner class
2014-10-31 10:50:47 +08:00
CHEN Bin
e1dc437cd4 TDI-30862: 65k issue with tFileInputPositional, 890 fields.
https://jira.talendforge.org/browse/TDI-30862
format code
2014-10-31 10:50:35 +08:00
cmeng-talend
5f53a01799 TDI-30924 fix bug: When "Create Salesforce Connection",the shell "New
Salesforce" didn't pop up on Ubuntu12
https://jira.talendforge.org/browse/TDI-30924

Recompiled the salesforceCRMManagement.jar using Java 6.
2014-10-30 18:44:52 +08:00
wluo
4ac60aac44 TDI-30431 : can't update table when using time fields as key
https://jira.talendforge.org/browse/TDI-30431
2014-10-27 10:29:24 +08:00
wluo
b97b329feb fix bug: tVerticaRow still allow to set auto commit when checked use an
existing connection
https://jira.talendforge.org/browse/TDI-30704
2014-10-23 16:44:30 +08:00
wluo
1ea8297f8f fix bug:tInformixOutput - Truncate
https://jira.talendforge.org/browse/TDI-30625
2014-10-23 16:25:31 +08:00
wluo
0733a0797f fix bug: Update jet file of tFileInputExcel and tFileOutputExcel
https://jira.talendforge.org/browse/TDI-29361
2014-10-22 15:05:30 +08:00
zwzhao-talend
af18e8a3ce TDI-30246 : Inconsistent behaviors between job, jobscript, routine
creating with the same name;
2014-10-22 14:39:15 +08:00
hwang
8a06a58fdc TDI-30853:context value of db password in stats&logs become invalid
after migrate from v5.3.1 to v5.5.1
2014-10-22 13:47:14 +08:00
hwang
b8296e86f4 TDI-30853:context value of db password in stats&logs become invalid
after migrate from v5.3.1 to v5.5.1
2014-10-22 13:47:11 +08:00
cmeng-talend
77dbd51477 TDI-30475 fix bug: tELTxxxInput: Column in schema with Build-In mode
couldn't be deleted correctly
2014-10-21 15:59:46 +08:00
wang wei
0074dc2a90 TDI-30833: the order of elements is not correct with
tAdvancedFileOutputXML 
https://jira.talendforge.org/browse/TDI-30833
2014-10-21 13:58:45 +08:00
jzhao
904a10f96c TDI-30040: remove unnecessary code in scd
https://jira.talendforge.org/browse/TDI-30040
Note:Change parameter name for tMDMConnection
2014-10-21 13:34:10 +08:00
jzhao
9935c1d9ba TDI-30728: Need component to sychronized the tMDMInput_java.xml and
tMDMConection_java.xml 
https://jira.talendforge.org/browse/TDI-30728
Note:Change parameter name for tMDMConnection
2014-10-21 11:50:24 +08:00
jzhao
ed19328f56 TDI-29885: Google BigQuery upload components do not allow the handling
of newline characters properly.
https://jira.talendforge.org/browse/TDI-29885 
Note:upload new jar
2014-10-20 11:27:58 +08:00
wang wei
a156c12d6b TDI-30608: can't get value if xml attribute contain "{" , "}" or "."
https://jira.talendforge.org/browse/TDI-30608
2014-10-20 10:51:23 +08:00
wluo
bbea8e3fa4 fix workitem: tVerticaRow still allow to set auto commit when checked
use an existing connection
https://jira.talendforge.org/browse/TDI-30704
2014-08-15 13:42:30 +08:00
ldong-talend
7fd7b17ccb TDI-28452:Avoid the Recovery after a if link and a onComponentOK. 2014-10-16 11:05:50 +08:00
nrousseau
20cdc88c63 TUP-2257: fix the problem of resize when the zoom is not 100% 2014-10-15 11:41:56 +02:00
wang wei
4c923c2867 TDI-30291: Subjob hangs
https://jira.talendforge.org/browse/TDI-30291
2014-10-11 15:03:25 +08:00
wluo
9b67395e7f fix bug: tVerticaRow still allow to set auto commit when checked use an
existing connection
https://jira.talendforge.org/browse/TDI-30704
2014-10-10 18:23:11 +08:00
wluo
8d8050ad0c fix bug: tVerticaRow still allow to set auto commit when checked use an
existing connection
https://jira.talendforge.org/browse/TDI-30704
2014-10-10 18:12:06 +08:00
wluo
dec8532cdc fix bug: tSybaseIQBulkExec has a compile error when action on table is
Truncate table
https://jira.talendforge.org/browse/TDI-30756
2014-10-10 16:56:45 +08:00
wluo
0f532acf11 fix bug: tInformixRow produce code which is incorrect when checked use
an existing connection at branch 5.5
https://jira.talendforge.org/browse/TDI-30721
2014-10-10 11:34:27 +08:00
wchen-talend
8b8e724bb4 TDI-30185 fixed: Job when run and displays statistics gets cleared even 2014-10-10 09:55:19 +08:00
hcyi
a69b2f721e TDI-30447:SQL Builder: "Save Query as" pops up instead of Query Property
when user r-click Property for one query;
2014-10-08 17:13:05 +08:00
zwzhao-talend
064cd01af3 TDI-30449 : JobCompare: Connector difference couldn't be exported to
exported html file
2014-10-08 17:04:59 +08:00
wang wei
a773751df8 TDI-30662: CodeGenerator got java.lang.IndexOutOfBoundsException when
connect tESBProviderRequest and tXMLMap in a job.
https://jira.talendforge.org/browse/TDI-30662
2014-10-08 16:53:48 +08:00
wang wei
4c37d77789 TDI-30672: Combination of disk caching, a certain volume of records and
a inner join (first match) causes tMap to join incorrectly
https://jira.talendforge.org/browse/TDI-30672
2014-09-29 10:44:07 +08:00
Wu Liu
a8d622a938 TDI-30200 : Run doesn't stop if an exception is raised when using
partitioner components
https://jira.talendforge.org/browse/TDI-30200
2014-09-25 16:11:21 +08:00
cmeng-talend
6da232abf9 TDI-30183 fix bug: The tLogRow name is wrong when I do copy&past&delete
for job then do copy&past agains
https://jira.talendforge.org/browse/TDI-30183

Fix bug:
 Studio will crashed:
  1. Create a MR job, and add a node
  2. delete this node
 the result is studio will crash

Reason:
In MR job, the container of nodes will contains it self too.
so "jobletContainer.getNodeContainers()" will return a list which
contains itself, so this case make the function falling into dead loop.

Resolve:
I add a readedContainers set to make sure this function will never read
a container which he has read in case of falling into dead loop again.
2014-09-25 12:09:08 +08:00
plv
676dbf3e5d TDI-30560 : ODBC: Stast&Logs in job couldn't find the datasoure and
driver when user configure the Property type as Repository->odbc souce;
2014-09-24 16:35:46 +08:00
jzhao
d3ad25d070 Fixed Bug TDI-30399: ORA-00942 table or view does not exist during
transfer of tables with CLOB fields
https://jira.talendforge.org/browse/TDI-30399
Note:Fixed XMLType and Bolb type can't work with Dynamic type.
2014-09-24 15:23:32 +08:00
jzhao
463add70e6 Fixed Bug TDI-30399: ORA-00942 table or view does not exist during
transfer of tables with CLOB fields
https://jira.talendforge.org/browse/TDI-30399
Note:Fixed XMLType and Bolb type can't work with Dynamic type.
2014-09-23 14:26:20 +08:00
jzhao
f4bce4c2e0 Fixed Bug TDI-30273: Use tFTPPut or tFTPRename to rename a file
https://jira.talendforge.org/browse/TDI-30273
Note:Fixed SFTP Overwirte file(overwrite/resume) rename to a exist file
throw error.
2014-09-23 13:53:37 +08:00
GGu
c273449832 TUP-1820: fixed the dialog to popup twince. 2014-09-22 13:38:14 +08:00
wluo
9ebd1b69dc Fix Bug TDI-29669 : tTeradataTPTUtility don't support the function of
'define character set'
https://jira.talendforge.org/browse/TDI-29943
2014-09-22 10:11:30 +08:00
cmeng-talend
3f600741f9 TDI-30475 fix bug: tELTxxxInput: Column in schema with Build-In mode
couldn't be deleted correctly
https://jira.talendforge.org/browse/TDI-30475

Conflicts:
	main/plugins/org.talend.designer.dbmap/src/main/java/org/talend/designer/dbmap/DbMapComponent.java
2014-09-19 18:50:32 +08:00
wluo
cf102b7570 Fix Bug TDI-29669 : tTeradataTPTUtility don't support the function of
'define character set'
https://jira.talendforge.org/browse/TDI-29943
2014-09-19 14:34:03 +08:00
hcyi
634b17e24f TDI-30448:SQL Builder: All new queries is autosaved as the last stored
query instead of new one after user open and save two queries.
2014-09-18 15:59:45 +08:00
jzhao
22611e1e5b Fixed Bug TDI-30399: ORA-00942 table or view does not exist during
transfer of tables with CLOB fields
https://jira.talendforge.org/browse/TDI-30399
Note:Fixed XMLType and Bolb type can't work with Dynamic type.
2014-09-15 18:33:51 +08:00
wluo
677289c39a Fix workitem TDI-30414 : There are two problems for DBOutput
https://jira.talendforge.org/browse/TDI-30414
2014-09-12 18:53:22 +08:00
cmeng-talend
b5c2f45ebf TDI-30366 fix bug: Unable to retrieve salesforce modules from Salesforce
metadata connection
https://jira.talendforge.org/browse/TDI-30366
2014-09-11 18:45:04 +08:00
wluo
7dcd7e5c9a Fix bug TDI-29943 : tTeradataTPTUtility don't support the function of
'define character set'
https://jira.talendforge.org/browse/TDI-29943
2014-09-12 16:27:40 +08:00
cmeng-talend
a67ea5fdc5 TDI-30183 fix bug: The tLogRow name is wrong when I do copy&past&delete
for job then do copy&past agains
https://jira.talendforge.org/browse/TDI-30183
2014-09-12 10:14:53 +08:00
wluo
d7e270b875 fix workitem TDI-30485 : Please clean the no useful parameter in
tTeradataTPTExec_java.xml/tTeradataTPTUtility_java.xml
https://jira.talendforge.org/browse/TDI-30485
2014-09-12 10:13:04 +08:00
cmeng-talend
5955ccf400 TDI-30474 fix bug: UI layout: No space between "ELT Oracle Map Editor"
button and "Property Type" dropdownlist in ELT components;
https://jira.talendforge.org/browse/TDI-30474
2014-09-11 17:35:21 +08:00
zwzhao-talend
dd0ec72c7a TDI-30494 : SVN Branch is not sorted in the studio 2014-09-09 15:18:31 +08:00
plv
b04d6eef12 TDI-30347 : The schema error information prompt is wrong. 2014-09-05 18:23:30 +08:00
plv
cbc5700e99 TDI-30353 : Show an NPE error when I click cancel button for
Perferences->Talend->Appearance->Designer
2014-09-05 18:09:56 +08:00
wang wei
ea6bb6a285 TDI-29313: tSSH Component always output some line jump in console
https://jira.talendforge.org/browse/TDI-29313
2014-09-04 14:16:34 +08:00
CHEN Bin
85ae202f79 Revert "TDI-29926: HashInput Parallel Iteration https://jira.talendforge.org/browse/TDI-29926 make input support multiple thread read"
This reverts commit b766456204.
2014-09-03 11:07:10 +08:00
nrousseau
d2a245117f TDI-30480: fix tRunJob copy schema 2014-09-03 10:44:31 +08:00
jzhao
9ca528d37b Fixed Bug TDI-30399: ORA-00942 table or view does not exist during
transfer of tables with CLOB fields
https://jira.talendforge.org/browse/TDI-30399
Note:Fixed transfer Clob data between different database get error.
2014-09-01 18:13:57 +08:00
wang wei
ac81e3d231 TDI-30339: Improve the performance of tFileOutputExcel(when append and
formula exist)
https://jira.talendforge.org/browse/TDI-30339
2014-09-01 11:37:37 +08:00
hcyi
0381894e7d TDI-29762 : Set up SFTP with private key in repository not possible. 2014-09-01 10:47:38 +08:00
wang wei
6f419498e8 TDI-29782: tExtractXmlField should use input Document column
https://jira.talendforge.org/browse/TDI-29782
2014-08-29 15:50:23 +08:00
GGu
356ea0dba2 TDI-30276: fixed the duplicated projects issue. 2014-08-26 10:18:17 +08:00
GGu
ff5ee21808 TDI-23558: the find component action is only enabled for Components,
won't enable for folder.
2014-08-26 10:18:05 +08:00
GGu
129ce13184 TUP-2190: fixed the job xsl problem for exporting html doc. 2014-08-26 10:17:46 +08:00
plv
716fa891ad TDI-30284 : Drag and Drop of a PostgreSQL table from context repository
connection does not include Schema parameter in query
2014-08-25 14:37:48 +08:00
hcyi
f1d6c93b36 bug TDI-30190 fixed:tDB2Input can not retrive correct tables for
corresponding schema field in tDB2Connection when using an existing
connection.
2014-08-22 16:30:51 +08:00
sizhaoliu
2339918329 TDQ-9336 fix tRuleSurvivorship rule dependency issue 2014-08-19 17:05:43 +02:00
CHEN Bin
75212a5636 bug fixed TDI-30286: Wrong behavior on tEXAOutput when Die on error unchecked
https://jira.talendforge.org/browse/TDI-30286
2014-08-18 14:03:52 +08:00
GGu
b62955c2ef TDI-30108: Add the table changes for exporting html. 2014-08-15 11:58:03 +08:00
Wu Liu
706bb16293 TDI-26881 : DYNAMIC type schema cause DATE, TIME, and DATETIME2 DB types
to be rejected
https://jira.talendforge.org/browse/TDI-26881
Use tJDBCInput instead of tMSSQLInput to use sqljdbc4.jar to meet the
requirement.
2014-08-14 16:54:26 +08:00
wang wei
7fe2d50e60 TDI-30313: Bug in lookup of tXMLMap?
https://jira.talendforge.org/browse/TDI-30313
2014-08-13 16:22:45 +08:00
wang wei
202fe371a3 TDI-30297: Function Identity field, Start value, step of tMSSqlOutput
can't be showed in tos
https://jira.talendforge.org/browse/TDI-30297
2014-08-13 15:54:23 +08:00
zwzhao-talend
f5e0dc709d bug TDI-29960 fixed : The Required checkbox should be checked as default
setting for components which need to install jar
2014-08-13 14:26:01 +08:00
CHEN Bin
629e0f8424 TDI-29926: HashInput Parallel Iteration
https://jira.talendforge.org/browse/TDI-29926
make input support multiple thread read
2014-08-12 10:08:18 +08:00
CHEN Bin
c543a04213 Revert "Fixed Bug TDI-29926: HashInput Parallel Iteration https://jira.talendforge.org/browse/TDI-29926 Note:Fixed HashInput/Output Parallel Iteration problem"
This reverts commit d746694ac2.
2014-08-12 10:08:17 +08:00
remydub
7abd2882ba Merge branch 'maintenance/5.5' of https://github.com/Talend/tdi-studio-se into maintenance/5.5 2014-08-11 17:51:36 +02:00
remydub
349cd48178 TBD-933: Add a migration task to disable the die on error for the command line mode 2014-08-11 17:48:48 +02:00
zwzhao-talend
960fcfe02f TDI-8312 : Component settings not refreshed 2014-08-11 10:11:36 +08:00
zwzhao-talend
63f323a078 bug TDI-8312 fixed : Component settings not refreshed 2014-08-11 10:10:51 +08:00
wang wei
e9fff603fd TDI-30262: Change the length of job of tAssertCatcher as TDI-30166
https://jira.talendforge.org/browse/TDI-30262
2014-08-06 17:55:15 +08:00
Wu Liu
307fcd80a0 TDI-30252 : different behavior about tAS400Output component after
migrate from v5.2.1 to v5.4.2
https://jira.talendforge.org/browse/TDI-30252
2014-08-05 17:12:03 +08:00
GGu
0a0a27d9f9 https://jira.talendforge.org/browse/TDI-30108 : Fixed one problem for compare, when open editor with readonly. 2014-08-05 16:57:34 +08:00
nrousseau
229516934b TDI-30056 : update dependencies when use save as on job 2014-08-04 18:48:35 +08:00
wluo
787d9e4792 Fix workitem TDI-29669 : tDBOutput output query which availability
should be FLOW type
https://jira.talendforge.org/browse/TDI-29669
2014-08-04 14:26:14 -07:00
wluo
d723037e7f Merge branch 'maintenance/5.5' of git@github.com:Talend/tdi-studio-se.git into maintenance/5.5 2014-08-04 13:29:24 -07:00
wluo
cd36af03ea Fix workitem TDI-29669 : tDBOutput output query which availability
should be FLOW type
https://jira.talendforge.org/browse/TDI-29669
2014-08-04 13:28:26 -07:00
Alex Telesh
36e67baf23 TESB-13929 - Exception while using option "Use an existing connection"
=> TESB-13979 - commit to source repository (master + branches)
2014-08-01 09:12:43 -04:30
wluo
5fd65d7540 Fix workitem TDI-29669 : tDBOutput output query which availability
should be FLOW type
https://jira.talendforge.org/browse/TDI-29669
2014-07-31 19:35:24 -07:00
Wu Liu
692a1fbdfa Fix Bug TDI-30200 : fix the block problem when there is an exception
happen
https://jira.talendforge.org/browse/TDI-30200
2014-07-31 15:45:13 +08:00
CHEN Bin
39853f528e bug fixed TDI-30121: tMap has a compile error when checked log4j mode
https://jira.talendforge.org/browse/TDI-30121
log reference instead of expression avoid append(null) problem.
2014-07-29 12:16:03 +08:00
wang wei
9f72414fe1 Bug TDI-30166: Service job can't work well when enable the database of
AMC
https://jira.talendforge.org/browse/TDI-30166
2014-07-28 15:58:41 +08:00
CHEN Bin
246865e4dd fixed Bug TDI-29912: tSalesforceInput - Session Invalid Error
https://jira.talendforge.org/browse/TDI-29912

1. refactor
move some method from SforceManagementImpl to SforceManagementUtil & clean SforceManagementImpl
extract connection part as SforceConnection.

2. implement renew session for basic/oauth on soap/bulk api

3. modified all salesforce components to adapt the change of api

Conflicts:
	main/plugins/org.talend.designer.components.localprovider/components/tSalesforceBulkExec/tSalesforceBulkExec_begin.javajet
	main/plugins/org.talend.designer.components.localprovider/components/tSalesforceConnection/tSalesforceConnection_begin.javajet
	main/plugins/org.talend.designer.components.localprovider/components/tSalesforceGetDeleted/tSalesforceGetDeleted_begin.javajet
	main/plugins/org.talend.designer.components.localprovider/components/tSalesforceGetServerTimestamp/tSalesforceGetServerTimestamp_begin.javajet
	main/plugins/org.talend.designer.components.localprovider/components/tSalesforceGetUpdated/tSalesforceGetUpdated_begin.javajet
	main/plugins/org.talend.designer.components.localprovider/components/tSalesforceInput/tSalesforceInput_begin.javajet
	main/plugins/org.talend.designer.components.localprovider/components/tSalesforceOutput/tSalesforceOutput_begin.javajet
2014-07-25 18:35:50 +08:00
Wu Liu
6966d99b9f Fix Bug TDI-29759 : to resolve the problem during migration.
https://jira.talendforge.org/browse/TDI-29759
2014-07-25 17:51:04 +08:00
Wu Liu
e321c2bfc0 Fix Bug TDI-29759 : Add a new table to support decoding
Integer(int),Long(long), Byte(byte), Short(short) types.
https://jira.talendforge.org/browse/TDI-29759
2014-07-23 14:44:20 +08:00
zwzhao-talend
5acc34e4fe bug TDI-29345 fixed : Status &log disappeared if click "link with editor
"
2014-07-23 12:06:37 +08:00
wang wei
205e8ecc69 Bug TDI-30053: Row separators incorrect with CSV options and split
output
https://jira.talendforge.org/browse/TDI-30053
2014-07-22 16:10:18 +08:00
jzhao
b5165e5ba5 Fixed Bug TDI-30088: Unable to write to SAS
https://jira.talendforge.org/browse/TDI-30088
Note:Merge to branch 5.5
2014-07-21 11:37:54 +08:00
jzhao
0ef11c33d0 Fixed Bug TDI-30009: Issue with the tSybaseOutput
https://jira.talendforge.org/browse/TDI-30009
Note:Merge to branch 5.5
2014-07-21 09:41:53 +08:00
nrousseau
d610220c94 fix issues related to hl7: TDI-29999 / TDI-29925 / TDI-30016 /TDI-29453 2014-07-18 16:59:55 +08:00
wang wei
8a48abe7d8 Fixed Bug TDI-29958: tXMLMap doesn't work with more data
https://jira.talendforge.org/browse/TDI-29958
2014-07-18 16:36:58 +08:00
zwzhao-talend
bcfce5dd01 bug TDI-29869 fixed : Inconsistent behavior of the job tab in the Studio 2014-07-18 10:30:00 +08:00
Wu Liu
bd1a153a9a Fix backlog task TDI-29911 : link these 2 parameters with the metadata,
PRIVATEKEY & PASSPHRASE
https://jira.talendforge.org/browse/TDI-29911
2014-07-16 15:06:23 +08:00
CHEN Bin
be371811fa Fixed Bug TDI-29843: Sudden end of job unexpectedly
https://jira.talendforge.org/browse/TDI-29843
revert the code about "modify the type of nb_line from Integer to Long on tFileInputDelimited"
2014-07-16 10:24:06 +08:00
Wu Liu
ac5544c972 Fix Bug TDI-29157 : For tRestRequest + tMomConnection + ActiveMQ the
producers spawned continuously for every request => ultimately running
out of memory
https://jira.talendforge.org/browse/TDI-29157
2014-07-11 14:51:46 +08:00
jzhao
1c7eaad2c4 Fixed Bug TDI-29926: HashInput Parallel Iteration
https://jira.talendforge.org/browse/TDI-29926
Note:Merge to branch 5.5
2014-07-11 09:33:38 +08:00
jzhao
eb58252a71 TDI-29598: Click tELTXXXOutput componment, there is an error in error
log 
https://jira.talendforge.org/browse/TDI-29598
Note: Avoid NPE when previousNode is null.
2014-07-08 11:39:04 +08:00
jzhao
0b69fac187 Fixed Bug TDI-29360: tVerticaSCD can't create a table which surrogate
keys is Auto increment 
https://jira.talendforge.org/browse/TDI-29360 
Note:Merge branch 5.5
2014-07-07 18:13:23 +08:00
CHEN Bin
62b058d6a7 fixed bug TDI-29861: tHashOutput in a cTalendJob causes memory leak
https://jira.talendforge.org/browse/TDI-29861
release resource on tHashInput which the resource used by tHashOutput
2014-07-07 17:16:38 +08:00
nrousseau
89e13dd543 TDI-29917 : update junit feature 2014-07-07 12:16:00 +08:00
Wu Liu
9ac1ccd558 Fix Bug TDI-29959 : when the password is null, it will generate "null"
instead
https://jira.talendforge.org/browse/TDI-29959
2014-07-04 18:14:51 +08:00
CHEN Bin
9b321eafc1 Fix Bug TDI-29620 : tSASInput Component unable to connect to SAS
https://jira.talendforge.org/browse/TDI-29620
2014-07-04 10:52:27 +08:00
GGu
eef8708b58 TUP-2084: fix build problem for ftp lib plugin. 2014-07-03 13:44:28 +08:00
wang wei
88587221b5 Fix Bug TDI-29720 : Exception when configuring a tXMLMap with 2 outputs
of the same type
https://jira.talendforge.org/browse/TDI-29720
2014-07-03 09:39:53 -07:00
jzhao
a651264695 Fixed Bug TDI-26876: Component managed date now has time appended when
it was originally just a date
https://jira.talendforge.org/browse/TDI-26876
Note:Remove useless code. merge branch 5.5
2014-07-02 17:27:31 +08:00
bchen
33613cff3c Fix Bug TDI-29620 : tSASInput Component unable to connect to SAS
https://jira.talendforge.org/browse/TDI-29620
2014-07-02 15:30:36 +08:00
bchen
fdd4415dea Fix Bug TDI-29614 : tSchemaComplianceCheck errorCode wrong behaviour
https://jira.talendforge.org/browse/TDI-29614
clarify errorCode value when multiple node have error

git-svn-id: http://talendforge.org/svn/tos/trunk@118386 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2014-07-02 14:37:32 +08:00
jzhao
7b36650ee3 Fixed Bug TDI-26876: Component managed date now has time appended when
it was originally just a date
https://jira.talendforge.org/browse/TDI-26876
Note:Merge branch 5.5
2014-07-02 12:04:27 +08:00
Sébastien Gandon
1c4cfda8f5 Merge branch 'maintenance/5.5' of github.com:Talend/tdi-studio-se into maintenance/5.5 2014-07-01 15:18:26 +02:00
jzhao
56ea52079e Fixed Bug TDI-29930: The text of 'where condition in case' shouldn't be
showed when action on data is insert/update/insert or update  on
tTeradataMulitiLoad
Note:Merge to branch 5.5
2014-07-01 18:12:14 +08:00
plv
e49321897a bug TDI-29899 fixed: DB2 connection ignore the 'schema' parameter 2014-07-01 17:22:42 -07:00
477 changed files with 14885 additions and 10203 deletions

View File

@@ -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>

View File

@@ -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) {

View File

@@ -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){

View File

@@ -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
*/ */

View File

@@ -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
<% <%

View File

@@ -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;
} }

View File

@@ -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");

View File

@@ -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
%> %>

View File

@@ -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;

View File

@@ -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;

View File

@@ -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.

View File

@@ -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);

View File

@@ -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$

View File

@@ -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;
} }

View File

@@ -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;
} }

View File

@@ -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>

View File

@@ -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,

View File

@@ -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;

View File

@@ -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);
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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,

View File

@@ -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);
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
} }

View File

@@ -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();
}
} }

View File

@@ -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);
}
}

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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

View File

@@ -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);
}
}

View File

@@ -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" />

View File

@@ -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);
} }

View File

@@ -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>

View File

@@ -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);

View File

@@ -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>

View File

@@ -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

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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"));
}
}

View File

@@ -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"));
}
}

View File

@@ -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" />

View File

@@ -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() {

View File

@@ -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>

View File

@@ -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();
}
}

View File

@@ -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"));
}
}

View File

@@ -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>

View File

@@ -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>

View File

@@ -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%>);
<%
}
}
%>

View File

@@ -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
}
}
%>

View File

@@ -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();
}
%>

View File

@@ -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 *** ------------------- //
%>

View File

@@ -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();
<%
}
}
%>

View File

@@ -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);
} }

View File

@@ -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);
} }

View File

@@ -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>

View File

@@ -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);
} }

View File

@@ -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 %>;

View File

@@ -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_<
<% <%
} }
}
} }
} }
%> %>

View File

@@ -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>

View File

@@ -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) {

View File

@@ -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>

View File

@@ -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%>);
<% <%

View File

@@ -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"/>

View File

@@ -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.");
<%}%> <%}%>

View File

@@ -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%>();

View File

@@ -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>

View File

@@ -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()%>;
<%
}
} }
} }
} }

View File

@@ -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

View File

@@ -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()));
<% <%
} }
} }

View File

@@ -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"

View File

@@ -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

View File

@@ -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)) {
%> %>

View File

@@ -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>

View File

@@ -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);

View File

@@ -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%> + "'.");

View File

@@ -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>

View File

@@ -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"
} }
} }
} }
%> %>

View File

@@ -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%>);
} }

View File

@@ -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%>);

View File

@@ -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)) {

View File

@@ -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)) {

View File

@@ -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 {
%> %>

View File

@@ -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;
<% <%

View File

@@ -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)) {

View File

@@ -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)) {

View File

@@ -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)) {

View File

@@ -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)) {

View File

@@ -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%>();

View File

@@ -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() %>;
<% <%
} }

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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 />

View File

@@ -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>

View File

@@ -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>

View File

@@ -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.");

View File

@@ -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