Compare commits

...

134 Commits

Author SHA1 Message Date
apoltavtsev
78acebc15f bugfix(APPINT-32306) Wrong artifact version of the job called by a route 2021-04-01 08:33:12 +02:00
bhe-talendbj
bb0ee2a746 fix(TUP-25820): backport (#5920) 2021-03-09 10:43:55 +08:00
bhe-talendbj
9478ce6a0b fix(TUP-25109): backport TUP-25109 (#5882)
* fix(TUP-25109): backport TUP-25109

* fix(TUP-25109): fix guess schema warning
2021-03-08 14:13:53 +08:00
apoltavtsev
ba425ca2b8 fix(TESB-32028) Remove supported ref Code Projects (#5910) 2021-03-05 23:14:02 +08:00
hcyi
d2983c5c19 fix(TDI-39084): fail to get sap table parameter for tsapbapi and throw NPE. (#5853)
* fix(TDI-39084): fail to get sap table parameter for tsapbapi and throw
NPE.

* TPS-4677:[7.1.1] "Z_TALEND_READ_TABLE" in tSAPBapi give null output
field

Co-authored-by: wang wei <wwang@talend.com>
2021-02-23 16:24:52 +08:00
Jane Ding
afec35bce4 fix(TUP-21055)Migration check executed at each start of studio (#2884) (#2916) (#5832)
* fix(TUP-21055)Migration check executed at each start of studio
https://jira.talendforge.org/browse/TUP-21055

* fix(TUP-21055)Migration check executed at each start of studio
https://jira.talendforge.org/browse/TUP-21055

* fix(TUP-21055)Migration check executed at each start of studio
https://jira.talendforge.org/browse/TUP-21055
Sort the ConfigTypeNode collection

* fix(TUP-21055)Migration check executed at each start of studio
https://jira.talendforge.org/browse/TUP-21055

* fix(TUP-21055)Migration check executed at each start of studio
https://jira.talendforge.org/browse/TUP-21055
2021-02-07 20:08:52 +08:00
bhe-talendbj
5ab73d73a2 fix(TUP-30360): add an option to disable sharing libraries (#5814)
* fix(TUP-30360): add an option to disable sharing libraries

* fix(TUP-30360): add an option to disable sharing libraries, default to true
2021-02-07 10:04:34 +08:00
Chao MENG
7a2837b9d4 fix(TUP-28576):Reference projects routine POM file is modified and can't (#5181) (#5761)
be committed to GIT

Co-authored-by: Zhiwei Xue <zwxue@talend.com>
2021-01-26 12:03:45 +08:00
hzhao-talendbj
e18491a014 fix(TUP-30179): sync context from ext-resource to resource (#5757)
* TUP-30179   remove context from resource and copy context from
ext-resource to resource

* tup-30179  add condition !isSynchronized
2021-01-25 11:15:12 +08:00
hzhao-talendbj
7577d3a038 TUP-30133 add directory resource in route template (#5738) 2021-01-18 09:50:33 +08:00
sbliu
747fe520be fix(TUP-29550) fix problem that "rename" Job in property sheet page duplicates item in Pom file (#5701) 2021-01-05 15:34:06 +08:00
kjwang
c8bbb07688 Kjwang/fix tps 4585 (#5696)
Fix TUP-25777 Integer values are read as string after applying
TPS-3637
https://jira.talendforge.org/browse/TUP-25777
2021-01-05 14:59:44 +08:00
Jane Ding
9a0fd741ce fix(TUP-25649):ERROR when Job in MDM project calling Job in Reference DI (#4331) (#4355) (#5682)
project:import routines.DataQuality cannot be resolved.

Co-authored-by: hcyi <hcyi@talend.com>
2020-12-30 13:02:25 +08:00
mbasiuk-talend
ff71365a17 fix(TDI-45260): save patched version changes on github (#5679) 2020-12-29 15:01:21 +02:00
Jane Ding
8b6daa73e2 Jding/72/tup 22361 elt map bug in column expression while using context (#5595)
variable as a parameter (#3990) (#4209)

* fix(TUP-22361)ELTMap bug in column expression while using context
(#3938)

* fix(TUP-22361)ELTMap bug in column expression while using context
variable as a parameter
https://jira.talendforge.org/browse/TUP-22361

* fix(TUP-22361)ELTMap bug in column expression while using context
variable as a parameter
https://jira.talendforge.org/browse/TUP-22361

* fix(TUP-22361)ELTMap bug in column expression while using context
variable as a parameter
https://jira.talendforge.org/browse/TUP-22361

* fix(TUP-22361)ELTMap bug in column expression while using context
variable as a parameter
https://jira.talendforge.org/browse/TUP-22361

* fix(TUP-22361)ELTMap bug in column expression while using context
variable as a parameter
https://jira.talendforge.org/browse/TUP-22361

Conflicts:
	main/plugins/org.talend.designer.dbmap/src/main/java/org/talend/designer/dbmap/language/generation/DbGenerationManager.java
	main/plugins/org.talend.designer.dbmap/src/main/java/org/talend/designer/dbmap/language/postgres/PostgresGenerationManager.java
	test/plugins/org.talend.designer.dbmap.test/src/org/talend/designer/dbmap/language/generation/DbGenerationManagerTest.java
2020-12-07 10:03:37 +08:00
Zhiwei Xue
eeca56b820 fix(TUP-24623):Compilation error on the job with project references (#5464)
* fix(TUP-24623):Compilation error on the job with project references (#4010)

* fix(TUP-24623):fix regression.
2020-11-06 11:34:24 +08:00
wang wei
9446ce6bad fix(TDI-43619): Null Value Treated as <TALEND_NULL> in Subjob (#4488) (#5449)
Conflicts:
	main/plugins/org.talend.designer.codegen/jet_stub/footer.javajet
2020-11-06 10:09:15 +08:00
vdrokov
a35024deb3 TESB-30572:[7.1] Job build error (#5316)
Avoid build error by removing property from job design if it's value is "ROUTE".
2020-11-03 16:05:56 +01:00
hzhao-talendbj
f53601fb12 tup-27447 backport to patch721 (#4822) (#5238)
* tup-27447  backport to patch721 (#4822)

* fix Could not find the context
2020-10-12 10:04:08 +08:00
Zhiwei Xue
2d3e975d22 fix(TUP-26233):[7.0.1] Sometimes , the ZIP file created by a commandline (#4569) (#4985)
PublishJob is not correct, missing item files.
2020-07-24 18:20:15 +08:00
Dmytro Sylaiev
68aa2a03d5 patch(TPS-4071): Make cumulative patch (#4847)
* patch(TPS-4071): Make cumulative patch

* patch(TPS-4071): Make localprovider buildable

* patch(TPS-4071): Remove localprovider from cumulative patch

* patch(TPS-4071): Remove extra files

* patch(TPS-4071): Fix codegen to avoid compile errors

* patch(TPS-4071): tftpconnection ftps compile error

Co-authored-by: jzhao <jzhao@talend.com>
2020-06-29 20:08:39 +08:00
Jane Ding
5c1725b749 fix(TUP-27179):Studio freezes on job importing/loading (#4682) (#4865)
* fix(TUP-27179):Studio freezes on job importing/loading
https://jira.talendforge.org/browse/TUP-27179

* fix(TUP-27179):Studio freezes on job importing/loading
https://jira.talendforge.org/browse/TUP-27179

* fix(TUP-27179):Studio freezes on job importing/loading
https://jira.talendforge.org/browse/TUP-27179
2020-06-29 10:57:35 +08:00
Jane Ding
7f2c60fff4 feat(TUP-16546)Prompt users for new password in Studio Connection when AD or LDAP credentials change in TAC (#4787)
* feat(TUP-16546)Prompt users for new password in Studio Connection when
(#4508)

* feat(TUP-16546)Prompt users for new password in Studio Connection when
AD/LDAP credentials change in TAC
https://jira.talendforge.org/browse/TUP-16546

* feat(TUP-16546)Prompt users for new password in Studio Connection when
AD/LDAP credentials change in TAC
https://jira.talendforge.org/browse/TUP-16546

* feat(TUP-16546)Prompt users for new password in Studio Connection when
AD/LDAP credentials change in TAC
https://jira.talendforge.org/browse/TUP-16546

* feat(TUP-16546)Prompt users for new password in Studio Connection when
AD/LDAP credentials change in TAC
https://jira.talendforge.org/browse/TUP-16546

* feat(TUP-16546)Prompt users for new password in Studio Connection when
AD or LDAP credentials change in TAC
https://jira.talendforge.org/browse/TUP-16546

* feat(TUP-16546)Prompt users for new password in Studio Connection when
AD/LDAP credentials change in TAC
https://jira.talendforge.org/browse/TUP-16546

* feat(TUP-16546)Prompt users for new password in Studio Connection when
AD/LDAP credentials change in TAC
https://jira.talendforge.org/browse/TUP-16546

* feat(TUP-16546):Prompt users for new password in Studio Connection
when
AD or LDAP credentials change in TAC
https://jira.talendforge.org/browse/TUP-16546

* feat(TUP-16546):Prompt users for new password in Studio Connection
when
AD/LDAP credentials change in TAC
https://jira.talendforge.org/browse/TUP-16546

Conflicts:
	main/plugins/org.talend.repository/src/main/java/messages.properties
	main/plugins/org.talend.repository/src/main/java/org/talend/repository/ui/login/LoginHelper.java
	main/plugins/org.talend.repository/src/main/java/org/talend/repository/ui/login/LoginProjectPage.java

* feat(TUP-16546):Prompt users for new password in Studio Connection when
AD/LDAP credentials change in TAC
https://jira.talendforge.org/browse/TUP-16546
2020-06-09 16:47:12 +08:00
Laurent BOURGEOIS
2db98b7aa5 fix(TBD-10285):Add contains predicate to expressions (#4758) 2020-05-30 10:06:45 +02:00
Chao MENG
a9e3f1f4e9 fix(TUP-26683): Inputs label in documentation not the same as (#4641)
(#4751)

FlowDiagram
2020-05-29 22:15:54 +08:00
kjwang
bc69ecf45a fix(TUP-26189): [7.2.1] snowflake metadata connection with proxy failure
(#4505)

fix(TUP-26189): [7.2.1] snowflake metadata connection with proxy failure
https://jira.talendforge.org/browse/TUP-26189

Conflicts:
	main/plugins/org.talend.designer.core.generic/src/main/java/org/talend/designer/core/generic/model/GenericElementParameter.java
2020-05-29 17:57:31 +08:00
hcyi
0013d26860 fix(TUP-26683): Inputs label in documentation not the same as (#4641) (#4751)
FlowDiagram
2020-05-29 17:31:16 +08:00
Dmytro Sylaiev
4fa889ddfd Dsylaiev/tdi 43810 add ignore service attr checkbox for xml (#4539)
* fix(TDI-43810): Fix for xml component

* fix(TDI-43810): Do not ignore service attr when checkbox is hidden

* fix(TDI-43810): Use hashset instead of arraylist

* fix(TDI-43810): Minor refactoring
2020-03-24 14:47:55 +02:00
Jane Ding
1b0b5b9c4b Jding/patch711/tps 3786 (#4497)
* fix(TUP-22620)java.lang.StackOverflowError exception when opening the (#3391) (#3399)

* fix(TUP-22620)java.lang.StackOverflowError exception when opening the
job in studio
https://jira.talendforge.org/browse/TUP-22620

* fix(TUP-22620)java.lang.StackOverflowError exception when opening the
job in studio
https://jira.talendforge.org/browse/TUP-22620

* fix(TUP-22620)java.lang.StackOverflowError exception when opening the (#3402) (#3406)

job in studio
https://jira.talendforge.org/browse/TUP-22620
Since my new added test testCheckCircle is the first one to execute, it
used common variable node broke other test balance. Modify to use it own
private variable.
2020-03-02 18:29:38 +08:00
hwang-talend
4fa291afa5 Hwang/tup 26059 (#4436)
* bugfix(TUP-26059):tELTPostgresqlMap lost its "DB Type" column for which
the value should be "BPCHAR"
2020-03-02 17:01:26 +08:00
Mike Yan
2410d7c81b fix(TESB-28166): [CI] Missig fieature.xml in esb consumer and service (#4494) 2020-03-02 14:21:45 +08:00
apoltavtsev
a6dac58827 fix(TESB-27583): Maven nature is added to child Job for OSGI build 2020-01-20 10:46:58 +01:00
Denis Sergent
d1ce25465c fix(TESB-27030): Exclude jms library when it is used from tRunJob (#4340)
Backport for patch 7.1.1 (#4045)
* fix(TESB-27030): Avoid to add activemq-all lib in OSGi bundle
* fix(TESB-27030): Exclude jms library when it is used from tRunJob

Conflicts:
	main/plugins/org.talend.repository/src/main/java/org/talend/repository/ui/wizards/exportjob/scriptsmanager/esb/JobJavaScriptOSGIForESBManager.java

Co-authored-by: Mike Yan <yyan@talend.com>
2020-01-17 10:44:32 +01:00
bhe-talendbj
1f31ea1c4f backport(TUP-25237) backport (#4218)
Conflicts:
	main/plugins/org.talend.designer.runprocess/src/main/java/org/talend/designer/runprocess/java/TalendJavaProjectManager.java
2020-01-03 17:41:35 +08:00
hwang-talend
4a28c50b04 bugfix(TUP-23228):The order of schema changed when ticked "used column" (#3525) (#4234)
bugfix(TUP-23228):The order of schema changed when ticked "used column" again
2020-01-03 17:38:09 +08:00
Chao MENG
6beef70589 fix(TUP-24749): [7.2.1] issue to download component jar via https proxy (#4167) (#4184) (#4279)
fix(TUP-24749): [7.2.1] issue to download component jar via https proxy
https://jira.talendforge.org/browse/TUP-24749
2020-01-03 17:35:14 +08:00
hzhao-talendbj
06be524b5c bugfix(TUP-25035)Implicit tContextLoad feature (with selection from (#4268) (#4276)
file) uses a hardcoded encoding of ISO-8859-15
2020-01-03 17:31:18 +08:00
bhe-talendbj
139acb8b90 backport(TUP-25257) 2019-12-12 10:48:47 +08:00
hwang-talend
e1a8dfc24b bugfix(TUP-24355):Default Context environment appended after migrating (#4037) (#4041)
bugfix(TUP-24355):Default Context environment appended after migrating
2019-12-09 10:54:44 +08:00
hwang-talend
6782042783 bugfix(TUP-24355):Default Context environment appended after migrating (#3927)
* bugfix(TUP-24355):Default Context environment appended after migrating
to 7.2.1
2019-12-09 10:54:41 +08:00
hzhao-talendbj
c54af4b1e2 Hengzhao/bugfix/tup 25035 (#4157)
* feat(TUP-25035)Implicit tContextLoad feature (with selection from file)
uses a hardcoded encoding of ISO-8859-15

* bugfix(TUP-25035)Implicit tContextLoad feature (with selection from
file) uses a hardcoded encoding of ISO-8859-15

* bugfix(TUP-25035)Implicit tContextLoad feature (with selection from
file) uses a hardcoded encoding of ISO-8859-15

* bugfix(TUP-25035)Implicit tContextLoad feature (with selection from
file) uses a hardcoded encoding of ISO-8859-15

* bugfix(TUP-25035)Implicit tContextLoad feature (with selection from
file) uses a hardcoded encoding of ISO-8859-15
2019-12-09 10:46:24 +08:00
Hanna Liashchuk
71e572da23 patch(TPS-3584): Header field is ignored in Service account mode tBigQueryBulkExec (TBD-8951) (#4210) 2019-12-06 16:43:13 +02:00
hwang
d46c202e6b bugfix(TUP-24884):Spark Joblets cannot be built within Parent DI job
#1102
2019-11-11 13:06:27 +08:00
nrousseau
f536ed47ae Nrousseau/tup 24884 backport (#4110)
* bugfix(TUP-24884):Spark Joblets cannot be built within Parent DI job (#4042)

bugfix(TUP-24884):Spark Joblets cannot be built within Parent DI job

* bugfix(TUP-24884):Spark Joblets cannot be built within Parent DI job (#4101)

bugfix(TUP-24884):Spark Joblets cannot be built within Parent DI job
2019-11-11 11:41:58 +08:00
hwang-talend
de82c16af4 bugfix(TUP-23322):context value doesn't update after publishing the job (#3555) (#3580)
bugfix(TUP-23322):context value doesn't update after publishing the job to release repository
2019-11-11 10:42:53 +08:00
apoltavtsev
c5eac4ef90 TESB-27081 SOAP Action missing while calling a SOAP WebService through tESBConsumer 2019-11-08 10:03:22 +01:00
hwang
1fa26e95ed Revert "bugfix(TUP-23322):context value doesn't update after publishing the job (#3555) (#3580)"
This reverts commit 4d4040de42.
2019-11-08 14:45:52 +08:00
hwang-talend
4d4040de42 bugfix(TUP-23322):context value doesn't update after publishing the job (#3555) (#3580)
bugfix(TUP-23322):context value doesn't update after publishing the job to release repository
2019-11-08 14:27:32 +08:00
Chao MENG
2fa1c9c6c0 Patch/monthly/7.1.1/201911/tps 3485 subquery issue (#4093)
* Revert "Revert "fix(TBD-9366): tELTHiveMap doesn't pass context variable properly (#4066)""

This reverts commit d69f83c3bd.

* fix(TBD-9366): tELTHiveMap doesn't pass context variable properly
https://jira.talendforge.org/browse/TBD-9366
2019-11-04 18:13:53 +08:00
Chao MENG
d69f83c3bd Revert "fix(TBD-9366): tELTHiveMap doesn't pass context variable properly (#4066)"
This reverts commit 2ad55908cd.
2019-11-01 16:41:59 +08:00
Chao MENG
2ad55908cd fix(TBD-9366): tELTHiveMap doesn't pass context variable properly
(#4066)

fix(TBD-9366): tELTHiveMap doesn't pass context variable properly
https://jira.talendforge.org/browse/TBD-9366

Conflicts:
	main/plugins/org.talend.designer.dbmap/src/main/java/org/talend/designer/dbmap/language/generation/DbGenerationManager.java
	test/plugins/org.talend.designer.dbmap.test/src/org/talend/designer/dbmap/language/generation/DbGenerationManagerTest.java
2019-11-01 16:40:20 +08:00
hwang
f6209cee95 Revert "bugfix(TUP-24273):Created a new test case and run it, can not show up the test result on the right panel"
This reverts commit fe032a359c.
2019-10-30 15:36:04 +08:00
hwang
fe032a359c bugfix(TUP-24273):Created a new test case and run it, can not show up
the test result on the right panel
2019-10-28 17:59:08 +08:00
apoltavtsev
dec8461335 TESB-26789 Bean called in routelet not found by main route (#3987) 2019-10-07 14:47:49 +02:00
Zhiwei Xue
46eae3db6a fix(TUP-24310):routines is duplicated in the reactor (#3909) 2019-09-24 16:46:46 +08:00
AlixMetivier
0b2496cca6 migration task from TBD-9121 (#3905) 2019-09-06 11:29:47 +02:00
Chao MENG
24c2e1bbb3 Cmeng/bugfix/tup 23914 json wizard encoding (#3771) (#3778)
* fix(TUP-23914): JSON with accented characters is not being recognized
when creating a new JSON file in Metadata.
https://jira.talendforge.org/browse/TUP-23914
2019-09-06 17:26:27 +08:00
Andrii Medvedenko
dd18017695 patch(TPS-3276): Could not insert a value which the column type is DATETIME via tBigQueryBulkExec(TBD-8925) (#3856)
* fix(TBD-8242): Compilation error for tFileInputDelimited/tFixedFlowInput with int type not nullable (#3193)

* fix(TBD-8301) : Use Regional Location for BigQuery datasets (#3228) (#3229)

* fix(TBD-7153): Fixed missing mappings for BigQuery (#3291) (#3337)

* Hliashchuk/fix/tbd 8356 bigquery empty strings (#3322) (#3339)

* fix(TBD-8356): empty strings handling in bigquery

* fix(TBD-8356): service account empty strings support

* fix(TBD-8925): table won't be created unless createTable option is checked OAuth (#3686)
2019-08-23 15:30:56 +03:00
SunChaoqun
af1d09968b TESB-24354:SFTP proxy bean not recognized in runtime only (#3131) 2019-08-23 11:56:08 +08:00
yanbasic
4a0e546f9a Revert "fix(TESB-26174):tRunJob calling another Child job with tESBConsumer"
This reverts commit 48571e54bc.
2019-08-21 17:41:12 +08:00
jiezhang-tlnd
9142b137de fix(TUP-24159)XML metadata wizard showing inconsistent view on V711 (#3838)
comparing with V6 Studio
https://jira.talendforge.org/browse/TUP-24159
2019-08-20 10:58:44 +08:00
jiezhang-tlnd
96d9b2c8a2 fix(TUP-24159)XML metadata wizard showing inconsistent view on (#3810)
V711comparing with V6 Studio
https://jira.talendforge.org/browse/TUP-24159
2019-08-16 17:54:33 +08:00
Jane Ding
96a52cea5a Jding/71/tup 23789 pom files are not generated (#3753)
* fix(TUP-23789)Pom files are not generated sometimes for the jobs in
(#3738)

* fix(TUP-23789)Pom files are not generated sometimes for the jobs in
7.1.1
https://jira.talendforge.org/browse/TUP-23789

* fix(TUP-23789)Pom files are not generated sometimes for the jobs in
7.1.1
https://jira.talendforge.org/browse/TUP-23789
Add a junit.

* fix(TUP-23789)Pom files are not generated sometimes for the jobs in
7.1.1
https://jira.talendforge.org/browse/TUP-23789

Conflicts:
	test/plugins/org.talend.designer.runprocess.test/src/org/talend/designer/runprocess/maven/listener/ProcessChangeListenerTest.java
2019-08-12 11:03:40 +08:00
Stéphane Bouchet
af6792732a TESB-26300: disable message dialog when checking build errors (#3654)
* TESB-23600 : do not open dialog anymore when checking errors

* TESB-23600 : refactor/cleanup

Conflicts:
	main/plugins/org.talend.designer.runprocess/src/main/java/org/talend/designer/runprocess/JobErrorsChecker.java
2019-08-09 15:07:03 +02:00
yanbasic
48571e54bc fix(TESB-26174):tRunJob calling another Child job with tESBConsumer 2019-08-06 15:40:30 +08:00
Jane Ding
dc64a893c6 Jding/patch711/tup 21075 t map issue on mac (#3792)
* fix(TUP-21075)Problem of display in the tMap with Mojave (#2900) (#2906)

* fix(TUP-21075)Problem of display in the tMap with Mojave
https://jira.talendforge.org/browse/TUP-21075

* fix(TUP-21075)use duplicate name for jdbc connection, no error show
https://jira.talendforge.org/browse/TUP-21075

* fix(TUP-21075)Problem of display in the tMap with Mojave
https://jira.talendforge.org/browse/TUP-21075

* fix(TUP-21075)Problem of display in the tMap with Mojave (#2943) (#2954)

https://jira.talendforge.org/browse/TUP-21075
2019-08-05 11:15:45 +08:00
hcyi
78d8d901b6 fix(TUP-23743):ERROR when Job in MDM project calling Job in Reference DI (#3710)
project routines cannot be resolved.
2019-08-05 11:04:54 +08:00
apoltavtsev
6947ccdf9d TESB-24730 Services no longer accessible ( NPE) after route deployment (#3758) 2019-07-29 11:08:37 +08:00
wwang-talend
91bd64ec32 fix(TPS-3238): [7.1.1]Migration issues in the Studio after migrating the
jobs from 6.5 to 7.1(TDI-42380).
2019-07-26 10:11:48 +08:00
apoltavtsev
d96a383857 TESB-24900 Compillation error is removed 2019-07-24 11:47:19 +03:00
apoltavtsev
85581b5d25 TESB-24900 Undeploying a Data Service causes "Exception in opening zip file" error 2019-07-22 17:17:14 +03:00
hwang
32e02c0bbd bugfix(TUP-22649):tELTOracleMap : wrong Generated SQL Select query after
patch
2019-07-18 17:14:48 +08:00
hwang-talend
f0251625b4 Hwang/tup 22649 (#3413) (#3440)
bugfix(TUP-22649):tELTOracleMap : wrong Generated SQL Select query after
patch TPS-2944

Conflicts:
	main/plugins/org.talend.designer.dbmap/src/main/java/org/talend/designer/dbmap/language/generation/DbGenerationManager.java
2019-07-18 16:13:07 +08:00
sponomarova
cb3b7a5b37 patch(TPS-3225): removed too small total timeout for service account (#3726) 2019-07-17 10:50:07 +03:00
Denis Sergent
4388a3d154 TESB-26086 Adding missing context files to published artifacts (#3718)
This fix is intended to include context files in a data service
published artifact. When a dataservice job is published for the first
time and was never build from Studio before, published artifact was
missing the context files.
2019-07-16 16:13:32 +02:00
Chao MENG
271428b447 fix(TUP-23594): NullPointerException when using the build job wizard. (#3651)
fix(TUP-23594): NullPointerException when using the build job wizard. 
https://jira.talendforge.org/browse/TUP-23594
2019-07-15 10:19:04 +08:00
AlixMetivier
1efa27abdb patch(TPS-3161) (#3644)
* fix(TBD-8708): code enhancement (#3599)

* patch

* patch .xml files
2019-07-08 16:43:29 +02:00
zhangjie
e8e74bfc74 fix(TUP-23389)tMap - cannot edit schema 2019-07-04 16:31:19 +08:00
Hanna Liashchuk
86a8bf705b fix(TBD-8603): tHiveRow compile error (#3425) (#3679)
* fix(TBD-8603): tHiveRow compile error

Only add the log.info if log4j is enabled

* fix(TBD-8603): tHiveRow compile error

Only add the log.info if log4j is enabled
2019-07-03 11:58:13 +03:00
apoltavtsev
cc4b7b663a TESB-26293 Duplicated libraries in private & import packages of the build manifest file (#3668) 2019-06-28 09:45:10 +02:00
jiezhang-tlnd
04102e6eb6 Jzhang/bugfix/maintenance71/tup 23510 there is compile error job in tdi demo project (#3650)
* bugfix(TUP-23510):There is compile error job in TDI demo project (#3622)

* bugfix(TUP-23510):There is compile error job in TDI demo project (#3628)
2019-06-24 16:19:50 +08:00
hwang-talend
d8dc2ad6b6 bugfix(TUP-21944):Problem with globalMap.get in tELTOracleOutput (#3301)
bugfix(TUP-21944):Problem with globalMap.get in tELTOracleOutput component
2019-06-24 16:17:19 +08:00
hwang-talend
d008f5463b bugfix(TUP-21944):Problem with globalMap.get in tELTOracleOutput (#3262)
bugfix(TUP-21944):Problem with globalMap.get in tELTOracleOutput
component

Conflicts:
	main/plugins/org.talend.designer.dbmap/src/main/java/org/talend/designer/dbmap/language/generation/DbGenerationManager.java
	test/plugins/org.talend.designer.dbmap.test/src/org/talend/designer/dbmap/language/generation/DbGenerationManagerTest.java
2019-06-24 16:16:02 +08:00
hwang-talend
c967457a21 bugfix(TUP-21164):Context is not recognized as context variable in ELT
(#2984)

bugfix(TUP-21164):Context is not recognized as context variable in ELT
Map components and is not separated with string concat from SQL code

Conflicts:
	main/plugins/org.talend.designer.dbmap/src/main/java/org/talend/designer/dbmap/language/generation/DbGenerationManager.java

Conflicts:
	main/plugins/org.talend.designer.dbmap/src/main/java/org/talend/designer/dbmap/language/generation/DbGenerationManager.java
	test/plugins/org.talend.designer.dbmap.test/src/org/talend/designer/dbmap/language/generation/DbGenerationManagerTest.java
2019-06-24 14:55:07 +08:00
Jane Ding
b2eb5593c3 fix(TUP-22147)There is a NPE error when closing studio (#3443) (#3510)
* fix(TUP-22147)There is a NPE error when closing studio

* fix(TUP-22147)There is a NPE error when closing studio

Conflicts:
	main/plugins/org.talend.designer.runprocess/src/main/java/org/talend/designer/runprocess/java/TalendJavaProjectManager.java
2019-06-24 14:24:53 +08:00
sponomarova
5c416a92af patch(TBD-8649): tBigQueryInput component doesn't contain field Result Size for service account (#3616) 2019-06-19 10:55:54 +03:00
Stéphane Bouchet
a61b3dc917 TESB-25939 : fix context update when building route and job (#3563) (#3584) 2019-06-12 15:58:14 +02:00
Chao MENG
f7d6fb76ea fix(TUP-22713): Possible thread lock during git update operation (#3449) (#3455)
* fix(TUP-22713): Possible thread lock during git update operation
https://jira.talendforge.org/browse/TUP-22713
2019-05-31 15:18:57 +08:00
hwang-talend
2c57e7ddab Hwang/tup 22649 (#3413) (#3440)
bugfix(TUP-22649):tELTOracleMap : wrong Generated SQL Select query after
patch TPS-2944
2019-05-27 15:44:08 +08:00
hcyi
63d6e72165 fix(TUP-22521):tHiveMap- Unexpected SQL syntax for 'case when (#3373)
...then....else' condition.
2019-05-27 15:42:16 +08:00
hwang-talend
e76641d9c6 bugfix(TUP-21944):Problem with globalMap.get in tELTOracleOutput (#3301)
bugfix(TUP-21944):Problem with globalMap.get in tELTOracleOutput component
2019-05-27 15:41:15 +08:00
hwang-talend
8909d17589 bugfix(TUP-21944):Problem with globalMap.get in tELTOracleOutput (#3262)
bugfix(TUP-21944):Problem with globalMap.get in tELTOracleOutput component
2019-05-27 15:39:46 +08:00
hwang-talend
9b474c2b77 Hwang/tup 21164 (#3004) (#3011)
* bugfix(TUP-21164):Context is not recognized as context variable in ELT
Map components and is not separated with string concat from SQL code
2019-05-27 15:23:37 +08:00
hwang-talend
85cef87bb7 bugfix(TUP-21164):Context is not recognized as context variable in ELT
(#2984)

bugfix(TUP-21164):Context is not recognized as context variable in ELT
Map components and is not separated with string concat from SQL code

Conflicts:
	main/plugins/org.talend.designer.dbmap/src/main/java/org/talend/designer/dbmap/language/generation/DbGenerationManager.java
2019-05-27 15:19:22 +08:00
sponomarova
5de0ba36f9 fix(TBD-8566): correct context var replacement in subqueries (#3420) (#3505) 2019-05-24 11:43:41 +03:00
sponomarova
e403bf0794 fix(TBD-8343): NoSuchMethodError when Having tGSConnection and tS3Connection Components Within one Job # (#3484) 2019-05-16 18:06:57 +02:00
Jane Ding
24d0328283 fix(TUP-22804)Job with component tSAPIDOCOutput not getting built (#3430) (#3433)
https://jira.talendforge.org/browse/TUP-22804
2019-05-13 16:17:14 +08:00
Jane Ding
f099632878 fix(TUP-22681)Job in CI Builder gets generated and deployed, but doesn't (#3427) (#3435)
show as a Tag
https://jira.talendforge.org/browse/TUP-22681
2019-05-13 16:07:06 +08:00
Laurent BOURGEOIS
33cdb3caf4 fix(TBD-8573): correct parsing date values from BigQuery (#3429) (#3464) 2019-05-10 15:38:23 +02:00
hwang
03faf7d8ee bugfix(TUP-21895):An error has occurred. UNEXPECTED_EXCEPTION when
opening job migrated 6.4.1 to 7.1.1 (job using tJDBCInput)
2019-05-06 17:12:04 +08:00
hwang
9cb25d527f bugfix(TUP-21895):An error has occurred. UNEXPECTED_EXCEPTION when
opening job migrated 6.4.1 to 7.1.1 (job using tJDBCInput)
2019-05-06 15:42:14 +08:00
hwang-talend
93c22330ad bugfix(TUP-22435):tMap lost look-up details (#3404)
bugfix(TUP-22435):tMap lost look-up details
2019-05-05 11:25:18 +08:00
yanbasic
733f8c5703 fix(TESB-25045): Add missing i18n messages 2019-04-29 15:30:46 +08:00
Zhiwei Xue
22fcba6407 fix(TUP-22438):Null pointer exception when executing the jobs. (#3365) 2019-04-26 14:56:21 +08:00
Denis Sergent
166d51a407 Dsergent/fix tesb 25045 71patch (#3424)
* TESB-25045 Authorize Docker Build for job with tRESTClient (#3295)

Jobs containing tRESTClient or tESBConsumer components can be build as
Job standalone. Thereby it is now also possible to package build as a
Docker image. This commit also improve the way error messages are
managed in build wizard: before, a displayed error message could wrongly
disappear because of new controls for docker export details.

* TESB-25045 Authorize Docker Build for job with tRESTClient (#3328)

Fix for side effect disabling Docker build

Conflicts:
	main/plugins/org.talend.repository/src/main/java/org/talend/repository/ui/wizards/exportjob/JavaJobScriptsExportWSWizardPage.java
2019-04-23 14:45:32 +02:00
Jane Ding
8e6231e008 Patch cloudbeta/7.1.1 (#3405)
* feat(TUP-21495):Support MFA on studio for the Cloud.

Conflicts:
	main/plugins/org.talend.repository/src/main/java/org/talend/repository/ui/login/connections/ConnectionFormComposite.java

* feat(TUP-21495):improve for Support MFA on studio for the Cloud.

* feat(TUP-21495):improve for Support MFA on studio for the Cloud.

* feat(TUP-21495):improve for connection GUI part.

* fix(TUP-22063)[bug] when use different cloud type,click ... to fetch (#3270)

* fix(TUP-22063)[bug] when use different cloud type,click ... to fetch
token will all open the same url.
https://jira.talendforge.org/browse/TUP-22063

* fix(TUP-22063)[bug] when use different cloud type,click ... to fetch
token will all open the same url.
https://jira.talendforge.org/browse/TUP-22063

* fix(TUP-22063)[bug] when use different cloud type,click ... to fetch
token will all open the same url.
https://jira.talendforge.org/browse/TUP-22063

* fix(TUP-22063)[bug] when use different cloud type,click ... to fetch (#3274)

token will all open the same url.
https://jira.talendforge.org/browse/TUP-22063

* fix(TUP-22144)[bug] UX suggestion for layout of password/token.
https://jira.talendforge.org/browse/TUP-22144

* feat(TUP-21495):TUP-22141 [bug] update and save the connection in create
connection page will make the token change.

* fix(TUP-21495)Support MFA on studio for the Cloud
https://jira.talendforge.org/browse/TUP-21495
2019-04-15 18:08:04 +08:00
Dmytro Sylaiev
085af13fc4 patch(TPS-3051): Fix prot and pbsz order ftps 2019-04-09 17:45:05 +03:00
Dmytro Sylaiev
a0488e2318 Revert "fix(TDI-42024): Change execProt and execPBSZ order (#3333)"
This reverts commit 710fd4c47d.
2019-04-09 17:41:04 +03:00
Dmytro Sylaiev
710fd4c47d fix(TDI-42024): Change execProt and execPBSZ order (#3333) 2019-04-09 17:37:25 +03:00
wang wei
3f95ec9a9a fix(TDI-41898): Comment in the query in tJDBCInput component does not work if the job is migrated from 6.2.1 to 7.1.1(#3334) 2019-04-08 15:19:00 +08:00
zwxue
a8f63cf6a2 fix(TUP-21252):tMap losing all links in testcase when we do some (#3014)
modification in the main job in the same component
2019-04-08 14:05:08 +08:00
Dmytro Sylaiev
6eb4fee6fd fix(TDI-41808): Fix showing pass as clear text NZLoad (#3269)
* fix(TDI-41808): Fix showing pass as clear text NZLoad

* fix(TDI-41808): Rewrite fix to be more efficient

* chore(TDI-41808): Fix indentation

* fix(TDI-41808): Avoid to show real length of password

* fix(TDI-41808): Use constant from util class
2019-04-01 15:46:40 +03:00
Denis Sergent
48c888fbd4 TESB-24920 Backport fix to patch/7.1 (#3342) 2019-03-22 17:21:59 +01:00
Vladimir Bogatyrov
1b38f3f40a [TPS-2978] Intermittent "ClassNotFoundException: javax.mail.Address" errors (TESB-25164) 2019-03-20 09:36:50 +02:00
hwang-talend
1815b86e25 Hwang/tup 21105 b71 (#3029)
* bugfix(TUP-21105):tDBConnection(Snowflake) issue within joblet.

* bugfix(TUP-21105):tDBConnection(Snowflake) issue within joblet.
2019-03-11 14:08:09 +08:00
hwang-talend
6288747ebf Hwang/tup 21105 t db connection (#2953) (#2993)
* bugfix(TUP-21105):tDBConnection(Snowflake) issue within joblet.
2019-03-11 14:08:06 +08:00
Jane Ding
1e6c0002c9 fix(TUP-21333)OnSubJob Links Not Working (#3079) (#3103)
https://jira.talendforge.org/browse/TUP-21333
2019-03-11 13:03:17 +08:00
Emmanuel GALLOIS
52f565ce42 fix(TDI-41795): migrate correctly connection and linked connection (#3251)
* fix(TDI-41795): migrate correctly connection and linked connection
* fix(TDI-41795): fix invalid char in properties files
* chore(TDI-41795): do net set value at each property, just once
* fix(TDI-41795): correct NPE for tGoogleDriveCopy/Put
* fix(TDI-41795): do not corrupt tcompv0 components
  - fix migration version and breaks
  - do not execute migration for tcompv0 components

(cherry picked from commit c23955d51f)
2019-03-04 17:38:41 +01:00
jzhao
2c5e280c3d fix(TDI-41320): Fix oracle 11 migration task use existing connection (#2902) (#2933) (#3244) 2019-02-15 17:18:00 +08:00
hwang-talend
5cae20af15 bugfix(TUP-21895):An error has occurred. UNEXPECTED_EXCEPTION when (#3217)
opening job migrated 6.4.1 to 7.1.1 (job using tJDBCInput)
2019-02-15 17:02:37 +08:00
hcyi
7bbc06f153 fix(TUP-21888):NPE when importing job. (#3236) 2019-02-15 16:46:30 +08:00
Laurent BOURGEOIS
7a709f3056 TUP-21356 : "talend-bigdata-launcher-1.2.0-20170410.jar" not found when spark job launched from standard job by jobserver (#3218) 2019-02-04 00:13:36 +01:00
BOURGEOIS Laurent
55cd1934c9 Revert "fix(TUP-21356):talend-bigdata-launcher-1.2.0-20170410.jar not found (#3077) (#3209)"
This reverts commit b05d01e4fe.
2019-02-01 00:17:40 +01:00
Laurent BOURGEOIS
b05d01e4fe fix(TUP-21356):talend-bigdata-launcher-1.2.0-20170410.jar not found (#3077) (#3209) 2019-01-31 21:56:03 +01:00
Stéphane Bouchet
cb6334969d Merging missing fix from old patch branch (#3195)
* TESB-24093 : context values can be overriten by MS.

* fix(TESB-22833): Compile route before generate manifest (#2951)

* fix(TESB-22833): Compile route before generate manifest

* fix(TESB-22833): replace maven by jdt compiler for import packages

* fix(TESB-22833): Fixed packages not allowed: java.util" problem (#2960)
2019-01-25 10:32:36 +01:00
Zhiwei Xue
8c78159f7c fix(TUP-21532):re-fix child assembly problem. (#3181) 2019-01-22 14:19:36 +08:00
Zhiwei Xue
edaebf6bd7 fix(TUP-21532):fix StandardJobStandaloneBuildProviderTest (#3175) 2019-01-22 14:16:59 +08:00
Zhiwei Xue
931bc1d107 fix(TUP-21532): fix run job and assembly problem. (#3168) 2019-01-22 14:16:20 +08:00
Zhiwei Xue
f19a2f73ea fix(TUP-21532):fix junit. (#3141) 2019-01-22 14:07:42 +08:00
Zhiwei Xue
fc68a47bbb fix(TUP-21532):Standard DI job which refers to big data batch job having (#3120) (#3130)
* fix(TUP-21532):Standard DI job which refers to big data batch job having
S3 component and standard DI job having S3 connection component fails
with an error.

* fix(TUP-21532):add JUnit
2019-01-22 14:06:46 +08:00
jiezhang-tlnd
947666d009 fix(TUP-21005)In studio Java Debugging of Routes fails (#2871) 2019-01-07 14:51:39 +08:00
hcyi
e5c864c8ba fix(TUP-21160):refix JDBC connection will not commit even if autocommit (#3033) (#3041)
is set to True.
2018-12-10 10:24:30 +08:00
kjwang-talend
962c04b466 fix(TUP-21160):JDBC connection will not commit even if autocommit is set (#2976) (#2981)
to True.
2018-12-10 10:24:03 +08:00
Stéphane Bouchet
083f8b3ec7 TESB-24093 : context values can be overriten by MS. (#2947) (#2971) 2018-11-20 17:00:24 +01:00
152 changed files with 6353 additions and 1857 deletions

View File

@@ -506,7 +506,7 @@
if (inContext == null) {
inContext = <%=className%>.class.getClassLoader().getResourceAsStream("config/contexts/" + contextStr + ".properties");
}
if (inContext != null) {
if (inContext != null && context != null && context.isEmpty()) {
//defaultProps is in order to keep the original context value
defaultProps.load(inContext);
inContext.close();
@@ -530,9 +530,19 @@
String warningMessageFormat = "Null value will be used for context parameter %s: %s";
for (IContextParameter ctxParam :params)
{
%>
context.setContextType("<%=ctxParam.getName()%>", "<%=ctxParam.getType()%>");
<%
%>
context.setContextType("<%=ctxParam.getName()%>", "<%=ctxParam.getType()%>");
if(context.getStringValue("<%=ctxParam.getName()%>") == null) {
context.<%=ctxParam.getName()%> = null;
} else {
<%//}B1 block%>
<%
String typeToGenerate ="String";
if(!(ctxParam.getType().equals("id_File") || ctxParam.getType().equals("id_Directory") ||ctxParam.getType().equals("id_List Of Value"))) {
typeToGenerate=JavaTypesManager.getTypeToGenerate(ctxParam.getType(),true);
}
if (ctxParam.getType().equals("id_Password")) {
%>
String pwd_<%=ctxParam.getName()%>_value = context.getProperty("<%=ctxParam.getName()%>");
@@ -550,14 +560,7 @@
}
}
<%
continue;
}
String typeToGenerate ="String";
if( !(ctxParam.getType().equals("id_File") || ctxParam.getType().equals("id_Directory") ||ctxParam.getType().equals("id_List Of Value")))
{
typeToGenerate=JavaTypesManager.getTypeToGenerate(ctxParam.getType(),true);
}
if(typeToGenerate.equals("java.util.Date"))
} else if(typeToGenerate.equals("java.util.Date"))
{
%>
@@ -621,6 +624,10 @@
}
<%
}
%>
<%//{B1 block%>
}
<%
}
%>
} catch (java.io.IOException ie) {
@@ -1171,13 +1178,27 @@ if (execStat) {
} else {
type = "ftp";
}
if ("ftp".equals(type)) { %>
((com.enterprisedt.net.ftp.FTPClient) obj_conn).quit();
<%} else if ("sftp".equals(type)) { %>
if ("sftp".equals(type)) { %>
((com.jcraft.jsch.ChannelSftp) obj_conn).quit();
<%} else { %>
((org.apache.commons.net.ftp.FTPSClient) obj_conn).disconnect();
<%}%>
<%} else {
String libImplementation = ElementParameterParser.getValue(ftpNode, "__LIB_IMPLEMENTATION__");
if ("Apache".equalsIgnoreCase(libImplementation)) {
%>
((org.apache.commons.net.ftp.FTPClient) obj_conn).disconnect();
<%
} else {
if ("ftp".equals(type)) {
%>
((com.enterprisedt.net.ftp.FTPClient) obj_conn).quit();
<%
}else{
%>
((org.apache.commons.net.ftp.FTPSClient) obj_conn).disconnect();
<%
}
}
}
%>
}
<% } %>
} catch (java.lang.Exception e) {

View File

@@ -69,145 +69,140 @@ if(hasInput){
}
}
}
boolean hasValidInput = inputConn!=null;
IMetadataTable metadata = null;
List<IMetadataTable> metadatas = node.getMetadataList();
boolean haveValidNodeMetadata = ((metadatas != null) && (metadatas.size() > 0) && (metadata = metadatas.get(0)) != null);
if (hasValidInput && haveValidNodeMetadata) {
if (hasValidInput) {
List<IMetadataColumn> input_columnList = inputConn.getMetadataTable().getListColumns();
if(input_columnList == null) {
input_columnList = new ArrayList<IMetadataColumn>();
}
// add incoming (not present) columns to enforcer for this comps
if (cid.contains("tDataStewardship") || cid.contains("tMarkLogic")){
%>
boolean shouldCreateRuntimeSchemaForIncomingNode = false;
<%
for (int i = 0; i < input_columnList.size(); i++) {
if(!input_columnList.get(i).getTalendType().equals("id_Dynamic")) {
%>
if (incomingEnforcer_<%=cid%>.getDesignSchema().getField("<%=input_columnList.get(i)%>") == null){
incomingEnforcer_<%=cid%>.addIncomingNodeField("<%=input_columnList.get(i)%>", ((Object) <%=inputConn.getName()%>.<%=input_columnList.get(i)%>).getClass().getCanonicalName());
shouldCreateRuntimeSchemaForIncomingNode = true;
}
<%
}
}
%>
if (shouldCreateRuntimeSchemaForIncomingNode){
incomingEnforcer_<%=cid%>.createRuntimeSchema();
}
<%
}
// If there are dynamic columns in the schema, they need to be
// initialized into the runtime schema of the actual IndexedRecord
// provided to the component.
int dynamicPos = -1;
for (int i = 0; i < input_columnList.size(); i++) {
if (input_columnList.get(i).getTalendType().equals("id_Dynamic")) {
dynamicPos = i;
break;
}
}
if (dynamicPos != -1) {
%>
if (!incomingEnforcer_<%=cid%>.areDynamicFieldsInitialized()) {
// Initialize the dynamic columns when they are first encountered.
for (routines.system.DynamicMetadata dm_<%=cid%> : <%=inputConn.getName()%>.<%=input_columnList.get(dynamicPos).getLabel()%>.metadatas) {
incomingEnforcer_<%=cid%>.addDynamicField(
dm_<%=cid%>.getName(),
dm_<%=cid%>.getType(),
dm_<%=cid%>.getLogicalType(),
dm_<%=cid%>.getFormat(),
dm_<%=cid%>.getDescription(),
dm_<%=cid%>.isNullable());
}
incomingEnforcer_<%=cid%>.createRuntimeSchema();
}
<%
}
%>
incomingEnforcer_<%=cid%>.createNewRecord();
<%
for (int i = 0; i < input_columnList.size(); i++) { // column
IMetadataColumn column = input_columnList.get(i);
if (dynamicPos != i) {
%>
//skip the put action if the input column doesn't appear in component runtime schema
if (incomingEnforcer_<%=cid%>.getRuntimeSchema().getField("<%=input_columnList.get(i)%>") != null){
incomingEnforcer_<%=cid%>.put("<%=column.getLabel()%>", <%=inputConn.getName()%>.<%=column.getLabel()%>);
}
<%
} else {
%>
for (int i = 0; i < <%=inputConn.getName()%>.<%=column.getLabel()%>.getColumnCount(); i++) {
incomingEnforcer_<%=cid%>.put(<%=inputConn.getName()%>.<%=column.getLabel()%>.getColumnMetadata(i).getName(),
<%=inputConn.getName()%>.<%=column.getLabel()%>.getColumnValue(i));
}
<%
}
} // column
// If necesary, generate the code to handle outgoing connections.
// TODO: For now, this can only handle one outgoing record for
// each incoming record. To handle multiple outgoing records, code
// generation needs to occur in component_begin in order to open
// a for() loop.
// There will be a ClassCastException if the output component does
// not implement WriterWithFeedback, but permits outgoing
// connections.
if (input_columnList!=null && !input_columnList.isEmpty()) {
// add incoming (not present) columns to enforcer for this comps
if (cid.contains("tDataStewardship") || cid.contains("tMarkLogic")){
%>
boolean shouldCreateRuntimeSchemaForIncomingNode = false;
<%
for (int i = 0; i < input_columnList.size(); i++) {
if(!input_columnList.get(i).getTalendType().equals("id_Dynamic")) {
%>
if (incomingEnforcer_<%=cid%>.getDesignSchema().getField("<%=input_columnList.get(i)%>") == null){
incomingEnforcer_<%=cid%>.addIncomingNodeField("<%=input_columnList.get(i)%>", ((Object) <%=inputConn.getName()%>.<%=input_columnList.get(i)%>).getClass().getCanonicalName());
shouldCreateRuntimeSchemaForIncomingNode = true;
}
<%
}
}
%>
if (shouldCreateRuntimeSchemaForIncomingNode){
incomingEnforcer_<%=cid%>.createRuntimeSchema();
}
<%
}
// If there are dynamic columns in the schema, they need to be
// initialized into the runtime schema of the actual IndexedRecord
// provided to the component.
int dynamicPos = -1;
for (int i = 0; i < input_columnList.size(); i++) {
if (input_columnList.get(i).getTalendType().equals("id_Dynamic")) {
dynamicPos = i;
break;
}
}
if (dynamicPos != -1) {
%>
if (!incomingEnforcer_<%=cid%>.areDynamicFieldsInitialized()) {
// Initialize the dynamic columns when they are first encountered.
for (routines.system.DynamicMetadata dm_<%=cid%> : <%=inputConn.getName()%>.<%=input_columnList.get(dynamicPos).getLabel()%>.metadatas) {
incomingEnforcer_<%=cid%>.addDynamicField(
dm_<%=cid%>.getName(),
dm_<%=cid%>.getType(),
dm_<%=cid%>.getLogicalType(),
dm_<%=cid%>.getFormat(),
dm_<%=cid%>.getDescription(),
dm_<%=cid%>.isNullable());
}
incomingEnforcer_<%=cid%>.createRuntimeSchema();
}
<%
}
%>
incomingEnforcer_<%=cid%>.createNewRecord();
<%
for (int i = 0; i < input_columnList.size(); i++) { // column
IMetadataColumn column = input_columnList.get(i);
if (dynamicPos != i) {
%>
//skip the put action if the input column doesn't appear in component runtime schema
if (incomingEnforcer_<%=cid%>.getRuntimeSchema().getField("<%=input_columnList.get(i)%>") != null){
incomingEnforcer_<%=cid%>.put("<%=column.getLabel()%>", <%=inputConn.getName()%>.<%=column.getLabel()%>);
}
<%
} else {
%>
for (int i = 0; i < <%=inputConn.getName()%>.<%=column.getLabel()%>.getColumnCount(); i++) {
incomingEnforcer_<%=cid%>.put(<%=inputConn.getName()%>.<%=column.getLabel()%>.getColumnMetadata(i).getName(),
<%=inputConn.getName()%>.<%=column.getLabel()%>.getColumnValue(i));
}
<%
}
} // column
// If necesary, generate the code to handle outgoing connections.
// TODO: For now, this can only handle one outgoing record for
// each incoming record. To handle multiple outgoing records, code
// generation needs to occur in component_begin in order to open
// a for() loop.
// There will be a ClassCastException if the output component does
// not implement WriterWithFeedback, but permits outgoing
// connections.
ComponentProperties componentProps = node.getComponentProperties();
ProcessPropertiesGenerator generator = new ProcessPropertiesGenerator(cid, component);
List<Component.CodegenPropInfo> propsToProcess = component.getCodegenPropInfos(componentProps);
for (Component.CodegenPropInfo propInfo : propsToProcess) { // propInfo
List<NamedThing> properties = propInfo.props.getProperties();
for (NamedThing prop : properties) { // property
if (prop instanceof Property) { // if, only deal with valued Properties
Property property = (Property)prop;
if (property.getFlags() != null && (property.getFlags().contains(Property.Flags.DESIGN_TIME_ONLY) || property.getFlags().contains(Property.Flags.HIDDEN)))
continue;
if(property.getTaggedValue(IGenericConstants.DYNAMIC_PROPERTY_VALUE)!=null && Boolean.valueOf(String.valueOf(property.getTaggedValue(IGenericConstants.DYNAMIC_PROPERTY_VALUE)))) {
generator.setPropertyValues(property, propInfo, null, false, false);
}
ComponentProperties componentProps = node.getComponentProperties();
ProcessPropertiesGenerator generator = new ProcessPropertiesGenerator(cid, component);
List<Component.CodegenPropInfo> propsToProcess = component.getCodegenPropInfos(componentProps);
for (Component.CodegenPropInfo propInfo : propsToProcess) { // propInfo
List<NamedThing> properties = propInfo.props.getProperties();
for (NamedThing prop : properties) { // property
if (prop instanceof Property) { // if, only deal with valued Properties
Property property = (Property)prop;
if (property.getFlags() != null && (property.getFlags().contains(Property.Flags.DESIGN_TIME_ONLY) || property.getFlags().contains(Property.Flags.HIDDEN)))
continue;
if(property.getTaggedValue(IGenericConstants.DYNAMIC_PROPERTY_VALUE)!=null && Boolean.valueOf(String.valueOf(property.getTaggedValue(IGenericConstants.DYNAMIC_PROPERTY_VALUE)))) {
generator.setPropertyValues(property, propInfo, null, false, false);
}
} // property
} // propInfo
%>
org.apache.avro.generic.IndexedRecord data_<%=cid%> = incomingEnforcer_<%=cid%>.getCurrentRecord();
<%
boolean isParallelize ="true".equalsIgnoreCase(ElementParameterParser.getValue(node, "__PARALLELIZE__"));
if (isParallelize) {
String sourceComponentId = inputConn.getSource().getUniqueName();
if(sourceComponentId!=null && sourceComponentId.contains("tAsyncIn")) {
%>
globalMap.put(buffersSizeKey_<%=cid%>, buffersSize_<%=sourceComponentId%>);
<%
}
}
%>
}
} // property
} // propInfo
%>
org.apache.avro.generic.IndexedRecord data_<%=cid%> = incomingEnforcer_<%=cid%>.getCurrentRecord();
<%
boolean isParallelize ="true".equalsIgnoreCase(ElementParameterParser.getValue(node, "__PARALLELIZE__"));
if (isParallelize) {
String sourceComponentId = inputConn.getSource().getUniqueName();
if(sourceComponentId!=null && sourceComponentId.contains("tAsyncIn")) {
%>
globalMap.put(buffersSizeKey_<%=cid%>, buffersSize_<%=sourceComponentId%>);
<%
}
}
%>
writer_<%=cid%>.write(data_<%=cid%>);
nb_line_<%=cid %>++;
<%if(hasMainOutput){
%>
if(!(writer_<%=cid%> instanceof org.talend.components.api.component.runtime.WriterWithFeedback)) {
// For no feedback writer,just pass the input record to the output
if (data_<%=cid%>!=null) {
outgoingMainRecordsList_<%=cid%> = java.util.Arrays.asList(data_<%=cid%>);
}
}
<%
}
writer_<%=cid%>.write(data_<%=cid%>);
nb_line_<%=cid %>++;
<%if(hasMainOutput){
%>
if(!(writer_<%=cid%> instanceof org.talend.components.api.component.runtime.WriterWithFeedback)) {
// For no feedback writer,just pass the input record to the output
if (data_<%=cid%>!=null) {
outgoingMainRecordsList_<%=cid%> = java.util.Arrays.asList(data_<%=cid%>);
}
}
<%
}
}
} // canStart

View File

@@ -289,6 +289,15 @@ if(isRunInMultiThread){
}
<% } %>
}
//if the stored or passed value is "<TALEND_NULL>" string, it mean null
public String getStringValue(String key) {
String origin_value = this.getProperty(key);
if(NULL_VALUE_EXPRESSION_IN_COMMAND_STRING_FOR_CHILD_JOB_ONLY.equals(origin_value)) {
return null;
}
return origin_value;
}
<%
for (IContextParameter ctxParam :params)
@@ -312,7 +321,7 @@ public <%=JavaTypesManager.getTypeToGenerate(ctxParam.getType(),true)%> get<%=Ch
}
%>
}
private ContextProperties context = new ContextProperties();
protected ContextProperties context = new ContextProperties(); // will be instanciated by MS.
public ContextProperties getContext() {
return this.context;
}

View File

@@ -48,6 +48,7 @@ ComponentsFactory.componentNotFound=Component folder not found\:
ComponentsFactory.load.components=Load Components...
ComponentsFactory.parentNotRecompiled=Warning\: parents of *.inc.javajet are not recompiled \!
ComponentsFactory.loadComponents.missingFolder=The folder "{0}" is missing in the plugin "{1}".
ComponentsFactory.init.waitForFinish.timeout=Can't initialise ComponentsFactory, please try again.
ComponentsLocalProviderService.componentLoadError=Component load error
ComponentsLocalProviderService.talendExchangeError=Talend Exchange Error
ComponentsPreferencePage.ButtonLabel0=Ok

View File

@@ -92,7 +92,7 @@ public class JavaRoutineSynchronizer extends AbstractRoutineSynchronizer {
private void syncRoutineItems(Collection<RoutineItem> routineObjects, boolean forceUpdate) throws SystemException {
for (RoutineItem routineItem : routineObjects) {
syncRoutine(routineItem, true, true, forceUpdate);
syncRoutine(routineItem, true, forceUpdate);
}
syncSystemRoutine(ProjectManager.getInstance().getCurrentProject());
}

View File

@@ -30,6 +30,11 @@ import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Level;
@@ -139,66 +144,119 @@ public class ComponentsFactory implements IComponentsFactory {
private static boolean cleanDone = false;
protected static Map<String, Map<String, Set<IComponent>>> componentNameMap;
private AtomicBoolean isInitialising;
private volatile Lock initialiseLock;
public ComponentsFactory() {
isInitialising = new AtomicBoolean(false);
initialiseLock = new ReentrantLock();
}
private void init(boolean duringLogon) {
removeOldComponentsUserFolder(); // not used anymore
long startTime = System.currentTimeMillis();
// TimeMeasure.display = true;
// TimeMeasure.displaySteps = true;
// TimeMeasure.measureActive = true;
// TimeMeasure.begin("initComponents");
componentList = Collections.synchronizedSet(new HashSet<IComponent>());
customComponentList = new HashSet<IComponent>();
skeletonList = new ArrayList<String>();
userComponentList = new HashSet<IComponent>();
String installLocation = new Path(Platform.getConfigurationLocation().getURL().getPath()).toFile().getAbsolutePath();
componentToProviderMap = new HashMap<IComponent, AbstractComponentsProvider>();
boolean isNeedClean = !cleanDone && TalendCacheUtils.isSetCleanComponentCache();
cleanDone = true; // only check this parameter one time, or it will reinitialize things all the time...
isCreated = hasComponentFile(installLocation) && !isNeedClean;
ComponentsCache cache = ComponentManager.getComponentCache();
try {
if (isCreated) {
// if cache is created and empty, means we never loaded it before.
// if it was already loaded, then no need to go again, since it's a static variable, it's still in
// memory.
// it avoids to reload from disk again even more for commandline at each logon, since it's no use.
if (cache.getComponentEntryMap().isEmpty()) {
ComponentsCache loadCache = loadComponentResource(installLocation);
cache.getComponentEntryMap().putAll(loadCache.getComponentEntryMap());
}
} else {
cache.getComponentEntryMap().clear();
}
} catch (IOException e) {
ExceptionHandler.process(e);
cache.getComponentEntryMap().clear();
isCreated = false;
if (wait4InitialiseFinish()) {
return;
}
try {
try {
initialiseLock.lock();
} catch (Exception e) {
throw new RuntimeException(e);
}
isInitialising.set(true);
removeOldComponentsUserFolder(); // not used anymore
long startTime = System.currentTimeMillis();
loadComponentsFromComponentsProviderExtension();
// TimeMeasure.display = true;
// TimeMeasure.displaySteps = true;
// TimeMeasure.measureActive = true;
// TimeMeasure.begin("initComponents");
componentList = Collections.synchronizedSet(new HashSet<IComponent>());
customComponentList = new HashSet<IComponent>();
skeletonList = new ArrayList<String>();
userComponentList = new HashSet<IComponent>();
String installLocation = new Path(Platform.getConfigurationLocation().getURL().getPath()).toFile().getAbsolutePath();
componentToProviderMap = new HashMap<IComponent, AbstractComponentsProvider>();
boolean isNeedClean = !cleanDone && TalendCacheUtils.isSetCleanComponentCache();
cleanDone = true; // only check this parameter one time, or it will reinitialize things all the time...
isCreated = hasComponentFile(installLocation) && !isNeedClean;
ComponentsCache cache = ComponentManager.getComponentCache();
try {
if (isCreated) {
// if cache is created and empty, means we never loaded it before.
// if it was already loaded, then no need to go again, since it's a static variable, it's still in
// memory.
// it avoids to reload from disk again even more for commandline at each logon, since it's no use.
if (cache.getComponentEntryMap().isEmpty()) {
ComponentsCache loadCache = loadComponentResource(installLocation);
cache.getComponentEntryMap().putAll(loadCache.getComponentEntryMap());
}
} else {
cache.getComponentEntryMap().clear();
}
} catch (IOException e) {
ExceptionHandler.process(e);
cache.getComponentEntryMap().clear();
isCreated = false;
}
// TimeMeasure.step("initComponents", "loadComponentsFromProvider");
// 2.Load Component from extension point: component_definition
loadComponentsFromExtensions();
// TimeMeasure.step("initComponents", "loadComponentsFromExtension[joblets?]");
loadComponentsFromComponentsProviderExtension();
ComponentManager.saveResource(); // will save only if needed.
// TimeMeasure.step("initComponents", "loadComponentsFromProvider");
// 2.Load Component from extension point: component_definition
loadComponentsFromExtensions();
// TimeMeasure.step("initComponents", "loadComponentsFromExtension[joblets?]");
// init component name map, used to pick specified component immediately
initComponentNameMap();
ComponentManager.saveResource(); // will save only if needed.
// TimeMeasure.step("initComponents", "createCache");
log.debug(componentList.size() + " components loaded in " + (System.currentTimeMillis() - startTime) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$
// init component name map, used to pick specified component immediately
initComponentNameMap();
// TimeMeasure.end("initComponents");
// TimeMeasure.display = false;
// TimeMeasure.displaySteps = false;
// TimeMeasure.measureActive = false;
// TimeMeasure.step("initComponents", "createCache");
log.debug(componentList.size() + " components loaded in " + (System.currentTimeMillis() - startTime) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$
// TimeMeasure.end("initComponents");
// TimeMeasure.display = false;
// TimeMeasure.displaySteps = false;
// TimeMeasure.measureActive = false;
} finally {
isInitialising.set(false);
initialiseLock.unlock();
}
}
private boolean wait4InitialiseFinish() {
if (isInitialising.get()) {
try {
// wait for 10 min (10 * 60 seconds) by default
long timeout = 600L;
String timeoutStr = System.getProperty("studio.componentsFactory.init.timeout"); //$NON-NLS-1$
if (!StringUtils.isBlank(timeoutStr)) {
try {
timeout = Long.valueOf(timeoutStr);
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
if (initialiseLock.tryLock(timeout, TimeUnit.SECONDS)) {
initialiseLock.unlock();
} else {
// may be track in dead lock, throw exception to try to break dead lock
throw new RuntimeException(Messages.getString("ComponentsFactory.init.waitForFinish.timeout")); //$NON-NLS-1$
}
// initialise successfully or not
return !isInitialising.get();
} catch (RuntimeException e) {
throw e;
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
// initialise failed, still need to initialise
return false;
}
protected void initComponentNameMap() {
@@ -729,7 +787,8 @@ public class ComponentsFactory implements IComponentsFactory {
}
@Override
public synchronized int size() {
public int size() {
wait4InitialiseFinish();
if (componentList == null) {
init(false);
}
@@ -737,7 +796,8 @@ public class ComponentsFactory implements IComponentsFactory {
}
@Override
public synchronized IComponent get(String name) {
public IComponent get(String name) {
wait4InitialiseFinish();
if (componentList == null) {
init(false);
}
@@ -757,7 +817,8 @@ public class ComponentsFactory implements IComponentsFactory {
* @see org.talend.core.model.components.IComponentsFactory#get(java.lang.String, java.lang.String)
*/
@Override
public synchronized IComponent get(String name, String paletteType) {
public IComponent get(String name, String paletteType) {
wait4InitialiseFinish();
if (componentList == null) {
init(false);
}
@@ -772,6 +833,7 @@ public class ComponentsFactory implements IComponentsFactory {
@Override
public IComponent getJobletComponent(String name, String paletteType) {
wait4InitialiseFinish();
if (componentList == null) {
init(false);
}
@@ -799,6 +861,7 @@ public class ComponentsFactory implements IComponentsFactory {
@Override
public void initializeComponents(IProgressMonitor monitor) {
this.monitor = monitor;
wait4InitialiseFinish();
if (componentList == null) {
init(false);
}
@@ -809,6 +872,7 @@ public class ComponentsFactory implements IComponentsFactory {
@Override
public void initializeComponents(IProgressMonitor monitor, boolean duringLogon) {
this.monitor = monitor;
wait4InitialiseFinish();
if (componentList == null) {
init(duringLogon);
}
@@ -822,12 +886,18 @@ public class ComponentsFactory implements IComponentsFactory {
* @see org.talend.core.model.components.IComponentsFactory#getComponents()
*/
@Override
public synchronized Set<IComponent> getComponents() {
public Set<IComponent> getComponents() {
wait4InitialiseFinish();
if (componentList == null) {
init(false);
}
return componentList;
}
@Override
public boolean isInitialising() {
return isInitialising.get();
}
@Override
public Collection<IComponent> readComponents() {
@@ -840,7 +910,8 @@ public class ComponentsFactory implements IComponentsFactory {
}
@Override
public synchronized Map<String, Map<String, Set<IComponent>>> getComponentNameMap() {
public Map<String, Map<String, Set<IComponent>>> getComponentNameMap() {
wait4InitialiseFinish();
if (componentNameMap == null) {
init(false);
}
@@ -848,7 +919,8 @@ public class ComponentsFactory implements IComponentsFactory {
}
@Override
public synchronized List<IComponent> getCustomComponents() {
public List<IComponent> getCustomComponents() {
wait4InitialiseFinish();
if (customComponentList == null) {
init(false);
}
@@ -862,6 +934,7 @@ public class ComponentsFactory implements IComponentsFactory {
*/
@Override
public List<String> getSkeletons() {
wait4InitialiseFinish();
if (skeletonList == null) {
init(false);
}
@@ -900,6 +973,7 @@ public class ComponentsFactory implements IComponentsFactory {
jobletService.clearSparkStreamingJobletComponent();
}
}
isInitialising.set(false);
}
@Override

View File

@@ -0,0 +1,57 @@
<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.components.lib</groupId>
<artifactId>talend_file_enhanced</artifactId>
<name>talend_file_enhanced</name>
<version>1.1-patch</version>
<properties>
<talend.nexus.url>https://artifacts-oss.talend.com</talend.nexus.url>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.0</version>
<type>jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<distributionManagement>
<snapshotRepository>
<id>talend_nexus_deployment</id>
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceSnapshot/</url>
<snapshots><enabled>true</enabled></snapshots>
<releases><enabled>false</enabled></releases>
</snapshotRepository>
<repository>
<id>talend_nexus_deployment</id>
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceRelease/</url>
<snapshots><enabled>false</enabled></snapshots>
<releases><enabled>true</enabled></releases>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
</resource>
</resources>
</build>
</project>

View File

@@ -0,0 +1,235 @@
// ============================================================================
//
// Talend Community Edition
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// ============================================================================
package org.talend.fileprocess.delimited.patched;
import java.io.BufferedReader;
import java.io.IOException;
/**
* DelimitedDataReader is a stream based API for reading any size of delimited data whith any type of field and record
* delimiters. If you want to get an instance of this type please use the DelimitedDataReaderFactory<br/>
*
* @author gke
*/
public abstract class DelimitedDataReader {
protected BufferedReader inputStream = null;
protected ColumnBuffer columnBuffer = new ColumnBuffer();
protected boolean startedRow = false;
protected int columnsCount = 0;
protected boolean hasReadRecord = false;
protected String[] values = new String[StaticSettings.INITIAL_COLUMN_COUNT];
protected boolean initialized = false;
protected boolean closed = false;
protected boolean skipEmptyRecord = true;
protected long currentRecord = 0;
protected boolean safetySwitch = true;
public DelimitedDataReader(BufferedReader inputStream, boolean skipEmptyRecord) {
if (inputStream == null) {
throw new IllegalArgumentException("Parameter inputStream can not be null.");
}
this.inputStream = inputStream;
this.skipEmptyRecord = skipEmptyRecord;
initialized = true;
}
/**
* DOC ke Comment method "checkClosed". This will be call before read new record or get content of the column
*
* @throws IOException Thrown if this object has already been closed.
*/
protected void checkClosed() throws IOException {
if (closed) {
throw new IOException("This instance of the DelimitedFileReader class has already been closed.");
}
}
/**
* Reads another record. If this returns true, a new row data will be available using get(columnIndex)
*
* @return Whether another record was successfully read or not.
* @throws IOException Thrown if an error occurs while reading data from the source stream.
*/
public abstract boolean readRecord() throws IOException;
/**
* Returns the current columns value for a given column index.
*
* @param columnIndex The index of the column.
* @return The current column value.
* @throws IOException Thrown if this object has already been closed.
*/
public String get(int columnIndex) throws IOException {
checkClosed();
if (columnIndex > -1 && columnIndex < columnsCount) {
return values[columnIndex];
} else {
return "";
}
}
/**
* Gets the count of the records that have been read.
*
* @throws the count of the records that have been read.
*/
public long getProcessedRecordCount() {
return currentRecord;
}
/**
* Closes and releases all related resources.
*/
public void close() {
if (!closed) {
close(true);
closed = true;
}
}
/**
* If closing is true, close and release all related resources.
*
* @param closing
*/
protected abstract void close(boolean closing);
/**
* DOC ke Comment method "getAvailableRowCount".
*
* @param footer the record count that will not used, just as footer for the delimited data. It will also be skipped
* @return the count of Available row count
* @throws IOException
*/
public long getAvailableRowCount(int footer) throws IOException {
checkClosed();
boolean flag = true;
do {
flag = readRecord();
} while (flag);
return currentRecord - footer;
}
public int getAvailableColumnsCount() throws IOException {
return columnsCount;
}
/**
* DOC ke Comment method "skipHeaders". This is used to skip headers in the delimited data
*
* @param header rows count that will be skipped as header
* @throws IOException
*/
public void skipHeaders(int header) throws IOException {
checkClosed();
if (header <= 0) {
return;
}
for (int i = 0; i < header; i++) {
readRecord();
}
currentRecord = 0;
}
/**
* DOC ke Comment method "isSafetySwitch".
*
* @return the state of the safetySwitch
*/
public boolean isSafetySwitch() {
return safetySwitch;
}
/**
* DOC ke Comment method "setSafetySwitch". When reading a delmited text, if safetySwitch is true, and if a column's
* content length is larger than 100,000 or a row's column count is larger than 100,000, an Exception will be
* thrown, and the process of reading delimited data will be terminated.
*
* @param safetySwitch
*/
public void setSafetySwitch(boolean safetySwitch) {
this.safetySwitch = safetySwitch;
}
/**
* @exception IOException Thrown if an error occurs while reading data from the source stream.
*/
protected void endRecord() throws IOException {
// this flag is used as a loop exit condition
// during parsing
hasReadRecord = true;
currentRecord++;
}
@Override
protected void finalize() {
close(false);
}
/**
* StaticSettings for the DelimitedDataReader. they can be changed in unit test.
*/
class StaticSettings {
public static final int MAX_BUFFER_SIZE = 1024;
public static final int INITIAL_COLUMN_COUNT = 10;
public static final int INITIAL_COLUMN_BUFFER_SIZE = 50;
public static final int MAX_SIZE_FOR_SAFTY = 100000;
}
/**
* This is data buffer for storing the contents of a column. this is used in case that the size of a column's
* content is bigger than MAX_BUFFER_SIZE
*
* @author Administrator
*
*/
class ColumnBuffer {
char[] buffer;
int position;
public ColumnBuffer() {
buffer = new char[StaticSettings.INITIAL_COLUMN_BUFFER_SIZE];
position = 0;
}
}
}

View File

@@ -0,0 +1,482 @@
// ============================================================================
//
// Talend Community Edition
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// ============================================================================
package org.talend.fileprocess.delimited.patched;
import java.io.BufferedReader;
import java.io.IOException;
import java.text.NumberFormat;
import java.util.function.Predicate;
/**
* DOC ibmuser class global comment. Detailled comment <br/>
*
*/
public class RowParser extends DelimitedDataReader {
private char[] rowSeparator;
private StreamBuffer streamBuffer = null;
private ColumnBuffer rowBuffer = null;
private String rowRecord;
private int mode = 1;
private int rowLength = -1;
private char[] buffer;
private static final int BUFFER_SIZE = 8192;
boolean requireAdditionalReadFromSource = true;
private int separatorIndex;
private boolean foundCR = false;
private int extendedArrayStartIndex = 0;
private int readSymbols = 0;
private int length;
private Predicate<Character> characterVerifier;
/**
* DOC ibmuser RowParser constructor comment.
*
* @param inputStream
* @param rowSeparator
* @param skipEmptyRecords
* @throws IOException
*/
public RowParser(BufferedReader inputStream, String rowSeparator, boolean skipEmptyRecords) throws IOException {
super(inputStream, skipEmptyRecords);
columnBuffer = null;
values = null;
if ("\n".equals(rowSeparator) || "\r\n".equals(rowSeparator)) {
this.buffer = new char[BUFFER_SIZE];
this.mode = 0;
characterVerifier = "\n".equals(rowSeparator) ? c -> c == Character.LETTER_NUMBER : this::testCRLF;
} else if(rowSeparator!=null) {
streamBuffer = new StreamBuffer();
this.rowSeparator = rowSeparator.toCharArray();
rowBuffer = new ColumnBuffer();
try {
streamBuffer.count = inputStream.read(streamBuffer.buffer, 0, streamBuffer.buffer.length);
} catch (IOException ex) {
close();
throw ex;
}
streamBuffer.currentPosition = 0;
streamBuffer.rowStart = 0;
streamBuffer.delimiterLength = rowSeparator.length();
streamBuffer.lastIndexToRead = streamBuffer.count - streamBuffer.delimiterLength;
streamBuffer.streamEndMeet = (streamBuffer.count < streamBuffer.buffer.length);
}
}
/**
* DOC ibmuser RowParser constructor comment.
*
* @param inputStream
* @param rowLength
* @throws IOException
*/
public RowParser(BufferedReader inputStream, int rowLength) throws IOException {
super(inputStream, true);
columnBuffer = null;
values = null;
mode = 2;
this.rowLength = rowLength;
buffer = new char[rowLength];
}
@Override
protected void close(boolean closing) {
if (!closed) {
if (closing && mode == 1) {
streamBuffer.buffer = null;
rowBuffer.buffer = null;
}
try {
if(initialized && inputStream != null) {
inputStream.close();
}
} catch (Exception e) {
// just eat the exception
}
inputStream = null;
closed = true;
}
}
/*
* (non-Javadoc)
*
* @see org.talend.fileprocess.delimited.DelimitedDataReader#readRecord()
*/
public boolean readRecord() throws IOException {
checkClosed();
if (mode == 0) {
return hasNext();
} else if (mode == 1) {
hasReadRecord = false;
if (streamBuffer.hasMoreData()) {
while (streamBuffer.hasMoreData() && !hasReadRecord) {
if (streamBuffer.noDataForDelimter()) {
checkDataLength();
} else {
if (isStartRecordDelimited()) {
if (!skipEmptyRecord) {
endRecord();
}
streamBuffer.skipDelimiter();
} else {
startedRow = true;
streamBuffer.rowStart = streamBuffer.currentPosition;
boolean firstLoop = true;
while (streamBuffer.hasMoreData() && startedRow) {
if (!firstLoop && streamBuffer.noDataForDelimter()) {
checkDataLength();
} else {
if (!firstLoop) {
if (isStartRecordDelimited()) {
endRecord();
streamBuffer.skipDelimiter();
}
} else {
firstLoop = false;
}
if (startedRow) {
streamBuffer.currentPosition++;
if (safetySwitch
&& streamBuffer.currentPosition - streamBuffer.rowStart
+ rowBuffer.position > StaticSettings.MAX_SIZE_FOR_SAFTY) {
close();
throw new IOException(
"Maximum row record length of 100,000 exceeded in row in record "
+ NumberFormat.getIntegerInstance().format(currentRecord)
+ ". Set the safetySwitch property to false"
+ " if you're expecting row record lengths greater than 100,000 characters to"
+ " avoid this error.");
}
}
} // end else
}
}
} // end else
}
}
if (!hasReadRecord) {
if (!streamBuffer.noData()) {
if (!startedRow) {
startedRow = true;
streamBuffer.rowStart = streamBuffer.currentPosition;
streamBuffer.currentPosition = streamBuffer.count;
endRecord();
return true;
}
if (startedRow) {
streamBuffer.currentPosition = streamBuffer.count;
endRecord();
return true;
}
} else {
// if (columnsCount > 0) {
// endRecord();
// return true;
// } else {
return false;
// }
}
}
return hasReadRecord;
} else {
int readNumber = inputStream.read(buffer, 0, rowLength);
if (readNumber == -1) {
return false;
} else {
this.rowRecord = new String(buffer, 0, readNumber);
currentRecord++;
return true;
}
}
}
/**
* Find available record from the source with specified separators.
*
* @return true if reader has a value, otherwise false.
*/
private boolean hasNext() throws IOException {
while (hasMoreData()) {
requireAdditionalReadFromSource = false;
length = readSymbols + extendedArrayStartIndex;
for (int j = Math.max(separatorIndex, extendedArrayStartIndex); j < length; j++){
if (characterVerifier.test(buffer[j])) {
rowRecord = new String(buffer, separatorIndex, j - separatorIndex);
if (j == (length - 1)) {
separatorIndex = 0;
extendedArrayStartIndex = 0;
buffer = new char[BUFFER_SIZE];
if (!skipEmptyRecord || !"".equals(rowRecord)) {
requireAdditionalReadFromSource = true;
currentRecord++;
return true;
} else {
// Reached the end of the buffer and the record is skipped.
break;
}
} else {
separatorIndex = j + 1;
if (!skipEmptyRecord || !"".equals(rowRecord)) {
currentRecord++;
return true;
}
// Skipped, find the next record in the buffer.
}
}
if (j == buffer.length - 1) {
//The end of the buffer is reached, copy unprocessed characters to a new buffer.
ensureBufferCapacity();
}
}
//Reached the last buffer character.
requireAdditionalReadFromSource = true;
if (readSymbols < BUFFER_SIZE) {
break;
}
}
//Last record in the end of the file is reached.
if (readSymbols > 0 || separatorIndex != 0) {
rowRecord = new String(buffer, separatorIndex, length - separatorIndex);
separatorIndex = 0;
if (!skipEmptyRecord || !"".equals(rowRecord)) {
currentRecord++;
return true;
}
}
buffer = null;
return false;
}
/**
* Perform read from source if <b>requireAdditionalReadFromSource</b> is true, otherwise proceed with current read characters.
*
* @return true if buffer contain values to be processed, otherwise source is exhausted.
* @throws IOException exception from input stream read.
*/
private boolean hasMoreData() throws IOException {
return requireAdditionalReadFromSource ? (readSymbols = inputStream.read(buffer, extendedArrayStartIndex, BUFFER_SIZE)) != -1 : true;
}
private boolean testCRLF(Character c) {
if (foundCR && c == Character.LETTER_NUMBER) {
return true;
}
foundCR = c == Character.LINE_SEPARATOR;
return false;
}
/**
* The unprocessed characters has to be copied to a new extended buffer.<br>
* Separator index is reset to 0 to include the unprocessed characters to the next record.
*/
private void ensureBufferCapacity() {
char[] tempChars = buffer;
extendedArrayStartIndex = tempChars.length - separatorIndex;
buffer = new char[extendedArrayStartIndex + BUFFER_SIZE];
System.arraycopy(tempChars, separatorIndex, buffer, 0, extendedArrayStartIndex);
separatorIndex = 0;
}
/**
* @exception IOException Thrown if an error occurs while reading data from the source stream.
*/
private void checkDataLength() throws IOException {
updateCurrentValue();
streamBuffer.moveTailToHead();
int count = 0;
try {
count = inputStream.read(streamBuffer.buffer, streamBuffer.count, streamBuffer.buffer.length
- streamBuffer.count);
} catch (IOException ex) {
close();
throw ex;
}
streamBuffer.count += count;
streamBuffer.lastIndexToRead = streamBuffer.count - streamBuffer.delimiterLength;
if (streamBuffer.count < streamBuffer.buffer.length) {
streamBuffer.streamEndMeet = true;
}
}
private void updateCurrentValue() {
if (startedRow && streamBuffer.rowStart < streamBuffer.currentPosition) {
if (rowBuffer.buffer.length - rowBuffer.position < streamBuffer.currentPosition - streamBuffer.rowStart) {
int newLength = rowBuffer.buffer.length
+ Math.max(streamBuffer.currentPosition - streamBuffer.rowStart, rowBuffer.buffer.length);
char[] holder = new char[newLength];
System.arraycopy(rowBuffer.buffer, 0, holder, 0, rowBuffer.position);
rowBuffer.buffer = holder;
}
System.arraycopy(streamBuffer.buffer, streamBuffer.rowStart, rowBuffer.buffer, rowBuffer.position,
streamBuffer.currentPosition - streamBuffer.rowStart);
rowBuffer.position += streamBuffer.currentPosition - streamBuffer.rowStart;
}
}
private boolean isStartRecordDelimited() {
for (int i = 0; i < rowSeparator.length; i++) {
if (streamBuffer.buffer[streamBuffer.currentPosition + i] != rowSeparator[i]) {
return false;
}
}
return true;
}
@Override
protected void endRecord() throws IOException {
String currentValue = "";
// must be called before setting startedColumn = false
if (startedRow) {
if (rowBuffer.position == 0) {
if (streamBuffer.rowStart < streamBuffer.currentPosition) {
currentValue = new String(streamBuffer.buffer, streamBuffer.rowStart, streamBuffer.currentPosition
- streamBuffer.rowStart);
}
} else {
updateCurrentValue();
currentValue = new String(rowBuffer.buffer, 0, rowBuffer.position);
}
}
rowBuffer.position = 0;
if (startedRow) {
startedRow = false;
}
rowRecord = currentValue;
super.endRecord();
}
/**
* A buffer structure that used to load data from stream for processing.
*
* @author gke
*/
private class StreamBuffer {
char[] buffer;
int currentPosition;
// lastIndexToRead is the last index of letter in the buffer for
// processing, this will be equal to count - delimiterLegnth. This
// is needed because evertime we process a letter, when we need to read
// the proceeding letters in order to make sure if currentPosition is
// the begin of field or record delmiter
int lastIndexToRead;
int delimiterLength;
// count indicates how much usable data has been read into the stream,
// which will not always be as long as Buffer.Length.
int count;
// columnStart is the position in the buffer when the
// current column was started or the last time data
// was moved out to the column buffer.
int rowStart;
// streamEndMeet is also very important, when we loag data from stream,
// if the count is smaller than buffer.length, it indcates that there
// must be no more data in the stream, the stream end is meet.
boolean streamEndMeet = false;
public StreamBuffer() {
buffer = new char[StaticSettings.MAX_BUFFER_SIZE];
currentPosition = 0;
count = 0;
rowStart = 0;
}
public void moveTailToHead() {
count = count - currentPosition;
for (int i = 0; i < count; i++) {
buffer[i] = buffer[currentPosition + i];
}
lastIndexToRead = count - delimiterLength;
currentPosition = 0;
rowStart = 0;
}
public void skipDelimiter() {
currentPosition += delimiterLength;
}
public boolean noDataForDelimter() {
return currentPosition > lastIndexToRead;
}
public boolean hasMoreData() {
return (currentPosition <= lastIndexToRead) || (currentPosition > lastIndexToRead && !streamEndMeet);
}
public boolean noData() {
return currentPosition >= count;
}
}
public String getRowRecord() {
return rowRecord;
}
}

View File

@@ -0,0 +1,168 @@
package org.talend.fileprocess.delimited.patched;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.text.NumberFormat;
import java.util.zip.ZipInputStream;
public class RowParserByByte {
private byte[] buffer;
private int row_length;
private BufferedInputStream in = null;
private boolean safetySwitch = false;
public final int MAX_SIZE_FOR_SAFTY = 100000;
private boolean closed = false;
private long currentRecord = 0;
private int header = 0;
public RowParserByByte(String filename, int row_length) throws FileNotFoundException {
this.row_length = row_length;
File f = new File(filename);
if (!f.exists()) {
throw new FileNotFoundException(filename);
}
in = new BufferedInputStream(new FileInputStream(f));
}
public RowParserByByte(ZipInputStream zis, int row_length) throws FileNotFoundException {
this.row_length = row_length;
in = new BufferedInputStream(zis);
}
public boolean readRecord() throws Exception {
return toByteArray();
}
/**
* DOC ke Comment method "isSafetySwitch".
*
* @return the state of the safetySwitch
*/
public boolean isSafetySwitch() {
return safetySwitch;
}
/**
* DOC ke Comment method "setSafetySwitch". When reading a delmited text, if
* safetySwitch is true, and if a column's content length is larger than
* 100,000 or a row's column count is larger than 100,000, an Exception will
* be thrown, and the process of reading delimited data will be terminated.
*
* @param safetySwitch
*/
public void setSafetySwitch(boolean safetySwitch) {
this.safetySwitch = safetySwitch;
}
/**
* DOC ke Comment method "checkClosed". This will be call before read new
* record or get content of the column
*
* @throws IOException
* Thrown if this object has already been closed.
*/
protected void checkClosed() throws IOException {
if (closed) {
throw new IOException("This instance of the RowRaeserByByte class has already been closed.");
}
}
/**
* DOC ke Comment method "skipHeaders". This is used to skip headers in the
* delimited data
*
* @param header
* rows count that will be skipped as header
* @throws IOException
*/
public void skipHeaders(int header) throws Exception {
checkClosed();
if (header <= 0) {
return;
}
this.header = header;
for (int i = 0; i < header; i++) {
readRecord();
}
currentRecord = 0;
}
public byte[] getBuffer() {
return buffer;
}
public String getRowRecord() {
return new String(buffer);
}
public boolean toByteArray() throws IOException {
this.buffer = new byte[row_length];
if (-1 != in.read(buffer, 0, row_length)) {
if (safetySwitch && currentRecord - header > this.MAX_SIZE_FOR_SAFTY) {
close();
throw new IOException("Maximum row record length of 100,000 exceeded in row in record "
+ NumberFormat.getIntegerInstance().format(currentRecord)
+ ". Set the safetySwitch property to false"
+ " if you're expecting row record lengths greater than 100,000 characters to"
+ " avoid this error.");
}
currentRecord++;
return true;
} else {
return false;
}
}
/**
* DOC ke Comment method "getAvailableRowCount".
*
* @param footer
* the record count that will not used, just as footer for the
* delimited data. It will also be skipped
* @return the count of Available row count
* @throws Exception
*/
public long getAvailableRowCount(int footer) throws Exception {
checkClosed();
boolean flag = true;
do {
flag = readRecord();
} while (flag);
return currentRecord - footer;
}
/**
* Closes and releases all related resources.
*/
public void close() {
try {
in.close();
} catch (IOException e) {
// just eat the exception
}
closed = true;
}
}

View File

@@ -1,10 +1,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.talend.libraries</groupId>
<groupId>org.talend.components.lib</groupId>
<artifactId>talendsap</artifactId>
<name>talendsap</name>
<version>1.0.1</version>
<version>1.0.2</version>
<properties>
<talend.nexus.url>https://artifacts-oss.talend.com</talend.nexus.url>

View File

@@ -90,6 +90,7 @@ public class DocumentExtractor {
List<Element> tablesAndChangingElements = new ArrayList<Element>(3);
tablesAndChangingElements.add(functionElement.element("TABLES"));
tablesAndChangingElements.add(functionElement.element("CHANGING"));
tablesAndChangingElements.add(functionElement.element("OUTPUT"));
for(Element tablesOrChangingElement : tablesAndChangingElements) {
if (tablesOrChangingElement == null) {
@@ -121,6 +122,10 @@ public class DocumentExtractor {
}
result.add(row);
}
if(!result.isEmpty()) {
return result;
}
}
return result;

View File

@@ -49,11 +49,11 @@ public class DocumentHelper {
}
}
public void addSingleParameter(String name, String value, boolean isChanging) {
public void addSingleParameter(String name, String value, SAPParameterType parameter_type) {
if(value == null) {
value = "";
}
if (isChanging) {
if (parameter_type == SAPParameterType.CHANGING) {
correctChanging();
changing.addElement(name).setText(value);
} else {
@@ -62,8 +62,8 @@ public class DocumentHelper {
}
}
public void addStructParameter(String name, boolean isChanging) {
if (isChanging) {
public void addStructParameter(String name, SAPParameterType parameter_type) {
if (parameter_type == SAPParameterType.CHANGING) {
correctChanging();
currentStruct = changing.addElement(name);
} else {
@@ -79,13 +79,16 @@ public class DocumentHelper {
currentStruct.addElement(name).setText(value);
}
public void addTableParameter(String name, boolean isChanging) {
if (isChanging) {
public void addTableParameter(String name, SAPParameterType parameter_type) {
if (parameter_type == SAPParameterType.CHANGING) {
correctChanging();
currentTable = changing.addElement(name);
} else {
} else if(parameter_type == SAPParameterType.TABLES) {
correctTables();
currentTable = tables.addElement(name);
} else {
correctInput();
currentTable = input.addElement(name);
}
}
@@ -108,18 +111,18 @@ public class DocumentHelper {
DocumentHelper helper = new DocumentHelper();
helper.setFunctionName("READ_TABLE_FUNCTION");
helper.addSingleParameter("ID", "1", true);
helper.addSingleParameter("NAME", "gaoyan", false);
helper.addSingleParameter("ID", "1", SAPParameterType.CHANGING);
helper.addSingleParameter("NAME", "gaoyan", SAPParameterType.IMPORT);
helper.addStructParameter("INFO", true);
helper.addStructParameter("INFO", SAPParameterType.CHANGING);
helper.addStructChildParameter("ID", "2");
helper.addStructChildParameter("NAME", "wangwei");
helper.addStructParameter("INFO1", false);
helper.addStructParameter("INFO1", SAPParameterType.IMPORT);
helper.addStructChildParameter("ID1", "4");
helper.addStructChildParameter("NAME1", "momo");
helper.addTableParameter("TABLE1", false);
helper.addTableParameter("TABLE1", SAPParameterType.TABLES);
for (int i = 0; i < 200000; i++) {
helper.addTableRow();
helper.addTableRowChildParameter("c1", i + "");
@@ -132,7 +135,7 @@ public class DocumentHelper {
helper.addTableRowChildParameter("c8", "wangwei" + i);
}
helper.addTableParameter("TABLE2", false);
helper.addTableParameter("TABLE2", SAPParameterType.TABLES);
for (int i = 0; i < 2; i++) {
helper.addTableRow();
helper.addTableRowChildParameter("ID4", i + "");

View File

@@ -0,0 +1,8 @@
package org.talend.sap;
public enum SAPParameterType {
IMPORT,
CHANGING,
TABLES,
EXPORT
}

View File

@@ -24,7 +24,7 @@
String dataset = ElementParameterParser.getValue(node, "__DATASET__");
String table = ElementParameterParser.getValue(node, "__TABLE__");
String gsFile = ElementParameterParser.getValue(node, "__GS_FILE__");
String fieldDelimiter = ElementParameterParser.getValue(node, "__FIELD_DELIMITER__");
String actionOnData = ElementParameterParser.getValue(node, "__ACTION_ON_DATA__");
boolean dieOnError = "true".equals(ElementParameterParser.getValue(node, "__DIE_ON_ERROR__"));
@@ -258,56 +258,80 @@
com.google.api.services.bigquery.model.JobConfiguration config_<%=cid%> = new com.google.api.services.bigquery.model.JobConfiguration();
com.google.api.services.bigquery.model.JobConfigurationLoad queryLoad_<%=cid%> = new com.google.api.services.bigquery.model.JobConfigurationLoad();
com.google.api.services.bigquery.model.TableSchema schema_<%=cid%> = new com.google.api.services.bigquery.model.TableSchema();
<%
if(isLog4jEnabled){
%>
log.info("<%=cid%> - Table field schema:");
<%
}
%>
java.util.List<com.google.api.services.bigquery.model.TableFieldSchema> fields_<%=cid%> = new java.util.ArrayList<com.google.api.services.bigquery.model.TableFieldSchema>();
<%
List<IMetadataTable> metadatas = node.getMetadataList();
if ((metadatas!=null) && (metadatas.size() > 0)) {
IMetadataTable metadata = metadatas.get(0);
if (metadata != null) {
List<IMetadataColumn> columns = metadata.getListColumns();
int nbColumns = columns.size();
for (int i = 0; i < nbColumns; i++ ) {
IMetadataColumn column = columns.get(i);
String columnName = column.getLabel();
String typeToGenerate = "string";
if("id_Float".equals(column.getTalendType())) {
typeToGenerate = "float";
} else if("id_Integer".equals(column.getTalendType())) {
typeToGenerate = "integer";
} else if("id_Boolean".equals(column.getTalendType())) {
typeToGenerate = "boolean";
} else if("id_Date".equals(column.getTalendType())) {
typeToGenerate = "timestamp";
}
%>
com.google.api.services.bigquery.model.TableFieldSchema <%=columnName%>_<%=cid%> = new com.google.api.services.bigquery.model.TableFieldSchema();
<%=columnName%>_<%=cid%>.setName("<%=columnName%>");
<%=columnName%>_<%=cid%>.setType("<%=typeToGenerate%>");
fields_<%=cid%>.add(<%=columnName%>_<%=cid%>);
<%
if(isLog4jEnabled){
%>
log.debug("<%=cid%> - Field index[<%=i%>] {\"name\":\"<%=columnName%>\",\"type\":\"<%=typeToGenerate%>\"}");
<%
if (<%=ElementParameterParser.getBooleanValue(node, "__CREATE_TABLE_IF_NOT_EXIST__")%>) {
com.google.api.services.bigquery.model.TableSchema schema_<%=cid%> = new com.google.api.services.bigquery.model.TableSchema();
<%
if(isLog4jEnabled){
%>
log.info("<%=cid%> - Table field schema:");
<%
}
%>
java.util.List<com.google.api.services.bigquery.model.TableFieldSchema> fields_<%=cid%> = new java.util.ArrayList<com.google.api.services.bigquery.model.TableFieldSchema>();
<%
List<IMetadataTable> metadatas = node.getMetadataList();
if ((metadatas!=null) && (metadatas.size() > 0)) {
IMetadataTable metadata = metadatas.get(0);
if (metadata != null) {
List<IMetadataColumn> columns = metadata.getListColumns();
int nbColumns = columns.size();
for (int i = 0; i < nbColumns; i++ ) {
IMetadataColumn column = columns.get(i);
String columnName = column.getLabel();
String typeToGenerate = "string";
if("id_Float".equals(column.getTalendType()) || "id_Double".equals(column.getTalendType())) {
typeToGenerate = "float";
}else if("id_Integer".equals(column.getTalendType()) || "id_Long".equals(column.getTalendType()) || "id_Short".equals(column.getTalendType())) {
typeToGenerate = "integer";
} else if("id_Character".equals(column.getTalendType())) {
typeToGenerate = "string";
} else if("id_BigDecimal".equals(column.getTalendType())) {
typeToGenerate = "numeric";
} else if("id_Boolean".equals(column.getTalendType())) {
typeToGenerate = "boolean";
} else if("id_Date".equals(column.getTalendType())) {
String pattern = column.getPattern();
if(pattern.length() == 12 || pattern.isEmpty() || "\"\"".equals(pattern)) {
typeToGenerate = "date";
}else if(pattern.length() > 12){
typeToGenerate = "timestamp";
}else{
typeToGenerate = "string";
}
}
%>
<%
String modeType = null;
if (!column.isNullable()) {
modeType = "REQUIRED";
} else {
modeType = "NULLABLE";
}
%>
com.google.api.services.bigquery.model.TableFieldSchema <%=columnName%>_<%=cid%> = new com.google.api.services.bigquery.model.TableFieldSchema();
<%=columnName%>_<%=cid%>.setName("<%=columnName%>");
<%=columnName%>_<%=cid%>.setType("<%=typeToGenerate%>");
<%=columnName%>_<%=cid%>.setMode("<%=modeType%>");
fields_<%=cid%>.add(<%=columnName%>_<%=cid%>);
<%
if(isLog4jEnabled){
%>
log.debug("<%=cid%> - Field index[<%=i%>] {\"name\":\"<%=columnName%>\",\"type\":\"<%=typeToGenerate%>\",\"mode\":\"<%=modeType%>\"}");
<%
}
}
}
}
}
%>
%>
schema_<%=cid%>.setFields(fields_<%=cid%>);
queryLoad_<%=cid%>.setSchema(schema_<%=cid%>);
schema_<%=cid%>.setFields(fields_<%=cid%>);
queryLoad_<%=cid%>.setSchema(schema_<%=cid%>);
}
<%
if("true".equals(ElementParameterParser.getValue(node, "__CREATE_TABLE_IF_NOT_EXIST__"))) {
%>
@@ -321,7 +345,7 @@
if("true".equals(ElementParameterParser.getValue(node, "__SET_FIELD_DELIMITER__"))) {
%>
queryLoad_<%=cid%>.setFieldDelimiter(<%=ElementParameterParser.getValue(node, "__FIELD_DELIMITER__")%>);
queryLoad_<%=cid%>.setFieldDelimiter(<%=fieldDelimiter%>);
<%
}
%>
@@ -336,7 +360,7 @@
queryLoad_<%=cid%>.setDestinationTable(destinationTable_<%=cid%>);
queryLoad_<%=cid%>.setSourceUris(java.util.Arrays.asList(<%=ElementParameterParser.getValue(node, "__GS_FILE__")%>));
queryLoad_<%=cid%>.setSkipLeadingRows(<%=ElementParameterParser.getValue(node, "__GS_FILE_HEADER__")%>);
queryLoad_<%=cid%>.setNullMarker("\\N");
config_<%=cid%>.setLoad(queryLoad_<%=cid%>);
job_<%=cid%>.setConfiguration(config_<%=cid%>);
@@ -375,10 +399,10 @@
}
if (jobExec_<%=cid%>.getStatus().getState().equals("RUNNING")
|| jobExec_<%=cid%>.getStatus().getState().equals("PENDING")) {
com.google.api.services.bigquery.model.Job pollJob_<%=cid%> = bigqueryclient_<%=cid%>.jobs().get(PROJECT_ID_<%=cid%>,jobExec_<%=cid%>.getJobReference().getJobId()).execute();
com.google.api.services.bigquery.model.Job pollJob_<%=cid%> = bigqueryclient_<%=cid%>.jobs().get(PROJECT_ID_<%=cid%>,jobExec_<%=cid%>.getJobReference().getJobId()).setLocation(jobExec_<%=cid%>.getJobReference().getLocation()).execute();
while (pollJob_<%=cid%>.getStatus().getState().equals("RUNNING") || pollJob_<%=cid%>.getStatus().getState().equals("PENDING")) {
Thread.sleep(1000);
pollJob_<%=cid%> = bigqueryclient_<%=cid%>.jobs().get(PROJECT_ID_<%=cid%>,jobExec_<%=cid%>.getJobReference().getJobId()).execute();
pollJob_<%=cid%> = bigqueryclient_<%=cid%>.jobs().get(PROJECT_ID_<%=cid%>,jobExec_<%=cid%>.getJobReference().getJobId()).setLocation(jobExec_<%=cid%>.getJobReference().getLocation()).execute();
System.out.println(String.format(
"Waiting on job %s ... Current status: %s", jobExec_<%=cid%>
.getJobReference().getJobId(), pollJob_<%=cid%>
@@ -440,6 +464,7 @@
/* ----START-CREATING-JOB (Cloud API)---- */
com.google.cloud.bigquery.TableId tableId_<%=cid%> = com.google.cloud.bigquery.TableId.of(<%=projectId%>, <%=dataset%>, <%=table%>);
com.google.cloud.bigquery.Table table_<%=cid%> = bigquery_<%=cid%>.getTable(tableId_<%=cid%>);
com.google.cloud.bigquery.LoadJobConfiguration.Builder loadJobBuilder_<%=cid%> = com.google.cloud.bigquery.LoadJobConfiguration.newBuilder(tableId_<%=cid%>, <%=gsFile%>);
if (<%=ElementParameterParser.getBooleanValue(node, "__DROP__")%> && table_<%=cid%> != null) {
boolean deleted = bigquery_<%=cid%>.delete(tableId_<%=cid%>);
if (deleted) {
@@ -454,9 +479,7 @@
throw new RuntimeException("Unable to delete table " + tableId_<%=cid%>);
}
}
boolean tableNotExist = table_<%=cid%> == null;
if (<%=ElementParameterParser.getBooleanValue(node, "__DROP__")%> || tableNotExist) {
boolean typeSupported = true;
if (<%=ElementParameterParser.getBooleanValue(node, "__DROP__")%> || <%=ElementParameterParser.getBooleanValue(node, "__CREATE_TABLE_IF_NOT_EXIST__")%>) {
java.util.List<com.google.cloud.bigquery.Field> fields_<%=cid%> = new java.util.ArrayList<>();
<%
List<IMetadataTable> metadatas = node.getMetadataList();
@@ -468,27 +491,37 @@
for (int i = 0; i < nbColumns; i++ ) {
IMetadataColumn column = columns.get(i);
String columnName = column.getLabel();
String typeToGenerate = null;
if("id_String".equals(column.getTalendType())) {
String typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.STRING";
if("id_String".equals(column.getTalendType()) || "id_Character".equals(column.getTalendType())) {
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.STRING";
} else if ("id_Float".equals(column.getTalendType()) || "id_Double".equals(column.getTalendType())) {
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.FLOAT";
} else if ("id_Short".equals(column.getTalendType()) || "id_Integer".equals(column.getTalendType()) || "id_Long".equals(column.getTalendType())) {
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.INTEGER";
} else if ("id_BigDecimal".equals(column.getTalendType())) {
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.NUMERIC";
} else if ("id_Boolean".equals(column.getTalendType())) {
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.BOOLEAN";
} else if ("id_Date".equals(column.getTalendType())) {
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.TIMESTAMP";
} else {
%>
typeSupported = false;
<%
} else if ("id_Date".equals(column.getTalendType())) {
String pattern = column.getPattern();
if(pattern.length() == 12 || pattern.isEmpty() || "\"\"".equals(pattern)) {
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.DATE";
}else if(pattern.length() > 12){
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.TIMESTAMP";
}else{
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.STRING";
}
}
String modeType = "NULLABLE";
if (!column.isNullable()) {
modeType = "REQUIRED";
}
%>
if (!typeSupported) {
throw new IllegalArgumentException("unsupported type for column [<%=columnName%>]: " + "<%=column.getTalendType()%>");
}
com.google.cloud.bigquery.Field field_<%=i%> = com.google.cloud.bigquery.Field.of("<%=columnName%>", <%=typeToGenerate%>);
com.google.cloud.bigquery.Field field_<%=i%> = com.google.cloud.bigquery.Field.newBuilder("<%=columnName%>", <%=typeToGenerate%>)
.setMode(com.google.cloud.bigquery.Field.Mode.valueOf("<%=modeType%>"))
.build();
fields_<%=cid%>.add(field_<%=i%>);
<%
if(isLog4jEnabled){
@@ -500,12 +533,59 @@
}
}
%>
com.google.cloud.bigquery.Schema schema_<%=cid%> = com.google.cloud.bigquery.Schema.of(fields_<%=cid%>);
com.google.cloud.bigquery.TableInfo tableInfo_<%=cid%> = com.google.cloud.bigquery.TableInfo.newBuilder(tableId_<%=cid%>, com.google.cloud.bigquery.StandardTableDefinition.of(schema_<%=cid%>)).build();
table_<%=cid%> = bigquery_<%=cid%>.create(tableInfo_<%=cid%>);
loadJobBuilder_<%=cid%>.setSchema(schema_<%=cid%>);
}
com.google.cloud.bigquery.Job job_<%=cid%> = table_<%=cid%>.load(com.google.cloud.bigquery.FormatOptions.csv(), <%=gsFile%>);
job_<%=cid%> = job_<%=cid%>.waitFor(com.google.cloud.RetryOption.initialRetryDelay(org.threeten.bp.Duration.ofSeconds(1)), com.google.cloud.RetryOption.totalTimeout(org.threeten.bp.Duration.ofSeconds(30)));
<%
if("true".equals(ElementParameterParser.getValue(node, "__CREATE_TABLE_IF_NOT_EXIST__"))) {
%>
loadJobBuilder_<%=cid%>.setCreateDisposition(com.google.cloud.bigquery.JobInfo.CreateDisposition.CREATE_IF_NEEDED);
<%
} else {
%>
loadJobBuilder_<%=cid%>.setCreateDisposition(com.google.cloud.bigquery.JobInfo.CreateDisposition.CREATE_NEVER);
<%
}
%>
<%
if("APPEND".equals(actionOnData)) {
%>
loadJobBuilder_<%=cid%>.setWriteDisposition(com.google.cloud.bigquery.JobInfo.WriteDisposition.WRITE_APPEND);
<%
} else if("TRUNCATE".equals(actionOnData)) {
%>
loadJobBuilder_<%=cid%>.setWriteDisposition(com.google.cloud.bigquery.JobInfo.WriteDisposition.WRITE_TRUNCATE);
<%
}
else {
%>
loadJobBuilder_<%=cid%>.setWriteDisposition(com.google.cloud.bigquery.JobInfo.WriteDisposition.WRITE_EMPTY);
<%
}
%>
loadJobBuilder_<%=cid%>.setDestinationTable(tableId_<%=cid%>);
com.google.cloud.bigquery.CsvOptions.Builder csvOptions_<%=cid%> = com.google.cloud.bigquery.CsvOptions.newBuilder();
csvOptions_<%=cid%>.setAllowQuotedNewLines(true);
csvOptions_<%=cid%>.setSkipLeadingRows(<%=ElementParameterParser.getValue(node, "__GS_FILE_HEADER__")%>);
<%if("true".equals(ElementParameterParser.getValue(node, "__SET_FIELD_DELIMITER__"))) {
%>
csvOptions_<%=cid%>.setFieldDelimiter(<%=fieldDelimiter%>);
<%
}
%>
loadJobBuilder_<%=cid%>.setNullMarker("\\N");
loadJobBuilder_<%=cid%>.setFormatOptions(csvOptions_<%=cid%>.build());
com.google.cloud.bigquery.Job job_<%=cid%> = bigquery_<%=cid%>.create(com.google.cloud.bigquery.JobInfo.of(loadJobBuilder_<%=cid%>.build()));
job_<%=cid%> = job_<%=cid%>.waitFor(com.google.cloud.RetryOption.initialRetryDelay(org.threeten.bp.Duration.ofSeconds(1)));
if (job_<%=cid%> != null && job_<%=cid%>.getStatus().getError() == null) {
<%
if(isLog4jEnabled){
@@ -515,7 +595,8 @@
}
%>
} else {
throw new RuntimeException("Job failed: " + job_<%=cid%>.getStatus().getError());
List<com.google.cloud.bigquery.BigQueryError> errorList = job_<%=cid%>.getStatus().getExecutionErrors();
throw new RuntimeException("Job failed: " + errorList.get(errorList.size() - 1));
}
/* ----END-CREATING-JOB (Cloud API)---- */
@@ -523,4 +604,4 @@
} else {
throw new IllegalArgumentException("authentication mode should be either \"SERVICEACCOUNT\" or \"OAUTH\", but it is " + authMode);
}
%>
%>

View File

@@ -1,218 +1,217 @@
<COMPONENT>
<HEADER
PLATEFORM="ALL"
SERIAL=""
VERSION="0.102"
STATUS="ALPHA"
COMPATIBILITY="ALL"
AUTHOR="Talend"
RELEASE_DATE="20070312A"
STARTABLE="true"
LOG4J_ENABLED="true"
>
<SIGNATURE/>
</HEADER>
<FAMILIES>
<FAMILY>Big Data/Google BigQuery</FAMILY>
</FAMILIES>
<DOCUMENTATION>
<URL/>
</DOCUMENTATION>
<CONNECTORS>
<CONNECTOR CTYPE="FLOW" MAX_INPUT="0" MAX_OUTPUT="0"/>
<CONNECTOR CTYPE="ITERATE" MAX_OUTPUT="1" MAX_INPUT="1"/>
<CONNECTOR CTYPE="SUBJOB_OK" MAX_INPUT="1" />
<CONNECTOR CTYPE="SUBJOB_ERROR" MAX_INPUT="1" />
<CONNECTOR CTYPE="COMPONENT_OK"/>
<CONNECTOR CTYPE="COMPONENT_ERROR"/>
<CONNECTOR CTYPE="RUN_IF"/>
</CONNECTORS>
<PARAMETERS>
<PARAMETER
NAME="SCHEMA"
FIELD="SCHEMA_TYPE"
REQUIRED="true"
NUM_ROW="1"
/>
<PARAMETER NAME="AUTH_MODE" FIELD="CLOSED_LIST" NUM_ROW="3" REQUIRED="true" GROUP="AUTHENTICATION" REPOSITORY_VALUE="AUTH_MODE">
<ITEMS DEFAULT="SERVICEACCOUNT">
<ITEM NAME="SERVICEACCOUNT" VALUE="SERVICEACCOUNT" />
<ITEM NAME="OAUTH" VALUE="OAUTH" />
</ITEMS>
</PARAMETER>
<PARAMETER
NAME="SERVICE_ACCOUNT_CREDENTIALS_FILE"
REPOSITORY_VALUE="SERVICE_ACCOUNT_CREDENTIALS_FILE"
FIELD="FILE"
NUM_ROW="10"
REQUIRED="true"
SHOW_IF="AUTH_MODE == 'SERVICEACCOUNT'"
GROUP="AUTHENTICATION"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="CLIENT_ID"
FIELD="TEXT"
NUM_ROW="10"
REQUIRED="true"
SHOW_IF="AUTH_MODE == 'OAUTH'"
GROUP="AUTHENTICATION"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="CLIENT_SECRET"
FIELD="PASSWORD"
NUM_ROW="20"
REQUIRED="true"
SHOW_IF="AUTH_MODE == 'OAUTH'"
GROUP="AUTHENTICATION"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="AUTHORIZATION_CODE"
FIELD="TEXT"
NUM_ROW="30"
REQUIRED="true"
SHOW_IF="AUTH_MODE == 'OAUTH'"
GROUP="AUTHENTICATION"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="PROJECT_ID"
FIELD="TEXT"
NUM_ROW="40"
REQUIRED="true"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="DATASET"
FIELD="TEXT"
NUM_ROW="49"
REQUIRED="true"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="TABLE"
FIELD="TEXT"
NUM_ROW="50"
REQUIRED="true"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="CREATE_TABLE_IF_NOT_EXIST" FIELD="CHECK" NUM_ROW="50" REQUIRED="true" SHOW_IF="AUTH_MODE == 'OAUTH'">
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="ACTION_ON_DATA"
SHOW_IF="AUTH_MODE == 'OAUTH'"
FIELD="CLOSED_LIST"
NUM_ROW="51"
REQUIRED="true"
>
<ITEMS DEFAULT="TRUNCATE">
<ITEM NAME="TRUNCATE" VALUE="TRUNCATE" />
<ITEM NAME="APPEND" VALUE="APPEND" />
<ITEM NAME="EMPTY" VALUE="EMPTY" />
</ITEMS>
</PARAMETER>
<PARAMETER NAME="BULK_FILE_ALREADY_EXIST" FIELD="CHECK" NUM_ROW="59" REQUIRED="true" GROUP="GS_CONF">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="GS_ACCESS_KEY" FIELD="TEXT" NUM_ROW="60" REQUIRED="true" GROUP="GS_CONF" SHOW_IF="BULK_FILE_ALREADY_EXIST=='false'">
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="GS_SECRET_KEY" FIELD="PASSWORD" NUM_ROW="61" REQUIRED="true" GROUP="GS_CONF" SHOW_IF="BULK_FILE_ALREADY_EXIST=='false'">
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="GS_LOCAL_FILE" FIELD="FILE" NUM_ROW="62" REQUIRED="true" GROUP="GS_CONF" SHOW_IF="BULK_FILE_ALREADY_EXIST=='false'">
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="BUCKET_NAME" FIELD="TEXT" NUM_ROW="63" REQUIRED="true" GROUP="GS_CONF" SHOW_IF="BULK_FILE_ALREADY_EXIST=='false'">
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="GS_FILE"
FIELD="TEXT"
NUM_ROW="70"
REQUIRED="true"
GROUP="GS_CONF"
>
<DEFAULT>"gs://"</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="GS_FILE_HEADER"
FIELD="TEXT"
NUM_ROW="71"
REQUIRED="true"
GROUP="GS_CONF"
>
<DEFAULT>0</DEFAULT>
</PARAMETER>
<PARAMETER NAME="DIE_ON_ERROR" FIELD="CHECK" NUM_ROW="80" REQUIRED="true">
<DEFAULT>false</DEFAULT>
</PARAMETER>
</PARAMETERS>
<ADVANCED_PARAMETERS>
<PARAMETER NAME="TOKEN_NAME" FIELD="FILE" NUM_ROW="10"
REQUIRED="true" SHOW_IF="AUTH_MODE == 'OAUTH'">
<DEFAULT>"__COMP_DEFAULT_FILE_DIR__/token.properties"</DEFAULT>
</PARAMETER>
<PARAMETER NAME="SET_FIELD_DELIMITER" FIELD="CHECK" REQUIRED="true" NUM_ROW="20" >
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="FIELD_DELIMITER" FIELD="TEXT" REQUIRED="true" NUM_ROW="20"
SHOW_IF="(SET_FIELD_DELIMITER == 'true')">
<DEFAULT>","</DEFAULT>
</PARAMETER>
<PARAMETER NAME="DROP" FIELD="CHECK" REQUIRED="true" NUM_ROW="25" SHOW_IF="AUTH_MODE == 'SERVICEACCOUNT'">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="ENCODING" FIELD="ENCODING_TYPE" NUM_ROW="30"
REQUIRED="true" REPOSITORY_VALUE="ENCODING">
<DEFAULT>"ISO-8859-15"</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="google-api-client-1.19.0.jar" MODULE="google-api-client-1.19.0.jar" MVN="mvn:org.talend.libraries/google-api-client-1.19.0/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.google/lib/google-api-client-1.19.0.jar" REQUIRED="true" />
<IMPORT NAME="google-api-services-oauth2-v2-rev78-1.19.0.jar" MODULE="google-api-services-oauth2-v2-rev78-1.19.0.jar" MVN="mvn:org.talend.libraries/google-api-services-oauth2-v2-rev78-1.19.0/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.google/lib/google-api-services-oauth2-v2-rev78-1.19.0.jar" REQUIRED="true" />
<IMPORT NAME="google-api-services-bigquery-v2-rev391-1.21.0.jar" MODULE="google-api-services-bigquery-v2-rev391-1.21.0.jar" MVN="mvn:org.talend.libraries/google-api-services-bigquery-v2-rev391-1.21.0/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.google/lib/google-api-services-bigquery-v2-rev391-1.21.0.jar" REQUIRED="true" />
<IMPORT NAME="google-http-client-1.19.0.jar" MODULE="google-http-client-1.19.0.jar" MVN="mvn:org.talend.libraries/google-http-client-1.19.0/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.google/lib/google-http-client-1.19.0.jar" REQUIRED="true" />
<IMPORT NAME="google-oauth-client-1.19.0.jar" MODULE="google-oauth-client-1.19.0.jar" MVN="mvn:org.talend.libraries/google-oauth-client-1.19.0/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.google/lib/google-oauth-client-1.19.0.jar" REQUIRED="true" />
<IMPORT NAME="google-http-client-jackson2-1.19.0.jar" MODULE="google-http-client-jackson2-1.19.0.jar" MVN="mvn:org.talend.libraries/google-http-client-jackson2-1.19.0/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.google/lib/google-http-client-jackson2-1.19.0.jar" REQUIRED="true" />
<IMPORT NAME="guava-jdk5-13.0.jar" MODULE="guava-jdk5-13.0.jar" MVN="mvn:org.talend.libraries/guava-jdk5-13.0/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.guava/lib/guava-jdk5-13.0.jar" REQUIRED="true" />
<IMPORT NAME="jackson-core-2.9.5.jar" MODULE="jackson-core-2.9.5.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.9.5" REQUIRED="true" />
<!-- REQUIRED FOR GOOGLE STORAGE -->
<IMPORT NAME="jets3t-0.9.1" MODULE="jets3t-0.9.1.jar" MVN="mvn:org.talend.libraries/jets3t-0.9.1/6.0.0" REQUIRED="true" />
<IMPORT NAME="commons-logging-1.1.1" MODULE="commons-logging-1.1.1.jar" MVN="mvn:org.talend.libraries/commons-logging-1.1.1/6.0.0" UrlPath="platform:/base/plugins/org.apache.commons.logging_1.1.1.v201101211721.jar" REQUIRED="true" />
<IMPORT NAME="httpclient-4.5.5" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.apache.httpcomponents/httpclient/4.5.5" REQUIRED="true" />
<IMPORT NAME="httpcore-4.4.9" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.apache.httpcomponents/httpcore/4.4.9" REQUIRED="true" />
<IMPORT NAME="commons-codec-1.4" MODULE="commons-codec-1.4.jar" MVN="mvn:commons-codec/commons-codec/1.4" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.4.jar" REQUIRED="true" />
<IMPORT NAME="google-cloud-bigquery-1.32.0.jar" MODULE="google-cloud-bigquery-1.32.0.jar" MVN="mvn:com.google.cloud/google-cloud-bigquery/1.32.0" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="google-http-client-jackson-1.23.0.jar" MODULE="google-http-client-jackson-1.23.0.jar" MVN="mvn:com.google.http-client/google-http-client-jackson/1.23.0" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="threetenbp-1.3.3.jar" MODULE="threetenbp-1.3.3.jar" MVN="mvn:org.threeten/threetenbp/1.3.3" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="google-auth-library-credentials-0.9.1.jar" MODULE="google-auth-library-credentials-0.9.1.jar" MVN="mvn:com.google.auth/google-auth-library-credentials/0.9.1" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="gax-httpjson-0.44.0.jar" MODULE="gax-httpjson-0.44.0.jar" MVN="mvn:com.google.api/gax-httpjson/0.44.0" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="jackson-core-asl-1.9.11.jar" MODULE="jackson-core-asl-1.9.11.jar" MVN="mvn:org.codehaus.jackson/jackson-core-asl/1.9.11" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="google-auth-library-oauth2-http-0.9.1.jar" MODULE="google-auth-library-oauth2-http-0.9.1.jar" MVN="mvn:com.google.auth/google-auth-library-oauth2-http/0.9.1" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="google-cloud-core-1.32.0.jar" MODULE="google-cloud-core-1.32.0.jar" MVN="mvn:com.google.cloud/google-cloud-core/1.32.0" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="google-cloud-core-http-1.32.0.jar" MODULE="google-cloud-core-http-1.32.0.jar" MVN="mvn:com.google.cloud/google-cloud-core-http/1.32.0" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="guava-20.0.jar" MODULE="guava-20.0.jar" MVN="mvn:com.google.guava/guava/20.0" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="gax-1.27.0.jar" MODULE="gax-1.27.0.jar" MVN="mvn:com.google.api/gax/1.27.0" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="google-http-client-appengine-1.23.0.jar" MODULE="google-http-client-appengine-1.23.0.jar" MVN="mvn:com.google.http-client/google-http-client-appengine/1.23.0" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="api-common-1.6.0.jar" MODULE="api-common-1.6.0.jar" MVN="mvn:com.google.api/api-common/1.6.0" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
</IMPORTS>
</CODEGENERATION>
<RETURNS>
</RETURNS>
</COMPONENT>
<COMPONENT>
<HEADER
PLATEFORM="ALL"
SERIAL=""
VERSION="0.102"
STATUS="ALPHA"
COMPATIBILITY="ALL"
AUTHOR="Talend"
RELEASE_DATE="20070312A"
STARTABLE="true"
LOG4J_ENABLED="true"
>
<SIGNATURE/>
</HEADER>
<FAMILIES>
<FAMILY>Big Data/Google BigQuery</FAMILY>
</FAMILIES>
<DOCUMENTATION>
<URL/>
</DOCUMENTATION>
<CONNECTORS>
<CONNECTOR CTYPE="FLOW" MAX_INPUT="0" MAX_OUTPUT="0"/>
<CONNECTOR CTYPE="ITERATE" MAX_OUTPUT="1" MAX_INPUT="1"/>
<CONNECTOR CTYPE="SUBJOB_OK" MAX_INPUT="1" />
<CONNECTOR CTYPE="SUBJOB_ERROR" MAX_INPUT="1" />
<CONNECTOR CTYPE="COMPONENT_OK"/>
<CONNECTOR CTYPE="COMPONENT_ERROR"/>
<CONNECTOR CTYPE="RUN_IF"/>
</CONNECTORS>
<PARAMETERS>
<PARAMETER
NAME="SCHEMA"
FIELD="SCHEMA_TYPE"
REQUIRED="true"
NUM_ROW="1"
/>
<PARAMETER NAME="AUTH_MODE" FIELD="CLOSED_LIST" NUM_ROW="3" REQUIRED="true" GROUP="AUTHENTICATION" REPOSITORY_VALUE="AUTH_MODE">
<ITEMS DEFAULT="SERVICEACCOUNT">
<ITEM NAME="SERVICEACCOUNT" VALUE="SERVICEACCOUNT" />
<ITEM NAME="OAUTH" VALUE="OAUTH" />
</ITEMS>
</PARAMETER>
<PARAMETER
NAME="SERVICE_ACCOUNT_CREDENTIALS_FILE"
REPOSITORY_VALUE="SERVICE_ACCOUNT_CREDENTIALS_FILE"
FIELD="FILE"
NUM_ROW="10"
REQUIRED="true"
SHOW_IF="AUTH_MODE == 'SERVICEACCOUNT'"
GROUP="AUTHENTICATION"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="CLIENT_ID"
FIELD="TEXT"
NUM_ROW="10"
REQUIRED="true"
SHOW_IF="AUTH_MODE == 'OAUTH'"
GROUP="AUTHENTICATION"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="CLIENT_SECRET"
FIELD="PASSWORD"
NUM_ROW="20"
REQUIRED="true"
SHOW_IF="AUTH_MODE == 'OAUTH'"
GROUP="AUTHENTICATION"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="AUTHORIZATION_CODE"
FIELD="TEXT"
NUM_ROW="30"
REQUIRED="true"
SHOW_IF="AUTH_MODE == 'OAUTH'"
GROUP="AUTHENTICATION"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="PROJECT_ID"
FIELD="TEXT"
NUM_ROW="40"
REQUIRED="true"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="DATASET"
FIELD="TEXT"
NUM_ROW="49"
REQUIRED="true"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="TABLE"
FIELD="TEXT"
NUM_ROW="50"
REQUIRED="true"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="CREATE_TABLE_IF_NOT_EXIST" FIELD="CHECK" NUM_ROW="50" REQUIRED="true">
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="ACTION_ON_DATA"
FIELD="CLOSED_LIST"
NUM_ROW="51"
REQUIRED="true"
>
<ITEMS DEFAULT="TRUNCATE">
<ITEM NAME="TRUNCATE" VALUE="TRUNCATE" />
<ITEM NAME="APPEND" VALUE="APPEND" />
<ITEM NAME="EMPTY" VALUE="EMPTY" />
</ITEMS>
</PARAMETER>
<PARAMETER NAME="BULK_FILE_ALREADY_EXIST" FIELD="CHECK" NUM_ROW="59" REQUIRED="true" GROUP="GS_CONF">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="GS_ACCESS_KEY" FIELD="TEXT" NUM_ROW="60" REQUIRED="true" GROUP="GS_CONF" SHOW_IF="BULK_FILE_ALREADY_EXIST=='false'">
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="GS_SECRET_KEY" FIELD="PASSWORD" NUM_ROW="61" REQUIRED="true" GROUP="GS_CONF" SHOW_IF="BULK_FILE_ALREADY_EXIST=='false'">
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="GS_LOCAL_FILE" FIELD="FILE" NUM_ROW="62" REQUIRED="true" GROUP="GS_CONF" SHOW_IF="BULK_FILE_ALREADY_EXIST=='false'">
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="BUCKET_NAME" FIELD="TEXT" NUM_ROW="63" REQUIRED="true" GROUP="GS_CONF" SHOW_IF="BULK_FILE_ALREADY_EXIST=='false'">
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="GS_FILE"
FIELD="TEXT"
NUM_ROW="70"
REQUIRED="true"
GROUP="GS_CONF"
>
<DEFAULT>"gs://"</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="GS_FILE_HEADER"
FIELD="TEXT"
NUM_ROW="71"
REQUIRED="true"
GROUP="GS_CONF"
>
<DEFAULT>0</DEFAULT>
</PARAMETER>
<PARAMETER NAME="DIE_ON_ERROR" FIELD="CHECK" NUM_ROW="80" REQUIRED="true">
<DEFAULT>false</DEFAULT>
</PARAMETER>
</PARAMETERS>
<ADVANCED_PARAMETERS>
<PARAMETER NAME="TOKEN_NAME" FIELD="FILE" NUM_ROW="10"
REQUIRED="true" SHOW_IF="AUTH_MODE == 'OAUTH'">
<DEFAULT>"__COMP_DEFAULT_FILE_DIR__/token.properties"</DEFAULT>
</PARAMETER>
<PARAMETER NAME="SET_FIELD_DELIMITER" FIELD="CHECK" REQUIRED="true" NUM_ROW="20" >
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="FIELD_DELIMITER" FIELD="TEXT" REQUIRED="true" NUM_ROW="20"
SHOW_IF="(SET_FIELD_DELIMITER == 'true')">
<DEFAULT>","</DEFAULT>
</PARAMETER>
<PARAMETER NAME="DROP" FIELD="CHECK" REQUIRED="true" NUM_ROW="25" SHOW_IF="AUTH_MODE == 'SERVICEACCOUNT'">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="ENCODING" FIELD="ENCODING_TYPE" NUM_ROW="30"
REQUIRED="true" REPOSITORY_VALUE="ENCODING">
<DEFAULT>"ISO-8859-15"</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="google-api-client-1.19.0.jar" MODULE="google-api-client-1.19.0.jar" MVN="mvn:org.talend.libraries/google-api-client-1.19.0/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.google/lib/google-api-client-1.19.0.jar" REQUIRED="true" />
<IMPORT NAME="google-api-services-oauth2-v2-rev78-1.19.0.jar" MODULE="google-api-services-oauth2-v2-rev78-1.19.0.jar" MVN="mvn:org.talend.libraries/google-api-services-oauth2-v2-rev78-1.19.0/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.google/lib/google-api-services-oauth2-v2-rev78-1.19.0.jar" REQUIRED="true" />
<IMPORT NAME="google-api-services-bigquery-v2-rev391-1.21.0.jar" MODULE="google-api-services-bigquery-v2-rev391-1.21.0.jar" MVN="mvn:org.talend.libraries/google-api-services-bigquery-v2-rev391-1.21.0/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.google/lib/google-api-services-bigquery-v2-rev391-1.21.0.jar" REQUIRED="true" />
<IMPORT NAME="google-http-client-1.19.0.jar" MODULE="google-http-client-1.19.0.jar" MVN="mvn:org.talend.libraries/google-http-client-1.19.0/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.google/lib/google-http-client-1.19.0.jar" REQUIRED="true" />
<IMPORT NAME="google-oauth-client-1.19.0.jar" MODULE="google-oauth-client-1.19.0.jar" MVN="mvn:org.talend.libraries/google-oauth-client-1.19.0/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.google/lib/google-oauth-client-1.19.0.jar" REQUIRED="true" />
<IMPORT NAME="google-http-client-jackson2-1.19.0.jar" MODULE="google-http-client-jackson2-1.19.0.jar" MVN="mvn:org.talend.libraries/google-http-client-jackson2-1.19.0/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.google/lib/google-http-client-jackson2-1.19.0.jar" REQUIRED="true" />
<IMPORT NAME="guava-jdk5-13.0.jar" MODULE="guava-jdk5-13.0.jar" MVN="mvn:org.talend.libraries/guava-jdk5-13.0/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.guava/lib/guava-jdk5-13.0.jar" REQUIRED="true" />
<IMPORT NAME="jackson-core-2.9.5.jar" MODULE="jackson-core-2.9.5.jar" MVN="mvn:com.fasterxml.jackson.core/jackson-core/2.9.5" REQUIRED="true" />
<!-- REQUIRED FOR GOOGLE STORAGE -->
<IMPORT NAME="jets3t-0.9.1" MODULE="jets3t-0.9.1.jar" MVN="mvn:org.talend.libraries/jets3t-0.9.1/6.0.0" REQUIRED="true" />
<IMPORT NAME="commons-logging-1.1.1" MODULE="commons-logging-1.1.1.jar" MVN="mvn:org.talend.libraries/commons-logging-1.1.1/6.0.0" UrlPath="platform:/base/plugins/org.apache.commons.logging_1.1.1.v201101211721.jar" REQUIRED="true" />
<IMPORT NAME="httpclient-4.5.5" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.apache.httpcomponents/httpclient/4.5.5" REQUIRED="true" />
<IMPORT NAME="httpcore-4.4.9" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.apache.httpcomponents/httpcore/4.4.9" REQUIRED="true" />
<IMPORT NAME="commons-codec-1.4" MODULE="commons-codec-1.4.jar" MVN="mvn:commons-codec/commons-codec/1.4" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.4.jar" REQUIRED="true" />
<IMPORT NAME="google-cloud-bigquery-1.32.0.jar" MODULE="google-cloud-bigquery-1.32.0.jar" MVN="mvn:com.google.cloud/google-cloud-bigquery/1.32.0" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="google-http-client-jackson-1.23.0.jar" MODULE="google-http-client-jackson-1.23.0.jar" MVN="mvn:com.google.http-client/google-http-client-jackson/1.23.0" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="threetenbp-1.3.3.jar" MODULE="threetenbp-1.3.3.jar" MVN="mvn:org.threeten/threetenbp/1.3.3" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="google-auth-library-credentials-0.9.1.jar" MODULE="google-auth-library-credentials-0.9.1.jar" MVN="mvn:com.google.auth/google-auth-library-credentials/0.9.1" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="gax-httpjson-0.44.0.jar" MODULE="gax-httpjson-0.44.0.jar" MVN="mvn:com.google.api/gax-httpjson/0.44.0" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="jackson-core-asl-1.9.11.jar" MODULE="jackson-core-asl-1.9.11.jar" MVN="mvn:org.codehaus.jackson/jackson-core-asl/1.9.11" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="google-auth-library-oauth2-http-0.9.1.jar" MODULE="google-auth-library-oauth2-http-0.9.1.jar" MVN="mvn:com.google.auth/google-auth-library-oauth2-http/0.9.1" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="google-cloud-core-1.32.0.jar" MODULE="google-cloud-core-1.32.0.jar" MVN="mvn:com.google.cloud/google-cloud-core/1.32.0" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="google-cloud-core-http-1.32.0.jar" MODULE="google-cloud-core-http-1.32.0.jar" MVN="mvn:com.google.cloud/google-cloud-core-http/1.32.0" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="guava-20.0.jar" MODULE="guava-20.0.jar" MVN="mvn:com.google.guava/guava/20.0" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="gax-1.27.0.jar" MODULE="gax-1.27.0.jar" MVN="mvn:com.google.api/gax/1.27.0" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="google-http-client-appengine-1.23.0.jar" MODULE="google-http-client-appengine-1.23.0.jar" MVN="mvn:com.google.http-client/google-http-client-appengine/1.23.0" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
<IMPORT NAME="api-common-1.6.0.jar" MODULE="api-common-1.6.0.jar" MVN="mvn:com.google.api/api-common/1.6.0" REQUIRED_IF="AUTH_MODE == 'SERVICEACCOUNT'" />
</IMPORTS>
</CODEGENERATION>
<RETURNS>
</RETURNS>
</COMPONENT>

View File

@@ -62,11 +62,12 @@ class BigQueryUtil_<%=cid%> {
com.google.api.services.bigquery.model.JobConfigurationQuery queryConfig = new com.google.api.services.bigquery.model.JobConfigurationQuery();
queryConfig.setQuery(query);
queryConfig.setUseLegacySql(useLegacySql);
String location = getLocation(queryConfig);
if(useLargeResult){
this.useLargeResult = true;
tempDataset = genTempName("dataset");
tempTable = genTempName("table");
createDataset(getLocation(queryConfig));
createDataset(location);
queryConfig.setAllowLargeResults(true);
queryConfig.setDestinationTable(new com.google.api.services.bigquery.model.TableReference()
.setProjectId(projectId)
@@ -131,7 +132,7 @@ class BigQueryUtil_<%=cid%> {
%>
// wait for query execution
while (true) {
com.google.api.services.bigquery.model.Job pollJob = bigqueryclient.jobs().get(projectId, jobId.getJobId()).execute();
com.google.api.services.bigquery.model.Job pollJob = bigqueryclient.jobs().get(projectId, jobId.getJobId()).setLocation(location).execute();
com.google.api.services.bigquery.model.JobStatus status = pollJob.getStatus();
if (status.getState().equals("DONE")) {
com.google.api.services.bigquery.model.ErrorProto errorProto = status.getErrorResult();

View File

@@ -1,10 +1,10 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.metadata.types.JavaTypesManager
@@ -28,10 +28,11 @@
String authorizationCode = ElementParameterParser.getValue(node,"__AUTHORIZATION_CODE__");
String query = ElementParameterParser.getValue(node,"__QUERY__");
boolean useLegacySql = ElementParameterParser.getBooleanValue(node,"__USE_LEGACY_SQL__");
String resultSizeType = ElementParameterParser.getValue(node,"__RESULT_SIZE__");
query = query.replaceAll("\n"," ");
query = query.replaceAll("\r"," ");
String tokenFile = ElementParameterParser.getValue(node,"__TOKEN_NAME__");
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
if (authMode.equals("OAUTH")) {
@@ -40,22 +41,22 @@
<%
String passwordFieldName = "__CLIENT_SECRET__";
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
final String CLIENT_SECRET_<%=cid%> = "{\"web\": {\"client_id\": \""+<%=clientId%>+"\",\"client_secret\": \"" +decryptedPassword_<%=cid%>+ "\",\"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\"token_uri\": \"https://accounts.google.com/o/oauth2/token\"}}";
final String PROJECT_ID_<%=cid %> = <%=projectId %>;
// Static variables for API scope, callback URI, and HTTP/JSON functions
final List<String> SCOPES_<%=cid%> = java.util.Arrays.asList("https://www.googleapis.com/auth/bigquery");
final String REDIRECT_URI_<%=cid%> = "urn:ietf:wg:oauth:2.0:oob";
final com.google.api.client.http.HttpTransport TRANSPORT_<%=cid %> = new com.google.api.client.http.javanet.NetHttpTransport();
final com.google.api.client.json.JsonFactory JSON_FACTORY_<%=cid %> = new com.google.api.client.json.jackson2.JacksonFactory();
com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets clientSecrets_<%=cid%> = com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets.load(
new com.google.api.client.json.jackson2.JacksonFactory(), new java.io.InputStreamReader(new java.io.ByteArrayInputStream(
CLIENT_SECRET_<%=cid%>.getBytes())));
com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow flow_<%=cid%> = null;
com.google.api.services.bigquery.Bigquery bigqueryclient_<%=cid%> = null;
long nb_line_<%=cid%> = 0;
@@ -68,7 +69,7 @@
<%
}
%>
// Attempt to load existing refresh token
String tokenFile_<%=cid %> = <%=tokenFile%>;
java.util.Properties properties_<%=cid%> = new java.util.Properties();
@@ -94,7 +95,7 @@
%>
}
String storedRefreshToken_<%=cid%> = (String) properties_<%=cid%>.get("refreshtoken");
// Check to see if the an existing refresh token was loaded.
// If so, create a credential and call refreshToken() to get a new
// access token.
@@ -103,7 +104,7 @@
com.google.api.client.googleapis.auth.oauth2.GoogleCredential credential_<%=cid%> = new com.google.api.client.googleapis.auth.oauth2. GoogleCredential.Builder().setTransport(TRANSPORT_<%=cid%>)
.setJsonFactory(JSON_FACTORY_<%=cid%>).setClientSecrets(clientSecrets_<%=cid%>)
.build().setFromTokenResponse(new com.google.api.client.auth.oauth2.TokenResponse().setRefreshToken(storedRefreshToken_<%=cid%>));
credential_<%=cid%>.refreshToken();
<%
if(isLog4jEnabled){
@@ -125,7 +126,7 @@
if(authorizationCode_<%=cid%> == null || "".equals(authorizationCode_<%=cid%>) || "\"\"".equals(authorizationCode_<%=cid%>)) {
String authorizeUrl_<%=cid%> = new com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl(
clientSecrets_<%=cid%>, REDIRECT_URI_<%=cid%>, SCOPES_<%=cid%>).setState("").build();
System.out
.println("Paste this URL into a web browser to authorize BigQuery Access:\n"
+ authorizeUrl_<%=cid%>);
@@ -155,7 +156,7 @@
}
com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse response_<%=cid%> = flow_<%=cid%>.newTokenRequest(authorizationCode_<%=cid%>).setRedirectUri(REDIRECT_URI_<%=cid%>).execute();
com.google.api.client.auth.oauth2.Credential credential_<%=cid%> = flow_<%=cid%>.createAndStoreCredential(response_<%=cid%>, null);
<%
if(isLog4jEnabled){
%>
@@ -171,17 +172,13 @@
if (outputStream_<%=cid%> != null) {
outputStream_<%=cid%>.close();
}
bigqueryclient_<%=cid%> = new com.google.api.services.bigquery.Bigquery.Builder(new com.google.api.client.http.javanet.NetHttpTransport(),new com.google.api.client.json.jackson2.JacksonFactory(),credential_<%=cid%>).build();
}
}
<%
String resultSizeType = ElementParameterParser.getValue(node,"__RESULT_SIZE__");
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/tBigQueryInput/BigQueryInputQueryHelper.javajet"%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/tBigQueryInput/BigQueryInputQueryHelper.javajet"%>
// Start a Query Job
String querySql_<%=cid %> = <%=query %>;
System.out.format("Running Query : %s\n", querySql_<%=cid %>);
@@ -192,18 +189,17 @@
<%
}
%>
BigQueryUtil_<%=cid%> bigQueryUtil_<%=cid%> = new BigQueryUtil_<%=cid%>(PROJECT_ID_<%=cid%>, bigqueryclient_<%=cid%>, tokenFile_<%=cid%>);
<%
if(isLog4jEnabled){
%>
log.info("<%=cid%> - Try <%="LARGE".equals(resultSizeType) ? "with" : "without"%> allow large results flag");
log.info("<%=cid%> - Try <%="LARGE".equals(resultSizeType) ? "with" : "without"%> the allowLargeResults flag");
<%
}
%>
com.google.api.services.bigquery.model.Job insert_<%=cid %> = bigQueryUtil_<%=cid%>.executeQuery(querySql_<%=cid%>, <%="LARGE".equals(resultSizeType) ? true : false%>, <%=useLegacySql%>);
<%
if(isLog4jEnabled){
%>
@@ -221,15 +217,30 @@
credentials_<%=cid%> = com.google.auth.oauth2.ServiceAccountCredentials.fromStream(credentialsStream_<%=cid%>);
}
String query_<%=cid%> = <%=query%>;
String dataset = query_<%=cid%>.substring(query_<%=cid%>.indexOf("from") + 4, query_<%=cid%>.indexOf(".")).trim();
String temp_table = "temp_" + dataset + java.util.UUID.randomUUID().toString().replaceAll("-", "")
+ "<%=cid%>".toLowerCase().replaceAll("[^a-z0-9]", "0").replaceAll("^[^a-z]", "a")
+ Integer.toHexString(java.util.concurrent.ThreadLocalRandom.current().nextInt());
com.google.cloud.bigquery.BigQuery bigquery_<%=cid%> = com.google.cloud.bigquery.BigQueryOptions.newBuilder()
.setCredentials(credentials_<%=cid%>)
.setProjectId(<%=projectId%>)
.build()
.getService();
com.google.cloud.bigquery.QueryJobConfiguration queryConfiguration_<%=cid%> = com.google.cloud.bigquery.QueryJobConfiguration.newBuilder(<%=query%>).setUseLegacySql(<%=useLegacySql%>).build();
com.google.cloud.bigquery.JobId jobId_tBigQueryInput_1 = com.google.cloud.bigquery.JobId.of(java.util.UUID.randomUUID().toString());
com.google.cloud.bigquery.Job job_<%=cid%> = bigquery_<%=cid%>.create(com.google.cloud.bigquery.JobInfo.newBuilder(queryConfiguration_<%=cid%>).setJobId(jobId_<%=cid%>).build());
com.google.cloud.bigquery.QueryJobConfiguration.Builder queryConfiguration_<%=cid%> = com.google.cloud.bigquery.QueryJobConfiguration.newBuilder(<%=query%>).setUseLegacySql(<%=useLegacySql%>);
<%
if (resultSizeType.equals("LARGE") || resultSizeType.equals("AUTO")) {
%>
queryConfiguration_<%=cid%>.setDestinationTable(com.google.cloud.bigquery.TableId.of(dataset, temp_table)).setAllowLargeResults(true);
<%
}
%>
com.google.cloud.bigquery.JobId jobId_<%=cid%> = com.google.cloud.bigquery.JobId.of(java.util.UUID.randomUUID().toString());
com.google.cloud.bigquery.Job job_<%=cid%> = bigquery_<%=cid%>.create(com.google.cloud.bigquery.JobInfo.newBuilder(queryConfiguration_<%=cid%>.build()).setJobId(jobId_<%=cid%>).build());
<%
if(isLog4jEnabled){
@@ -245,7 +256,6 @@
} else if (job_<%=cid%>.getStatus().getError() != null) {
throw new RuntimeException(job_<%=cid%>.getStatus().getError().toString());
}
<%
if(isLog4jEnabled){
%>
@@ -253,16 +263,14 @@
<%
}
%>
com.google.cloud.bigquery.TableResult result_<%=cid%> = job_<%=cid%>.getQueryResults();
long nb_line_<%=cid%> = 0;
<%
} else {
throw new IllegalArgumentException("authentication mode should be either \"SERVICEACCOUNT\" or \"OAUTH\", but it is " + authMode);
}
if (authMode.equals("OAUTH")) {
%>
while (true) {
@@ -274,14 +282,13 @@
insert_<%=cid %>.getConfiguration().getQuery()
.getDestinationTable().getTableId())
.setPageToken(pageToken_<%=cid%>).execute();
List<com.google.api.services.bigquery.model.TableRow> rows_<%=cid %> = dataList_<%=cid %>.getRows();
List<com.google.api.services.bigquery.model.TableRow> rows_<%=cid %> = dataList_<%=cid %>.getRows();
if(rows_<%=cid %> == null) {
// Means there is no record.
rows_<%=cid %> = new java.util.ArrayList<com.google.api.services.bigquery.model.TableRow>();
}
for (com.google.api.services.bigquery.model.TableRow row_<%=cid %> : rows_<%=cid %>) {
java.util.List<com.google.api.services.bigquery.model.TableCell> field_<%=cid %> = row_<%=cid %>.getF();
Object value_<%=cid%> = null;
@@ -311,16 +318,14 @@
boolean advancedSeparator = (advancedSeparatorStr!=null&&!("").equals(advancedSeparatorStr))?("true").equals(advancedSeparatorStr):false;
String thousandsSeparator = ElementParameterParser.getValueWithJavaType(node, "__THOUSANDS_SEPARATOR__", JavaTypesManager.CHARACTER);
String decimalSeparator = ElementParameterParser.getValueWithJavaType(node, "__DECIMAL_SEPARATOR__", JavaTypesManager.CHARACTER);
List<IMetadataColumn> columns = metadata.getListColumns();
int nbColumns = columns.size();
for (int i = 0; i < nbColumns; i++ ) {
IMetadataColumn column = columns.get(i);
String columnName = column.getLabel();
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getTalendType(), column.isNullable());
JavaType javaType = JavaTypesManager.getJavaTypeFromId(column.getTalendType());
String patternValue = column.getPattern() == null || column.getPattern().trim().length() == 0 ? null : column.getPattern();
String patternValue = column.getPattern() == null || column.getPattern().trim().length() == 0 ? null : column.getPattern();
if (authMode.equals("OAUTH")) {
%>
value_<%=cid%> = field_<%=cid %>.get(<%=i%>).getV();
@@ -334,27 +339,34 @@
}
%>
if(com.google.api.client.util.Data.isNull(value_<%=cid%>)) value_<%=cid%> = null;
if(value_<%=cid%> != null){
<%
if (javaType == JavaTypesManager.STRING) {
%>
<%=connName%>.<%=columnName%> = value_<%=cid%>.toString();
<%
} else if (javaType == JavaTypesManager.OBJECT) {
%>
%>
<%=connName%>.<%=columnName%> = value_<%=cid%>;
<%
} else if(javaType == JavaTypesManager.DATE) {
%>
<%=connName%>.<%=columnName%> = ParserUtils.parseTo_Date(value_<%=cid%>.toString());
<%
} else if(advancedSeparator && JavaTypesManager.isNumberType(javaType)) {
<%
} else if(javaType == JavaTypesManager.DATE) {
%>
if (value_<%=cid%>.toString().contains("-")) {
<%=connName%>.<%=columnName%> = ParserUtils.parseTo_Date(value_<%=cid%>.toString(),<%=patternValue%>);
} else {
<%=connName%>.<%=columnName%> = ParserUtils.parseTo_Date(value_<%=cid%>.toString());
}
<%
} else if(advancedSeparator && JavaTypesManager.isNumberType(javaType)) {
%>
<%=connName%>.<%=columnName%> = ParserUtils.parseTo_<%= typeToGenerate %>(ParserUtils.parseTo_Number(value_<%=cid%>.toString(), <%= thousandsSeparator %>, <%= decimalSeparator %>));
<%
} else if(javaType == JavaTypesManager.BYTE_ARRAY) {
%>
} else if(javaType == JavaTypesManager.BYTE_ARRAY) {
%>
<%=connName%>.<%=columnName%> = value_<%=cid%>.toString().getBytes(<%=encoding %>);
<%
} else {

View File

@@ -1,311 +1,310 @@
<COMPONENT>
<HEADER
PLATEFORM="ALL"
SERIAL=""
VERSION="0.102"
STATUS="ALPHA"
COMPATIBILITY="ALL"
AUTHOR="Talend"
RELEASE_DATE="20050320A"
STARTABLE="false"
PARTITIONING="NONE"
>
<SIGNATURE/>
</HEADER>
<FAMILIES>
<FAMILY>Big Data/Google BigQuery</FAMILY>
</FAMILIES>
<DOCUMENTATION>
<URL/>
</DOCUMENTATION>
<CONNECTORS>
<CONNECTOR CTYPE="FLOW" MAX_INPUT="1" MAX_OUTPUT="0"/>
<CONNECTOR CTYPE="ITERATE" MAX_OUTPUT="1" MAX_INPUT="1"/>
<CONNECTOR CTYPE="SUBJOB_OK" MAX_INPUT="1" />
<CONNECTOR CTYPE="SUBJOB_ERROR" MAX_INPUT="1" />
<CONNECTOR CTYPE="COMPONENT_OK"/>
<CONNECTOR CTYPE="COMPONENT_ERROR"/>
<CONNECTOR CTYPE="RUN_IF"/>
</CONNECTORS>
<PARAMETERS>
<PARAMETER NAME="PROPERTY" FIELD="PROPERTY_TYPE" SHOW="true" NUM_ROW="10" REPOSITORY_VALUE="DELIMITED" />
<PARAMETER NAME="FILENAME" FIELD="FILE" NUM_ROW="11" REQUIRED="true" REPOSITORY_VALUE="FILE_PATH">
<DEFAULT>"__COMP_DEFAULT_FILE_DIR__/biquery_bulk.txt"</DEFAULT>
</PARAMETER>
<PARAMETER NAME="APPEND" FIELD="CHECK" REQUIRED="true" NUM_ROW="12" REPOSITORY_VALUE="APPEND">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="SCHEMA" FIELD="SCHEMA_TYPE" REQUIRED="true" NUM_ROW="13">
<DEFAULT/>
</PARAMETER>
<PARAMETER NAME="AUTH_MODE" FIELD="CLOSED_LIST" NUM_ROW="15" REQUIRED="true" GROUP="AUTHENTICATION" REPOSITORY_VALUE="AUTH_MODE">
<ITEMS DEFAULT="SERVICEACCOUNT">
<ITEM NAME="SERVICEACCOUNT" VALUE="SERVICEACCOUNT" />
<ITEM NAME="OAUTH" VALUE="OAUTH" />
</ITEMS>
</PARAMETER>
<PARAMETER
NAME="SERVICE_ACCOUNT_CREDENTIALS_FILE"
REPOSITORY_VALUE="SERVICE_ACCOUNT_CREDENTIALS_FILE"
FIELD="FILE"
NUM_ROW="18"
REQUIRED="true"
SHOW_IF="AUTH_MODE == 'SERVICEACCOUNT'"
GROUP="AUTHENTICATION"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="CLIENT_ID"
FIELD="TEXT"
NUM_ROW="20"
REQUIRED="true"
SHOW_IF="AUTH_MODE == 'OAUTH'"
GROUP="AUTHENTICATION"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="CLIENT_SECRET"
FIELD="PASSWORD"
NUM_ROW="21"
REQUIRED="true"
SHOW_IF="AUTH_MODE == 'OAUTH'"
GROUP="AUTHENTICATION"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="AUTHORIZATION_CODE"
FIELD="TEXT"
NUM_ROW="30"
REQUIRED="true"
SHOW_IF="AUTH_MODE == 'OAUTH'"
GROUP="AUTHENTICATION"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="PROJECT_ID"
FIELD="TEXT"
NUM_ROW="40"
REQUIRED="true"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="DATASET"
FIELD="TEXT"
NUM_ROW="49"
REQUIRED="true"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="TABLE"
FIELD="TEXT"
NUM_ROW="50"
REQUIRED="true"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="CREATE_TABLE_IF_NOT_EXIST" FIELD="CHECK" NUM_ROW="50" REQUIRED="true" SHOW_IF="AUTH_MODE == 'OAUTH'">
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="ACTION_ON_DATA"
SHOW_IF="AUTH_MODE == 'OAUTH'"
FIELD="CLOSED_LIST"
NUM_ROW="51"
REQUIRED="true"
>
<ITEMS DEFAULT="TRUNCATE">
<ITEM NAME="TRUNCATE" VALUE="TRUNCATE" />
<ITEM NAME="APPEND" VALUE="APPEND" />
<ITEM NAME="EMPTY" VALUE="EMPTY" />
</ITEMS>
</PARAMETER>
<PARAMETER NAME="BULK_FILE_ALREADY_EXIST" FIELD="CHECK" NUM_ROW="59" REQUIRED="true" SHOW="false">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="GS_ACCESS_KEY" FIELD="TEXT" NUM_ROW="60" REQUIRED="true" GROUP="GS_CONF" SHOW_IF="BULK_FILE_ALREADY_EXIST=='false'">
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="GS_SECRET_KEY" FIELD="PASSWORD" NUM_ROW="61" REQUIRED="true" GROUP="GS_CONF" SHOW_IF="BULK_FILE_ALREADY_EXIST=='false'">
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="BUCKET_NAME" FIELD="TEXT" NUM_ROW="63" REQUIRED="true" GROUP="GS_CONF" SHOW_IF="BULK_FILE_ALREADY_EXIST=='false'">
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="GS_FILE"
FIELD="TEXT"
NUM_ROW="70"
REQUIRED="true"
GROUP="GS_CONF"
>
<DEFAULT>"gs://"</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="GS_FILE_HEADER"
FIELD="TEXT"
NUM_ROW="71"
REQUIRED="true"
GROUP="GS_CONF"
>
<DEFAULT>0</DEFAULT>
</PARAMETER>
<PARAMETER NAME="DIE_ON_ERROR" FIELD="CHECK" NUM_ROW="80" REQUIRED="true">
<DEFAULT>false</DEFAULT>
</PARAMETER>
</PARAMETERS>
<ADVANCED_PARAMETERS>
<PARAMETER NAME="TOKEN_NAME" FIELD="FILE" NUM_ROW="10"
REQUIRED="true" SHOW_IF="AUTH_MODE == 'OAUTH'">
<DEFAULT>"__COMP_DEFAULT_FILE_DIR__/token.properties"</DEFAULT>
</PARAMETER>
<PARAMETER NAME="SET_FIELD_DELIMITER" FIELD="CHECK" REQUIRED="true" NUM_ROW="20" SHOW="false">
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER NAME="FIELD_DELIMITER" FIELD="TEXT" REQUIRED="true" NUM_ROW="20"
SHOW="false">
<DEFAULT>","</DEFAULT>
</PARAMETER>
<PARAMETER NAME="ROWSEPARATOR" FIELD="TEXT" REQUIRED="true" NUM_ROW="30" REPOSITORY_VALUE="ROW_SEPARATOR" SHOW="false">
<DEFAULT>"\n"</DEFAULT>
</PARAMETER>
<PARAMETER NAME="FIELDSEPARATOR" FIELD="TEXT" REQUIRED="true" NUM_ROW="30" REPOSITORY_VALUE="FIELD_SEPARATOR">
<DEFAULT>","</DEFAULT>
</PARAMETER>
<PARAMETER NAME="DROP" FIELD="CHECK" REQUIRED="true" NUM_ROW="33" SHOW_IF="AUTH_MODE == 'SERVICEACCOUNT'">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="ESCAPE_CHAR" FIELD="TEXT" REQUIRED="true" NUM_ROW="30" MAX_LENGTH="1" REPOSITORY_VALUE="ESCAPE_CHAR" SHOW="false">
<DEFAULT>"\\"</DEFAULT>
</PARAMETER>
<PARAMETER NAME="TEXT_ENCLOSURE" FIELD="TEXT" REQUIRED="true" NUM_ROW="30" MAX_LENGTH="1" REPOSITORY_VALUE="TEXT_ENCLOSURE" SHOW="false">
<DEFAULT>"\""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="CREATE" FIELD="CHECK" REQUIRED="true" NUM_ROW="40">
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER NAME="FLUSHONROW" FIELD="CHECK" REQUIRED="true" NUM_ROW="45">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="FLUSHONROW_NUM"
FIELD="TEXT"
REQUIRED="true"
NUM_ROW="45"
SHOW_IF="FLUSHONROW == 'true'"
>
<DEFAULT>1</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="RECORDS_CONTAIN_NULL_VALUE"
FIELD="CHECK"
SHOW="false"
NUM_ROW="50"
>
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="CHECK_DISK_SPACE"
FIELD="CHECK"
SHOW="true"
NUM_ROW="50"
>
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="ENCODING" FIELD="ENCODING_TYPE" NUM_ROW="60" REQUIRED="true" REPOSITORY_VALUE="ENCODING">
<DEFAULT>"ISO-8859-15"</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
<TEMPLATES INPUT="tBQOB" OUTPUT="tBQBE">
<TEMPLATE NAME="tBQOB" COMPONENT="tBigQueryOutputBulk">
<LINK_TO NAME="tBQBE" CTYPE="ROWS_END"/>
</TEMPLATE>
<TEMPLATE NAME="tBQBE" COMPONENT="tBigQueryBulkExec"/>
<TEMPLATE_PARAM SOURCE="self.AUTH_MODE" TARGET="tBQBE.AUTH_MODE" />
<TEMPLATE_PARAM SOURCE="self.SERVICE_ACCOUNT_CREDENTIALS_FILE" TARGET="tBQBE.SERVICE_ACCOUNT_CREDENTIALS_FILE" />
<TEMPLATE_PARAM SOURCE="self.CLIENT_ID" TARGET="tBQBE.CLIENT_ID" />
<TEMPLATE_PARAM SOURCE="self.CLIENT_SECRET" TARGET="tBQBE.CLIENT_SECRET" />
<TEMPLATE_PARAM SOURCE="self.PROJECT_ID" TARGET="tBQBE.PROJECT_ID" />
<TEMPLATE_PARAM SOURCE="self.AUTHORIZATION_CODE" TARGET="tBQBE.AUTHORIZATION_CODE"/>
<TEMPLATE_PARAM SOURCE="self.DATASET" TARGET="tBQBE.DATASET" />
<TEMPLATE_PARAM SOURCE="self.TABLE" TARGET="tBQBE.TABLE" />
<TEMPLATE_PARAM SOURCE="self.CREATE_TABLE_IF_NOT_EXIST" TARGET="tBQBE.CREATE_TABLE_IF_NOT_EXIST" />
<TEMPLATE_PARAM SOURCE="self.ACTION_ON_DATA" TARGET="tBQBE.ACTION_ON_DATA" />
<TEMPLATE_PARAM SOURCE="self.GS_ACCESS_KEY" TARGET="tBQBE.GS_ACCESS_KEY" />
<TEMPLATE_PARAM SOURCE="self.GS_SECRET_KEY" TARGET="tBQBE.GS_SECRET_KEY" />
<TEMPLATE_PARAM SOURCE="self.BUCKET_NAME" TARGET="tBQBE.BUCKET_NAME" />
<TEMPLATE_PARAM SOURCE="self.GS_FILE" TARGET="tBQBE.GS_FILE" />
<TEMPLATE_PARAM SOURCE="self.GS_FILE_HEADER" TARGET="tBQBE.GS_FILE_HEADER" />
<TEMPLATE_PARAM SOURCE="self.TOKEN_NAME" TARGET="tBQBE.TOKEN_NAME" />
<TEMPLATE_PARAM SOURCE="self.SET_FIELD_DELIMITER" TARGET="tBQBE.SET_FIELD_DELIMITER" />
<TEMPLATE_PARAM SOURCE="self.FIELDSEPARATOR" TARGET="tBQBE.FIELD_DELIMITER" />
<TEMPLATE_PARAM SOURCE="self.BULK_ALREADY_EXIST" TARGET="tBQBE.BULK_ALREADY_EXIST" />
<TEMPLATE_PARAM SOURCE="self.DIE_ON_ERROR" TARGET="tBQBE.DIE_ON_ERROR" />
<TEMPLATE_PARAM SOURCE="self.FILENAME" TARGET="tBQOB.FILENAME" />
<TEMPLATE_PARAM SOURCE="self.FILENAME" TARGET="tBQBE.GS_LOCAL_FILE" />
<TEMPLATE_PARAM SOURCE="self.ROWSEPARATOR" TARGET="tBQOB.ROWSEPARATOR" />
<TEMPLATE_PARAM SOURCE="self.FIELDSEPARATOR" TARGET="tBQOB.FIELDSEPARATOR" />
<TEMPLATE_PARAM SOURCE="self.DROP" TARGET="tBQBE.DROP" />
<TEMPLATE_PARAM SOURCE="self.ESCAPE_CHAR" TARGET="tBQOB.ESCAPE_CHAR" />
<TEMPLATE_PARAM SOURCE="self.TEXT_ENCLOSURE" TARGET="tBQOB.TEXT_ENCLOSURE" />
<TEMPLATE_PARAM SOURCE="self.SCHEMA" TARGET="tBQOB.SCHEMA" />
<TEMPLATE_PARAM SOURCE="self.SCHEMA" TARGET="tBQBE.SCHEMA" />
<TEMPLATE_PARAM SOURCE="self.ENCODING" TARGET="tBQOB.ENCODING" />
<TEMPLATE_PARAM SOURCE="self.ENCODING" TARGET="tBQBE.ENCODING" />
<TEMPLATE_PARAM SOURCE="self.RECORDS_CONTAIN_NULL_VALUE" TARGET="tBQOB.RECORDS_CONTAIN_NULL_VALUE" />
<TEMPLATE_PARAM SOURCE="self.APPEND" TARGET="tBQOB.APPEND" />
<TEMPLATE_PARAM SOURCE="self.CREATE" TARGET="tBQOB.CREATE" />
<TEMPLATE_PARAM SOURCE="self.FLUSHONROW" TARGET="tBQOB.FLUSHONROW" />
<TEMPLATE_PARAM SOURCE="self.FLUSHONROW_NUM" TARGET="tBQOB.FLUSHONROW_NUM" />
<TEMPLATE_PARAM SOURCE="self.DATA_ACTION" TARGET="tBQBE.DATA_ACTION" />
</TEMPLATES>
</CODEGENERATION>
<RETURNS/>
</COMPONENT>
<COMPONENT>
<HEADER
PLATEFORM="ALL"
SERIAL=""
VERSION="0.102"
STATUS="ALPHA"
COMPATIBILITY="ALL"
AUTHOR="Talend"
RELEASE_DATE="20050320A"
STARTABLE="false"
PARTITIONING="NONE"
>
<SIGNATURE/>
</HEADER>
<FAMILIES>
<FAMILY>Big Data/Google BigQuery</FAMILY>
</FAMILIES>
<DOCUMENTATION>
<URL/>
</DOCUMENTATION>
<CONNECTORS>
<CONNECTOR CTYPE="FLOW" MAX_INPUT="1" MAX_OUTPUT="0"/>
<CONNECTOR CTYPE="ITERATE" MAX_OUTPUT="1" MAX_INPUT="1"/>
<CONNECTOR CTYPE="SUBJOB_OK" MAX_INPUT="1" />
<CONNECTOR CTYPE="SUBJOB_ERROR" MAX_INPUT="1" />
<CONNECTOR CTYPE="COMPONENT_OK"/>
<CONNECTOR CTYPE="COMPONENT_ERROR"/>
<CONNECTOR CTYPE="RUN_IF"/>
</CONNECTORS>
<PARAMETERS>
<PARAMETER NAME="PROPERTY" FIELD="PROPERTY_TYPE" SHOW="true" NUM_ROW="10" REPOSITORY_VALUE="DELIMITED" />
<PARAMETER NAME="FILENAME" FIELD="FILE" NUM_ROW="11" REQUIRED="true" REPOSITORY_VALUE="FILE_PATH">
<DEFAULT>"__COMP_DEFAULT_FILE_DIR__/biquery_bulk.txt"</DEFAULT>
</PARAMETER>
<PARAMETER NAME="APPEND" FIELD="CHECK" REQUIRED="true" NUM_ROW="12" REPOSITORY_VALUE="APPEND">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="SCHEMA" FIELD="SCHEMA_TYPE" REQUIRED="true" NUM_ROW="13">
<DEFAULT/>
</PARAMETER>
<PARAMETER NAME="AUTH_MODE" FIELD="CLOSED_LIST" NUM_ROW="15" REQUIRED="true" GROUP="AUTHENTICATION" REPOSITORY_VALUE="AUTH_MODE">
<ITEMS DEFAULT="SERVICEACCOUNT">
<ITEM NAME="SERVICEACCOUNT" VALUE="SERVICEACCOUNT" />
<ITEM NAME="OAUTH" VALUE="OAUTH" />
</ITEMS>
</PARAMETER>
<PARAMETER
NAME="SERVICE_ACCOUNT_CREDENTIALS_FILE"
REPOSITORY_VALUE="SERVICE_ACCOUNT_CREDENTIALS_FILE"
FIELD="FILE"
NUM_ROW="18"
REQUIRED="true"
SHOW_IF="AUTH_MODE == 'SERVICEACCOUNT'"
GROUP="AUTHENTICATION"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="CLIENT_ID"
FIELD="TEXT"
NUM_ROW="20"
REQUIRED="true"
SHOW_IF="AUTH_MODE == 'OAUTH'"
GROUP="AUTHENTICATION"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="CLIENT_SECRET"
FIELD="PASSWORD"
NUM_ROW="21"
REQUIRED="true"
SHOW_IF="AUTH_MODE == 'OAUTH'"
GROUP="AUTHENTICATION"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="AUTHORIZATION_CODE"
FIELD="TEXT"
NUM_ROW="30"
REQUIRED="true"
SHOW_IF="AUTH_MODE == 'OAUTH'"
GROUP="AUTHENTICATION"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="PROJECT_ID"
FIELD="TEXT"
NUM_ROW="40"
REQUIRED="true"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="DATASET"
FIELD="TEXT"
NUM_ROW="49"
REQUIRED="true"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="TABLE"
FIELD="TEXT"
NUM_ROW="50"
REQUIRED="true"
>
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="CREATE_TABLE_IF_NOT_EXIST" FIELD="CHECK" NUM_ROW="50" REQUIRED="true">
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="ACTION_ON_DATA"
FIELD="CLOSED_LIST"
NUM_ROW="51"
REQUIRED="true"
>
<ITEMS DEFAULT="TRUNCATE">
<ITEM NAME="TRUNCATE" VALUE="TRUNCATE" />
<ITEM NAME="APPEND" VALUE="APPEND" />
<ITEM NAME="EMPTY" VALUE="EMPTY" />
</ITEMS>
</PARAMETER>
<PARAMETER NAME="BULK_FILE_ALREADY_EXIST" FIELD="CHECK" NUM_ROW="59" REQUIRED="true" SHOW="false">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="GS_ACCESS_KEY" FIELD="TEXT" NUM_ROW="60" REQUIRED="true" GROUP="GS_CONF" SHOW_IF="BULK_FILE_ALREADY_EXIST=='false'">
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="GS_SECRET_KEY" FIELD="PASSWORD" NUM_ROW="61" REQUIRED="true" GROUP="GS_CONF" SHOW_IF="BULK_FILE_ALREADY_EXIST=='false'">
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="BUCKET_NAME" FIELD="TEXT" NUM_ROW="63" REQUIRED="true" GROUP="GS_CONF" SHOW_IF="BULK_FILE_ALREADY_EXIST=='false'">
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="GS_FILE"
FIELD="TEXT"
NUM_ROW="70"
REQUIRED="true"
GROUP="GS_CONF"
>
<DEFAULT>"gs://"</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="GS_FILE_HEADER"
FIELD="TEXT"
NUM_ROW="71"
REQUIRED="true"
GROUP="GS_CONF"
>
<DEFAULT>0</DEFAULT>
</PARAMETER>
<PARAMETER NAME="DIE_ON_ERROR" FIELD="CHECK" NUM_ROW="80" REQUIRED="true">
<DEFAULT>false</DEFAULT>
</PARAMETER>
</PARAMETERS>
<ADVANCED_PARAMETERS>
<PARAMETER NAME="TOKEN_NAME" FIELD="FILE" NUM_ROW="10"
REQUIRED="true" SHOW_IF="AUTH_MODE == 'OAUTH'">
<DEFAULT>"__COMP_DEFAULT_FILE_DIR__/token.properties"</DEFAULT>
</PARAMETER>
<PARAMETER NAME="SET_FIELD_DELIMITER" FIELD="CHECK" REQUIRED="true" NUM_ROW="20" SHOW="false">
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER NAME="FIELD_DELIMITER" FIELD="TEXT" REQUIRED="true" NUM_ROW="20"
SHOW="false">
<DEFAULT>","</DEFAULT>
</PARAMETER>
<PARAMETER NAME="ROWSEPARATOR" FIELD="TEXT" REQUIRED="true" NUM_ROW="30" REPOSITORY_VALUE="ROW_SEPARATOR" SHOW="false">
<DEFAULT>"\n"</DEFAULT>
</PARAMETER>
<PARAMETER NAME="FIELDSEPARATOR" FIELD="TEXT" REQUIRED="true" NUM_ROW="30" REPOSITORY_VALUE="FIELD_SEPARATOR">
<DEFAULT>","</DEFAULT>
</PARAMETER>
<PARAMETER NAME="DROP" FIELD="CHECK" REQUIRED="true" NUM_ROW="33" SHOW_IF="AUTH_MODE == 'SERVICEACCOUNT'">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="ESCAPE_CHAR" FIELD="TEXT" REQUIRED="true" NUM_ROW="30" MAX_LENGTH="1" REPOSITORY_VALUE="ESCAPE_CHAR" SHOW="false">
<DEFAULT>"\\"</DEFAULT>
</PARAMETER>
<PARAMETER NAME="TEXT_ENCLOSURE" FIELD="TEXT" REQUIRED="true" NUM_ROW="30" MAX_LENGTH="1" REPOSITORY_VALUE="TEXT_ENCLOSURE" SHOW="false">
<DEFAULT>"\""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="CREATE" FIELD="CHECK" REQUIRED="true" NUM_ROW="40">
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER NAME="FLUSHONROW" FIELD="CHECK" REQUIRED="true" NUM_ROW="45">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="FLUSHONROW_NUM"
FIELD="TEXT"
REQUIRED="true"
NUM_ROW="45"
SHOW_IF="FLUSHONROW == 'true'"
>
<DEFAULT>1</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="RECORDS_CONTAIN_NULL_VALUE"
FIELD="CHECK"
SHOW="false"
NUM_ROW="50"
>
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="CHECK_DISK_SPACE"
FIELD="CHECK"
SHOW="true"
NUM_ROW="50"
>
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="ENCODING" FIELD="ENCODING_TYPE" NUM_ROW="60" REQUIRED="true" REPOSITORY_VALUE="ENCODING">
<DEFAULT>"ISO-8859-15"</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
<TEMPLATES INPUT="tBQOB" OUTPUT="tBQBE">
<TEMPLATE NAME="tBQOB" COMPONENT="tBigQueryOutputBulk">
<LINK_TO NAME="tBQBE" CTYPE="ROWS_END"/>
</TEMPLATE>
<TEMPLATE NAME="tBQBE" COMPONENT="tBigQueryBulkExec"/>
<TEMPLATE_PARAM SOURCE="self.AUTH_MODE" TARGET="tBQBE.AUTH_MODE" />
<TEMPLATE_PARAM SOURCE="self.SERVICE_ACCOUNT_CREDENTIALS_FILE" TARGET="tBQBE.SERVICE_ACCOUNT_CREDENTIALS_FILE" />
<TEMPLATE_PARAM SOURCE="self.CLIENT_ID" TARGET="tBQBE.CLIENT_ID" />
<TEMPLATE_PARAM SOURCE="self.CLIENT_SECRET" TARGET="tBQBE.CLIENT_SECRET" />
<TEMPLATE_PARAM SOURCE="self.PROJECT_ID" TARGET="tBQBE.PROJECT_ID" />
<TEMPLATE_PARAM SOURCE="self.AUTHORIZATION_CODE" TARGET="tBQBE.AUTHORIZATION_CODE"/>
<TEMPLATE_PARAM SOURCE="self.DATASET" TARGET="tBQBE.DATASET" />
<TEMPLATE_PARAM SOURCE="self.TABLE" TARGET="tBQBE.TABLE" />
<TEMPLATE_PARAM SOURCE="self.CREATE_TABLE_IF_NOT_EXIST" TARGET="tBQBE.CREATE_TABLE_IF_NOT_EXIST" />
<TEMPLATE_PARAM SOURCE="self.ACTION_ON_DATA" TARGET="tBQBE.ACTION_ON_DATA" />
<TEMPLATE_PARAM SOURCE="self.GS_ACCESS_KEY" TARGET="tBQBE.GS_ACCESS_KEY" />
<TEMPLATE_PARAM SOURCE="self.GS_SECRET_KEY" TARGET="tBQBE.GS_SECRET_KEY" />
<TEMPLATE_PARAM SOURCE="self.BUCKET_NAME" TARGET="tBQBE.BUCKET_NAME" />
<TEMPLATE_PARAM SOURCE="self.GS_FILE" TARGET="tBQBE.GS_FILE" />
<TEMPLATE_PARAM SOURCE="self.GS_FILE_HEADER" TARGET="tBQBE.GS_FILE_HEADER" />
<TEMPLATE_PARAM SOURCE="self.TOKEN_NAME" TARGET="tBQBE.TOKEN_NAME" />
<TEMPLATE_PARAM SOURCE="self.SET_FIELD_DELIMITER" TARGET="tBQBE.SET_FIELD_DELIMITER" />
<TEMPLATE_PARAM SOURCE="self.FIELDSEPARATOR" TARGET="tBQBE.FIELD_DELIMITER" />
<TEMPLATE_PARAM SOURCE="self.BULK_ALREADY_EXIST" TARGET="tBQBE.BULK_ALREADY_EXIST" />
<TEMPLATE_PARAM SOURCE="self.DIE_ON_ERROR" TARGET="tBQBE.DIE_ON_ERROR" />
<TEMPLATE_PARAM SOURCE="self.FILENAME" TARGET="tBQOB.FILENAME" />
<TEMPLATE_PARAM SOURCE="self.FILENAME" TARGET="tBQBE.GS_LOCAL_FILE" />
<TEMPLATE_PARAM SOURCE="self.ROWSEPARATOR" TARGET="tBQOB.ROWSEPARATOR" />
<TEMPLATE_PARAM SOURCE="self.FIELDSEPARATOR" TARGET="tBQOB.FIELDSEPARATOR" />
<TEMPLATE_PARAM SOURCE="self.DROP" TARGET="tBQBE.DROP" />
<TEMPLATE_PARAM SOURCE="self.ESCAPE_CHAR" TARGET="tBQOB.ESCAPE_CHAR" />
<TEMPLATE_PARAM SOURCE="self.TEXT_ENCLOSURE" TARGET="tBQOB.TEXT_ENCLOSURE" />
<TEMPLATE_PARAM SOURCE="self.SCHEMA" TARGET="tBQOB.SCHEMA" />
<TEMPLATE_PARAM SOURCE="self.SCHEMA" TARGET="tBQBE.SCHEMA" />
<TEMPLATE_PARAM SOURCE="self.ENCODING" TARGET="tBQOB.ENCODING" />
<TEMPLATE_PARAM SOURCE="self.ENCODING" TARGET="tBQBE.ENCODING" />
<TEMPLATE_PARAM SOURCE="self.RECORDS_CONTAIN_NULL_VALUE" TARGET="tBQOB.RECORDS_CONTAIN_NULL_VALUE" />
<TEMPLATE_PARAM SOURCE="self.APPEND" TARGET="tBQOB.APPEND" />
<TEMPLATE_PARAM SOURCE="self.CREATE" TARGET="tBQOB.CREATE" />
<TEMPLATE_PARAM SOURCE="self.FLUSHONROW" TARGET="tBQOB.FLUSHONROW" />
<TEMPLATE_PARAM SOURCE="self.FLUSHONROW_NUM" TARGET="tBQOB.FLUSHONROW_NUM" />
<TEMPLATE_PARAM SOURCE="self.DATA_ACTION" TARGET="tBQBE.DATA_ACTION" />
</TEMPLATES>
</CODEGENERATION>
<RETURNS/>
</COMPONENT>

View File

@@ -43,10 +43,8 @@
JavaType javaType = JavaTypesManager.getJavaTypeFromId(column.getTalendType());
String pattern = column.getPattern() == null || column.getPattern().trim().length() == 0 ? null : column.getPattern();
if(JavaTypesManager.isJavaPrimitiveType( column.getTalendType(), column.isNullable())){
%>
if(<%=conn.getName() %>.<%=column.getLabel() %> != null) {
<%
if(javaType == JavaTypesManager.BOOLEAN ){
if(javaType == JavaTypesManager.BOOLEAN ){
%>
row_<%=cid%>[<%=i%>] = String.valueOf(
true == <%=conn.getName() %>.<%=column.getLabel() %> ?"1":"0"
@@ -56,12 +54,8 @@
%>
row_<%=cid%>[<%=i%>] = String.valueOf(<%=conn.getName() %>.<%=column.getLabel() %>);
<%
}
%>
} else {
row_<%=cid%>[<%=i%>] = null;
}
<%
}
}else {
%>
if(<%=conn.getName() %>.<%=column.getLabel() %> != null){
@@ -70,10 +64,24 @@
%>
row_<%=cid%>[<%=i%>] = <%=conn.getName() %>.<%=column.getLabel() %>;
<%
}else if(javaType == JavaTypesManager.DATE && pattern != null){
%>
row_<%=cid%>[<%=i%>] = FormatterUtils.format_Date(<%=conn.getName() %>.<%=column.getLabel() %>, "yyyy-MM-dd HH:mm:ss");
}else if(javaType == JavaTypesManager.DATE && pattern == null){
%>
row_<%=cid%>[<%=i%>] = FormatterUtils.format_Date(<%=conn.getName() %>.<%=column.getLabel() %>, "yyyy-MM-dd");
<%
}else if(javaType == JavaTypesManager.DATE && pattern != null){
if(pattern.length() > 12){
%>
row_<%=cid%>[<%=i%>] = FormatterUtils.format_Date(<%=conn.getName() %>.<%=column.getLabel() %>, "yyyy-MM-dd HH:mm:ss");
<%
}else if(pattern.length() == 12 || "\"\"".equals(pattern)) {
%>
row_<%=cid%>[<%=i%>] = FormatterUtils.format_Date(<%=conn.getName() %>.<%=column.getLabel() %>, "yyyy-MM-dd");
<%
}else {
%>
row_<%=cid%>[<%=i%>] = FormatterUtils.format_Date(<%=conn.getName() %>.<%=column.getLabel() %>, <%=pattern%>);
<%
}
}else if(javaType == JavaTypesManager.BYTE_ARRAY){
%>
row_<%=cid%>[<%=i%>] = java.nio.charset.Charset.forName(<%=encoding %>).decode(java.nio.ByteBuffer.wrap(<%=conn.getName() %>.<%=column.getLabel() %>)).toString();
@@ -92,7 +100,7 @@
}
%>
} else {
row_<%=cid%>[<%=i%>] = null;
row_<%=cid%>[<%=i%>] = "\\N";
}
<%
}

View File

@@ -228,8 +228,8 @@ if (!sftp && !ftps) { // *** ftp *** //
}
ftp_<%=cid %>.setFileType(org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE);
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
} catch (Exception e) {
<%if(isLog4jEnabled){%>
log.error("<%=cid%> - Can't create connection: " + e.getMessage());

View File

@@ -249,8 +249,8 @@ int nb_file_<%=cid%> = 0;
throw new RuntimeException("Login failed");
}
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
} catch (Exception e) {
<%if(isLog4jEnabled){%>
log.error("<%=cid%> - Can't create connection: " + e.getMessage());

View File

@@ -235,8 +235,8 @@ if (sftp) { // *** sftp *** //
throw new RuntimeException("Login failed");
}
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
} catch (Exception e) {
<%if(isLog4jEnabled){%>
log.error("<%=cid%> - Can't create connection: " + e.getMessage());

View File

@@ -317,8 +317,8 @@ if (sftp) {// *** sftp *** //
throw new RuntimeException("Login failed");
}
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
} catch (Exception e) {
<%if(isLog4jEnabled){%>
log.error("<%=cid%> - Can't create connection: " + e.getMessage());

View File

@@ -284,8 +284,8 @@ if (sftp) { // *** sftp *** //
}
ftp_<%=cid %>.setFileType(org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE); //to calculate md5 for binary files correctly
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
} catch (Exception e) {
<%if(isLog4jEnabled){%>
log.error("<%=cid%> - Can't create connection: " + e.getMessage());

View File

@@ -732,8 +732,8 @@ if (sftp) { // *** sftp *** //
}
ftp_<%=cid %>.setFileType(org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE);
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
} catch (Exception e) {
<%if(isLog4jEnabled){%>
log.error("<%=cid%> - Can't create connection: " + e.getMessage());

View File

@@ -415,8 +415,8 @@ int nb_file_<%=cid%> = 0;
}
ftp_<%=cid %>.setFileType(org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE);
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
} catch (Exception e) {
<%if(isLog4jEnabled){%>
log.error("<%=cid%> - Can't create connection: " + e.getMessage());

View File

@@ -254,8 +254,8 @@ if (sftp) { // *** sftp *** //
throw new RuntimeException("Login failed");
}
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
} catch (Exception e) {
<%if(isLog4jEnabled){%>
log.error("<%=cid%> - Can't create connection: " + e.getMessage());

View File

@@ -252,8 +252,8 @@ if (sftp) {// *** sftp *** //
throw new RuntimeException("Login failed");
}
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
ftp_<%=cid %>.execPBSZ(<%=protectionBufferSize %>);
ftp_<%=cid %>.execPROT(<%=protectionLevel %>);
} catch (Exception e) {
<%if(isLog4jEnabled){%>
log.error("<%=cid%> - Can't create connection: " + e.getMessage());

View File

@@ -152,8 +152,8 @@
<IMPORTS>
<IMPORT NAME="jets3t-0.9.1" MODULE="jets3t-0.9.1.jar" MVN="mvn:org.talend.libraries/jets3t-0.9.1/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-logging-1.1.3" MODULE="commons-logging-1.1.3.jar" MVN="mvn:commons-logging/commons-logging/1.1.3" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.3.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.3.6" MODULE="httpclient-4.3.6.jar" MVN="mvn:org.talend.libraries/httpclient-4.3.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.3.6.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpcore-4.3.3" MODULE="httpcore-4.3.3.jar" MVN="mvn:org.talend.libraries/httpcore-4.3.3/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.3.3.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.5.5" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.talend.libraries/httpclient-4.5.5/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.5.5.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpcore-4.4.9" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.talend.libraries/httpcore-4.4.9/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.4.9.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-codec-1.6" MODULE="commons-codec-1.6.jar" MVN="mvn:org.talend.libraries/commons-codec-1.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -99,8 +99,8 @@
<IMPORTS>
<IMPORT NAME="jets3t-0.9.1" MODULE="jets3t-0.9.1.jar" MVN="mvn:org.talend.libraries/jets3t-0.9.1/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-logging-1.1.3" MODULE="commons-logging-1.1.3.jar" MVN="mvn:commons-logging/commons-logging/1.1.3" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.3.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.3.6" MODULE="httpclient-4.3.6.jar" MVN="mvn:org.talend.libraries/httpclient-4.3.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.3.6.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpcore-4.3.3" MODULE="httpcore-4.3.3.jar" MVN="mvn:org.talend.libraries/httpcore-4.3.3/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.3.3.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.5.5" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.talend.libraries/httpclient-4.5.5/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.5.5.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpcore-4.4.9" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.talend.libraries/httpcore-4.4.9/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.4.9.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-codec-1.6" MODULE="commons-codec-1.6.jar" MVN="mvn:org.talend.libraries/commons-codec-1.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -99,8 +99,8 @@
<IMPORTS>
<IMPORT NAME="jets3t-0.9.1" MODULE="jets3t-0.9.1.jar" MVN="mvn:org.talend.libraries/jets3t-0.9.1/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-logging-1.1.3" MODULE="commons-logging-1.1.3.jar" MVN="mvn:commons-logging/commons-logging/1.1.3" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.3.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.3.6" MODULE="httpclient-4.3.6.jar" MVN="mvn:org.talend.libraries/httpclient-4.3.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.3.6.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpcore-4.3.3" MODULE="httpcore-4.3.3.jar" MVN="mvn:org.talend.libraries/httpcore-4.3.3/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.3.3.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.5.5" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.talend.libraries/httpclient-4.5.5/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.5.5.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpcore-4.4.9" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.talend.libraries/httpcore-4.4.9/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.4.9.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-codec-1.6" MODULE="commons-codec-1.6.jar" MVN="mvn:org.talend.libraries/commons-codec-1.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -102,8 +102,8 @@
<IMPORTS>
<IMPORT NAME="jets3t-0.9.1" MODULE="jets3t-0.9.1.jar" MVN="mvn:org.talend.libraries/jets3t-0.9.1/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-logging-1.1.3" MODULE="commons-logging-1.1.3.jar" MVN="mvn:commons-logging/commons-logging/1.1.3" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.3.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.3.6" MODULE="httpclient-4.3.6.jar" MVN="mvn:org.talend.libraries/httpclient-4.3.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.3.6.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpcore-4.3.3" MODULE="httpcore-4.3.3.jar" MVN="mvn:org.talend.libraries/httpcore-4.3.3/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.3.3.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.5.5" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.talend.libraries/httpclient-4.5.5/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.5.5.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpcore-4.4.9" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.talend.libraries/httpcore-4.4.9/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.4.9.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-codec-1.6" MODULE="commons-codec-1.6.jar" MVN="mvn:org.talend.libraries/commons-codec-1.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -62,8 +62,8 @@
<IMPORTS>
<IMPORT NAME="jets3t-0.9.1" MODULE="jets3t-0.9.1.jar" MVN="mvn:org.talend.libraries/jets3t-0.9.1/6.0.0" REQUIRED="true" />
<IMPORT NAME="commons-logging-1.1.3" MODULE="commons-logging-1.1.3.jar" MVN="mvn:commons-logging/commons-logging/1.1.3" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.3.jar" REQUIRED="true" />
<IMPORT NAME="httpclient-4.3.6" MODULE="httpclient-4.3.6.jar" MVN="mvn:org.talend.libraries/httpclient-4.3.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.3.6.jar" REQUIRED="true" />
<IMPORT NAME="httpcore-4.3.3" MODULE="httpcore-4.3.3.jar" MVN="mvn:org.talend.libraries/httpcore-4.3.3/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.3.3.jar" REQUIRED="true" />
<IMPORT NAME="httpclient-4.5.5" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.talend.libraries/httpclient-4.5.5/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.5.5.jar" REQUIRED="true" />
<IMPORT NAME="httpcore-4.4.9" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.talend.libraries/httpcore-4.4.9/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.4.9.jar" REQUIRED="true" />
<IMPORT NAME="commons-codec-1.6" MODULE="commons-codec-1.6.jar" MVN="mvn:org.talend.libraries/commons-codec-1.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED="true" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -169,8 +169,8 @@
<IMPORTS>
<IMPORT NAME="jets3t-0.9.1" MODULE="jets3t-0.9.1.jar" MVN="mvn:org.talend.libraries/jets3t-0.9.1/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-logging-1.1.3" MODULE="commons-logging-1.1.3.jar" MVN="mvn:commons-logging/commons-logging/1.1.3" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.3.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.3.6" MODULE="httpclient-4.3.6.jar" MVN="mvn:org.talend.libraries/httpclient-4.3.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.3.6.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpcore-4.3.3" MODULE="httpcore-4.3.3.jar" MVN="mvn:org.talend.libraries/httpcore-4.3.3/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.3.3.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.5.5" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.talend.libraries/httpclient-4.5.5/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.5.5.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpcore-4.4.9" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.talend.libraries/httpcore-4.4.9/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.4.9.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-codec-1.6" MODULE="commons-codec-1.6.jar" MVN="mvn:org.talend.libraries/commons-codec-1.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -161,8 +161,8 @@
<IMPORTS>
<IMPORT NAME="jets3t-0.9.1" MODULE="jets3t-0.9.1.jar" MVN="mvn:org.talend.libraries/jets3t-0.9.1/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-logging-1.1.3" MODULE="commons-logging-1.1.3.jar" MVN="mvn:commons-logging/commons-logging/1.1.3" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.3.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.3.6" MODULE="httpclient-4.3.6.jar" MVN="mvn:org.talend.libraries/httpclient-4.3.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.3.6.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpcore-4.3.3" MODULE="httpcore-4.3.3.jar" MVN="mvn:org.talend.libraries/httpcore-4.3.3/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.3.3.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.5.5" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.talend.libraries/httpclient-4.5.5/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.5.5.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpcore-4.4.9" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.talend.libraries/httpcore-4.4.9/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.4.9.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-codec-1.6" MODULE="commons-codec-1.6.jar" MVN="mvn:org.talend.libraries/commons-codec-1.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -198,8 +198,8 @@
<IMPORTS>
<IMPORT NAME="jets3t-0.9.1" MODULE="jets3t-0.9.1.jar" MVN="mvn:org.talend.libraries/jets3t-0.9.1/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-logging-1.1.3" MODULE="commons-logging-1.1.3.jar" MVN="mvn:commons-logging/commons-logging/1.1.3" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.3.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.3.6" MODULE="httpclient-4.3.6.jar" MVN="mvn:org.talend.libraries/httpclient-4.3.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.3.6.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpcore-4.3.3" MODULE="httpcore-4.3.3.jar" MVN="mvn:org.talend.libraries/httpcore-4.3.3/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.3.3.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.5.5" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.talend.libraries/httpclient-4.5.5/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.5.5.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpcore-4.4.9" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.talend.libraries/httpcore-4.4.9/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.4.9.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-codec-1.6" MODULE="commons-codec-1.6.jar" MVN="mvn:org.talend.libraries/commons-codec-1.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -161,8 +161,8 @@
<IMPORTS>
<IMPORT NAME="jets3t-0.9.1" MODULE="jets3t-0.9.1.jar" MVN="mvn:org.talend.libraries/jets3t-0.9.1/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-logging-1.1.3" MODULE="commons-logging-1.1.3.jar" MVN="mvn:commons-logging/commons-logging/1.1.3" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.3.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.3.6" MODULE="httpclient-4.3.6.jar" MVN="mvn:org.talend.libraries/httpclient-4.3.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.3.6.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpcore-4.3.3" MODULE="httpcore-4.3.3.jar" MVN="mvn:org.talend.libraries/httpcore-4.3.3/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.3.3.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.5.5" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.talend.libraries/httpclient-4.5.5/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.5.5.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpcore-4.4.9" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.talend.libraries/httpcore-4.4.9/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.4.9.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-codec-1.6" MODULE="commons-codec-1.6.jar" MVN="mvn:org.talend.libraries/commons-codec-1.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -142,8 +142,8 @@
<IMPORT NAME="GoogleStorageUtils" MODULE="GoogleStorageUtils.jar" MVN="mvn:org.talend.libraries/GoogleStorageUtils/6.0.0" REQUIRED="true" />
<IMPORT NAME="jets3t-0.9.1" MODULE="jets3t-0.9.1.jar" MVN="mvn:org.talend.libraries/jets3t-0.9.1/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-logging-1.1.3" MODULE="commons-logging-1.1.3.jar" MVN="mvn:commons-logging/commons-logging/1.1.3" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.3.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.3.6" MODULE="httpclient-4.3.6.jar" MVN="mvn:org.talend.libraries/httpclient-4.3.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.3.6.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpcore-4.3.3" MODULE="httpcore-4.3.3.jar" MVN="mvn:org.talend.libraries/httpcore-4.3.3/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.3.3.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.5.5" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.talend.libraries/httpclient-4.5.5/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpclient-4.5.5.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpcore-4.4.9" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.talend.libraries/httpcore-4.4.9/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.http/lib/httpcore-4.4.9.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-codec-1.6" MODULE="commons-codec-1.6.jar" MVN="mvn:org.talend.libraries/commons-codec-1.6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false')" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -266,7 +266,9 @@ if(hiveDistrib.isExecutedThroughWebHCat()) {
}
}
%>
log.info("Query sent to HiveServer2 to be executed with [Application Name(MapReduce)/DAG Name(Tez): " + queryIdentifier_<%=cid %> + "]");
<%if(isLog4jEnabled){%>
log.info("Query sent to HiveServer2 to be executed with [Application Name(MapReduce)/DAG Name(Tez): " + queryIdentifier_<%=cid%> + "]");
<%}%>
} catch (java.lang.Exception e) {
whetherReject_<%=cid%> = true;
<%

View File

@@ -398,10 +398,15 @@ skeleton="../templates/db_output_bulk.skeleton"
// added "print command" feature
<% if (printCommand == true) { %>
System.out.println("INFO: executing nzload command:");
for( String cmd : cmds ) {
System.out.print(cmd + " ");
}
System.out.println("INFO: executing nzload command:");
for(int i = 0; i < cmds.length; i++) {
if ("-pw".equals(cmds[i]) && decryptedPwd_<%=cid %>.equals(cmds[i+1])) {
System.out.print(cmds[i] + " " + routines.system.PasswordEncryptUtil.PASSWORD_FOR_LOGS_VALUE + " ");
i++;
} else {
System.out.print(cmds[i] + " ");
}
}
<% } %>
Runtime rt = Runtime.getRuntime();

View File

@@ -106,7 +106,12 @@
REQUIRED="false" NUM_ROW="11">
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER NAME="IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY" FIELD="CHECK" NUM_ROW="11"
SHOW_IF="CREATE_EMPTY_ELEMENT=='false'">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="EXPAND_EMPTY_ELM" FIELD="CHECK" NUM_ROW="11"
SHOW_IF="CREATE_EMPTY_ELEMENT=='true'">
<DEFAULT>false</DEFAULT>
@@ -173,6 +178,8 @@
TARGET="Out.CREATE" />
<TEMPLATE_PARAM SOURCE="self.CREATE_EMPTY_ELEMENT"
TARGET="Out.CREATE_EMPTY_ELEMENT" />
<TEMPLATE_PARAM SOURCE="self.IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY"
TARGET="Out.IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY" />
<TEMPLATE_PARAM SOURCE="self.EXPAND_EMPTY_ELM"
TARGET="Out.EXPAND_EMPTY_ELM" />
<TEMPLATE_PARAM SOURCE="self.OUTPUT_AS_XSD"

View File

@@ -43,4 +43,5 @@ SCHEMA.NAME=Schema
THOUSANDS_SEPARATOR.NAME=Thousands separator
XMLFIELD.NAME=Output Column
XSD_FILE.NAME=XSD file path
IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY.NAME = Ignore service attributes for empty elements
EXPAND_EMPTY_ELM.NAME = Expand Empty Element if needed(for dom4j)

View File

@@ -45,6 +45,7 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
String removeHeader = ElementParameterParser.getValue(node, "__REMOVE_HEADER__"); // add for feature7788
String encoding = ElementParameterParser.getValue(node, "__ENCODING__");
boolean isAllowEmpty = ("true").equals(ElementParameterParser.getValue(node, "__CREATE_EMPTY_ELEMENT__"));
boolean ignoreServiceAttributes = ("true").equals(ElementParameterParser.getValue(node, "__IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY__"));
boolean expandEmptyElm = ("true").equals(ElementParameterParser.getValue(node, "__EXPAND_EMPTY_ELM__"));
String mode = ElementParameterParser.getValue(node, "__GENERATION_MODE__");
List<Map<String, String>> rootTable =
@@ -200,6 +201,18 @@ java.util.Map<String,String> arraysValueMap_<%=cid%> = new java.util.HashMap<Str
%>
class NestXMLTool_<%=cid%>{
<%
if (!isAllowEmpty && ignoreServiceAttributes) {
%>
private java.util.Set<String> serviceAttributeNames = new java.util.HashSet<>();
{
serviceAttributeNames.add("type");
serviceAttributeNames.add("class");
serviceAttributeNames.add("array");
}
<%
}
%>
public void parseAndAdd(org.dom4j.Element nestRoot, String value){
try {
org.dom4j.Document doc4Str = org.dom4j.DocumentHelper.parseText("<root>"+ value + "</root>");
@@ -235,16 +248,25 @@ class NestXMLTool_<%=cid%>{
for (org.dom4j.Element tmp: (java.util.List<org.dom4j.Element>) root.elements()) {
removeEmptyElement(tmp);
}
if (root.content().size() == 0
&& root.attributes().size() == 0
&& root.declaredNamespaces().size() == 0) {
if(root.getParent()!=null){
root.getParent().remove(root);
boolean noSignificantDataAnnotationsExist = root.attributes().isEmpty() <%if (!isAllowEmpty && ignoreServiceAttributes) {%>|| isOnlyServiceAttributesDeclared(root.attributes()) <% } %>;
if (root.content().isEmpty()
&& noSignificantDataAnnotationsExist && root.declaredNamespaces().isEmpty()) {
if(root.getParent()!=null){
root.getParent().remove(root);
}
}
}
}
}
}
<%
if (!isAllowEmpty && ignoreServiceAttributes) {
%>
private boolean isOnlyServiceAttributesDeclared(List<org.dom4j.Attribute> attributes) {
return attributes.stream().allMatch(a -> serviceAttributeNames.contains(a.getName().toLowerCase()));
}
<%
}
%>
public String objectToString(Object value){
if(value.getClass().isArray()){
StringBuilder sb = new StringBuilder();

View File

@@ -99,6 +99,11 @@
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER NAME="IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY" FIELD="CHECK" NUM_ROW="11"
SHOW_IF="CREATE_EMPTY_ELEMENT=='false'">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="EXPAND_EMPTY_ELM" FIELD="CHECK" NUM_ROW="11"
SHOW_IF="CREATE_EMPTY_ELEMENT=='true'">
<DEFAULT>false</DEFAULT>

View File

@@ -44,5 +44,6 @@ THOUSANDS_SEPARATOR.NAME=Thousands separator
XMLFIELD.NAME=Output Column
XML_FIELD.NAME=XML Field
XSD_FILE.NAME=XSD file path
IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY.NAME = Ignore service attributes for empty elements
EXPAND_EMPTY_ELM.NAME = Expand Empty Element if needed(for dom4j)
COMPACT_FORMAT.NAME = Compact Format

View File

@@ -35,6 +35,7 @@ imports="
%>
String driverClass_<%=cid%> = "<%=this.getDirverClassName(node)%>";
java.lang.Class.forName(driverClass_<%=cid%>);
globalMap.put("driverClass_<%=cid%>", driverClass_<%=cid%>);
<%
}

View File

@@ -165,6 +165,12 @@ imports="
close_begin();
%>
conn_<%=cid%>.close();
<% /* TESB-24900 - graceful shutdown for MYSQL connection */ %>
if("com.mysql.cj.jdbc.Driver".equals((String)globalMap.get("driverClass_<%=(connection!=null)?connection.replaceAll("'","").trim():""%>"))
&& routines.system.BundleUtils.inOSGi()) {
Class.forName("com.mysql.cj.jdbc.AbandonedConnectionCleanupThread").
getMethod("checkedShutdown").invoke(null, (Object[]) null);
}
<%
close_end();
}

View File

@@ -104,7 +104,7 @@
</projecttask>
<projecttask
beforeLogon="false"
breaks="7.0.1"
breaks="7.0.0"
class="org.talend.designer.core.generic.model.migration.NewGoogleDriveMigrationTask"
description="Migration task for jobs using Google Drive components to TCOMP"
id="org.talend.designer.core.generic.model.migration.NewGoogleDriveMigrationTask"

View File

@@ -1469,9 +1469,11 @@ public class Component extends AbstractBasicComponent {
}
if (GenericTypeUtils.isStringType(property)
&& property.getTaggedValue(IGenericConstants.LINE_SEPARATOR_REPLACED_TO) != null) {
String replacedTo = String.valueOf(property.getTaggedValue(IGenericConstants.LINE_SEPARATOR_REPLACED_TO));
// "Win", "Linux/Unix", "Mac"
return value.replaceAll("\r\n", replacedTo).replaceAll("\n", replacedTo).replaceAll("\r", replacedTo);
//process for the sql field for jdbc, snowflake, salesforce, LINE_SEPARATOR_REPLACED_TO key can tell us which a sql type field,
//as sql type value may have newline and return characters, which make compiler issue in java code,
//so have to convert the newline characters to visible "\r", "\n" for pass the compiler issue and can't only convert them to white space as TDI-41898
//jdbc drivers, salesforce driver can work like that sql : select * \nfrom Account, so it is ok
return NodeUtil.replaceCRLFInMEMO_SQL(value);
}
if (GenericTypeUtils.isSchemaType(property)) {
// Handles embedded escaped quotes which might occur

View File

@@ -15,6 +15,7 @@ package org.talend.designer.core.generic.model;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.lang.reflect.InvocationTargetException;
import java.net.ProxySelector;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -28,9 +29,9 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.ui.gmf.util.DisplayUtils;
import org.talend.commons.utils.network.TalendProxySelector;
import org.talend.components.api.component.Connector;
import org.talend.components.api.properties.ComponentProperties;
import org.talend.components.api.properties.ComponentReferenceProperties;
import org.talend.components.api.service.ComponentService;
import org.talend.core.model.components.EComponentType;
import org.talend.core.model.components.IComponent;
@@ -488,10 +489,26 @@ public class GenericElementParameter extends ElementParameter implements IGeneri
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask(taskName, IProgressMonitor.UNKNOWN);
try {
if (Boolean.getBoolean(TalendProxySelector.PROP_PRINT_LOGS)) {
ExceptionHandler.log(
"Before tcompv0 service call: ProxySelector.getDefault() -> " + ProxySelector.getDefault());
ExceptionHandler.log("http.proxyHost -> " + System.getProperty("http.proxyHost"));
}
toDo();
if (Boolean.getBoolean(TalendProxySelector.PROP_PRINT_LOGS)) {
ExceptionHandler.log(
"After tcompv0 service call: ProxySelector.getDefault() -> " + ProxySelector.getDefault());
ExceptionHandler.log("http.proxyHost -> " + System.getProperty("http.proxyHost"));
}
} catch (Throwable e) {
result.set(false);
throw new InvocationTargetException(e);
} finally {
if (Boolean.getBoolean(TalendProxySelector.PROP_PRINT_LOGS)) {
ExceptionHandler.log(
"Finally tcompv0 service call: ProxySelector.getDefault() -> " + ProxySelector.getDefault());
ExceptionHandler.log("http.proxyHost -> " + System.getProperty("http.proxyHost"));
}
}
result.set(true);
}

View File

@@ -62,6 +62,9 @@ public class GenericTableUtils {
if(dbService != null){
for(String v:values){
if(param.getName().equals(EConnectionParameterName.GENERIC_DRIVER_JAR.getDisplayName())){
if(v == null || v.length() <= 0 || TalendQuoteUtils.removeQuotesIfExist(v).length() <= 0){
continue;
}
v = dbService.getMVNPath(v);
}
valueList.add(v);

View File

@@ -6,12 +6,39 @@ import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Properties;
import org.talend.core.model.properties.Item;
import org.talend.core.utils.TalendQuoteUtils;
import org.talend.designer.core.generic.utils.ParameterUtilTool;
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
public class NewGoogleDriveMigrationTask extends org.talend.designer.core.generic.model.migration.NewComponentFrameworkMigrationTask {
public static final String GOOGLE_DRIVE_PREFIX = "tGoogleDrive";
public static final String JAVAJET_VERSION = "0.102";
@Override
public ExecutionResult execute(Item item) {
ProcessType processType = getProcessType(item);
if (processType != null) {
for (Object obj : processType.getNode()) {
if (obj != null && obj instanceof NodeType) {
String componentName = ((NodeType) obj).getComponentName();
String version = ((NodeType) obj).getComponentVersion();
if (componentName != null && componentName.startsWith(GOOGLE_DRIVE_PREFIX)) {
if (!JAVAJET_VERSION.equals(version)) {
// not a javajet component (tcompv0), we skip this migration for not corrupting comps.
return ExecutionResult.NOTHING_TO_DO;
}
}
}
}
}
return super.execute(item);
}
@Override
public Date getOrder() {
return new GregorianCalendar(2017, 10, 23, 10, 15, 0).getTime();
@@ -33,44 +60,43 @@ public class NewGoogleDriveMigrationTask extends org.talend.designer.core.generi
@Override
protected ElementParameterType getParameterType(NodeType node, String paramName) {
// sanitize inexistent props
ElementParameterType oAuthMethod = ParameterUtilTool.findParameterType(node, "OAUTH_METHOD");
if (oAuthMethod == null) {
ParameterUtilTool.addParameterType(node, "TEXT", "OAUTH_METHOD", "AccessToken");
}
ElementParameterType dsPath = ParameterUtilTool.findParameterType(node, "DATASTORE_PATH");
if (dsPath == null) {
String datastorePath = (System.getProperty("user.home", ".") + "/.credentials/talend-googledrive")
.replace("\\", "/");
ParameterUtilTool.addParameterType(node, "TEXT", "DATASTORE_PATH",
TalendQuoteUtils.addQuotesIfNotExist(datastorePath));
}
ElementParameterType paramType = ParameterUtilTool.findParameterType(node, paramName);
if (node != null && paramType != null) {
Object value = ParameterUtilTool.convertParameterValue(paramType);
String componentName = node.getComponentName();
//
if ("tGoogleDriveCopy".equals(componentName)) {
if ("FILE_MODE".equals(paramName)) {
if ("true".equals(String.valueOf(value))) {
paramType.setValue("File");
} else {
paramType.setValue("Folder");
}
}
if ("FILE_NAME".equals(paramName)) {
ElementParameterType fileMode = ParameterUtilTool.findParameterType(node, "FILE_MODE");
Object fileModeValue = ParameterUtilTool.convertParameterValue(fileMode);
if ("true".equals(String.valueOf(fileModeValue))) {
paramType.setValue(String.valueOf(value));
} else {
ElementParameterType folderName = ParameterUtilTool.findParameterType(node, "FOLDER_NAME");
Object folderNameValue = ParameterUtilTool.convertParameterValue(folderName);
paramType.setValue(String.valueOf(folderNameValue));
}
Object copyModeParam = ParameterUtilTool.findParameterType(node, "COPY_MODE");
if (copyModeParam == null) {
Object fileMode = ParameterUtilTool.getParameterValue(node, "FILE_MODE");
Object fileName = ParameterUtilTool.getParameterValue(node, "FILE_NAME");
Object folderName = ParameterUtilTool.getParameterValue(node, "FOLDER_NAME");
String copyMode = "true".equals(fileMode) ? "File" : "Folder";
String source = "File".equals(copyMode) ? String.valueOf(fileName) : String.valueOf(folderName);
ParameterUtilTool.addParameterType(node, "TEXT", "COPY_MODE", copyMode);
ParameterUtilTool.addParameterType(node, "TEXT", "SOURCE", source);
}
}
if ("tGoogleDrivePut".equals(componentName)) {
if ("READ_CONTENT_FROM_INPUT".equals(paramName)) {
if ("true".equals(String.valueOf(value))) {
paramType.setValue("READ_CONTENT_FROM_INPUT");
} else {
ElementParameterType upl = ParameterUtilTool.findParameterType(node, "UPLOAD_LOCAL_FILE");
Object uplv = ParameterUtilTool.convertParameterValue(upl);
if ("true".equals(String.valueOf(uplv))) {
paramType.setValue("UPLOAD_LOCAL_FILE");
} else {
paramType.setValue("EXPOSE_OUTPUT_STREAM");
}
Object uploadModeParam = ParameterUtilTool.findParameterType(node, "UPLOAD_MODE");
if (uploadModeParam == null) {
Object isReadContentFromInput = ParameterUtilTool.getParameterValue(node, "READ_CONTENT_FROM_INPUT");
Object uploadLocalFile = ParameterUtilTool.getParameterValue(node, "UPLOAD_LOCAL_FILE");
String uploadMode = "READ_CONTENT_FROM_INPUT";
if (!"true".equals(isReadContentFromInput)) {
uploadMode = "true".equals(uploadLocalFile) ? "UPLOAD_LOCAL_FILE" : "EXPOSE_OUTPUT_STREAM";
}
ParameterUtilTool.addParameterType(node, "TEXT", "UPLOAD_MODE", uploadMode);
}
}
}

View File

@@ -9,11 +9,25 @@ tGoogleDriveConnection.useSSL=USE_SSL
tGoogleDriveConnection.sslAlgorithm=SSL_ALGORITHM
tGoogleDriveConnection.sslTrustStore=SSL_TRUST_STORE
tGoogleDriveConnection.sslTrustStorePassword=SSL_TRUST_STORE_PASSWORD
tGoogleDriveConnection.oAuthMethod=OAUTH_METHOD
tGoogleDriveConnection.datastorePath=DATASTORE_PATH
# tGoogleDriveCopy
tGoogleDriveCopy=tGoogleDriveCopy
tGoogleDriveCopy.copyMode=FILE_MODE
tGoogleDriveCopy.source=FILE_NAME
tGoogleDriveCopy.connection.referencedComponent=CONNECTION
tGoogleDriveCopy.connection.applicationName=APPLICATION_NAME
tGoogleDriveCopy.connection.accessToken=ACCESS_TOKEN
tGoogleDriveCopy.connection.useProxy=USE_PROXY
tGoogleDriveCopy.connection.proxyHost=PROXY_HOST
tGoogleDriveCopy.connection.proxyPort=PROXY_PORT
tGoogleDriveCopy.connection.useSSL=USE_SSL
tGoogleDriveCopy.connection.sslAlgorithm=SSL_ALGORITHM
tGoogleDriveCopy.connection.sslTrustStore=SSL_TRUST_STORE
tGoogleDriveCopy.connection.sslTrustStorePassword=SSL_TRUST_STORE_PASSWORD
tGoogleDriveCopy.connection.oAuthMethod=OAUTH_METHOD
tGoogleDriveCopy.connection.datastorePath=DATASTORE_PATH
tGoogleDriveCopy.copyMode=COPY_MODE
tGoogleDriveCopy.source=SOURCE
tGoogleDriveCopy.destinationFolder=DESTINATION_FOLDER_NAME
tGoogleDriveCopy.rename=RENAME
tGoogleDriveCopy.newName=DESTINATION_FILE_NAME
@@ -21,16 +35,52 @@ tGoogleDriveCopy.deleteSourceFile=REMOVE_SOURCE_FILE
# tGoogleDriveCreate
tGoogleDriveCreate=tGoogleDriveCreate
tGoogleDriveCreate.connection.referencedComponent=CONNECTION
tGoogleDriveCreate.connection.applicationName=APPLICATION_NAME
tGoogleDriveCreate.connection.accessToken=ACCESS_TOKEN
tGoogleDriveCreate.connection.useProxy=USE_PROXY
tGoogleDriveCreate.connection.proxyHost=PROXY_HOST
tGoogleDriveCreate.connection.proxyPort=PROXY_PORT
tGoogleDriveCreate.connection.useSSL=USE_SSL
tGoogleDriveCreate.connection.sslAlgorithm=SSL_ALGORITHM
tGoogleDriveCreate.connection.sslTrustStore=SSL_TRUST_STORE
tGoogleDriveCreate.connection.sslTrustStorePassword=SSL_TRUST_STORE_PASSWORD
tGoogleDriveCreate.connection.oAuthMethod=OAUTH_METHOD
tGoogleDriveCreate.connection.datastorePath=DATASTORE_PATH
tGoogleDriveCreate.parentFolder=FOLDER_NAME
tGoogleDriveCreate.newFolder=NEW_FOLDER_NAME
# tGoogleDriveDelete
tGoogleDriveDelete=tGoogleDriveDelete
tGoogleDriveDelete.connection.referencedComponent=CONNECTION
tGoogleDriveDelete.connection.applicationName=APPLICATION_NAME
tGoogleDriveDelete.connection.accessToken=ACCESS_TOKEN
tGoogleDriveDelete.connection.useProxy=USE_PROXY
tGoogleDriveDelete.connection.proxyHost=PROXY_HOST
tGoogleDriveDelete.connection.proxyPort=PROXY_PORT
tGoogleDriveDelete.connection.useSSL=USE_SSL
tGoogleDriveDelete.connection.sslAlgorithm=SSL_ALGORITHM
tGoogleDriveDelete.connection.sslTrustStore=SSL_TRUST_STORE
tGoogleDriveDelete.connection.sslTrustStorePassword=SSL_TRUST_STORE_PASSWORD
tGoogleDriveDelete.connection.oAuthMethod=OAUTH_METHOD
tGoogleDriveDelete.connection.datastorePath=DATASTORE_PATH
tGoogleDriveDelete.file=FILE_NAME
tGoogleDriveDelete.useTrash=USE_TRASH
# tGoogleDriveGet
tGoogleDriveGet=tGoogleDriveGet
tGoogleDriveGet.connection.referencedComponent=CONNECTION
tGoogleDriveGet.connection.applicationName=APPLICATION_NAME
tGoogleDriveGet.connection.accessToken=ACCESS_TOKEN
tGoogleDriveGet.connection.useProxy=USE_PROXY
tGoogleDriveGet.connection.proxyHost=PROXY_HOST
tGoogleDriveGet.connection.proxyPort=PROXY_PORT
tGoogleDriveGet.connection.useSSL=USE_SSL
tGoogleDriveGet.connection.sslAlgorithm=SSL_ALGORITHM
tGoogleDriveGet.connection.sslTrustStore=SSL_TRUST_STORE
tGoogleDriveGet.connection.sslTrustStorePassword=SSL_TRUST_STORE_PASSWORD
tGoogleDriveGet.connection.oAuthMethod=OAUTH_METHOD
tGoogleDriveGet.connection.datastorePath=DATASTORE_PATH
tGoogleDriveGet.file=FILE_NAME
tGoogleDriveGet.storeToLocal=STORE_TO_LOCAL
tGoogleDriveGet.outputFileName=OUTPUT
@@ -43,6 +93,18 @@ tGoogleDriveGet.mainSchema.schema.connector=FLOW->FLOW
# tGoogleDriveList
tGoogleDriveList=tGoogleDriveList
tGoogleDriveList.connection.referencedComponent=CONNECTION
tGoogleDriveList.connection.applicationName=APPLICATION_NAME
tGoogleDriveList.connection.accessToken=ACCESS_TOKEN
tGoogleDriveList.connection.useProxy=USE_PROXY
tGoogleDriveList.connection.proxyHost=PROXY_HOST
tGoogleDriveList.connection.proxyPort=PROXY_PORT
tGoogleDriveList.connection.useSSL=USE_SSL
tGoogleDriveList.connection.sslAlgorithm=SSL_ALGORITHM
tGoogleDriveList.connection.sslTrustStore=SSL_TRUST_STORE
tGoogleDriveList.connection.sslTrustStorePassword=SSL_TRUST_STORE_PASSWORD
tGoogleDriveList.connection.oAuthMethod=OAUTH_METHOD
tGoogleDriveList.connection.datastorePath=DATASTORE_PATH
tGoogleDriveList.folder=FOLDER_NAME
tGoogleDriveList.includeSubDirectories=INCLUDSUBDIR
tGoogleDriveList.listMode=LIST_MODE
@@ -50,7 +112,19 @@ tGoogleDriveList.includeTrashedFiles=INCLUDTRASHFILES
# tGoogleDrivePut
tGoogleDrivePut=tGoogleDrivePut
tGoogleDrivePut.uploadMode=READ_CONTENT_FROM_INPUT
tGoogleDrivePut.connection.referencedComponent=CONNECTION
tGoogleDrivePut.connection.applicationName=APPLICATION_NAME
tGoogleDrivePut.connection.accessToken=ACCESS_TOKEN
tGoogleDrivePut.connection.useProxy=USE_PROXY
tGoogleDrivePut.connection.proxyHost=PROXY_HOST
tGoogleDrivePut.connection.proxyPort=PROXY_PORT
tGoogleDrivePut.connection.useSSL=USE_SSL
tGoogleDrivePut.connection.sslAlgorithm=SSL_ALGORITHM
tGoogleDrivePut.connection.sslTrustStore=SSL_TRUST_STORE
tGoogleDrivePut.connection.sslTrustStorePassword=SSL_TRUST_STORE_PASSWORD
tGoogleDrivePut.connection.oAuthMethod=OAUTH_METHOD
tGoogleDrivePut.connection.datastorePath=DATASTORE_PATH
tGoogleDrivePut.uploadMode=UPLOAD_MODE
tGoogleDrivePut.fileName=FILE_TITLE
tGoogleDrivePut.destinationFolder=DESTINATION_FOLDER_NAME
tGoogleDrivePut.overwrite=OVERWRITE

View File

@@ -19,8 +19,13 @@ import java.util.Map;
import java.util.Set;
import org.talend.components.api.component.ComponentDefinition;
import org.talend.components.api.properties.ComponentProperties;
import org.talend.components.api.properties.ComponentReferenceProperties;
import org.talend.core.model.process.EParameterFieldType;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.INode;
import org.talend.core.runtime.services.IGenericService;
import org.talend.daikon.properties.Properties;
import org.talend.designer.core.generic.model.GenericElementParameter;
import org.talend.designer.core.generic.utils.ComponentsUtils;
@@ -52,5 +57,56 @@ public class GenericService implements IGenericService {
}
return genericComponents;
}
@Override
public void resetReferenceValue(INode curNode, String oldConnectionName, String newConnectionName) {
ComponentReferenceProperties comPro = null;
IElementParameter refPara = curNode.getElementParameterFromField(EParameterFieldType.COMPONENT_REFERENCE);
if(refPara != null){
comPro = ComponentsUtils.getReferencedComponent(refPara);
}
if(comPro != null){
Object sValue = comPro.componentInstanceId.getStoredValue();
if (oldConnectionName.equals(sValue)) {
comPro.componentInstanceId.setValue(newConnectionName);
return;
}
if (sValue != null && ((String)sValue).startsWith(oldConnectionName + "_")) { //$NON-NLS-1$
comPro.componentInstanceId.setValue(((String)sValue).replaceFirst(oldConnectionName + "_", newConnectionName + "_")); //$NON-NLS-1$
return;
}
}
comPro = getComponentReferenceProperties(curNode);
if(comPro == null){
return;
}
Object sValue = comPro.componentInstanceId.getStoredValue();
if (oldConnectionName.equals(sValue)) {
comPro.componentInstanceId.setValue(newConnectionName);
} else if (sValue != null && ((String)sValue).startsWith(oldConnectionName + "_")) { //$NON-NLS-1$
comPro.componentInstanceId.setValue(((String)sValue).replaceFirst(oldConnectionName + "_", newConnectionName + "_")); //$NON-NLS-1$
}
}
private ComponentReferenceProperties getComponentReferenceProperties(INode curNode){
ComponentProperties pros = curNode.getComponentProperties();
if(pros == null){
return null;
}
Properties ps = pros.getProperties("referencedComponent"); //$NON-NLS-1$
if(ps == null){
Properties conn = pros.getProperties("connection"); //$NON-NLS-1$
if(conn != null){
ps = conn.getProperties("referencedComponent"); //$NON-NLS-1$
}
}
if(ps == null){
return null;
}
if(ps instanceof ComponentReferenceProperties){
return (ComponentReferenceProperties)ps;
}
return null;
}
}

View File

@@ -837,6 +837,20 @@ public class ComponentsUtils {
}
return nals;
}
public static ComponentReferenceProperties getReferencedComponent(IElementParameter refPara){
if (!(refPara instanceof GenericElementParameter)) {
return null;
}
Widget widget = ((GenericElementParameter) refPara).getWidget();
NamedThing widgetProperty = widget.getContent();
if (widgetProperty instanceof ComponentReferenceProperties
&& Widget.COMPONENT_REFERENCE_WIDGET_TYPE.equals(widget.getWidgetType())) {
ComponentReferenceProperties props = (ComponentReferenceProperties) widgetProperty;
return props;
}
return null;
}
public static void initReferencedComponent(IElementParameter refPara, String newValue) {

View File

@@ -759,6 +759,15 @@
name="ChangeOracleVersionForProjectSetting"
version="5.2.1">
</projecttask>
<projecttask
beforeLogon="false"
breaks="7.1.0"
class="org.talend.designer.core.utils.FillTRunJobReferenceParametersMigrationTask"
description="Fix empty process id parameters for tRunjob node."
id="org.talend.designer.core.utils.FillTRunJobReferenceParametersMigrationTask"
name="Fix empty process id parameters for tRunjob node"
version="7.1.1">
</projecttask>
</extension>
<extension
point="org.talend.repository.projectsetting_page">

View File

@@ -272,6 +272,7 @@ EParameterName.FunName=Function name
EParameterName.IDocName=IDoc name
EParameterName.fromDatabaseFlag=From Database
EParameterName.fromFileFlag=From File
EParameterName.OverrideEncodingFlag=Override Encoding
EParameterName.generateCode=Generate Code
EParameterName.help=Help
EParameterName.host=Host
@@ -397,6 +398,7 @@ GuessSchemaController.connectionFailed=Database connection is failed.
GuessSchemaController.connError=Connection error
GuessSchemaController.setParameter=Please set connection parameters
GuessSchemaController.waitOpenDatabase=Waiting for opening Database ...
GuessSchemaController.emptyQuery=Empty query
I18nPreferencePage.allTranslation=Import all translations
I18nPreferencePage.completeInfo=Translations loaded from Babili, these translations will be only displayed to test, on next restart of the application, these texts for translations will be lost.
I18nPreferencePage.importBabili=Import Translation from Babili
@@ -733,6 +735,7 @@ PerformancePreferencePage.generateCode=Generate code when opening the job
PerformancePreferencePage.checkVersion=Check only the last version when updating jobs or joblets
PerformancePreferencePage.addOrDeleteVariable=Propagate add/delete variable changes in repository contexts
PerformancePreferencePage.ActivedTimeoutSetting=Activate the timeout for database connection.
PerformancePreferencePage.propagateContext=Propagate contexts added in repository context groups
PerformancePreferencePage.ConnectionTimeout=Connection timeout (seconds)
PerformancePreferencePage.HBaseOrMaprDBScanLimit=HBase/MapR-DB scan limit (for retrieving schema)
PerformancePreferencePage.HBaseOrMaprDBScanLimitTip=If set it by zero, will be same as deactiving the limit.

View File

@@ -226,6 +226,9 @@ public enum EParameterName {
FIELDSEPARATOR(Messages.getString("EParameterName.FieldSeparator")), //$NON-NLS-1$
ROWSEPARATOR(Messages.getString("EParameterName.RowSeparator")), //$NON-NLS-1$
FROM_FILE_FLAG(Messages.getString("EParameterName.fromFileFlag")), //$NON-NLS-1$
OVERRIDE_ENCODING_FLAG(Messages.getString("EParameterName.OverrideEncodingFlag")), //$NON-NLS-1$
// for override encoding (name should be diff from the encoding of Stats&Logs)
OVERRIDE_ENCODING_IN_EXTRA("OVERRIDE_ENCODING_IN_EXTRA"), //$NON-NLS-1$
FROM_DATABASE_FLAG(Messages.getString("EParameterName.fromDatabaseFlag")), //$NON-NLS-1$
// implict tConextLoad parameters.
LOAD_NEW_VARIABLE(Messages.getString("EParameterName.LoadNewVariableLabel")), //$NON-NLS-1$

View File

@@ -2248,6 +2248,9 @@ public class EmfComponent extends AbstractBasicComponent {
readOnlyColumnPosition = EReadOnlyComlumnPosition.BOTTOM.toString();
}
defaultTable.setReadOnlyColumnPosition(readOnlyColumnPosition);
List<String> originalColumns = new ArrayList<>();
int nbCustom = 0;
for (int i = 0; i < xmlColumnList.size(); i++) {
xmlColumn = (COLUMNType) xmlColumnList.get(i);
@@ -2283,9 +2286,11 @@ public class EmfComponent extends AbstractBasicComponent {
talendColumn.setCustomId(-1);
}
talendColumnList.add(talendColumn);
originalColumns.add(talendColumn.getLabel());
}
defaultTable.setListColumns(talendColumnList);
defaultTable.setOriginalColumns(originalColumns);
// store the default table in default value
IElementParameterDefaultValue defaultValue = new ElementParameterDefaultValue();

View File

@@ -76,6 +76,8 @@ public final class Expression {
private static final Pattern isShowFuncPattern = Pattern.compile("isShow\\[(\\w+)(\\.\\w+)*\\]"); //$NON-NLS-1$
private static final String CONTAINS = "CONTAINS"; //$NON-NLS-1$
private Expression(String expressionString) {
this.expressionString = expressionString;
}
@@ -274,6 +276,10 @@ public final class Expression {
if ((simpleExpression.contains("SPARK_VERSION["))) { //$NON-NLS-1$
return evaluateSparkVersion(simpleExpression, listParam, currentParam);
}
if ((simpleExpression.contains(CONTAINS))) { //$NON-NLS-1$
return evaluateContains(simpleExpression, listParam);
}
List<String> paraNames = getParaNamesFromIsShowFunc(simpleExpression);
if (paraNames.size() > 0) {
@@ -1030,5 +1036,28 @@ public final class Expression {
}
return false;
}
public static boolean evaluateContains(String simpleExpression, List<? extends IElementParameter> listParam) {
//Split to get param name and param value to look after
String[] splitted = simpleExpression.split(CONTAINS);
if (splitted.length != 2) {
return false;
}
String paramName = splitted[0].trim();
String paramValue = splitted[1].trim();
//Look for the param name in list
IElementParameter param = listParam.stream()
.filter(p -> paramName.equals(p.getName()))
.findAny()
.orElse(null);
if (param == null || ! EParameterFieldType.TABLE.equals(param.getFieldType())) {
return false;
}
// Check if we can find paraValue among table lines
return ((List<Map<String, Object>>) param.getValue()).stream()
.anyMatch(line -> paramValue.equals(line.toString()));
}
}

View File

@@ -23,6 +23,7 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.gef.palette.PaletteEntry;
import org.eclipse.jface.resource.ImageDescriptor;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.model.components.IComponent;
import org.talend.core.model.process.INode;
import org.talend.core.model.process.IProcess;
@@ -31,6 +32,7 @@ import org.talend.core.model.process.IReplaceNodeInProcess;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.JobletProcessItem;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryEditorInput;
import org.talend.core.model.update.UpdateResult;
import org.talend.designer.core.ui.editor.process.Process;
@@ -143,7 +145,7 @@ public abstract class AbstractProcessProvider implements IReplaceNodeInProcess {
}
}
}
/**
* DOC qzhang Comment method "canDeleteNode".
*
@@ -257,5 +259,10 @@ public abstract class AbstractProcessProvider implements IReplaceNodeInProcess {
public boolean canHandleNode(INode node) {
return false;
}
public IRepositoryEditorInput createJobletEditorInput(JobletProcessItem processItem, boolean load, Boolean lastVersion, Boolean readonly,
Boolean openedInJob) throws PersistenceException{
return null;
}
}

View File

@@ -808,6 +808,9 @@ public class ConnectionManager {
if (list.contains(newTarget)) {
return true;
}
if (source.equals(newTarget)) {
return true;
}
return false;
}

View File

@@ -256,6 +256,9 @@ public class JobContextLoadComponent implements IComponent {
source = self + "IGNORE_ERROR_MESSAGE"; //$NON-NLS-1$
multipleComponentManager.addParam(source, FILE_INPUT_REGEX + ".IGNORE_ERROR_MESSAGE"); //$NON-NLS-1$
source = self + "ENCODING";
multipleComponentManager.addParam(source, FILE_INPUT_REGEX + ".ENCODING"); //$NON-NLS-1$ //$NON-NLS-2$
} else {
String source = self + JobSettingsConstants.getExtraParameterName(EParameterName.URL.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".URL");

View File

@@ -96,6 +96,12 @@ public class JobSettingsManager {
private static final String CONNECTOR = TalendTextUtils.getStringConnect();
private static final String ENCODING_TYPE_UTF_8 = "UTF-8"; //$NON-NLS-1$
private static final String ENCODING_TYPE_ISO_8859_15 = "ISO-8859-15"; //$NON-NLS-1$
private static final String ENCODING_TYPE_CUSTOM = "CUSTOM"; //$NON-NLS-1$
private static List<IElementParameter> getHeaderFooterParameters(IProcess process) {
// for headerFooter Code
ElementParameter param;
@@ -384,6 +390,51 @@ public class JobSettingsManager {
param.setShowIf(condition);
paramList.add(param);
// begin Override encoding checkbox
param = new ElementParameter(process);
param.setName(EParameterName.OVERRIDE_ENCODING_FLAG.getName());
param.setDisplayName(EParameterName.OVERRIDE_ENCODING_FLAG.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.EXTRA);
param.setGroup(IMPLICIT_GROUP);
param.setNumRow(33);
param.setValue(false);
param.setShowIf(condition);
paramList.add(param);
// end Override encoding checkbox
// begin encoding select
ElementParameter encodingParam = new ElementParameter(process);
encodingParam.setName(EParameterName.OVERRIDE_ENCODING_IN_EXTRA.getName());
encodingParam.setDisplayName(EParameterName.OVERRIDE_ENCODING_IN_EXTRA.getDisplayName());
encodingParam.setCategory(EComponentCategory.EXTRA);
encodingParam.setGroup(IMPLICIT_GROUP);
encodingParam.setFieldType(EParameterFieldType.ENCODING_TYPE);
StringBuilder sb = new StringBuilder();
sb.append(JobSettingsConstants.getExtraParameterName(EParameterName.FROM_FILE_FLAG.getName())).append(" == 'true' and ")
.append(EParameterName.OVERRIDE_ENCODING_FLAG.getName()).append(" == 'true' and ").append(CONTEXTLOAD_CONDITION);
condition = JobSettingsConstants.addBrackets(sb.toString());
encodingParam.setShowIf(condition); // $NON-NLS-1$
encodingParam.setValue(ENCODING_TYPE_ISO_8859_15);
encodingParam.setNumRow(34);
paramList.add(encodingParam);
ElementParameter childParam = new ElementParameter(process);
childParam.setName(EParameterName.ENCODING_TYPE.getName());
childParam.setDisplayName(EParameterName.ENCODING_TYPE.getDisplayName());
childParam.setFieldType(EParameterFieldType.TECHNICAL);
childParam.setCategory(EComponentCategory.EXTRA);
childParam.setGroup(IMPLICIT_GROUP);
childParam.setListItemsDisplayName(new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
childParam.setListItemsDisplayCodeName(
new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
childParam.setListItemsValue(new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
childParam.setValue(ENCODING_TYPE_ISO_8859_15);
childParam.setNumRow(34);
childParam.setShow(true);
childParam.setShowIf(condition); // $NON-NLS-1$
childParam.setParentParameter(encodingParam);
// end encoding select
return paramList;
}
@@ -952,6 +1003,25 @@ public class JobSettingsManager {
tContextLoadNode.getElementParameter(EParameterName.IMPLICIT_TCONTEXTLOAD_FILE.getName()).setValue(inputFile);
String regex = FileSeparator.getSeparatorsRegexp(fileSparator);
tContextLoadNode.getElementParameter(JobSettingsConstants.IMPLICIT_TCONTEXTLOAD_REGEX).setValue(regex);
String encoding = (String) process.getElementParameter(EParameterName.OVERRIDE_ENCODING_IN_EXTRA.getName())
.getValue();
if (StringUtils.isNotEmpty(encoding) && !encoding.startsWith(TalendTextUtils.getQuoteChar())) {
encoding = TalendTextUtils.addQuotes(encoding);
}
// override encoding
paramName = EParameterName.OVERRIDE_ENCODING_FLAG.getName();
boolean overrideFlag = ((Boolean) process.getElementParameter(paramName).getValue())
&& process.getElementParameter(paramName).isShow(process.getElementParameters());
if (overrideFlag) {
IElementParameter encodingParam = new ElementParameter(tContextLoadNode);
encodingParam.setName(EParameterName.ENCODING.getName());
encodingParam.setDisplayName(EParameterName.ENCODING.getDisplayName());
encodingParam.setFieldType(EParameterFieldType.ENCODING_TYPE);
encodingParam.setValue(encoding);
tContextLoadNode.addElementParameter(encodingParam);
}
} else {
// is db
paramName = JobSettingsConstants.getExtraParameterName(EParameterName.URL.getName());

View File

@@ -737,6 +737,12 @@ public class StatsAndLogsManager {
if (isGeneric) {// reset the show if
resetShowIf(connectionNode);
if (checkUrlContainsAutoCommit(connectionNode)) {
IElementParameter autoCommitParam = connectionNode.getElementParameter("autocommit");//$NON-NLS-1$
if (autoCommitParam != null) {
autoCommitParam.setValue(Boolean.TRUE);
}
}
}
if (connectionComponentName.contains("Oracle")) {//$NON-NLS-1$
@@ -764,13 +770,44 @@ public class StatsAndLogsManager {
}
}
}
DataConnection dataConnec = createDataConnectionForSubJobOK(dataNode, commitNode);
((List<IConnection>) dataNode.getOutgoingConnections()).add(dataConnec);
((List<IConnection>) commitNode.getIncomingConnections()).add(dataConnec);
boolean noCommitNode = false;
if (checkUrlContainsAutoCommit(connectionNode)) {
IElementParameter autoCommitParam = connectionNode.getElementParameter("autocommit");//$NON-NLS-1$
if (autoCommitParam != null && autoCommitParam.getValue() != null) {
noCommitNode = Boolean.parseBoolean(autoCommitParam.getValue().toString());
if (noCommitNode && nodeList.contains(commitNode)) {
nodeList.remove(commitNode);
}
}
}
if (!noCommitNode) {
DataConnection dataConnec = createDataConnectionForSubJobOK(dataNode, commitNode);
((List<IConnection>) dataNode.getOutgoingConnections()).add(dataConnec);
((List<IConnection>) commitNode.getIncomingConnections()).add(dataConnec);
}
return connectionNode;
}
private static boolean checkUrlContainsAutoCommit(DataNode connectionNode) {
if (connectionNode != null) {
boolean isGeneric = connectionNode.getComponent().getComponentType() == EComponentType.GENERIC;
if (isGeneric) {
IElementParameter urlParam = connectionNode
.getElementParameter(EConnectionParameterName.GENERIC_URL.getDisplayName());
if (urlParam != null) {
Object obj = urlParam.getValue();
if (obj != null && obj instanceof String) {
String url = (String) obj;
if (url != null && url.toLowerCase().contains("autocommit=true")) {//$NON-NLS-1$
return true;
}
}
}
}
}
return false;
}
private static void resetShowIf(DataNode connectionNode) {
ComponentProperties tcomp_properties = connectionNode.getComponentProperties();
if (tcomp_properties != null) {

View File

@@ -634,6 +634,7 @@ public class Node extends Element implements IGraphicalNode {
if (param.getValue() instanceof IMetadataTable) {
IMetadataTable paramTable = (IMetadataTable) param.getValue();
table.getListColumns().addAll(paramTable.getListColumns());
table.setOriginalColumns(paramTable.getOriginalColumns());
table.setReadOnly(paramTable.isReadOnly());
} else if (param.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
Schema schema = (Schema) componentProperties.getValuedProperty(param.getName()).getValue();
@@ -1883,7 +1884,15 @@ public class Node extends Element implements IGraphicalNode {
if (id.equals(EParameterName.CONNECTION_FORMAT.getName())) {
connectionToParse = (String) value;
setConnectionName(ElementParameterParser.parse(this, connectionToParse));
boolean isTestCase = false;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
ITestContainerProviderService testContainerService = (ITestContainerProviderService) GlobalServiceRegister
.getDefault().getService(ITestContainerProviderService.class);
isTestCase = getProcess() != null && testContainerService.isTestContainerProcess(getProcess());
}
if (!isTestCase) {
setConnectionName(ElementParameterParser.parse(this, connectionToParse));
}
// to check
// String newValue = ElementParameterParser.parse(this, connectionToParse);
// setConnectionName(newValue);

View File

@@ -29,6 +29,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.ArrayUtils;
@@ -122,7 +123,9 @@ import org.talend.core.model.update.IUpdateManager;
import org.talend.core.model.utils.TalendTextUtils;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.repository.utils.ConvertJobsUtil;
import org.talend.core.repository.utils.ProjectHelper;
import org.talend.core.repository.utils.XmiResourceManager;
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
import org.talend.core.runtime.repository.item.ItemProductKeys;
import org.talend.core.runtime.util.ItemDateParser;
import org.talend.core.service.IScdComponentService;
@@ -1813,23 +1816,36 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
routinesDependencies = new ArrayList<RoutinesParameterType>();
}
try {
Project targetProject = new Project(ProjectManager.getInstance().getProject(getProperty()));
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
Set<IRepositoryViewObject> routines = new HashSet<>();
routines.addAll(factory.getAll(targetProject, ERepositoryObjectType.ROUTINES));
List<Project> referenceProjects = ProjectManager.getInstance().getAllReferencedProjects(targetProject, false);
referenceProjects.stream().forEach(p -> {
try {
routines.addAll(factory.getAll(p, ERepositoryObjectType.ROUTINES).stream()
.filter(o -> !((RoutineItem) o.getProperty().getItem()).isBuiltIn()).collect(Collectors.toList()));
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
});
Set<String> allRoutinesSet = routines.stream().map(o -> o.getProperty().getLabel()).collect(Collectors.toSet());
Iterator<RoutinesParameterType> iterator = routinesDependencies.iterator();
while (iterator.hasNext()) {
RoutinesParameterType routine = iterator.next();
if (!allRoutinesSet.contains(routine.getName())) {
iterator.remove();
}
}
List<String> possibleRoutines = new ArrayList<String>();
List<String> routinesToAdd = new ArrayList<String>();
String additionalString = LanguageManager.getCurrentLanguage() == ECodeLanguage.JAVA ? "." : "";
List<String> routinesAlreadySetup = new ArrayList<String>();
for (RoutinesParameterType routine : routinesDependencies) {
routinesAlreadySetup.add(routine.getName());
}
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
List<IRepositoryViewObject> routines = factory.getAll(ProjectManager.getInstance().getCurrentProject(),
ERepositoryObjectType.ROUTINES);
routines.addAll(factory.getAll(ProjectManager.getInstance().getCurrentProject(), ERepositoryObjectType.PIG_UDF));
for (Project project : ProjectManager.getInstance().getAllReferencedProjects()) {
for (Project project : referenceProjects) {
List<IRepositoryViewObject> refRoutines = factory.getAll(project, ERepositoryObjectType.ROUTINES);
refRoutines.addAll(factory.getAll(project, ERepositoryObjectType.PIG_UDF));
for (IRepositoryViewObject object : refRoutines) {
if (!((RoutineItem) object.getProperty().getItem()).isBuiltIn()) {
if (!possibleRoutines.contains(object.getLabel()) && !routinesAlreadySetup.contains(object.getLabel())) {
@@ -1854,9 +1870,8 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
possibleRoutines.add(object.getLabel());
}
}
for (Project project : ProjectManager.getInstance().getAllReferencedProjects()) {
for (Project project : referenceProjects) {
List<IRepositoryViewObject> refRoutines = factory.getAll(project, ERepositoryObjectType.ROUTINES);
refRoutines.addAll(factory.getAll(project, ERepositoryObjectType.PIG_UDF));
for (IRepositoryViewObject object : refRoutines) {
if (!((RoutineItem) object.getProperty().getItem()).isBuiltIn()) {
if (!possibleRoutines.contains(object.getLabel()) && !routinesAlreadySetup.contains(object.getLabel())) {
@@ -1914,12 +1929,25 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
}
for (IRepositoryViewObject object : routines) {
if (routinesToAdd.contains(object.getLabel()) && !routinesAlreadySetup.contains(object.getLabel())) {
RoutinesParameterType routinesParameterType = TalendFileFactory.eINSTANCE.createRoutinesParameterType();
routinesParameterType.setId(object.getId());
routinesParameterType.setName(object.getLabel());
routinesDependencies.add(routinesParameterType);
//
boolean isLimited = false;
org.talend.core.model.properties.Project currProject = getProject().getEmfProject();
org.talend.core.model.properties.Project project = ProjectManager.getInstance().getProject(this.property);
if (currProject != null && project != null && !currProject.equals(project)) {
int currOrdinal = ProjectHelper.getProjectTypeOrdinal(currProject);
int ordinal = ProjectHelper.getProjectTypeOrdinal(project);
if (currOrdinal > ordinal) {
isLimited = true;
}
}
if (!isLimited) {
for (IRepositoryViewObject object : routines) {
if (routinesToAdd.contains(object.getLabel()) && !routinesAlreadySetup.contains(object.getLabel())) {
RoutinesParameterType routinesParameterType = TalendFileFactory.eINSTANCE.createRoutinesParameterType();
routinesParameterType.setId(object.getId());
routinesParameterType.setName(object.getLabel());
routinesDependencies.add(routinesParameterType);
}
}
}
} catch (PersistenceException e) {
@@ -2777,9 +2805,14 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
continue;
}
}
EConnectionType type = EConnectionType.getTypeFromId(lineStyleId);
connec = new Connection(source, target, type, source.getConnectorFromType(type).getName(), metaname,
cType.getLabel(), cType.getMetaname(), monitorConnection);
if (!ConnectionManager.checkCircle(source, target)) {
EConnectionType type = EConnectionType.getTypeFromId(lineStyleId);
connec = new Connection(source, target, type, source.getConnectorFromType(type).getName(), metaname,
cType.getLabel(), cType.getMetaname(), monitorConnection);
} else {
ExceptionHandler.process(new Exception(Messages.getString("Process.errorCircleConnectionDetected", //$NON-NLS-1$
cType.getLabel(), source.getLabel(), target.getLabel())));
}
}
if (connec == null) {
continue;
@@ -4402,6 +4435,19 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
private void loadAdditionalProperties() {
if (additionalProperties == null) {
additionalProperties = new HashMap<Object, Object>();
try {
if (property.getItem() != null && ERepositoryObjectType.getType(property) != null) {
boolean isRouteProcess = ERepositoryObjectType.getType(property).equals(ERepositoryObjectType.PROCESS_ROUTE);
if (!isRouteProcess && "ROUTE"
.equals(this.property.getAdditionalProperties().get(TalendProcessArgumentConstant.ARG_BUILD_TYPE))) {
this.property.getAdditionalProperties().remove(TalendProcessArgumentConstant.ARG_BUILD_TYPE);
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
for (Object key : this.property.getAdditionalProperties().keySet()) {
additionalProperties.put(key, this.property.getAdditionalProperties().get(key));
}
@@ -4533,6 +4579,9 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
private void saveJobletNode(AbstractJobletContainer jobletContainer) {
if (CommonsPlugin.isHeadless()) {
return;
}
INode jobletNode = jobletContainer.getNode();
IProcess jobletProcess = jobletNode.getComponent().getProcess();
if (jobletProcess == null) {

View File

@@ -115,6 +115,7 @@ import org.talend.core.ui.ICDCProviderService;
import org.talend.core.ui.IJobletProviderService;
import org.talend.core.ui.component.ComponentsFactoryProvider;
import org.talend.cwm.helper.SAPBWTableHelper;
import org.talend.designer.core.DesignerPlugin;
import org.talend.designer.core.i18n.Messages;
import org.talend.designer.core.model.components.EParameterName;
import org.talend.designer.core.model.components.ElementParameter;
@@ -125,6 +126,7 @@ import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
import org.talend.designer.core.ui.editor.nodes.Node;
import org.talend.designer.core.ui.editor.update.UpdateCheckResult;
import org.talend.designer.core.ui.editor.update.UpdateManagerUtils;
import org.talend.designer.core.ui.preferences.TalendDesignerPrefConstants;
import org.talend.designer.core.utils.ConnectionUtil;
import org.talend.designer.core.utils.SAPParametersUtils;
import org.talend.metadata.managment.ui.utils.ConnectionContextHelper;
@@ -307,6 +309,10 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
}
}
} else {
Boolean propagate = DesignerPlugin.getDefault().getPreferenceStore().getBoolean(TalendDesignerPrefConstants.PROPAGATE_CONTEXT);
if(!propagate) {
return contextResults;
}
// only handle added groups
Set<String> contextSourceChecked = new HashSet<String>();
Set<String> processContextGroups = new HashSet<String>();

View File

@@ -1113,9 +1113,13 @@ public abstract class AbstractSchemaController extends AbstractRepositoryControl
for (IMetadataColumn column : metadataTable.getListColumns()) {
columnNames.add(column.getLabel());
}
metadataTable.setOriginalColumns(columnNames);
if(metadataTable.getOriginalColumns() == null || metadataTable.getOriginalColumns().isEmpty()){
metadataTable.setOriginalColumns(columnNames);
}
}
if(tableCopy.getOriginalColumns() == null || tableCopy.getOriginalColumns().isEmpty()){
tableCopy.setOriginalColumns(metadataTable.getOriginalColumns());
}
tableCopy.setOriginalColumns(metadataTable.getOriginalColumns());
}
}

View File

@@ -48,6 +48,7 @@ import org.talend.core.model.process.IElement;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.INode;
import org.talend.core.model.process.IProcess2;
import org.talend.core.runtime.services.IGenericService;
import org.talend.core.ui.IJobletProviderService;
import org.talend.core.ui.process.IGraphicalNode;
import org.talend.core.ui.properties.tab.IDynamicProperty;
@@ -209,6 +210,20 @@ public class ComponentListController extends AbstractElementPropertySectionContr
} else if (value != null && value.startsWith(oldConnectionName + "_")) {
curParam.setValue(value.replaceFirst(oldConnectionName + "_", newConnectionName + "_"));
}
}else if(curParam.getFieldType().equals(EParameterFieldType.COMPONENT_REFERENCE)){
String value = (String)curParam.getValue();
if (oldConnectionName.equals(value)) {
curParam.setValue(newConnectionName);
} else if (value != null && value.startsWith(oldConnectionName + "_")) {
curParam.setValue(value.replaceFirst(oldConnectionName + "_", newConnectionName + "_"));
}
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericService.class)) {
IGenericService genericService = (IGenericService) GlobalServiceRegister.getDefault().getService(
IGenericService.class);
if(genericService != null){
genericService.resetReferenceValue(curNode, oldConnectionName, newConnectionName);
}
}
} else if (curParam.getFieldType().equals(EParameterFieldType.TABLE)) {
final Object[] itemsValue = curParam.getListItemsValue();
for (Object element : itemsValue) {

View File

@@ -86,6 +86,7 @@ import org.talend.core.ui.properties.tab.IDynamicProperty;
import org.talend.core.ui.services.ISQLBuilderService;
import org.talend.core.utils.CsvArray;
import org.talend.core.utils.KeywordsValidator;
import org.talend.core.utils.TalendQuoteUtils;
import org.talend.designer.core.i18n.Messages;
import org.talend.designer.core.model.components.EParameterName;
import org.talend.designer.core.ui.editor.cmd.ChangeMetadataCommand;
@@ -214,6 +215,11 @@ public class GuessSchemaController extends AbstractElementPropertySectionControl
IElementParameter elementParameterFromField = elem.getElementParameterFromField(EParameterFieldType.MEMO_SQL);
memoSQL = (String) elementParameterFromField.getValue();
if (memoSQL == null || TalendQuoteUtils.removeQuotes(memoSQL).trim().isEmpty()) {
MessageDialog.open(MessageDialog.INFORMATION, this.btn.getShell(), "",
Messages.getString("GuessSchemaController.emptyQuery"), SWT.NONE);
return null;
}
initConnectionParameters();
if (this.connParameters != null && memoSQL != null) {
initConnectionParametersWithContext(elem, manager.getDefaultContext());

View File

@@ -200,6 +200,12 @@ public class GuessSchemaProcess extends AbstractGuessSchemaProcess {
|| EDatabaseTypeName.SAPHana.getXmlName().equals(info.getDbType())) {
createStatament = "conn.createStatement()";
}
if (EDatabaseTypeName.REDSHIFT.getXmlName().equals(info.getDbType())
|| EDatabaseTypeName.REDSHIFT_SSO.getXmlName().equals(info.getDbType())) {
createStatament = "conn.createStatement()";
}
codeStart = systemProperty + getCodeStart(connectionNode, createStatament, fetchSize);
codeMain = "String[] dataOneRow = new String[numbOfColumn];\r\n" + "for (int i = 1; i <= numbOfColumn; i++) {\r\n" //$NON-NLS-1$ //$NON-NLS-2$
@@ -207,13 +213,8 @@ public class GuessSchemaProcess extends AbstractGuessSchemaProcess {
+ "csvWriter.writeNext(dataOneRow);"; //$NON-NLS-1$
if(EDatabaseTypeName.REDSHIFT.getXmlName().equals(info.getDbType())||EDatabaseTypeName.REDSHIFT_SSO.getXmlName().equals(info.getDbType())){
codeEnd = "nbRows++;\r\n" + " if (nbRows > " + maximumRowsToPreview + ") break;\r\n" + "}\r\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "conn.close();\r\n" + "csvWriter.close();\r\n"; //$NON-NLS-1$ //$NON-NLS-2$
}else{
codeEnd = "nbRows++;\r\n" + " if (nbRows > " + maximumRowsToPreview + ") break;\r\n" + "}\r\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "conn.close();\r\n" + "csvWriter.close();\r\n"; //$NON-NLS-1$ //$NON-NLS-2$
}
codeEnd = "nbRows++;\r\n" + " if (nbRows > " + maximumRowsToPreview + ") break;\r\n" + "}\r\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "conn.close();\r\n" + "csvWriter.close();\r\n"; //$NON-NLS-1$ //$NON-NLS-2$
IComponent component = null;
switch (LanguageManager.getCurrentLanguage()) {
@@ -237,99 +238,34 @@ public class GuessSchemaProcess extends AbstractGuessSchemaProcess {
private String getCodeStart(INode connectionNode, String createStatament, int fetchSize){
IPath temppath = getTemppath();
String codeStart = null;
if(EDatabaseTypeName.REDSHIFT.getXmlName().equals(info.getDbType())||EDatabaseTypeName.REDSHIFT_SSO.getXmlName().equals(info.getDbType())){
INode node = getNode();
String tableName = (String) node.getElementParameter("TABLE").getValue();
String dbName = null;
String schema = null;
if(connectionNode!=null){
if(connectionNode.getElementParameter("DBNAME")!=null){
dbName = (String) connectionNode.getElementParameter("DBNAME").getValue();
}
if(connectionNode.getElementParameter("SCHEMA_DB")!=null){
schema = (String) connectionNode.getElementParameter("SCHEMA_DB").getValue();
}
}else{
if(node.getElementParameter("DBNAME")!=null){
dbName = (String) node.getElementParameter("DBNAME").getValue();
}
if(node.getElementParameter("SCHEMA_DB")!=null){
schema = (String) node.getElementParameter("SCHEMA_DB").getValue();
}
}
String codeStart = "java.lang.Class.forName(\"" + info.getDriverClassName() + "\");\r\n" + "String url = \"" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ info.getUrl() + "\";\r\n" + "java.sql.Connection conn = java.sql.DriverManager.getConnection(url, \"" //$NON-NLS-1$ //$NON-NLS-2$
+ info.getUsername() + "\", \"" + info.getPwd() + "\");\r\n" + "java.sql.Statement stm = " + createStatament + ";\r\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "try {\r\nstm.setFetchSize(" + fetchSize //$NON-NLS-1$
+ ");\r\n} catch (Exception e) {\r\n// Exception is thrown if db don't support, no need to catch exception here\r\n} \r\n" //$NON-NLS-1$
+ "java.sql.ResultSet rs = stm.executeQuery(" + memoSQL + ");\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "java.sql.ResultSetMetaData rsmd = rs.getMetaData();\r\n" + "int numbOfColumn = rsmd.getColumnCount();\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "\r\n" + "String fileName = (new java.io.File(\r\n" + " \"" + temppath //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "\")).getAbsolutePath().replace(\r\n" + " \"\\\\\", \"/\");\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "com.talend.csv.CSVWriter csvWriter = new com.talend.csv.CSVWriter(\r\n" //$NON-NLS-1$
+ " new java.io.BufferedWriter(new java.io.OutputStreamWriter(\r\n" //$NON-NLS-1$
+ " new java.io.FileOutputStream(\r\n" //$NON-NLS-1$
+ " fileName, false),\r\n" //$NON-NLS-1$
+ " \"GBK\")));\r\n" + " \r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "csvWriter.setSeparator(';');\r\n" + "csvWriter.setQuoteStatus(com.talend.csv.CSVWriter.QuoteStatus.FORCE);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "int nbRows = 0;\r\n" //$NON-NLS-1$
+ "String[] columnNames = new String[numbOfColumn];\r\n" + "String[] nullables = new String[numbOfColumn];\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "String[] lengths = new String[numbOfColumn];\r\n" + "String[] precisions = new String[numbOfColumn];\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "String[] dbtypes = new String[numbOfColumn];\r\n" //$NON-NLS-1$
+ "for(int i = 1;i<=numbOfColumn;i++){\r\n" + "columnNames[i-1] = rsmd.getColumnName(i);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "nullables[i-1] = rsmd.isNullable(i) == 0? \"false\" : \"true\";\r\n" //$NON-NLS-1$
+ "lengths[i-1] = Integer.toString(rsmd.getScale(i));\r\n" //$NON-NLS-1$
+ "precisions[i-1] = Integer.toString(rsmd.getPrecision(i));" //$NON-NLS-1$
+ "dbtypes[i-1] = rsmd.getColumnTypeName(i);\r\n" + "}\r\n" //$NON-NLS-1$ //$NON-NLS-2$
codeStart = "java.lang.Class.forName(\"" + info.getDriverClassName() + "\");\r\n" + "String url = \"" + info.getUrl() //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "\";\r\n" + "java.sql.Connection conn = java.sql.DriverManager.getConnection(url, \"" + info.getUsername() //$NON-NLS-1$ //$NON-NLS-2$
+ "\", \"" + info.getPwd() + "\");\r\n" + "java.sql.DatabaseMetaData metaData = conn.getMetaData();\r\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "java.sql.ResultSet rs = metaData.getColumns(" + dbName + "," + schema + "," + tableName + ",null);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "\r\n" + "String fileName = (new java.io.File(\r\n" + " \"" + temppath //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "\")).getAbsolutePath().replace(\r\n" + " \"\\\\\", \"/\");\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "com.talend.csv.CSVWriter csvWriter = new com.talend.csv.CSVWriter(\r\n" //$NON-NLS-1$
+ " new java.io.BufferedWriter(new java.io.OutputStreamWriter(\r\n" //$NON-NLS-1$
+ " new java.io.FileOutputStream(\r\n" //$NON-NLS-1$
+ " fileName, false),\r\n" //$NON-NLS-1$
+ " \"GBK\")));\r\n" + " \r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "csvWriter.setSeparator(';');\r\n" + "csvWriter.setQuoteStatus(com.talend.csv.CSVWriter.QuoteStatus.FORCE);\r\n" + "int nbRows = 0;\r\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "java.util.List<String> columnNameList= new java.util.ArrayList<String>();\r\n" + "java.util.List<String> nullableList= new java.util.ArrayList<String>();\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "java.util.List<String> lengthList= new java.util.ArrayList<String>();\r\n" + "java.util.List<String> precisionList= new java.util.ArrayList<String>();\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "java.util.List<String> dbtypeList= new java.util.ArrayList<String>();\r\n" //$NON-NLS-1$
+"while (rs.next()) {\r\n" //$NON-NLS-1$
+"columnNameList.add(rs.getString(\"COLUMN_NAME\"));\r\n" //$NON-NLS-1$
+"nullableList.add(rs.getBoolean(\"NULLABLE\") ? \"true\" : \"false\");\r\n" //$NON-NLS-1$
+"lengthList.add(Integer.toString(rs.getInt(\"COLUMN_SIZE\")));\r\n" //$NON-NLS-1$
+"precisionList.add(Integer.toString(rs.getInt(\"NUM_PREC_RADIX\")));\r\n" //$NON-NLS-1$
+"dbtypeList.add(rs.getString(\"TYPE_NAME\"));\r\n" //$NON-NLS-1$
+"}\r\n" //$NON-NLS-1$
+"int numbOfColumn = columnNameList.size();" //$NON-NLS-1$
+ "String[] columnNames = new String[numbOfColumn];\r\n" + "String[] nullables = new String[numbOfColumn];\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "String[] lengths = new String[numbOfColumn];\r\n" + "String[] precisions = new String[numbOfColumn];\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "String[] dbtypes = new String[numbOfColumn];\r\n" //$NON-NLS-1$
+ "for(int i = 0;i<=numbOfColumn-1;i++){\r\n" + "columnNames[i] = columnNameList.get(i);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "nullables[i] = nullableList.get(i);\r\n" //$NON-NLS-1$
+ "lengths[i] = lengthList.get(i);\r\n" //$NON-NLS-1$
+ "precisions[i] = precisionList.get(i);" //$NON-NLS-1$
+ "dbtypes[i] = dbtypeList.get(i);\r\n" + "}\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "csvWriter.writeNext(columnNames);\r\n" + "csvWriter.writeNext(nullables);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "csvWriter.writeNext(lengths);\r\n" + "csvWriter.writeNext(precisions);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "csvWriter.writeNext(dbtypes);\r\n" + "while (rs.next()) {"; //$NON-NLS-1$ //$NON-NLS-2$
}else{
codeStart = "java.lang.Class.forName(\"" + info.getDriverClassName() + "\");\r\n" + "String url = \"" + info.getUrl() //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "\";\r\n" + "java.sql.Connection conn = java.sql.DriverManager.getConnection(url, \"" + info.getUsername() //$NON-NLS-1$ //$NON-NLS-2$
+ "\", \"" + info.getPwd() + "\");\r\n" + "java.sql.Statement stm = " + createStatament + ";\r\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "try {\r\nstm.setFetchSize(" + fetchSize + ");\r\n} catch (Exception e) {\r\n// Exception is thrown if db don't support, no need to catch exception here\r\n} \r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "java.sql.ResultSet rs = stm.executeQuery(" + memoSQL + ");\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "java.sql.ResultSetMetaData rsmd = rs.getMetaData();\r\n" + "int numbOfColumn = rsmd.getColumnCount();\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "\r\n" + "String fileName = (new java.io.File(\r\n" + " \"" + temppath //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "\")).getAbsolutePath().replace(\r\n" + " \"\\\\\", \"/\");\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "com.talend.csv.CSVWriter csvWriter = new com.talend.csv.CSVWriter(\r\n" //$NON-NLS-1$
+ " new java.io.BufferedWriter(new java.io.OutputStreamWriter(\r\n" //$NON-NLS-1$
+ " new java.io.FileOutputStream(\r\n" //$NON-NLS-1$
+ " fileName, false),\r\n" //$NON-NLS-1$
+ " \"GBK\")));\r\n" + " \r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "csvWriter.setSeparator(';');\r\n" + "csvWriter.setQuoteStatus(com.talend.csv.CSVWriter.QuoteStatus.FORCE);\r\n" + "int nbRows = 0;\r\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "String[] columnNames = new String[numbOfColumn];\r\n" + "String[] nullables = new String[numbOfColumn];\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "String[] lengths = new String[numbOfColumn];\r\n" + "String[] precisions = new String[numbOfColumn];\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "String[] dbtypes = new String[numbOfColumn];\r\n" //$NON-NLS-1$
+ "for(int i = 1;i<=numbOfColumn;i++){\r\n" + "columnNames[i-1] = rsmd.getColumnName(i);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "nullables[i-1] = rsmd.isNullable(i) == 0? \"false\" : \"true\";\r\n" //$NON-NLS-1$
+ "lengths[i-1] = Integer.toString(rsmd.getScale(i));\r\n" //$NON-NLS-1$
+ "precisions[i-1] = Integer.toString(rsmd.getPrecision(i));" //$NON-NLS-1$
+ "dbtypes[i-1] = rsmd.getColumnTypeName(i);\r\n" + "}\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "csvWriter.writeNext(columnNames);\r\n" + "csvWriter.writeNext(nullables);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "csvWriter.writeNext(lengths);\r\n" + "csvWriter.writeNext(precisions);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "csvWriter.writeNext(dbtypes);\r\n" + "while (rs.next()) {"; //$NON-NLS-1$ //$NON-NLS-2$
}
+ "csvWriter.writeNext(columnNames);\r\n" + "csvWriter.writeNext(nullables);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "csvWriter.writeNext(lengths);\r\n" + "csvWriter.writeNext(precisions);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
+ "csvWriter.writeNext(dbtypes);\r\n" + "while (rs.next()) {"; //$NON-NLS-1$ //$NON-NLS-2$
return codeStart;
}

View File

@@ -133,7 +133,7 @@ public class DesignerPreferencePage extends FieldEditorPreferencePage implements
Messages.getString("DesignerPreferencePage.duplicateTestCases"), getFieldEditorParent()); //$NON-NLS-1$
addField(duplicateTestCases);
}
DirectoryFieldEditor compDefaultFileDir = new DirectoryFieldEditor(TalendDesignerPrefConstants.COMP_DEFAULT_FILE_DIR,
Messages.getString("DesignerPreferencePage.defaultFilePathDirectory"), getFieldEditorParent()) {

View File

@@ -64,6 +64,9 @@ public class PerformancePreferencePage extends FieldEditorPreferencePage impleme
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.CHECK_ONLY_LAST_VERSION,
Messages.getString("PerformancePreferencePage.checkVersion"), //$NON-NLS-1$
getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.PROPAGATE_CONTEXT,
Messages.getString("PerformancePreferencePage.propagateContext"), //$NON-NLS-1$
getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.PROPAGATE_CONTEXT_VARIABLE,
Messages.getString("PerformancePreferencePage.addOrDeleteVariable"), //$NON-NLS-1$
getFieldEditorParent()));
@@ -100,6 +103,9 @@ public class PerformancePreferencePage extends FieldEditorPreferencePage impleme
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.CHECK_ONLY_LAST_VERSION,
Messages.getString("PerformancePreferencePage.checkVersion"), //$NON-NLS-1$
getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.PROPAGATE_CONTEXT,
Messages.getString("PerformancePreferencePage.propagateContext"), //$NON-NLS-1$
getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.PROPAGATE_CONTEXT_VARIABLE,
Messages.getString("PerformancePreferencePage.addOrDeleteVariable"), //$NON-NLS-1$
getFieldEditorParent()));

View File

@@ -175,6 +175,8 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
store.setDefault(ITalendCorePrefConstants.NEXUS_TIMEOUT, 20000);
store.setDefault(ITalendCorePrefConstants.NEXUS_REFRESH_FREQUENCY, 0);
store.setDefault(ITalendCorePrefConstants.NEXUS_SHARE_LIBS, true);
if (!CommonUIPlugin.isFullyHeadless()) {
Display display = Display.getDefault();
if (display == null) {

View File

@@ -67,6 +67,8 @@ public class TalendDesignerPrefConstants {
public static final String EDITOR_LINESTYLE = "editorLineStyle "; //$NON-NLS-1$
public static final String DUPLICATE_TESTCASE = "duplicateTestCases "; //$NON-NLS-1$
public static final String PROPAGATE_CONTEXT = "propagateContext"; //$NON-NLS-1$
public static final String SCHEMA_OPTIONS = "schemaOptions"; //$NON-NLS-1$

View File

@@ -85,6 +85,12 @@ public class ProjectSettingManager extends Utils {
private static String languagePrefix = LanguageManager.getCurrentLanguage().toString() + "_"; //$NON-NLS-1$
private static final String ENCODING_TYPE_UTF_8 = "UTF-8"; //$NON-NLS-1$
private static final String ENCODING_TYPE_ISO_8859_15 = "ISO-8859-15"; //$NON-NLS-1$
private static final String ENCODING_TYPE_CUSTOM = "CUSTOM"; //$NON-NLS-1$
public static void saveProject() {
RepositoryContext repositoryContext = (RepositoryContext) CorePlugin.getContext().getProperty(
Context.REPOSITORY_CONTEXT_KEY);
@@ -448,6 +454,51 @@ public class ProjectSettingManager extends Utils {
param.setShowIf(condition);
paramList.add(param);
// begin Override encoding checkbox
param = new ElementParameter(elem);
param.setName(EParameterName.OVERRIDE_ENCODING_FLAG.getName());
param.setDisplayName(EParameterName.OVERRIDE_ENCODING_FLAG.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.EXTRA);
param.setGroup(IMPLICIT_GROUP);
param.setNumRow(33);
param.setValue(false);
param.setShowIf(condition);
paramList.add(param);
// end Override encoding checkbox
// begin encoding select
ElementParameter encodingParam = new ElementParameter(elem);
encodingParam.setName(EParameterName.OVERRIDE_ENCODING_IN_EXTRA.getName());
encodingParam.setDisplayName(EParameterName.OVERRIDE_ENCODING_IN_EXTRA.getDisplayName());
encodingParam.setCategory(EComponentCategory.EXTRA);
encodingParam.setGroup(IMPLICIT_GROUP);
encodingParam.setFieldType(EParameterFieldType.ENCODING_TYPE);
StringBuilder sb = new StringBuilder();
sb.append(JobSettingsConstants.getExtraParameterName(EParameterName.FROM_FILE_FLAG.getName())).append(" == 'true' and ")
.append(EParameterName.OVERRIDE_ENCODING_FLAG.getName()).append(" == 'true' and ").append(CONTEXTLOAD_CONDITION);
condition = JobSettingsConstants.addBrackets(sb.toString());
encodingParam.setShowIf(condition); // $NON-NLS-1$
encodingParam.setValue(ENCODING_TYPE_ISO_8859_15);
encodingParam.setNumRow(34);
paramList.add(encodingParam);
ElementParameter childParam = new ElementParameter(elem);
childParam.setName(EParameterName.ENCODING_TYPE.getName());
childParam.setDisplayName(EParameterName.ENCODING_TYPE.getDisplayName());
childParam.setFieldType(EParameterFieldType.TECHNICAL);
childParam.setCategory(EComponentCategory.EXTRA);
childParam.setGroup(IMPLICIT_GROUP);
childParam.setListItemsDisplayName(new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
childParam.setListItemsDisplayCodeName(
new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
childParam.setListItemsValue(new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
childParam.setValue(ENCODING_TYPE_ISO_8859_15);
childParam.setNumRow(34);
childParam.setShow(true);
childParam.setShowIf(condition); // $NON-NLS-1$
childParam.setParentParameter(encodingParam);
// end encoding select
}
private static void createExtraOnDBParameters(Element elem) {

View File

@@ -115,6 +115,8 @@ public class DeploymentComposite extends AbstractTabComposite {
private boolean isDataServiceJob; // Is ESB SOAP Service Job
private boolean isChildJob;
public DeploymentComposite(Composite parent, int style, TabbedPropertySheetWidgetFactory widgetFactory,
IRepositoryViewObject repositoryViewObject) {
super(parent, style, widgetFactory, repositoryViewObject);
@@ -139,6 +141,7 @@ public class DeploymentComposite extends AbstractTabComposite {
defaultVersion = getDefaultVersion(process.getVersion());
isDataServiceJob = false;
isChildJob = false;
// Disable widgests in case of the job is for ESB data service
if (!process.getComponentsType().equals(ComponentCategory.CATEGORY_4_CAMEL.getName())) {
List<INode> nodes = (List<INode>) process.getGraphicalNodes();
@@ -149,6 +152,13 @@ public class DeploymentComposite extends AbstractTabComposite {
break;
}
}
for (INode node : nodes) {
if ("tRouteInput".equals(node.getComponent().getName())) {
isChildJob = true;
break;
}
}
}
} else {
IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
@@ -211,6 +221,17 @@ public class DeploymentComposite extends AbstractTabComposite {
widgetFactory.createLabel(messageComposite,
"SOAP data service cannot be published, deployment setting is \naccording to the defined service.");
}
if (isChildJob) {
Composite messageComposite = new Composite(this, SWT.NONE);
GridLayout layout = new GridLayout(1, false);
layout.horizontalSpacing = 10;
layout.verticalSpacing = 10;
messageComposite.setLayout(layout);
messageComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
widgetFactory.createLabel(messageComposite,
"Deployment parameters will be inherited from parent route during publishing from Studio and Command Line");
}
Composite composite = new Composite(this, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
layout.horizontalSpacing = 10;

View File

@@ -587,6 +587,7 @@ public class MainComposite extends AbstractTabComposite {
|| property == null) {
return;
}
String oldVersion = repositoryObject.getVersion();
String originalName = nameText.getText();
String originalJobType = jobTypeCCombo.getText();
String originalFramework = ConvertJobsUtil.convertFrameworkByJobType(originalJobType,
@@ -779,8 +780,11 @@ public class MainComposite extends AbstractTabComposite {
public void run(final IProgressMonitor monitor) throws CoreException {
try {
if (repositoryObject.getProperty() != null) {
if (!originalversion.equals(StringUtils.trimToEmpty(oldVersion))) {
RelationshipItemBuilder.getInstance().addOrUpdateItem(repositoryObject.getProperty().getItem());
}
proxyRepositoryFactory.save(ProjectManager.getInstance().getCurrentProject(),
repositoryObject.getProperty().getItem(), false);
repositoryObject.getProperty(), oldName, oldVersion);
if (needjobletRelateUpdate && GlobalServiceRegister.getDefault()
.isServiceRegistered(IJobletProviderService.class)) {
IJobletProviderService jobletService = (IJobletProviderService) GlobalServiceRegister

View File

@@ -10,27 +10,29 @@
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.designer.runprocess.bigdata;
package org.talend.designer.core.utils;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.util.EList;
import org.osgi.framework.Bundle;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.hadoop.HadoopConstants;
import org.talend.core.hadoop.version.EHadoopDistributions;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.properties.Property;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.IProcess;
import org.talend.core.model.process.IProcess2;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
/**
* created by nrousseau on Mar 24, 2018 Detailled comment
@@ -38,10 +40,10 @@ import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
*/
public class BigDataJobUtil {
private ProcessItem processItem;
private IProcess process;
public BigDataJobUtil(ProcessItem processItem) {
this.processItem = processItem;
public BigDataJobUtil(IProcess process) {
this.process = process;
}
/**
@@ -68,11 +70,10 @@ public class BigDataJobUtil {
public boolean isSparkWithHDInsight() {
boolean isSparkWithHDInsight = false;
if (isBDJobWithFramework(ERepositoryObjectType.PROCESS_MR, HadoopConstants.FRAMEWORK_SPARK)
|| isBDJobWithFramework(ERepositoryObjectType.PROCESS_STORM,
HadoopConstants.FRAMEWORK_SPARKSTREAMING)) {
EList<ElementParameterType> parameters = processItem.getProcess().getParameters().getElementParameter();
|| isBDJobWithFramework(ERepositoryObjectType.PROCESS_STORM, HadoopConstants.FRAMEWORK_SPARKSTREAMING)) {
List<? extends IElementParameter> parameters = process.getElementParametersWithChildrens();
boolean modeParameterVisited = false;
for (ElementParameterType pt : parameters) {
for (IElementParameter pt : parameters) {
if (pt.getName().equals("SPARK_LOCAL_MODE")) { //$NON-NLS-1$
modeParameterVisited = true;
if ("true".equals(pt.getValue())) { //$NON-NLS-1$
@@ -96,11 +97,11 @@ public class BigDataJobUtil {
public boolean isMRWithHDInsight() {
Boolean isMRWithHDInsight = false;
if (processItem != null) {
if (process != null) {
isMRWithHDInsight = false;
if (isBDJobWithFramework(ERepositoryObjectType.PROCESS_MR, HadoopConstants.FRAMEWORK_MAPREDUCE)) {
EList<ElementParameterType> parameters = processItem.getProcess().getParameters().getElementParameter();
for (ElementParameterType pt : parameters) {
List<? extends IElementParameter> parameters = process.getElementParametersWithChildrens();
for (IElementParameter pt : parameters) {
if (pt.getName().equals("DISTRIBUTION") //$NON-NLS-1$
&& EHadoopDistributions.MICROSOFT_HD_INSIGHT.getName().equals(pt.getValue())) {
isMRWithHDInsight = true;
@@ -119,11 +120,10 @@ public class BigDataJobUtil {
Boolean isSparkInYarnClusterMode = false;
// Test if we are in Spark or Spark streaming
if (isBDJobWithFramework(ERepositoryObjectType.PROCESS_MR, HadoopConstants.FRAMEWORK_SPARK)
|| isBDJobWithFramework(ERepositoryObjectType.PROCESS_STORM,
HadoopConstants.FRAMEWORK_SPARKSTREAMING)) {
|| isBDJobWithFramework(ERepositoryObjectType.PROCESS_STORM, HadoopConstants.FRAMEWORK_SPARKSTREAMING)) {
EList<ElementParameterType> parameters = processItem.getProcess().getParameters().getElementParameter();
for (ElementParameterType pt : parameters) {
List<? extends IElementParameter> parameters = process.getElementParametersWithChildrens();
for (IElementParameter pt : parameters) {
if (HadoopConstants.SPARK_MODE.equals(pt.getName())
&& HadoopConstants.SPARK_MODE_YARN_CLUSTER.equals(pt.getValue())) {
isSparkInYarnClusterMode = true;
@@ -135,29 +135,26 @@ public class BigDataJobUtil {
}
private boolean isBDJobWithFramework(ERepositoryObjectType objectType, String frameworkName) {
if (processItem != null) {
// Storm/SparkStreaming(PROCESS_STORM), MR/Spark(PROCESS_MR)
if (ERepositoryObjectType.getItemType(processItem).equals(objectType)) { // have same type
Property property = processItem.getProperty();
if (property != null && property.getAdditionalProperties() != null
&& frameworkName.equals(property.getAdditionalProperties().get(HadoopConstants.FRAMEWORK))) {
return true;
}
}
// Storm/SparkStreaming(PROCESS_STORM), MR/Spark(PROCESS_MR)
if (process != null && process instanceof IProcess2 && ((IProcess2) process).getAdditionalProperties() != null
&& frameworkName.equals(((IProcess2) process).getAdditionalProperties().get(HadoopConstants.FRAMEWORK))) {
return true;
}
return false;
}
/** Find the distribution where the generated jar rquired to have the context files inside **/
public boolean needsToHaveContextInsideJar() {
if (processItem.getProcess() != null && processItem.getProcess().getParameters() != null) {
EList<ElementParameterType> parameters = processItem.getProcess().getParameters().getElementParameter();
for (ElementParameterType pt : parameters) {
List<? extends IElementParameter> parameters = process.getElementParametersWithChildrens();
if (process != null && parameters != null) {
for (IElementParameter pt : parameters) {
if (pt.getName().equals("DISTRIBUTION")) { //$NON-NLS-1$
String value = pt.getValue();
String value = String.valueOf(pt.getValue());
if ("MICROSOFT_HD_INSIGHT".equals(value) //$NON-NLS-1$
|| "GOOGLE_CLOUD_DATAPROC".equals(value) //$NON-NLS-1$
|| "CLOUDERA_ALTUS".equals(value)) { //$NON-NLS-1$
|| "CLOUDERA_ALTUS".equals(value) || "DATABRICKS".equals(value) || "QUBOLE".equals(value)) { //$NON-NLS-1$
return true;
}
}
@@ -169,6 +166,27 @@ public class BigDataJobUtil {
return false;
}
public void setExcludedModules(Collection<ModuleNeeded> modulesNeeded) {
if (isMRWithHDInsight() || isSparkWithHDInsight()) {
// we need to exclude every non-MR Required jars.
for (ModuleNeeded currentModule : modulesNeeded) {
if (currentModule.isMrRequired()) {
currentModule.setExcluded(true);
}
}
}
}
public void removeExcludedModules(Collection<ModuleNeeded> modulesNeeded) {
Iterator<ModuleNeeded> itModules = modulesNeeded.iterator();
while (itModules.hasNext()) {
ModuleNeeded module = itModules.next();
if (module.isExcluded()) {
itModules.remove();
}
}
}
/**
* DOC nrousseau Comment method "getShadedModulesExclude".
*
@@ -182,6 +200,8 @@ public class BigDataJobUtil {
for (ModuleNeeded currentModule : modulesNeeded) {
if (!currentModule.isMrRequired()) {
excludedModules.add(currentModule);
} else {
currentModule.setExcluded(true);
}
}
}

View File

@@ -0,0 +1,120 @@
// ============================================================================
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.designer.core.utils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.model.components.ComponentUtilities;
import org.talend.core.model.components.ModifyComponentsAction;
import org.talend.core.model.components.conversions.IComponentConversion;
import org.talend.core.model.components.filters.IComponentFilter;
import org.talend.core.model.components.filters.NameComponentFilter;
import org.talend.core.model.migration.AbstractItemMigrationTask;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.JobletProcessItem;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.designer.core.DesignerPlugin;
import org.talend.designer.core.model.components.EParameterName;
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
import org.talend.repository.model.IProxyRepositoryFactory;
/**
* Created by bhe on Nov 22, 2019
*/
public class FillTRunJobReferenceParametersMigrationTask extends AbstractItemMigrationTask {
@Override
public List<ERepositoryObjectType> getTypes() {
List<ERepositoryObjectType> toReturn = new ArrayList<ERepositoryObjectType>();
toReturn.addAll(ERepositoryObjectType.getAllTypesOfProcess());
toReturn.addAll(ERepositoryObjectType.getAllTypesOfProcess2());
return toReturn;
}
@Override
public final ExecutionResult execute(Item item) {
ProcessType pt = null;
if (item instanceof ProcessItem) {
ProcessItem processItem = (ProcessItem) item;
pt = processItem.getProcess();
} else if (item instanceof JobletProcessItem) {
JobletProcessItem jobletItem = (JobletProcessItem) item;
pt = jobletItem.getJobletProcess();
}
if (pt == null) {
return ExecutionResult.NOTHING_TO_DO;
}
IComponentFilter filter = new NameComponentFilter("tRunJob"); //$NON-NLS-1$
try {
ModifyComponentsAction.searchAndModify(item, pt, filter,
Arrays.<IComponentConversion> asList(new IComponentConversion() {
@Override
public void transform(NodeType node) {
ElementParameterType jobId = ComponentUtilities.getNodeProperty(node,
EParameterName.PROCESS.getName() + ":" + EParameterName.PROCESS_TYPE_PROCESS.getName()); //$NON-NLS-1$
if (jobId.getValue() == null || jobId.getValue().isEmpty()) {
ElementParameterType jobLabel = ComponentUtilities.getNodeProperty(node,
EParameterName.PROCESS.getName()); // $NON-NLS-1$
String id = getIdFormLabel(jobLabel.getValue());
if (id != null && !id.isEmpty()) {
jobId.setValue(id);
}
}
}
}));
} catch (PersistenceException e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
return ExecutionResult.SUCCESS_NO_ALERT;
}
private static String getIdFormLabel(final String label) {
if (label == null || label.isEmpty()) {
return null;
}
final IProxyRepositoryFactory proxyRepositoryFactory = DesignerPlugin.getDefault().getProxyRepositoryFactory();
try {
List<IRepositoryViewObject> allRepositoryObject = proxyRepositoryFactory.getAll(ERepositoryObjectType.PROCESS, true);
for (IRepositoryViewObject repObject : allRepositoryObject) {
Item item = repObject.getProperty().getItem();
if (item != null && label.equals(item.getProperty().getLabel())) {
return item.getProperty().getId();
}
}
} catch (PersistenceException e) {
//
}
return null;
}
public Date getOrder() {
GregorianCalendar gc = new GregorianCalendar(2019, 11, 22, 12, 0, 0);
return gc.getTime();
}
}

View File

@@ -27,12 +27,9 @@ import org.apache.commons.lang.StringUtils;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.talend.core.CorePlugin;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ILibraryManagerService;
import org.talend.core.hadoop.IHadoopClusterService;
import org.talend.core.hadoop.repository.HadoopRepositoryUtil;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.general.ModuleNeeded.ELibraryInstallStatus;
import org.talend.core.model.process.EParameterFieldType;
import org.talend.core.model.process.IContext;
import org.talend.core.model.process.IContextParameter;
@@ -106,6 +103,10 @@ public class JavaProcessUtil {
}
}
if (BitwiseOptionUtils.containOption(options, TalendProcessOptionConstants.MODULES_EXCLUDE_SHADED)) {
new BigDataJobUtil(process).removeExcludedModules(modulesNeeded);
}
return new HashSet<ModuleNeeded>(modulesNeeded);
}
@@ -208,6 +209,7 @@ public class JavaProcessUtil {
if (hadoopItemId != null) {
useCustomConfsJarIfNeeded(modulesNeeded, hadoopItemId);
}
new BigDataJobUtil(process).setExcludedModules(modulesNeeded);
}
public static String getHadoopClusterItemId(INode node) {

View File

@@ -2,8 +2,10 @@ package org.talend.designer.core.utils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.talend.core.model.metadata.IMetadataColumn;
import org.talend.core.model.metadata.IMetadataTable;
@@ -386,7 +388,18 @@ public class ParallelExecutionUtils {
}
public static boolean isExistPreviousParCon(Node previousNode) {
Set<String> checkedNodeSet = new HashSet<String>();
boolean existPreviousParCon = isExistPreviousParCon(previousNode, checkedNodeSet);
return existPreviousParCon;
}
private static boolean isExistPreviousParCon(Node previousNode, Set<String> checkedSet) {
boolean hasParInPreviousCon = false;
if (previousNode == null || checkedSet.contains(previousNode.getUniqueName())) {
// already checked, return
return hasParInPreviousCon;
}
checkedSet.add(previousNode.getUniqueName());
if (previousNode.getIncomingConnections().size() > 0) {
for (IConnection con : previousNode.getIncomingConnections()) {
if (con.getElementParameter(EParameterName.PARTITIONER.getName()) != null
@@ -396,7 +409,10 @@ public class ParallelExecutionUtils {
hasParInPreviousCon = true;
break;
} else {
hasParInPreviousCon = isExistPreviousParCon((Node) con.getSource());
hasParInPreviousCon = isExistPreviousParCon((Node) con.getSource(), checkedSet);
if (hasParInPreviousCon) {
break;
}
}
}
}

View File

@@ -27,8 +27,12 @@ import java.util.regex.PatternSyntaxException;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.commons.utils.StringUtils;
import org.talend.commons.utils.data.text.StringHelper;
import org.talend.core.database.EDatabaseTypeName;
import org.talend.core.model.metadata.Dbms;
import org.talend.core.model.metadata.IMetadataColumn;
import org.talend.core.model.metadata.IMetadataTable;
import org.talend.core.model.metadata.MappingTypeRetriever;
import org.talend.core.model.metadata.MetadataTalendType;
import org.talend.core.model.metadata.MetadataToolHelper;
import org.talend.core.model.process.EConnectionType;
import org.talend.core.model.process.IConnection;
@@ -40,6 +44,7 @@ import org.talend.core.model.process.INode;
import org.talend.core.model.process.IProcess;
import org.talend.core.model.utils.ContextParameterUtils;
import org.talend.core.model.utils.TalendTextUtils;
import org.talend.core.utils.TalendQuoteUtils;
import org.talend.designer.core.model.components.EParameterName;
import org.talend.designer.dbmap.DbMapComponent;
import org.talend.designer.dbmap.external.data.ExternalDbMapData;
@@ -74,6 +79,8 @@ public abstract class DbGenerationManager {
protected String tabSpaceString = DEFAULT_TAB_SPACE_STRING;
private final String DOT_STR = "."; //$NON-NLS-1$
protected static final String DEFAULT_TAB_SPACE_STRING = ""; //$NON-NLS-1$
protected List<String> queryColumnsSegments = new ArrayList<String>();
@@ -86,6 +93,8 @@ public abstract class DbGenerationManager {
protected Set<String> subQueryTable = new HashSet<String>();
protected Set<String> inputSchemaContextSet = new HashSet<String>();
/**
* DOC amaumont GenerationManager constructor comment.
*
@@ -271,6 +280,7 @@ public abstract class DbGenerationManager {
queryColumnsSegments.clear();
querySegments.clear();
subQueryTable.clear();
inputSchemaContextSet.clear();
this.tabSpaceString = tabString;
DbMapComponent component = getDbMapComponent(dbMapComponent);
@@ -283,7 +293,9 @@ public abstract class DbGenerationManager {
}
ExternalDbMapData data = component.getExternalData();
List<ExternalDbMapTable> inputTables = data.getInputTables();
List<String> contextList = getContextList(component);
collectSchemaContextParam(dbMapComponent, inputTables, contextList);
StringBuilder sb = new StringBuilder();
List<ExternalDbMapTable> outputTables = data.getOutputTables();
@@ -356,8 +368,6 @@ public abstract class DbGenerationManager {
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.FROM);
List<ExternalDbMapTable> inputTables = data.getInputTables();
// load input table in hash
boolean explicitJoin = false;
int lstSizeInputTables = inputTables.size();
@@ -436,6 +446,7 @@ public abstract class DbGenerationManager {
}
StringBuilder sbWhere = new StringBuilder();
this.tabSpaceString = DEFAULT_TAB_SPACE_STRING;
boolean isFirstClause = true;
for (int i = 0; i < lstSizeInputTables; i++) {
ExternalDbMapTable inputTable = inputTables.get(i);
@@ -443,7 +454,6 @@ public abstract class DbGenerationManager {
isFirstClause = false;
}
}
/*
* for addition conditions
*/
@@ -481,16 +491,19 @@ public abstract class DbGenerationManager {
}
}
}
List<ExternalDbMapEntry> customOtherConditionsEntries = outputTable.getCustomOtherConditionsEntries();
if (customOtherConditionsEntries != null) {
for (ExternalDbMapEntry entry : customOtherConditionsEntries) {
String exp = initExpression(component, entry);
if (exp != null && !DbMapSqlConstants.EMPTY.equals(exp.trim())) {
exp = replaceVariablesForExpression(component, exp);
otherAddition.add(exp);
}
}
}
}
this.tabSpaceString = tabString;
String whereClauses = sbWhere.toString();
@@ -543,6 +556,40 @@ public abstract class DbGenerationManager {
return sqlQuery;
}
protected void collectSchemaContextParam(DbMapComponent dbMapComponent, List<ExternalDbMapTable> inputTables,
List<String> contextList) {
List<IConnection> incomingConnections = (List<IConnection>) dbMapComponent.getIncomingConnections();
if (incomingConnections != null) {
for (IConnection connection : incomingConnections) {
INode input = connection.getSource();
if (input != null) {
IElementParameter eltSchemaNameParam = input.getElementParameter("ELT_SCHEMA_NAME"); //$NON-NLS-1$
if (eltSchemaNameParam != null && eltSchemaNameParam.getValue() != null) {
String schema = String.valueOf(eltSchemaNameParam.getValue());
if (schema != null && !inputSchemaContextSet.contains(schema) && contextList.contains(schema)) {
inputSchemaContextSet.add(schema);
}
}
IElementParameter eltTableNameParam = input.getElementParameter("ELT_TABLE_NAME"); //$NON-NLS-1$
if (eltTableNameParam != null && eltTableNameParam.getValue() != null) {
String table = String.valueOf(eltTableNameParam.getValue());
if (table != null && !inputSchemaContextSet.contains(table) && contextList.contains(table)) {
inputSchemaContextSet.add(table);
}
}
}
}
}
if (inputTables != null) {
for (ExternalDbMapTable table : inputTables) {
if (table.getAlias() != null && !inputSchemaContextSet.contains(table.getAlias())
&& contextList.contains(table.getAlias())) {
inputSchemaContextSet.add(table.getAlias());
}
}
}
}
protected DbMapComponent getDbMapComponent(DbMapComponent dbMapComponent) {
DbMapComponent component = dbMapComponent;
INode realGraphicalNode = dbMapComponent.getRealGraphicalNode();
@@ -590,29 +637,27 @@ public abstract class DbGenerationManager {
if (expression == null) {
return null;
}
if (DEFAULT_TAB_SPACE_STRING.equals(tabSpaceString)) {
List<String> contextList = getContextList(component);
boolean haveReplace = false;
for (String context : contextList) {
List<String> contextList = getContextList(component);
boolean haveReplace = false;
for (String context : contextList) {
if (expression.contains(context)) {
expression = expression.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
haveReplace = true;
}
}
if (!haveReplace) {
List<String> connContextList = getConnectionContextList(component);
for (String context : connContextList) {
if (expression.contains(context)) {
expression = expression.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
haveReplace = true;
}
}
if (!haveReplace) {
List<String> connContextList = getConnectionContextList(component);
for (String context : connContextList) {
if (expression.contains(context)) {
expression = expression.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
}
Set<String> globalMapList = getGlobalMapList(component, expression);
for (String globalMapStr : globalMapList) {
String regex = parser.getGlobalMapExpressionRegex(globalMapStr);
String replacement = parser.getGlobalMapReplacement(globalMapStr);
expression = expression.replaceAll(regex, "\" +" + replacement + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$
}
}
Set<String> globalMapList = getGlobalMapList(component, expression);
for (String globalMapStr : globalMapList) {
String regex = parser.getGlobalMapExpressionRegex(globalMapStr);
String replacement = parser.getGlobalMapReplacement(globalMapStr);
expression = expression.replaceAll(regex, "\" +" + replacement + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$
}
return expression;
}
@@ -669,7 +714,11 @@ public abstract class DbGenerationManager {
query = query + " \""; //$NON-NLS-1$
} else {
if (query.trim().endsWith("+ \"")) { //$NON-NLS-1$
query = query.substring(0, query.lastIndexOf("+ \"")); //$NON-NLS-1$
if (DEFAULT_TAB_SPACE_STRING.equals(this.tabSpaceString)) {
query = query.substring(0, query.lastIndexOf("+ \"")); //$NON-NLS-1$
} else {
query = query + "\"";
}
}
}
}
@@ -704,7 +753,7 @@ public abstract class DbGenerationManager {
return contextList;
}
protected Set<String> getGlobalMapList(DbMapComponent component, String sqlQuery) {
return parser.getGlobalMapSet(sqlQuery);
}
@@ -776,8 +825,7 @@ public abstract class DbGenerationManager {
*/
private boolean buildCondition(DbMapComponent component, StringBuilder sbWhere, ExternalDbMapTable table,
boolean isFirstClause, ExternalDbMapEntry dbMapEntry, boolean writeCr, boolean isSqlQuery) {
String expression = dbMapEntry.getExpression();
expression = initExpression(component, dbMapEntry);
String expression = initExpression(component, dbMapEntry);
IDbOperator dbOperator = getOperatorsManager().getOperatorFromValue(dbMapEntry.getOperator());
boolean operatorIsSet = dbOperator != null;
boolean expressionIsSet = expression != null && expression.trim().length() > 0;
@@ -1016,6 +1064,8 @@ public abstract class DbGenerationManager {
}
protected String initExpression(DbMapComponent component, ExternalDbMapEntry dbMapEntry) {
String quote = getQuote(component);
String quto_mark = TalendQuoteUtils.QUOTATION_MARK;
String expression = dbMapEntry.getExpression();
if (expression != null) {
List<Map<String, String>> itemNameList = null;
@@ -1040,7 +1090,7 @@ public abstract class DbGenerationManager {
itemNameList = mapParser2.parseInTableEntryLocations(expression);
}
String quoParser = "[\\\\]?\\\""; //$NON-NLS-1$
String quto_markParser = "[\\\\]?\\" + quto_mark; //$NON-NLS-1$
for (Map<String, String> itemNamemap : itemNameList) {
Set<Entry<String, String>> set = itemNamemap.entrySet();
Iterator<Entry<String, String>> ite = set.iterator();
@@ -1105,13 +1155,13 @@ public abstract class DbGenerationManager {
continue;
}
if (expression.trim().equals(tableValue + "." + oriName)) {
expression = tableValue + "." + getColumnName(iconn, oriName);
expression = expression.replaceAll(quoParser,"\\\\\""); //$NON-NLS-1$
expression = tableValue + "." + getColumnName(iconn, oriName, quote);
expression = expression.replaceAll(quto_markParser,"\\\\" +quto_mark); //$NON-NLS-1$
continue;
}
if (expression.trim().equals(originaltableName + "." + oriName)) {
expression = originaltableName + "." + getColumnName(iconn, oriName);
expression = expression.replaceAll(quoParser,"\\\\\""); //$NON-NLS-1$
expression = originaltableName + "." + getColumnName(iconn, oriName, quote);
expression = expression.replaceAll(quto_markParser,"\\\\" +quto_mark); //$NON-NLS-1$
continue;
}
// if it is temp delived table, use label to generate sql
@@ -1119,13 +1169,13 @@ public abstract class DbGenerationManager {
continue;
}
if (!isRefTableConnection(iconn) && isUseDelimitedIdentifiers()) {
oriName = getColumnName(iconn, oriName);
oriName = getColumnName(iconn, oriName, quote);
} else {
oriName = oriName.replaceAll("\\$", "\\\\\\$"); //$NON-NLS-1$ //$NON-NLS-2$
}
expression = expression.replaceFirst("\\." + co.getLabel(), //$NON-NLS-1$
"\\." + oriName); //$NON-NLS-1$
expression = expression.replaceAll(quoParser,"\\\\\""); //$NON-NLS-1$
expression = expression.replaceFirst(tableValue + "\\." + co.getLabel(), //$NON-NLS-1$
tableValue + "\\." + oriName); //$NON-NLS-1$
expression = replaceAuotes(expression, quto_markParser, quto_mark);
}
}
@@ -1139,6 +1189,63 @@ public abstract class DbGenerationManager {
return expression;
}
protected String replaceAuotes(String expression, String quoParser, String quote){
if(!expression.contains("'")){
return expression.replaceAll(quoParser,"\\\\" +quote); //$NON-NLS-1$
}
List<Integer> indexs = new ArrayList<>();
for(int i=0;i<expression.length();i++){
if("'".equals(String.valueOf(expression.charAt(i)))){
indexs.add(i);
}
}
StringBuffer result = new StringBuffer();
int start = 0;
for(int i=0;i<indexs.size();i++){
if(i == 0){
if(indexs.size() == 1 && indexs.get(i) == 0){
result.append(expression.substring(0, indexs.get(i)+1));
}else{
String exp = expression.substring(start, indexs.get(i));
result.append(exp.replaceAll(quoParser,"\\\\" +quote)); //$NON-NLS-1$
}
}
if(i % 2 == 0 && i != indexs.size() - 1){
result.append(expression.substring(indexs.get(i), indexs.get(i+1)+1));
if (i < indexs.size() - 2) {
String exp = expression.substring(indexs.get(i + 1) + 1, indexs.get(i + 2));
result.append(exp.replaceAll(quoParser,"\\\\" +quote)); //$NON-NLS-1$
}
start = indexs.get(i+1)+1;
}else if(i == indexs.size() - 1){
String exp = expression.substring(indexs.get(i)+1, expression.length());
result.append(exp.replaceAll(quoParser,"\\\\" +quote)); //$NON-NLS-1$
}
}
return result.toString();
}
private String getQuote(DbMapComponent component){
String quote = TalendQuoteUtils.QUOTATION_MARK;
IElementParameter mappingPara = component.getElementParameter(EParameterName.MAPPING.getName());
if(mappingPara == null){
return quote;
}
String mapping = (String) mappingPara.getValue();
if(mapping == null){
return quote;
}
MappingTypeRetriever mappingTypeRetriever = MetadataTalendType.getMappingTypeRetriever(mapping);
if (mappingTypeRetriever == null) {
return quote;
}
Dbms dbms = mappingTypeRetriever.getDbms();
String product = dbms.getProduct();
EDatabaseTypeName type = EDatabaseTypeName.getTypeFromProductName(product);
return TalendQuoteUtils.getQuoteByDBType(type);
}
private String getOriginalColumnName(String entryName, DbMapComponent component, ExternalDbMapTable table) {
List<IConnection> inputConnections = (List<IConnection>) component.getIncomingConnections();
@@ -1247,6 +1354,14 @@ public abstract class DbGenerationManager {
return name;
}
}
protected String getColumnName(IConnection conn, String name, String quote) {
if (!isRefTableConnection(conn) && isUseDelimitedIdentifiers()) {
return getNameWithDelimitedIdentifier(name, quote);
} else {
return name;
}
}
protected boolean isRefTableConnection(IConnection conn) {
return conn != null && conn.getLineStyle() == EConnectionType.TABLE_REF;
@@ -1259,6 +1374,13 @@ public abstract class DbGenerationManager {
newName = delimitedIdentifier + newName + delimitedIdentifier;
return newName;
}
protected String getNameWithDelimitedIdentifier(String name, String quote) {
String newName = name;
newName = newName.replaceAll("\"", "\"\"");
newName = quote + newName + quote;
return newName;
}
protected String getDelimitedIdentifiers() {
return "\""; //$NON-NLS-1$

View File

@@ -12,6 +12,9 @@
// ============================================================================
package org.talend.designer.dbmap.language.hive;
import java.util.List;
import java.util.Set;
import org.talend.designer.dbmap.DbMapComponent;
import org.talend.designer.dbmap.external.data.ExternalDbMapData;
import org.talend.designer.dbmap.external.data.ExternalDbMapTable;
@@ -53,4 +56,36 @@ public class HiveGenerationManager extends DbGenerationManager {
}
return query;
}
@Override
protected String replaceVariablesForExpression(DbMapComponent component, String expression) {
if (expression == null) {
return null;
}
List<String> contextList = getContextList(component);
boolean haveReplace = false;
for (String context : contextList) {
if (expression.contains(context)) {
expression = expression.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
haveReplace = true;
}
}
if (!haveReplace) {
List<String> connContextList = getConnectionContextList(component);
for (String context : connContextList) {
if (expression.contains(context)) {
expression = expression.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
}
Set<String> globalMapList = getGlobalMapList(component, expression);
for (String globalMapStr : globalMapList) {
String regex = parser.getGlobalMapExpressionRegex(globalMapStr);
String replacement = parser.getGlobalMapReplacement(globalMapStr);
expression = expression.replaceAll(regex, "\" +" + replacement + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$
}
return expression;
}
}

View File

@@ -194,6 +194,7 @@ public class OracleGenerationManager extends DbGenerationManager {
}
StringBuilder sbWhere = new StringBuilder();
this.tabSpaceString = DEFAULT_TAB_SPACE_STRING;
boolean isFirstClause = true;
for (int i = 0; i < lstSizeInputTables; i++) {
ExternalDbMapTable inputTable = inputTables.get(i);
@@ -201,6 +202,7 @@ public class OracleGenerationManager extends DbGenerationManager {
isFirstClause = false;
}
}
this.tabSpaceString = tabString;
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
@@ -281,6 +283,7 @@ public class OracleGenerationManager extends DbGenerationManager {
List<String> otherAddition = new ArrayList<String>();
if (outputTable != null) {
this.tabSpaceString = DEFAULT_TAB_SPACE_STRING;
List<ExternalDbMapEntry> customWhereConditionsEntries = outputTable.getCustomWhereConditionsEntries();
if (customWhereConditionsEntries != null) {
for (ExternalDbMapEntry entry : customWhereConditionsEntries) {
@@ -308,10 +311,12 @@ public class OracleGenerationManager extends DbGenerationManager {
for (ExternalDbMapEntry entry : customOtherConditionsEntries) {
String exp = initExpression(component, entry);
if (exp != null && !DbMapSqlConstants.EMPTY.equals(exp.trim())) {
exp = replaceVariablesForExpression(component, exp);
otherAddition.add(exp);
}
}
}
this.tabSpaceString = tabString;
}
String whereClauses = sbWhere.toString();

View File

@@ -236,8 +236,8 @@ public class PostgresGenerationManager extends DbGenerationManager {
}
tableAndSchema = tableAndSchema + getHandledField(tableNoQuote);
if (isVariable(schemaNoQuote) || isVariable(tableNoQuote)) {
tableAndSchema = replaceVariablesForExpression(component, tableAndSchema);
if (isVariable(schemaNoQuote) || isVariable(tableNoQuote)) {
tableAndSchema = replaceVariablesForExpression(component, tableAndSchema);
}
sb.append(tableAndSchema);
} else {
@@ -290,32 +290,39 @@ public class PostgresGenerationManager extends DbGenerationManager {
if (expression == null) {
return null;
}
if (DEFAULT_TAB_SPACE_STRING.equals(tabSpaceString)) {
List<String> contextList = getContextList(component);
boolean haveReplace = false;
for (String context : contextList) {
List<String> contextList = getContextList(component);
boolean haveReplace = false;
for (String context : contextList) {
if (expression.contains(context)) {
expression = replaceContextValue(expression, context);
haveReplace = true;
}
}
if (!haveReplace) {
List<String> connContextList = getConnectionContextList(component);
for (String context : connContextList) {
if (expression.contains(context)) {
expression = expression.replaceAll("\\b" + context + "\\b", "\\\\\"\"+" + context + "+\"\\\\\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
haveReplace = true;
expression = replaceContextValue(expression, context);
}
}
if (!haveReplace) {
List<String> connContextList = getConnectionContextList(component);
for (String context : connContextList) {
if (expression.contains(context)) {
expression = expression.replaceAll("\\b" + context + "\\b", "\\\\\"\"+" + context + "+\"\\\\\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
}
Set<String> globalMapList = getGlobalMapList(component, expression);
for (String globalMapStr : globalMapList) {
String replacement = globalMapStr;
if (globalMapStr.contains("\\\\")) {
replacement = globalMapStr.replaceAll("\\\\", "\\\\\\\\");
}
String regex = parser.getGlobalMapExpressionRegex(globalMapStr);
expression = expression.replaceAll(regex, "\\\\\"\"+" + replacement + "+\"\\\\\""); //$NON-NLS-1$ //$NON-NLS-2$
}
Set<String> globalMapList = getGlobalMapList(component, expression);
for (String globalMapStr : globalMapList) {
String replacement = globalMapStr;
if (globalMapStr.contains("\\\\")) {
replacement = globalMapStr.replaceAll("\\\\", "\\\\\\\\");
}
String regex = parser.getGlobalMapExpressionRegex(globalMapStr);
expression = expression.replaceAll(regex, "\\\\\"\"+" + replacement + "+\"\\\\\""); //$NON-NLS-1$ //$NON-NLS-2$
}
return expression;
}
private String replaceContextValue(String expression, String context) {
if (inputSchemaContextSet.contains(context)) {
expression = expression.replaceAll("\\b" + context + "\\b", "\\\\\"\"+" + context + "+\"\\\\\"");
} else {
expression = expression.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \"");
}
return expression;
}

View File

@@ -45,6 +45,7 @@ import org.talend.commons.ui.runtime.ws.WindowSystem;
import org.talend.commons.ui.swt.drawing.background.BackgroundRefresher;
import org.talend.commons.ui.swt.linking.BgDrawableComposite;
import org.talend.commons.utils.threading.ExecutionLimiter;
import org.talend.core.model.process.IConnection;
import org.talend.designer.abstractmap.model.table.IDataMapTable;
import org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup;
import org.talend.designer.abstractmap.ui.listener.DropTargetOperationListener;
@@ -230,6 +231,20 @@ public class MapperUI {
dbmsId = input.getMetadataTable().getDbms();
}
}
if(dbmsId == null && mapperModel.getOutputDataMapTables() != null && !mapperModel.getOutputDataMapTables().isEmpty()) {
OutputTable output = mapperModel.getOutputDataMapTables().get(0);
if (output.getMetadataTable() != null) {
dbmsId = output.getMetadataTable().getDbms();
}
}
if(dbmsId == null && mapperManager.getAbstractMapComponent() != null
&& !mapperManager.getAbstractMapComponent().getIncomingConnections().isEmpty()){
IConnection conn = mapperManager.getAbstractMapComponent().getIncomingConnections().get(0);
if(conn.getMetadataTable() != null) {
dbmsId = conn.getMetadataTable().getDbms();
}
}
tabFolderEditors = new TabFolderEditors(mainSashForm, SWT.BORDER, mapperManager, dbmsId);
createInputZoneWithTables(mapperModel, uiManager, display);

View File

@@ -62,9 +62,11 @@ public class DataMapExpressionParser {
// ((String)globalMap.get("tableName")).columnName
private final static String GLOBALMAP_EXPRESSION4 = "(" + GLOBALMAP_PATTERN + COLUMN_PATTERN + ")";
private final static String GLOBALMAP_EXPRESSION5 = "\\s*(\\s*(\\w+)\\s*\\.\\\\\"\\s*(.+?)\\s*\\\\\")\\s*";
private final static String GLOBALMAP_EXPRESSION = GLOBALMAP_EXPRESSION1 + "|" + GLOBALMAP_EXPRESSION2 + "|"//$NON-NLS-1$//$NON-NLS-2$
+ GLOBALMAP_EXPRESSION3 + "|" + GLOBALMAP_EXPRESSION4;//$NON-NLS-1$
+ GLOBALMAP_EXPRESSION3 + "|" + GLOBALMAP_EXPRESSION4 + "|" + GLOBALMAP_EXPRESSION5;//$NON-NLS-1$
private final static String EXPRESSION_PATTERN = "(\\s*(\\w+)\\s*\\.\\s*(\\w+)\\s*\\.\\s*(\\w+)\\s*\\.\\s*(\\w+)\\s*\\.\\s*(\\w+)\\s*)" //$NON-NLS-1$
+ "|(\\s*(\\w+)\\s*\\.\\s*(\\w+)\\s*\\.\\s*(\\w+)\\s*\\.\\s*(\\w+)\\s*)" //$NON-NLS-1$
@@ -143,6 +145,10 @@ public class DataMapExpressionParser {
} else if (matchResult.group(35) != null) {
// ((String)globalMap.get("tableName")).columnName
location = new TableEntryLocation(matchResult.group(36), matchResult.group(38));
}else if (matchResult.group(39) != null) {
// table.\"column\"
// Case NVL(Keys.\"ORG_SCD_ID\",-99) When -99 Then 'N' Else 'Y' End
location = new TableEntryLocation(matchResult.group(40), matchResult.group(41));
}
if (location != null) {
resultList.add(location);

View File

@@ -591,8 +591,8 @@ public class HTMLDocGenerator implements IDocumentationGenerator {
attri.setValue(IHTMLDocConstants.PICTUREFOLDERPATH + "pdf_" + jobName + IHTMLDocConstants.JOB_PREVIEW_PIC_SUFFIX); //$NON-NLS-1$
List attributeList = document.selectNodes("/project/job/externalNodeComponents/component/@preview"); //$NON-NLS-1$
for (int i = 0; i < attributeList.size(); i++) {
Attribute at = (Attribute) attributeList.get(i);
for (Object element : attributeList) {
Attribute at = (Attribute) element;
String externalValue = at.getValue().substring(at.getValue().indexOf("/") + 1); //$NON-NLS-1$
String value = IHTMLDocConstants.PICTUREFOLDERPATH + "pdf_" + externalValue; //$NON-NLS-1$
at.setValue(value);
@@ -665,8 +665,8 @@ public class HTMLDocGenerator implements IDocumentationGenerator {
// Check if generate Job Extra / Stats&Logs Setting Info
if (item instanceof ProcessItem) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IMRProcessService.class)) {
IMRProcessService mrProcessService = (IMRProcessService) GlobalServiceRegister.getDefault().getService(
IMRProcessService.class);
IMRProcessService mrProcessService = (IMRProcessService) GlobalServiceRegister.getDefault()
.getService(IMRProcessService.class);
generateExtraSetting = !mrProcessService.isMapReduceItem(item);
generateStatsLogsSetting = generateExtraSetting;
} else if (isRouteProcess(item)) {
@@ -847,8 +847,8 @@ public class HTMLDocGenerator implements IDocumentationGenerator {
Map<String, String> nameValueMap = new HashMap<String, String>();
for (int i = 0; i < params.size(); i++) {
ElementParameterType param = (ElementParameterType) params.get(i);
for (Object param2 : params) {
ElementParameterType param = (ElementParameterType) param2;
nameValueMap.put(param.getName(), ParameterValueUtil.getValue4Doc(param));
}
// Main settinparam info
@@ -1022,10 +1022,10 @@ public class HTMLDocGenerator implements IDocumentationGenerator {
Element contextListElement = DocumentHelper.createElement("contextList"); // Context root //$NON-NLS-1$
for (int i = 0, n = contexts.size(); i < n; i++) {
for (Object context2 : contexts) {
// export single context infomation
Element contextElement = DocumentHelper.createElement("context"); //$NON-NLS-1$
ContextType context = (ContextType) contexts.get(i);
ContextType context = (ContextType) context2;
// Attributes
contextElement.addAttribute("name", HTMLDocUtils.checkString(context.getName())); //$NON-NLS-1$
@@ -1034,13 +1034,13 @@ public class HTMLDocGenerator implements IDocumentationGenerator {
// Context parameters as children
EList params = context.getContextParameter();
if (params != null && !params.isEmpty()) {
for (int j = 0, k = params.size(); j < k; j++) {
for (Object param2 : params) {
/*
* <contextParameter comment="Give server name" name="server" prompt="Default Server "
* promptNeeded="false" repositoryContextId="_crJMkCCQEd2Oweh7yRMWjQ" type=""
* value="'192.168.0.109'"/>
*/
ContextParameterType param = (ContextParameterType) params.get(j);
ContextParameterType param = (ContextParameterType) param2;
Element contextParamElement = DocumentHelper.createElement("contextParameter"); //$NON-NLS-1$
contextParamElement.addAttribute("name", HTMLDocUtils.checkString(param.getName())); //$NON-NLS-1$
contextParamElement.addAttribute("prompt", HTMLDocUtils.checkString(param.getPrompt())); //$NON-NLS-1$
@@ -1212,8 +1212,8 @@ public class HTMLDocGenerator implements IDocumentationGenerator {
*/
private void generateConnectionsInfo(Element jobElement, EList connectionList) {
Element connectionsElement = jobElement.addElement("connections"); //$NON-NLS-1$
for (int j = 0; j < connectionList.size(); j++) {
ConnectionType type = (ConnectionType) connectionList.get(j);
for (Object element : connectionList) {
ConnectionType type = (ConnectionType) element;
Element connectionElement = connectionsElement.addElement("connection"); //$NON-NLS-1$
connectionElement.addAttribute("label", HTMLDocUtils.checkString(type.getLabel())); //$NON-NLS-1$
connectionElement.addAttribute("lineStyle", HTMLDocUtils.checkString(type.getLineStyle() + "")); //$NON-NLS-1$ //$NON-NLS-2$
@@ -1251,8 +1251,8 @@ public class HTMLDocGenerator implements IDocumentationGenerator {
}
if (isRouteProcess(item)) {
jobElement.addAttribute("type", "route");//$NON-NLS-1$//$NON-NLS-2$
ICamelDesignerCoreService camelService = (ICamelDesignerCoreService) GlobalServiceRegister.getDefault().getService(
ICamelDesignerCoreService.class);
ICamelDesignerCoreService camelService = (ICamelDesignerCoreService) GlobalServiceRegister.getDefault()
.getService(ICamelDesignerCoreService.class);
camelService.appendRouteInfo2Doc(item, jobElement);
}
if (generateExtraSetting) {
@@ -1330,8 +1330,8 @@ public class HTMLDocGenerator implements IDocumentationGenerator {
*/
protected boolean isRouteProcess(Item item) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICamelDesignerCoreService.class)) {
ICamelDesignerCoreService camelService = (ICamelDesignerCoreService) GlobalServiceRegister.getDefault().getService(
ICamelDesignerCoreService.class);
ICamelDesignerCoreService camelService = (ICamelDesignerCoreService) GlobalServiceRegister.getDefault()
.getService(ICamelDesignerCoreService.class);
return camelService.isInstanceofCamel(item);
}
return false;
@@ -1498,8 +1498,8 @@ public class HTMLDocGenerator implements IDocumentationGenerator {
protected void handleSourceAndTargetConnection(EList connectionList) {
List<String> targetList = new ArrayList<String>();
List<String> sourceList = new ArrayList<String>();
for (int j = 0; j < connectionList.size(); j++) {
ConnectionType type = (ConnectionType) connectionList.get(j);
for (Object element : connectionList) {
ConnectionType type = (ConnectionType) element;
if (!targetConnectionMap.containsKey(type.getSource())) {
targetList = new ArrayList<String>();
}
@@ -1509,10 +1509,13 @@ public class HTMLDocGenerator implements IDocumentationGenerator {
targetConnectionMap.put(type.getSource(), targetList);
if (!sourceConnectionMap.containsKey(type.getTarget())) {
sourceList = new ArrayList<String>();
sourceList = new ArrayList<String>();
if (sourceConnectionMap.containsKey(type.getTarget())) {
sourceList = sourceConnectionMap.get(type.getTarget());
}
if (!sourceList.contains(type.getSource())) {
sourceList.add(type.getSource());
}
sourceList.add(type.getSource());
sourceConnectionMap.put(type.getTarget(), sourceList);
}
@@ -1556,15 +1559,15 @@ public class HTMLDocGenerator implements IDocumentationGenerator {
* @return
*/
private String getFullProductName() {
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(
IBrandingService.class);
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault()
.getService(IBrandingService.class);
return brandingService.getFullProductName();
}
private String getProductVersionName() {
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(
IBrandingService.class);
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault()
.getService(IBrandingService.class);
return brandingService.getShortProductName() + IHTMLDocConstants.VERSION;
}
@@ -1597,8 +1600,8 @@ public class HTMLDocGenerator implements IDocumentationGenerator {
}
// if (result == null) {
result = new ByteArrayOutputStream(3072);
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(
IBrandingService.class);
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault()
.getService(IBrandingService.class);
ImageData imageData = brandingService.getLoginHImage().getImageData();
new ByteArrayOutputStream();

View File

@@ -478,12 +478,18 @@ public class MapperComponent extends AbstractMapComponent implements IHashableIn
ExternalMapperData data = mapperMain.buildExternalData();
if (mapperMain != null && data != null) {
if (externalData != null) {
this.externalData = data;// fwang fixed bug TDI-8027
if(!isConnectionEmpty()) {
this.externalData = data;// fwang fixed bug TDI-8027
}
MapperHelper.saveDataToEmf(data, emfMapperData);
}
}
return emfMapperData;
}
private boolean isConnectionEmpty() {
return getIncomingConnections().isEmpty() && getOutgoingConnections().isEmpty();
}
public void renameInputConnection(String oldConnectionName, String newConnectionName) {
if (oldConnectionName == null || newConnectionName == null) {

View File

@@ -507,6 +507,8 @@ public class CompleteDropTargetTableListener extends DefaultDropTargetListener {
uiManager.selectLinks(dataMapTableViewTarget, selectedEntries, true, false);
dataMapTableViewTarget.checkChangementsAfterEntryModifiedOrAdded(false);
// refresh for cell data disappear on MAC
tableViewerCreatorTarget.getTableViewer().refresh();
tableViewerCreatorTarget.getTable().setFocus();
uiManager.setDragging(false);

View File

@@ -48,6 +48,9 @@ import org.talend.core.ui.metadata.editor.MetadataToolbarEditorView;
import org.talend.designer.mapper.MapperMain;
import org.talend.designer.mapper.i18n.Messages;
import org.talend.designer.mapper.managers.MapperManager;
import org.talend.designer.mapper.model.table.InputTable;
import org.talend.designer.mapper.model.table.OutputTable;
import org.talend.designer.mapper.ui.visualmap.table.DataMapTableView;
/**
* DOC amaumont class global comment. Detailled comment <br/>
@@ -158,8 +161,20 @@ public class TabFolderEditors extends CTabFolder {
};
IExtendedButtonListener afterCommandListener = new IExtendedButtonListener() {
public void handleEvent(ExtendedButtonEvent event) {
List<InputTable> inputTablesList = mapperManager.getInputTables();
for (InputTable inputTable : inputTablesList) {
DataMapTableView view = mapperManager.retrieveAbstractDataMapTableView(inputTable);
view.getTableViewerCreatorForColumns().getTableViewer().refresh();
}
}
};
for (ExtendedPushButton extendedPushButton : inputToolBarButtons) {
extendedPushButton.addListener(beforeCommandListenerForInputButtons, true);
extendedPushButton.addListener(afterCommandListener, false);
}
this.addDisposeListener(new DisposeListener() {
@@ -197,8 +212,20 @@ public class TabFolderEditors extends CTabFolder {
};
IExtendedButtonListener afterCommandListener = new IExtendedButtonListener() {
public void handleEvent(ExtendedButtonEvent event) {
List<OutputTable> outputTablesList = mapperManager.getOutputTables();
for (OutputTable outputTable : outputTablesList) {
DataMapTableView view = mapperManager.retrieveAbstractDataMapTableView(outputTable);
view.getTableViewerCreatorForColumns().getTableViewer().refresh();
}
}
};
for (ExtendedPushButton extendedPushButton : outputToolBarButtons) {
extendedPushButton.addListener(beforeCommandListenerForOutputButtons, true);
extendedPushButton.addListener(afterCommandListener, false);
if (extendedPushButton instanceof RemovePushButton && !mapperManager.componentIsReadOnly()) {
removeButton = (RemovePushButtonForExtendedTable) extendedPushButton;
}

View File

@@ -1399,7 +1399,7 @@ public abstract class DataMapTableView extends Composite implements IDataMapTabl
if (mapperManager.componentIsReadOnly()) {
metadataEditorView.setReadOnly(true);
} else {
metadataEditorView.setReadOnly(isRepository || metadataEditorView.isReadOnly());
metadataEditorView.setReadOnly(isRepository);
}
}

View File

@@ -13,7 +13,8 @@
<directory>${project.build.outputDirectory}</directory>
<outputDirectory>${file.separator}</outputDirectory>
<includes>
<include>${talend.job.path}/**</include>
<include>${talend.job.path}/**/*.class</include>
<include>${talend.job.path}/**/*.wsdl</include>
<include>__tdm/**</include>
</includes>
</fileSet>
@@ -55,15 +56,5 @@
</includes>
</fileSet>
</fileSets>
<dependencySets>
<!-- for all jobs -->
<dependencySet>
<includes>
<!--@JobIncludes@-->
</includes>
<outputFileNameMapping>${artifact.build.finalName}.${artifact.extension}</outputFileNameMapping>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
</dependencySet>
</dependencySets>
<dependencySets></dependencySets>
</assembly>

View File

@@ -15,7 +15,8 @@
<directory>${project.build.outputDirectory}</directory>
<outputDirectory>${file.separator}</outputDirectory>
<includes>
<include>${talend.job.path}/**</include>
<include>${talend.job.path}/**/*.class</include>
<include>${talend.job.path}/**/*.wsdl</include>
<include>__tdm/**</include>
</includes>
</fileSet>
@@ -51,6 +52,14 @@
<include>${talend.job.path}/**</include>
</includes>
</fileSet>
<fileSet><!-- add context resources -->
<directory>${current.int-resources.dir}</directory>
<outputDirectory>${file.separator}</outputDirectory>
<includes>
<include>${talend.job.path}/**</include>
</includes>
</fileSet>
<fileSet> <!-- add provided-lib -->
<directory>${current.bundle.resources.dir}/provided-lib</directory>

View File

@@ -209,32 +209,5 @@
</includes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
<includes>
<!--@TalendLibIncludes@-->
</includes>
<!-- without version for talend libraries -->
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension}
</outputFileNameMapping>
<useProjectArtifact>false</useProjectArtifact>
</dependencySet>
<dependencySet>
<outputDirectory>lib</outputDirectory>
<includes>
<!--@3rdPartyLibIncludes@-->
</includes>
<useProjectArtifact>false</useProjectArtifact>
</dependencySet>
<!-- for all jobs -->
<dependencySet>
<outputDirectory>${talend.job.name}</outputDirectory>
<includes>
<!--@JobIncludes@-->
</includes>
<outputFileNameMapping>${artifact.build.finalName}.${artifact.extension}</outputFileNameMapping>
<useProjectArtifact>true</useProjectArtifact>
</dependencySet>
</dependencySets>
<dependencySets></dependencySets>
</assembly>

View File

@@ -112,6 +112,9 @@ public abstract class AbstractPublishJobAction implements IRunnableWithProgress
// TDI-32861, because for publish job, so means, must be binaries
exportChoiceMap.put(ExportChoice.binaries, true);
exportChoiceMap.put(ExportChoice.includeLibs, true);
// TESB-26145/TESB-26086 adding context to published job
exportChoiceMap.put(ExportChoice.needContext, true);
ProcessItem processItem = (ProcessItem) node.getObject().getProperty().getItem();
exportItemForDQComponent(processItem);

View File

@@ -44,6 +44,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.osgi.framework.Bundle;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.utils.workbench.resources.ResourceUtils;
import org.talend.core.CorePlugin;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.IESBService;
@@ -712,7 +713,19 @@ public class DefaultRunProcessService implements IRunProcessService {
@Override
public ITalendProcessJavaProject getTalendCodeJavaProject(ERepositoryObjectType type, String projectTechName) {
return TalendJavaProjectManager.getTalendCodeJavaProject(type, projectTechName);
ITalendProcessJavaProject codeProject = TalendJavaProjectManager.getTalendCodeJavaProject(type, projectTechName);
if (codeProject == null) {
// try to recover from any damage of pom.
try {
AggregatorPomsHelper helper = new AggregatorPomsHelper(projectTechName);
IFile pomFile = helper.getCodeFolder(type).getFile(TalendMavenConstants.POM_FILE_NAME);
helper.updateCodeProjectPom(new NullProgressMonitor(), type, pomFile);
codeProject = TalendJavaProjectManager.getTalendCodeJavaProject(type, projectTechName);
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
return codeProject;
}
@Override
@@ -720,6 +733,11 @@ public class DefaultRunProcessService implements IRunProcessService {
return TalendJavaProjectManager.getTalendJobJavaProject(property);
}
@Override
public IFolder getCodeSrcFolder(ERepositoryObjectType type, String projectTechName) {
return new AggregatorPomsHelper(projectTechName).getCodeSrcFolder(type);
}
@Override
public ITalendProcessJavaProject getTempJavaProject() {
return TalendJavaProjectManager.getTempJavaProject();
@@ -742,6 +760,10 @@ public class DefaultRunProcessService implements IRunProcessService {
return ProcessorUtilities.isExportConfig();
}
public boolean isdebug() {
return ProcessorUtilities.isdebug();
}
@Override
public void buildCodesJavaProject(IProgressMonitor monitor) {
try {
@@ -782,7 +804,7 @@ public class DefaultRunProcessService implements IRunProcessService {
for (ProjectReference ref : references) {
initRefPoms(new Project(ref.getReferencedProject()));
}
helper.updateRefProjectModules(references);
helper.updateRefProjectModules(references, monitor);
helper.updateCodeProjects(monitor, true);
} catch (Exception e) {
ExceptionHandler.process(e);
@@ -809,13 +831,16 @@ public class DefaultRunProcessService implements IRunProcessService {
if (ProcessUtils.isRequiredBeans(null, refProject)) {
installRefCodeProject(ERepositoryObjectType.valueOf("BEANS"), refHelper, monitor); //$NON-NLS-1$
}
}
deleteRefProjects(refProject, refHelper);
}
private void installRefCodeProject(ERepositoryObjectType codeType, AggregatorPomsHelper refHelper, IProgressMonitor monitor)
throws Exception, CoreException {
if (!refHelper.getProjectRootPom().exists()) {
return;
}
String projectTechName = refHelper.getProjectTechName();
ITalendProcessJavaProject codeProject = TalendJavaProjectManager.getExistingTalendCodeProject(codeType, projectTechName);
if (codeProject != null) {
@@ -824,6 +849,30 @@ public class DefaultRunProcessService implements IRunProcessService {
argumentsMap.put(TalendProcessArgumentConstant.ARG_GOAL, TalendMavenConstants.GOAL_INSTALL);
argumentsMap.put(TalendProcessArgumentConstant.ARG_PROGRAM_ARGUMENTS, TalendMavenConstants.ARG_MAIN_SKIP);
codeProject.buildModules(monitor, null, argumentsMap);
}
}
private void deleteRefProjects(Project refProject, AggregatorPomsHelper refHelper) throws Exception {
IProgressMonitor monitor = new NullProgressMonitor();
for (ERepositoryObjectType codeType : ERepositoryObjectType.getAllTypesOfCodes()) {
// use getAllTypesOfCodes to avoid NPE
// the ERepositoryObjectType may not load on current license
deleteRefProject(codeType, refHelper, monitor);
}
}
private void deleteRefProject(ERepositoryObjectType codeType, AggregatorPomsHelper refHelper, IProgressMonitor monitor)
throws Exception, CoreException {
if (!refHelper.getProjectRootPom().exists()) {
return;
}
String projectTechName = refHelper.getProjectTechName();
ITalendProcessJavaProject codeProject = TalendJavaProjectManager.getExistingTalendCodeProject(codeType, projectTechName);
if (codeProject != null) {
codeProject.getProject().delete(false, true, monitor);
TalendJavaProjectManager.removeFromCodeJavaProjects(codeType, projectTechName);
}
@@ -867,7 +916,7 @@ public class DefaultRunProcessService implements IRunProcessService {
IPath refPath = codeFile.getProjectRelativePath();
IFolder targetFolder = mainProject.getFolder(refPath.removeLastSegments(1));
if (!targetFolder.exists()) {
targetFolder.create(true, false, progressMonitor);
ResourceUtils.createFolder(targetFolder);
}
FilesUtils.copyDirectory(new File(codeFile.getLocation().toPortableString()),
new File(targetFolder.getLocation().toPortableString()));

Some files were not shown because too many files have changed in this diff Show More