Compare commits

...

123 Commits

Author SHA1 Message Date
Carlos Badillo
1737518abb fix(TBD-12184):Password field missing for tImpalaRow 2021-07-29 13:30:36 +02:00
Zhiwei Xue
576d3abf29 fix(TUP-32001):Tacokit slow to start (#4417) (#4427)
* fix(TUP-32001):Tacokit slow to start (#4417)

* fix(TUP-32001): fix TCK server readiness checker

Co-authored-by: bhe-talendbj <bhe@talend.com>
2021-07-26 11:01:08 +08:00
jiezhang-tlnd
14ca2dfaa7 fix(TUP-31656)Remove FilesUtils MD5 static helper methods (#4447)
* fix(TUP-31656)Remove FilesUtils MD5 static helper methods

* fix(TUP-31656 and TUP-31655)
2021-07-23 16:56:30 +08:00
Jane Ding
b607ed6fb3 feat(TUP-28580):Replace current "Copy to branch", with "Copy from (#4449) (#4451)
branch"
https://jira.talendforge.org/browse/TUP-28580
2021-07-19 17:29:20 +08:00
Jane Ding
acd02c4c18 feat(TUP-28580):Replace current "Copy to branch", with "Copy from (#4441)
branch"
https://jira.talendforge.org/browse/TUP-28580
2021-07-16 17:33:11 +08:00
cbadillo1603
615a4f209e fix(TBD-12715):Knox check HDFS service (#4408)
* fix(TBD-12715):Knox check HDFS service

* fix(TBD-12715):Knox check HDFS service

* fix(TBD-12715):Knox check HDFS service
2021-07-16 10:48:05 +02:00
jiezhang-tlnd
172f3c3483 fix(TUP-32130)CVE: json-smart-2.4.2.jar (#4432)
Co-authored-by: jie.zhang <jie.zhang@LT-DDC8R73.talend.com>
2021-07-16 10:21:10 +08:00
hcyi
a4ce2f457e feat(TUP-31123):In studio, do not store login credentials on disk for TAC and reprompt instead. (#4406)
* feat(TUP-31123):In studio, do not store login credentials on disk for
TAC and reprompt instead.

* feat(TUP-31123):In studio, do not store login credentials on disk for
TAC and reprompt instead.
2021-07-15 15:57:47 +08:00
Jane Ding
f2af89413f feat(TUP-28580):Replace current "Copy to branch", with "Copy from (#4392)
* feat(TUP-28580):Replace current "Copy to branch", with "Copy from
branch"
https://jira.talendforge.org/browse/TUP-28580

* feat(TUP-28580):Replace current "Copy to branch", with "Copy from
branch"
https://jira.talendforge.org/browse/TUP-28580

* feat(TUP-28580):Replace current "Copy to branch", with "Copy from
branch"
https://jira.talendforge.org/browse/TUP-28580

* feat(TUP-28580):Replace current "Copy to branch", with "Copy from
branch"
https://jira.talendforge.org/browse/TUP-28580

* feat(TUP-28580):Replace current "Copy to branch", with "Copy from
branch"
https://jira.talendforge.org/browse/TUP-28580

* feat(TUP-28580):Replace current "Copy to branch", with "Copy from
branch"
https://jira.talendforge.org/browse/TUP-28580

* feat(TUP-28580):Replace current "Copy to branch", with "Copy from
branch"
https://jira.talendforge.org/browse/TUP-28580

* feat(TUP-28580):Replace current "Copy to branch", with "Copy from
branch"
https://jira.talendforge.org/browse/TUP-28580

* feat(TUP-28580):Replace current "Copy to branch", with "Copy from
branch"
https://jira.talendforge.org/browse/TUP-28580
[bug] Select parent job, studio can't automatically select the sub-job
when check "import dependencies"
https://jira.talendforge.org/browse/TUP-32187
2021-07-15 00:55:25 +08:00
apoltavtsev
0c8c872bd6 fix(APPINT-33413) Java 11 dependencies are corrected 2021-07-14 10:53:57 +02:00
Emmanuel GALLOIS
38ed0b9f1f chore(studio731): bump component-runtime to 1.34.1 (#4423) 2021-07-13 09:39:31 +02:00
bhe-talendbj
4df14e99d0 chore(TUP-31163): upgrade daikon to 0.31.12 (#4377)
* chore(TUP-31163): upgrade daikon to 0.31.12

* chore(TUP-31163): execute UpdateDaikonCryptoUtilsMigrationTask always
2021-07-13 15:27:52 +08:00
jiezhang-tlnd
0c3e5175dd fix(TUP-31880)Build job failure due to joblet relationship didn't record (#4418)
https://jira.talendforge.org/browse/TUP-31880

Co-authored-by: jie.zhang <jie.zhang@LT-DDC8R73.talend.com>
2021-07-13 14:28:35 +08:00
Zhiwei Xue
4ed8a4a803 fix(TUP-31531):fix repository node order in remote mode (#4420) 2021-07-12 15:48:36 +08:00
chmyga
365700699e chore(TDI-46405): bump connectors to 1.23.0 (#4421)
Co-authored-by: Dmytro Chmyga <dmytro.chmyga@globallogic.com>
2021-07-09 18:01:57 +03:00
bhe-talendbj
dab6da165f fix(TUP-31736): fix junit (#4415) 2021-07-08 17:39:12 +08:00
bhe-talendbj
b33018d422 fix(TUP-31736): add functions of custom routine jars to auto complete (#4391)
* fix(TUP-31736): add functions of custom routine jars to auto complete

* fix(TUP-31736): using cache

* fix(TUP-31736): add warning message

* fix(TUP-31736): fix parsing functions

* fix(TUP-31736): remove log messages

* fix(TUP-31736): fix warning
2021-07-07 11:21:44 +08:00
Zhiwei Xue
81ec1966bd fix(TUP-31531):fix repository node order in remote mode (#4396) 2021-07-05 15:37:44 +08:00
Jane Ding
d3246a9713 feat(TUP-23337):Option to disable Job's screenshot creation. (#4365)
* feat(TUP-23337):Option to disable Job's screenshot creation.
https://jira.talendforge.org/browse/TUP-23337

Signed-off-by: jding-tlnd <jding@talend.com>

* feat(TUP-23337):Option to disable Job's screenshot creation.
https://jira.talendforge.org/browse/TUP-23337

Signed-off-by: jding-tlnd <jding@talend.com>

* feat(TUP-23337):Option to disable Job's screenshot creation.
https://jira.talendforge.org/browse/TUP-23337

Signed-off-by: jding-tlnd <jding@talend.com>

* feat(TUP-23337):Option to disable Job's screenshot creation.
https://jira.talendforge.org/browse/TUP-23337

* feat(TUP-23337):Option to disable Job's screenshot creation.
https://jira.talendforge.org/browse/TUP-23337
2021-07-05 08:56:59 +08:00
zshen-talend
b098e18278 fix(TDQ-19281): make export parser rule with dq mode (#4383) 2021-07-01 15:40:34 +08:00
kjwang
f635d5a9f6 Fix TUP-31909 Shared mode for Talend Studio doesn't work 5921 (#4395)
Fix TUP-31909 Shared mode for Talend Studio doesn't work
https://jira.talendforge.org/browse/TUP-31909
2021-07-01 09:54:30 +08:00
bhe-talendbj
49b4be0929 fix(TUP-31858): Implicit Context Load using Snowflake - Object does not exist error (#4385) 2021-06-30 09:47:38 +08:00
zyuan-talend
39afb9e94a feat(TUP-26268): fix the NPE. (#4378) 2021-06-16 18:04:34 +08:00
hcyi
d119efe8d6 fix(TUP-31238):Library sync with JFrog/Nexus on studio startup doesn't use proxy. (#4356)
* fix(TUP-31238):Library sync with JFrog/Nexus on studio startup doesn't
use proxy.

* fix(TUP-31238):improve for Library sync with JFrog/Nexus on studio
startup doesn't use proxy.

* fix(TUP-31238):add log for Library sync with JFrog/Nexus on studio
startup doesn't use proxy.
2021-06-11 17:23:28 +08:00
Zhiwei Xue
66cdd796fd fix(TUP-31759):fix codes install issues on CI (#4362) 2021-06-11 15:26:50 +08:00
jiezhang-tlnd
af3def7767 feat(TUP-31122)new Data Center in AWS Australia (#4355)
https://jira.talendforge.org/browse/TUP-31122

Co-authored-by: jie.zhang <jie.zhang@LT-DDC8R73.talend.com>
2021-06-10 17:59:17 +08:00
Jane Ding
e7db5386c9 fix(TUP-31159):When use remote mode with Custom log / unlocked, have (#4325)
only one popup of commit
https://jira.talendforge.org/browse/TUP-31159
2021-06-10 17:29:13 +08:00
zyuan-talend
0b8f214c38 feat(TUP-26268): Add button of manipulating Db Column field. (#4354)
* feat(TUP-26268): Add button of manipulating Db Column field.
2021-06-10 15:29:44 +08:00
Emmanuel GALLOIS
3c9684f993 feat(TDI-46215): bump component-runtime to 1.33.1 (#4337) 2021-06-10 09:04:49 +02:00
chmyga
de29a9fee4 chore(TDI-46267): bump connectors to 1.22.0 (#4363)
Co-authored-by: Dmytro Chmyga <dmytro.chmyga@globallogic.com>
2021-06-09 13:43:49 +03:00
sbliu
e346460a75 fix(TUP-31252) Improve the data collector for AMC. (#4349) 2021-06-08 14:24:24 +08:00
sbliu
294bb6a9c9 feat(TUP-30849) add progress bar to install local patch. (#4339) 2021-06-08 14:21:24 +08:00
Xilai Dai
cb76ce50a7 chore(APPINT-32986) fix CVE commons-io 2.6 (#4351) 2021-06-07 18:07:08 +08:00
bhe-talendbj
e8e197e81c fix(TUP-31580): Exclude unnecessary libraries (#4353) 2021-06-07 15:11:52 +08:00
bhe-talendbj
a5d5c0ef55 fix(TUP-31580): replace javascriptengine (#4334)
* fix(TUP-31580): replace javascriptengine

* fix(TUP-31580): fix test case

* fix(TUP-31580): fix test case
2021-06-03 16:16:17 +08:00
sbliu
82b425506a feat(TUP-30834) fix unit test failure introduced by api change (#4340) 2021-06-03 10:53:26 +08:00
Xilai Dai
932e8d61e3 chore(APPINT-32603) Update plexus utils to 3.0.24 (#4330) 2021-06-02 20:55:41 +08:00
sbliu
6baf2b82be feat(TUP-30834) add 2 axis2 module to classpath and export package. (#4280)
add axis2 dependencies.
remove salesforce code&dependency from tup repository metadata, adpt the 'create salesforce connection' toolbar action to generic salesforce connection creation action.
2021-06-02 18:30:01 +08:00
zshen-talend
1331c1d70b fix(TDQ-19437): backport on 7.3 (#4318) 2021-06-02 07:27:49 +00:00
jiezhang-tlnd
e719944af0 chore(TUP-31527)CVE lucene-queryparser (#4333)
Co-authored-by: jie.zhang <jie.zhang@LT-DDC8R73.talend.com>
2021-06-02 15:19:28 +08:00
vdrokov
333f9ad538 APPINT-32815: Bug in springboot build (microservice) 2021-06-01 15:52:32 +02:00
jiezhang-tlnd
eede5c3bc2 Revert "Jzhang/73/tup 31527 (#4300)" (#4332)
This reverts commit c0fde38133.
2021-06-01 14:43:48 +08:00
bhe-talendbj
cafb7db6b8 chore(TUP-31095): Use prepareStatement instead of plain sql execution (#4248)
* fix(TUP-31095): initial impl

* fix(TUP-31095): initial impl

* chore(TUP-31095): use prepared statement

* chore(TUP-31095): fix param index

* fix(TUP-31095): fix parameter index
2021-06-01 11:07:26 +08:00
vdrokov
b042f20e49 APPINT-33123: Account TDI use case (#4329) 2021-05-31 17:26:34 +03:00
jiezhang-tlnd
c0fde38133 Jzhang/73/tup 31527 (#4300)
* fix(TUP-31527)CVE lucene-queries

* remove org.talend.libraries.apache.lucene4
2021-05-31 17:13:46 +08:00
vdrokov
5efc4dd8c4 APPINT-33113: Fix not available routines (#4322) 2021-05-28 19:04:14 +03:00
hcyi
f5833bb365 fix(TUP-31553):Hadoop Metadata Wizard when using custom distro dialog (#4305)
box doesnt pop up to import dependencies.
2021-05-28 14:37:45 +08:00
vdrokov
548f6a97fd APPINT-32815: Bug in springboot build (microservice) (#4288) 2021-05-26 13:26:30 +03:00
Jane Ding
864ba43149 fix(TUP-31316):Error connecting to Azure SQL database with Azure Active (#4271)
* fix(TUP-31316):Error connecting to Azure SQL database with Azure Active
directory method
https://jira.talendforge.org/browse/TUP-31316

* fix(TUP-31316):Error connecting to Azure SQL database with Azure Active
directory method
https://jira.talendforge.org/browse/TUP-31316
2021-05-26 17:30:03 +08:00
zyuan-talend
d0d955546b feat(TUP-30343):have the "Export Dependencies" option checked by default (#4312) 2021-05-26 11:38:03 +08:00
Jane Ding
51cb13c619 fix(TUP-30849):Improve build Job performance (#4151)
* fix(TUP-30849):Improve build Job performance
https://jira.talendforge.org/browse/TUP-30849

Signed-off-by: jding-tlnd <jding@talend.com>

* fix(TUP-30849):Improve build Job performance
https://jira.talendforge.org/browse/TUP-30849
Signed-off-by: jding-tlnd <jding@talend.com>

* fix(TUP-30849):Improve build Job performance
https://jira.talendforge.org/browse/TUP-30849

Signed-off-by: jding-tlnd <jding@talend.com>

* fix(TUP-30849):Improve build Job performance
https://jira.talendforge.org/browse/TUP-30849

Signed-off-by: jding-tlnd <jding@talend.com>

* fix(TUP-30849):Improve build Job performance
https://jira.talendforge.org/browse/TUP-30849

Signed-off-by: jding-tlnd <jding@talend.com>

* fix(TUP-30849):Improve build Job performance
https://jira.talendforge.org/browse/TUP-30849

Signed-off-by: jding-tlnd <jding@talend.com>

* fix(TUP-30849):Improve build Job performance
https://jira.talendforge.org/browse/TUP-30849

Signed-off-by: jding-tlnd <jding@talend.com>

* fix(TUP-30849):Improve build Job performance
https://jira.talendforge.org/browse/TUP-30849

* feat(TUP-31117):Improve performances related to recursive jobs (#4290)

* feat(TUP-31117):Improve performances related to recursive jobs
https://jira.talendforge.org/browse/TUP-31117

* feat(TUP-31117):Improve performances related to recursive jobs
https://jira.talendforge.org/browse/TUP-31117
2021-05-25 18:10:48 +08:00
bhe-talendbj
e9d7c4a43c chore(TUP-30451): remove cve jars (#4301)
* chore(TUP-30415): remove cve jars

* chore(TUP-30415): remove cve jars
2021-05-25 14:33:51 +08:00
jiezhang-tlnd
67d44985fa fix(TUP-31164)Guess schema button on the informix tDBinput component (#4281)
* fix(TUP-31164)Guess schema button on the informix tDBinput component
returns zero length datatype

* Guess schema button on the informix tDBinput component returns zero
length datatype
2021-05-25 11:28:47 +08:00
jiezhang-tlnd
41f5d459f6 chore(TUP-30461)CVE plexus-utils (#4274)
* chore(TUP-30461)CVE plexus-utils

* remove from classpath file
2021-05-24 15:53:07 +08:00
hcyi
b38b96fedc feat(TUP-30619):Missing Additional parameters in SAP Connection. (#4284)
* feat(TUP-30619):Missing Additional parameters in SAP Connection.

* feat(TUP-30619):update key for Additional parameters in SAP Connection.
2021-05-24 09:49:54 +08:00
bhe-talendbj
df53ee1a1f fix(TUP-31380): include all needed modules for routines in CI mode (#4282) 2021-05-21 16:59:54 +08:00
kjwang
035bc4a39c TUP-31227 Studio populate UnstagedChanges for Global Routines and SQL (#4303)
Templates when opening a new Feature Branch (Improve the code)
https://jira.talendforge.org/browse/TUP-31227
2021-05-21 14:26:10 +08:00
kjwang
1105d9c65c Kjwang/fix tup 31227 studio populate unstaged changes (#4277)
* TUP-31227 Studio populate UnstagedChanges for Global Routines and SQL
Templates when opening a new Feature Branch
https://jira.talendforge.org/browse/TUP-31227
2021-05-21 10:54:25 +08:00
Liu Xinquan
488e7aaedb fix(TDQ-19429) tDqReportRun failed when dbconneciton is context mode (#4294) 2021-05-19 17:28:36 +08:00
vdrokov
681dd59eb2 APPINT-32987: Fix dublicate variable (#4278) 2021-05-13 12:08:54 +03:00
sbliu
7a3c23cdb5 fix(TUP-31060): store real routine id in case recreated routine with same name. 2021-05-12 19:14:38 +08:00
Jane Ding
a6f4581b0a chore(APPINT-32936):CVE:Upgrade commons-codec-1.11 to 1.15 (#4261)
https://jira.talendforge.org/browse/APPINT-32936

Co-authored-by: SunChaoqun <csun@talend.com>
2021-05-12 13:59:23 +08:00
Denis Sergent
40e63f3c01 Revert "APPINT-32905: Issue with Rest service flow (#4263)" (#4276)
This reverts commit d88d513e4e.
2021-05-10 11:36:24 +02:00
Jane Ding
d54cddaedf fix(TUP-31237):Invalid username or password when creating a Snowflake (#4232)
* fix(TUP-31237):Invalid username or password when creating a Snowflake
Metadata Connection with a Snowflake password that has a slash character
https://jira.talendforge.org/browse/TUP-31237

* fix(TUP-31237):Invalid username or password when creating a Snowflake
Metadata Connection with a Snowflake password that has a slash character
https://jira.talendforge.org/browse/TUP-31237
2021-05-10 16:04:00 +08:00
Jane Ding
41e2ef2d2d chore(TUP-31030):Update CXF to 3.3.10 (#4242)
* chore(TUP-31030):Update CXF to 3.3.10
https://jira.talendforge.org/browse/TUP-31030

* chore(TUP-31030):Update CXF to 3.3.10
https://jira.talendforge.org/browse/TUP-31030
2021-05-10 09:42:05 +08:00
mbasiuk-talend
bccc406937 chore(TDI-46032): bump connectors version to 1.21.0 (#4269) 2021-05-08 17:04:57 +08:00
hzhao-talendbj
a9b3d20e06 chore(TUP-31403): Add log4j dependency in maven.tis/maven.tos (#4267)
* chore(TUP-31403): Add log4j dependency in maven.tis/maven.tos

* add log4j-1.2-api

* TUP-31403 add maven-shared-utils 3.3.3
2021-05-08 09:44:59 +08:00
Liu Xinquan
47b5a7e251 Revert "Revert "fix(TDQ-19030): fix complier error (#4172)" (#4212)" (#4268)
This reverts commit 137c543bfd.
2021-05-07 14:37:05 +08:00
kjwang
e9b5fa3ba7 Feat:TUP-30377 Move the "Allow specific characters (UTF8,...)" (#4238)
Feat:TUP-30377 Move the "Allow specific characters (UTF8,...) preference setting to project setting.
https://jira.talendforge.org/browse/TUP-30377
2021-05-06 14:48:48 +08:00
jiezhang-tlnd
39a730cae4 fix(TUP-30451)maven-shared-utils-3.0.0.jar,maven-shared-utils-3.0.1.jar,maven-shared-utils-3.1.0.jar (#4262) 2021-05-06 11:01:59 +08:00
vdrokov
d88d513e4e APPINT-32905: Issue with Rest service flow (#4263) 2021-05-05 12:31:14 +03:00
kjwang
75176b6f45 Revert the commit of TUP-31096 to test tuj (#4253)
Co-authored-by: kjwang <kjwang@LT-B1Z2R73.talend.com>
2021-04-30 10:21:23 +08:00
hzhao-talendbj
11ecc1cbfd fix(TUP-31248):impala metadata connection issues for Cloudera (#4246)
* fix(TUP-31248):impala metadata connection issues for Cloudera

* TUP-31248 revert mistake remove

* TUP-31248 remove some useless code

* TUP-31248 add connection info to log when connection failed
2021-04-29 15:29:56 +08:00
jiezhang-tlnd
53efef8de0 fix(TUP-29866)CVE on maven-shared-utils (#4225)
* fix(TUP-29866)CVE on maven-shared-utils

* exclude maven-shared-utils 3.2.1

* update pom_project_template.xml

* exclude maven-shared-utils:jar:3.1.0
2021-04-29 14:27:16 +08:00
Jane Ding
db2eb01c38 fix(TUP-31234):Build job fail with option "Execute tests" if any test (#4244)
case fail
https://jira.talendforge.org/browse/TUP-31234
2021-04-28 17:59:19 +08:00
hzhao-talendbj
f9af16ba90 fix(TUP-30524): Commandline login svn project tag fail (#4228) 2021-04-28 11:59:24 +08:00
kjwang
23f2926741 Fix TUP-31096 Could not find or load main class error on the jobs (#4245)
Fix TUP-31096 Could not find or load main class error on the jobs created on the Feature Branch which has #
https://jira.talendforge.org/browse/TUP-31096
2021-04-27 17:57:52 +08:00
Jane Ding
48653aa380 feat(TUP-30730):Deprecate SAS from metadata wizard (#4210)
https://jira.talendforge.org/browse/TUP-30730
2021-04-27 15:15:31 +08:00
bhe-talendbj
d80fefc234 fix(TUP-31069): remove beanutils-core (#4227)
* fix(TUP-31069): remove beanutils-core

* chore(TUP-31069): change commons-io to 2.4

* chore(TUP-31069): change commons-io to 2.7

* chore(TUP-31069): change commons-io to 2.7

* chore(TUP-31069): only remove unsed cve jars
2021-04-26 18:21:31 +08:00
sbliu
a0b395cd3a feat(TUP-30846) Unify studio version information & patch info in studio logs. 2021-04-25 10:50:31 +08:00
hzhao-talendbj
98bcc66479 chore(TUP-31155): change the way to check if it's CI mode (#4208)
* chore(TUP-31155): change the way to check if it's CI mode

* TUP-31155 code change

* TUP-31155 add comments
2021-04-23 18:22:37 +08:00
ypiel
a716257dd0 chore: bump to tck:1.32.0 2021-04-22 12:13:51 +02:00
wang wei
b164f8c447 fix(TDI-43921): backport to 73 (#4231) 2021-04-21 18:08:04 +08:00
jiezhang-tlnd
dd352b4a8f fix(TUP-29381)CVE on (#4222)
commons-codec-1.6.jar/commons-codec-1.9.jar/commons-codec-1.10.jar
2021-04-19 15:43:12 +08:00
Jane Ding
08ac05c23e fix(TUP-30992):CVE: junit-4.11,4.13 (#4220)
https://jira.talendforge.org/browse/TUP-30992

Signed-off-by: jding-tlnd <jding@talend.com>
2021-04-16 19:19:40 +08:00
Zhiwei Xue
90a37f8418 fix(TUP-30187):rename maven property (#4216) 2021-04-16 15:36:36 +08:00
Liu Xinquan
137c543bfd Revert "fix(TDQ-19030): fix complier error (#4172)" (#4212)
This reverts commit c22eba9ead.
2021-04-15 16:39:40 +08:00
jiezhang-tlnd
42e94c6508 fix(TUP-30992)CVE: junit-4.11,4.13 (#4202)
* fix(TUP-30992)CVE: junit-4.11,4.13

* fix(TUP-30992)CVE: junit-4.11,4.13
2021-04-15 16:13:04 +08:00
hzhao-talendbj
ff9c4c021a fix(TUP-30921):Job fails with "Could not find the context Default" after migration 7.2.1 to 7.3.1 R2021-01 (#4154)
* fix(TUP-30921): Job fails with "Could not find the context Default"
after migration 7.2.1 to 7.3.1 R2021-01

* TUP-30921 new code change
2021-04-15 15:13:28 +08:00
Zhiwei Xue
291f56e505 fix(TUP-30586):Routine/Bean custom jars dependency management issues left todo (#4201)
* fix(TUP-30782):Fail to run job if use a custom routine jar without inner
jar.

* fix(TUP-30791): fix test case run failure
2021-04-14 16:54:11 +08:00
hzhao-talendbj
c67b2f479e chore(TUP-30942): upgrade to httpclient-4.5.13.jar (#4193) 2021-04-14 09:38:28 +08:00
mbasiuk-talend
45d373f447 chore(TDI-45894): bump connectors version to 1.20.0 (#4190) 2021-04-13 13:29:33 +03:00
Emmanuel GALLOIS
edff6eeeb8 feat(TDI-45842): bump component-runtime to 1.31.2 (#4164)
* feat(TDI-45842): bump component-runtime to 1.31.1-SNAPSHOT

* chore(TDI-45842): bump component-runtime to 1.31.2

Co-authored-by: jzhao-talend <jzhao@talend.com>
Co-authored-by: mbasiuk <mbasiuk@talend.com>
2021-04-13 12:39:28 +03:00
bhe-talendbj
acd1555a2b fix(TUP-26813): upgrade bcprov-jdk15on (#4053)
* fix(TUP-26813): upgrade bcprov-jdk15on

* fix(TUP-26813): upgrade bcprov-jdk15on

* fix(TUP-26813): add test case
2021-04-13 11:42:21 +08:00
sbliu
97a77ec401 feat(TUP-30953) record install additional packages. 2021-04-13 11:07:46 +08:00
bhe-talendbj
a5f6364467 bugfix(TUP-30203): Search required groups only (#4174)
* fix(TUP-30203): only search required library groups

* fix(TUP-30203): only search required library groups, refactor

* fix(TUP-30203): only search required library groups, refactor

* fix(TUP-30203): exclude class file

* fix(TUP-30203): exclude class file

* fix(TUP-30203): share libs in background

* fix(TUP-30203): add i18n
2021-04-12 18:05:35 +08:00
hcyi
db39d84224 feat(TUP-30291):Add Suggestable support for Table options (List<Row>) in (#4150)
Studio.
2021-04-12 15:24:23 +08:00
jiezhang-tlnd
d153fe9fa0 feat(TUP-30381)Support greenplum driver for Greenplum Database in studio (#4138)
* feat(TUP-30381)Support greenplum driver for Greenplum Database in studio
metadata
https://jira.talendforge.org/browse/TUP-30381

* add dbversion for greeenplu

* add dbversion

* update mapping_greenplum file

* update greenplum_mapping

* update greenplum mapping
2021-04-12 10:02:25 +08:00
hzhao-talendbj
939e974d1c fix(TUP-30429): the job export from v6.5.1 can't be imported to v7.3.1 (#4180) 2021-04-09 11:33:04 +08:00
Zhiwei Xue
722a0b1341 fix(TUP-30786):Avoid to click finish button more than once when do (#4184)
create custom routine jar/bean jar.
2021-04-08 18:32:55 +08:00
sbliu
7b391d516f TUP-30768 Can't reset performance_record if first patch use manual installation then the second use Software update 2021-04-08 17:26:50 +08:00
Xilai Dai
b5478c3f2f chore(APPINT-32718) override the httpclient version (#4189)
* chore(APPINT-32718) override the httpclient version

* chore(APPINT-32718) override the httpclient version
2021-04-08 16:27:29 +08:00
hzhao-talendbj
0726cb38fd chore(TUP-30942): CVE: httpclient-4.5.3.jar (#4157)
* chore(TUP-30942): CVE: httpclient-4.5.3.jar

* TUP-30942 modify manifest
2021-04-08 15:55:37 +08:00
pyzhou
687ab637be fix(TDI-45881):Update jackson mapper (#4188) 2021-04-08 15:27:31 +08:00
hzhao-talendbj
4cb1deb115 chore(TUP-27039): Update Commons Compress to 1.19 backport to 7.3 (#4140)
* chore(TUP-27039): Update Commons Compress to 1.19 backport to 7.3

* TUP-27093 fix wrong code dependency

* TUP-27039 revert tycho to 1.4.0

* TUP-27039 change karaf-maven-plugin to 4.2.7

* TUP-27039 change karaf-maven-plugin to 4.2.7

* TUP-27039 if packaging pom ,then use origin one
2021-04-08 10:51:39 +08:00
Zhiwei Xue
c594011902 fix(TUP-30187):CI: Add options to disable compile error of (#4177)
routines/beans/codejars pom
2021-04-07 09:46:54 +08:00
vdrokov
c6d7da2121 TESB-32416: Importing route from a zip file, imports all the other jobs (Clone TESB-32400) (#4147) 2021-04-06 15:00:36 +02:00
Zhiwei Xue
90951dced8 fix(TUP-30780):Only check used custom jars when run/build Job (#4173) 2021-04-06 15:51:34 +08:00
msjian
c22eba9ead fix(TDQ-19030): fix complier error (#4172) 2021-04-06 14:14:56 +08:00
Zhiwei Xue
e466c31b88 fix(TUP-30977):test run map using custom routines and beans doesn't work (#4159)
after switch branch
2021-04-06 12:05:53 +08:00
bhe-talendbj
6a601fadd2 fix(TUP-30047): fix missing joblet (#4107)
* fix(TUP-30047): fix missing joblet

* fix(TUP-30047): add missing joblets for test case job

* fix(TUP-30047): add missing joblets for test case job, infinite loop

* feat(TUP-30047): support running dynamic jobs

* feat(TUP-30047): change location of classpath.jar if running ci test
2021-04-02 16:14:23 +08:00
sbliu
28a216d0af fix(TUP-30685) Mvn package job use joblet in subref project fail to run the bat file correct. 2021-04-01 17:27:24 +08:00
hzhao-talendbj
5622490ca4 chore(TUP-29181): upgrade cxf backport to 73 (#4142)
* chore(TUP-29181): upgrade cxf backport to 73

* TUP-29181 remove extra bundle activationpolicy

* TUP-29181 try add source src

* TUP-29181 remove jars from lib folder

* TUP-29181 remove jars from lib
2021-03-30 16:14:45 +08:00
jiezhang-tlnd
283fa4ac93 Jzhang/73/tup 29381 (#4057)
* fix(TUP-29381)CVE on
commons-codec-1.6.jar/commons-codec-1.9.jar/commons-codec-1.10.jar

* fix(TUP-29381)CVE on
commons-codec-1.6.jar/commons-codec-1.9.jar/commons-codec-1.10.jar

* update on tos

* remove common-codec-1.6

* remove commons-dodec 1.6
2021-03-30 15:57:45 +08:00
Zhiwei Xue
b55a302e9f fix(TUP-30813):Add Junits for dependency management feature (#4144) 2021-03-25 09:39:16 +08:00
Jane Ding
887d1249dc fix(TUP-30216):Commandline install patch and login project throw NPE (#4114)
https://jira.talendforge.org/browse/TUP-30216

Signed-off-by: jding-tlnd <jding@talend.com>
2021-03-25 00:39:52 +08:00
Zhiwei Xue
caa73983c8 fix(TUP-30779):Custom jar resource unload issue after git pull&merge. (#4133) 2021-03-24 16:20:48 +08:00
Jane Ding
7a502a7dc1 fix(TUP-30615):Schema Update Detection popping up everytime upon opening (#4131)
the job
https://jira.talendforge.org/browse/TUP-30615

Signed-off-by: jding-tlnd <jding@talend.com>
2021-03-23 11:30:29 +08:00
hzhao-talendbj
c395d11c00 TUP-30558 (#4111) (#4130) 2021-03-23 09:53:34 +08:00
Zhiwei Xue
1fc99eaa02 feat(TUP-29014): bugfix 2021-03-16 (#4128) 2021-03-16 17:11:55 +08:00
jiezhang-tlnd
77a076cea1 revert the commit 94914d676b 2021-03-16 16:06:51 +08:00
jiezhang-tlnd
94914d676b check if custom nexus is available or not before deploy the jar 2021-03-16 16:01:53 +08:00
Laurent BOURGEOIS
1faf28843b fix(TBD-11964): Different time zone for Standard jobs and BD Batch (#4082) 2021-03-15 17:01:22 +01:00
353 changed files with 6435 additions and 12407 deletions

View File

@@ -29,7 +29,7 @@
<import plugin="org.eclipse.jdt.launching" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.jdt.ui" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.hamcrest.core" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.junit" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.junit" version="4.13.2" match="greaterOrEqual"/>
</requires>
<plugin id="org.eclipse.jdt.launching.macosx" os="macosx" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.eclipse.jdt.launching.ui.macosx" os="macosx" download-size="0" install-size="0" version="0.0.0" unpack="false"/>

View File

@@ -18,7 +18,7 @@
<import plugin="org.apache.commons.lang3" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.apache.log4j" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.apache.servicemix.bundles.avro" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.junit" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.junit" version="4.13.2" match="greaterOrEqual"/>
<import plugin="org.slf4j.api" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.apache.commons.configuration" version="2.0.0" match="greaterOrEqual"/>
</requires>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -132,3 +132,8 @@ GlobalServiceRegister.ServiceNotRegistered=The service {0} has not been register
MessageBoxExceptionHandler.showMessageForSchemaImportXml.unParseXML.title=The xml can't parse.
MessageBoxExceptionHandler.showMessageForSchemaImportXml.unParseXML.msg=The xml can't parse in this format.
HibernateUtils.auditDBIsNotUsable=The audit database must be empty or only contains tables related to audit.
CasePushButton.CaseButton.Tip=Uppercase/Lowercase Db column
QuotePushButton.QuoteButton.Tip=Add/Remove Quote on Db column
QuoteManipulateDialog.title=Add/Remove quote on Db column
QuoteManipulateDialog.addQuote=Add quote
QuoteManipulateDialog.removeQuote=Remove quote

View File

@@ -88,6 +88,8 @@ public enum EImage implements IImage {
LEFTX_ICON("/icons/leftx.png"), //$NON-NLS-1$
RIGHT_ICON("/icons/right.gif"), //$NON-NLS-1$
RIGHTX_ICON("/icons/rightx.png"), //$NON-NLS-1$
LOWERCASE_ICON("/icons/lowercase.jpg"), //$NON-NLS-1$
UPPERCASE_ICON("/icons/uppercase.jpg"), //$NON-NLS-1$
KEY_ICON("/icons/key.gif"), //$NON-NLS-1$
HIERARCHY_ICON("/icons/hierarchicalLayout.gif"), //$NON-NLS-1$

View File

@@ -0,0 +1,56 @@
package org.talend.commons.runtime.service;
import java.util.Collection;
import java.util.Collections;
import java.util.Properties;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
import org.talend.commons.exception.CommonExceptionHandler;
public interface ICollectDataService {
final String KEY_SOURCE = "source";
//
final String AMC_FILE_TYPE_USED = "FILE_TYPE_USED";
final String AMC_DATABASE_TYPE_USED = "DATABASE_TYPE_USED";
final String AMC_PREVIEW_KEY = "amc.datasource";
final String AMC_PREVIEW_FILEVALUE = "File";
final String AMC_PREVIEW_DATABASEVALUE = "Database";
/**
* @return json string
*/
String getCollectedDataJSON();
Properties getCollectedData();
public static ICollectDataService getInstance(String from) throws Exception {
BundleContext bc = FrameworkUtil.getBundle(ICollectDataService.class).getBundleContext();
Collection<ServiceReference<ICollectDataService>> tacokitServices = Collections.emptyList();
try {
tacokitServices = bc.getServiceReferences(ICollectDataService.class, null);
} catch (InvalidSyntaxException e) {
CommonExceptionHandler.process(e);
}
if (tacokitServices != null) {
for (ServiceReference<ICollectDataService> sr : tacokitServices) {
if (from == null || from.equals(sr.getProperty(KEY_SOURCE))) {
ICollectDataService tacokitService = bc.getService(sr);
if (tacokitService != null) {
return tacokitService;
}
}
}
}
return null;
}
}

View File

@@ -12,6 +12,8 @@
// ============================================================================
package org.talend.commons.runtime.service;
import org.eclipse.core.runtime.IProgressMonitor;
/**
* DOC ggu class global comment. Detailled comment
*/
@@ -19,6 +21,10 @@ public interface P2InstallComponent {
boolean install();
default boolean install(IProgressMonitor monitor) {
return false;
}
boolean needRelaunch();
String getInstalledMessages();

View File

@@ -29,6 +29,8 @@ public interface IExtendedList<T> extends List<T> {
public void swapElements(List<Integer> indicesOrigin, List<Integer> indicesTarget);
public void swapElement(T object1, T object2);
public void replaceElement(int index, T object2);
/**
* Getter for useEquals.

View File

@@ -537,6 +537,11 @@ public class ListenableList<T> implements IExtendedList<T> {
fireReplacedEvent(index, replacedObject, element, false);
return replacedObject;
}
@Override
public void replaceElement(int index, T element) {
this.list.set(index, element);
}
/*
* (non-Javadoc)

View File

@@ -16,7 +16,6 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
@@ -109,11 +108,11 @@ public class DB2ForZosDataBaseMetadata extends PackageFakeDatabaseMetadata {
// MOD yyin 2012-05-15 TDQ-5190
String sql = "SELECT DISTINCT CREATOR FROM SYSIBM.SYSTABLES"; //$NON-NLS-1$
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
rs = stmt.executeQuery();
while (rs.next()) {
String creator = rs.getString("CREATOR"); //$NON-NLS-1$
@@ -331,18 +330,20 @@ public class DB2ForZosDataBaseMetadata extends PackageFakeDatabaseMetadata {
public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)
throws SQLException {
// for real
String sql = "SELECT * FROM SYSIBM.SYSCOLUMNS where TBNAME='" + tableNamePattern + "' AND TBCREATOR = '" //$NON-NLS-1$ //$NON-NLS-2$
+ schemaPattern + "' ORDER BY TBCREATOR, TBNAME, COLNO"; //$NON-NLS-1$
String sql = "SELECT * FROM SYSIBM.SYSCOLUMNS where TBNAME=? AND TBCREATOR = ? ORDER BY TBCREATOR, TBNAME, COLNO"; //$NON-NLS-1$
// for test
// String sql = "SELECT * FROM SYSIBM.SYSCOLUMNS where NAME='NAME'";
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
stmt.setString(1, tableNamePattern);
stmt.setString(2, schemaPattern);
rs = stmt.executeQuery();
while (rs.next()) {
// For real db2 for zos, should use these code.

View File

@@ -25,7 +25,6 @@ public class JtdsDatabaseMetadata extends PackageFakeDatabaseMetadata {
@Override
public ResultSet getSchemas() throws SQLException {
java.sql.Statement statement = connection.createStatement();
String sql;
if (((PackageFakeDatabaseMetadata) connection).getDatabaseMajorVersion() >= 9) {
sql = JDBC3 ? "SELECT name AS TABLE_SCHEM, NULL as TABLE_CATALOG FROM " + connection.getCatalog() + ".sys.schemas"
@@ -36,6 +35,7 @@ public class JtdsDatabaseMetadata extends PackageFakeDatabaseMetadata {
}
sql += " ORDER BY TABLE_SCHEM";
return statement.executeQuery(sql);
java.sql.PreparedStatement statement = connection.prepareStatement(sql);
return statement.executeQuery();
}
}

View File

@@ -13,9 +13,9 @@
package org.talend.commons.utils.database;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
@@ -152,15 +152,19 @@ public class SAPHanaDataBaseMetadata extends FakeDatabaseMetaData {
// check if the type is contained is in the types needed.
String sqlcv = "SELECT OBJECT_NAME,PACKAGE_ID FROM _SYS_REPO.ACTIVE_OBJECT WHERE OBJECT_SUFFIX = 'calculationview'"; //$NON-NLS-1$
if (tableNamePattern != null && !tableNamePattern.equals("%")) { //$NON-NLS-1$
sqlcv += " AND (OBJECT_NAME LIKE '" + tableNamePattern + "'"; //$NON-NLS-1$ //$NON-NLS-2$
sqlcv += " OR PACKAGE_ID LIKE '" + tableNamePattern + "')"; //$NON-NLS-1$ //$NON-NLS-2$
sqlcv += " AND (OBJECT_NAME LIKE ?"; //$NON-NLS-1$ //$NON-NLS-2$
sqlcv += " OR PACKAGE_ID LIKE ? )"; //$NON-NLS-1$ //$NON-NLS-2$
}
ResultSet rscv = null;
Statement stmtcv = null;
PreparedStatement stmtcv = null;
List<String[]> listcv = new ArrayList<String[]>();
try {
stmtcv = connection.createStatement();
rscv = stmtcv.executeQuery(sqlcv);
stmtcv = connection.prepareStatement(sqlcv);
if (tableNamePattern != null && !tableNamePattern.equals("%")) {
stmtcv.setString(1, tableNamePattern);
stmtcv.setString(2, tableNamePattern);
}
rscv = stmtcv.executeQuery();
while (rscv.next()) {
String objectName = rscv.getString("OBJECT_NAME"); //$NON-NLS-1$
if (objectName != null) {
@@ -303,11 +307,11 @@ public class SAPHanaDataBaseMetadata extends FakeDatabaseMetaData {
if (!load) {
String sqlcv = "SELECT * from \"" + schemaPattern + "\".\"" + tableNamePattern + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ResultSet rscv = null;
Statement stmtcv = null;
PreparedStatement stmtcv = null;
List<String[]> listcv = new ArrayList<String[]>();
try {
stmtcv = connection.createStatement();
rscv = stmtcv.executeQuery(sqlcv);
stmtcv = connection.prepareStatement(sqlcv);
rscv = stmtcv.executeQuery();
int i = 1;
while (rscv.next()) {
String tableName = tableNamePattern;

View File

@@ -13,9 +13,9 @@
package org.talend.commons.utils.database;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
@@ -62,11 +62,11 @@ public class SASDataBaseMetadata extends FakeDatabaseMetaData {
// see the feature 5827
String sql = "SELECT DISTINCT LIBNAME FROM SASHELP.VTABLE"; //$NON-NLS-1$
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
rs = stmt.executeQuery();
while (rs.next()) {
String creator = rs.getString("LIBNAME"); //$NON-NLS-1$
@@ -147,17 +147,21 @@ public class SASDataBaseMetadata extends FakeDatabaseMetaData {
public ResultSet getTables(String catalog, String schema, String tableNamePattern, String[] types) throws SQLException {
String sql;
if (schema != null) {
sql = "SELECT * FROM SASHELP.VTABLE where LIBNAME = '" + schema + "'"; //$NON-NLS-1$ //$NON-NLS-2$
sql = "SELECT * FROM SASHELP.VTABLE where LIBNAME = ?"; //$NON-NLS-1$ //$NON-NLS-2$
} else {
sql = "SELECT * FROM SASHELP.VTABLE"; //$NON-NLS-1$
}
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
if (schema != null) {
stmt.setString(1, schema);
}
rs = stmt.executeQuery();
while (rs.next()) {
String name = rs.getString("MEMNAME"); //$NON-NLS-1$
@@ -229,18 +233,20 @@ public class SASDataBaseMetadata extends FakeDatabaseMetaData {
public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)
throws SQLException {
// for real
String sql = "SELECT * FROM SASHELP.VCOLUMN where MEMNAME='" + tableNamePattern + "' AND LIBNAME = '" //$NON-NLS-1$ //$NON-NLS-2$
+ schemaPattern + "' ORDER BY LIBNAME, MEMNAME, VARNUM"; //$NON-NLS-1$
String sql = "SELECT * FROM SASHELP.VCOLUMN where MEMNAME=? AND LIBNAME = ? ORDER BY LIBNAME, MEMNAME, VARNUM"; //$NON-NLS-1$
// for test
// String sql = "SELECT * FROM SYSIBM.SYSCOLUMNS where NAME='NAME'";
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
stmt.setString(1, tableNamePattern);
stmt.setString(2, schemaPattern);
rs = stmt.executeQuery();
while (rs.next()) {
String tableName = rs.getString("MEMNAME"); //$NON-NLS-1$
if (tableName != null) {

View File

@@ -13,9 +13,9 @@
package org.talend.commons.utils.database;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
@@ -52,10 +52,12 @@ public class Sybase16SADatabaseMetaData extends SybaseDatabaseMetaData {
for (String catalogName : catList) {
String sql = createSqlByLoginAndCatalog(login, catalogName);
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
stmt.setString(1, login);
rs = stmt.executeQuery();
while (rs.next()) {
int temp = rs.getInt(1);
@@ -113,8 +115,7 @@ public class Sybase16SADatabaseMetaData extends SybaseDatabaseMetaData {
*/
protected String createSqlByLoginAndCatalog(String loginName, String catalogName) {
String sql = "select count(*) from " + catalogName
+ ".dbo.sysusers where suid in (select suid from "+catalogName+".dbo.syslogins where name = '" + loginName
+ "')";
+ ".dbo.sysusers where suid in (select suid from " + catalogName + ".dbo.syslogins where name = ? )";
return sql;
}

View File

@@ -13,9 +13,9 @@
package org.talend.commons.utils.database;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
@@ -54,10 +54,13 @@ public class SybaseDatabaseMetaData extends PackageFakeDatabaseMetadata {
for (String catalogName : catList) {
String sql = createSqlByLoginAndCatalog(login, catalogName);
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
stmt.setString(1, login);
stmt.setString(2, login);
rs = stmt.executeQuery();
while (rs.next()) {
int temp = rs.getInt(1);
@@ -92,11 +95,11 @@ public class SybaseDatabaseMetaData extends PackageFakeDatabaseMetadata {
public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException {
String sql = "SELECT DISTINCT name FROM " + catalog + ".dbo.sysusers where suid > 0"; //$NON-NLS-1$ //$NON-NLS-2$
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
rs = stmt.executeQuery();
while (rs.next()) {
String name = rs.getString("name"); //$NON-NLS-1$
@@ -136,9 +139,9 @@ public class SybaseDatabaseMetaData extends PackageFakeDatabaseMetadata {
*/
protected String createSqlByLoginAndCatalog(String loginName, String catalogName) {
return "select count(*) from " + catalogName //$NON-NLS-1$
+ ".dbo.sysusers where suid in (select suid from master.dbo.syslogins where name = '" + loginName //$NON-NLS-1$
+ "') or suid in (select altsuid from " + catalogName //$NON-NLS-1$
+ ".dbo.sysalternates a, master.dbo.syslogins b where b.name = '" + loginName + "' and a.suid = b.suid)"; //$NON-NLS-1$ //$NON-NLS-2$
+ ".dbo.sysusers where suid in (select suid from master.dbo.syslogins where name = ?"
+ ") or suid in (select altsuid from " + catalogName //$NON-NLS-1$
+ ".dbo.sysalternates a, master.dbo.syslogins b where b.name = ? and a.suid = b.suid)"; //$NON-NLS-1$ //$NON-NLS-2$
}
@Override

View File

@@ -13,9 +13,9 @@
package org.talend.commons.utils.database;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
@@ -97,13 +97,12 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
int dbMajorVersion = connection.getMetaData().getDatabaseMajorVersion();
String sql = "HELP COLUMN \"" + schema + "\".\"" + table + "\".* ";//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
String columnName = null;
List<String[]> list = new ArrayList<String[]>();
try {
if (dbMajorVersion > 12) {
sql = "SELECT * from DBC.INDICESV WHERE UPPER(databasename) = UPPER('" + schema //$NON-NLS-1$
+ "') AND UPPER(tablename) = UPPER('" + table + "') AND UPPER(UniqueFlag) = UPPER('Y')"; //$NON-NLS-1$//$NON-NLS-2$
sql = "SELECT * from DBC.INDICESV WHERE UPPER(databasename) = UPPER(?) AND UPPER(tablename) = UPPER(?) AND UPPER(UniqueFlag) = UPPER('Y')"; //$NON-NLS-1$ //$NON-NLS-2$
rs = getResultSet(catalog, schema, table, sql);
while (rs.next()) {
columnName = rs.getString("ColumnName").trim(); //$NON-NLS-1$
@@ -112,8 +111,11 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
list.add(r);
}
} else {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
stmt.setString(1, schema);
stmt.setString(2, table);
rs = stmt.executeQuery();
while (rs.next()) {
columnName = rs.getString("Column Name").trim(); //$NON-NLS-1$
String pk = rs.getString("Primary?");//$NON-NLS-1$
@@ -138,10 +140,10 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
public ResultSet getResultSet(String catalog, String schema, String table, String sql) throws SQLException {
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
rs = stmt.executeQuery();
} catch (SQLException e) {
throw new RuntimeException(e);
}
@@ -203,17 +205,15 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
sysTable = "DBC.TABLESV";//$NON-NLS-1$
}
if (types != null && types.length > 0) {
sql = "SELECT * from " + sysTable + " WHERE UPPER(databasename) = UPPER('" + database //$NON-NLS-1$//$NON-NLS-2$
+ "') AND tablekind " + addTypesToSql(types); //$NON-NLS-1$
sql = "SELECT * from " + sysTable + " WHERE UPPER(databasename) = UPPER(?) AND tablekind " + addTypesToSql(types); //$NON-NLS-1$
} else {
// When the types is empty, all the tables and views will be retrieved.
sql = "SELECT * from " + sysTable + " WHERE UPPER(databasename) = UPPER('" + database //$NON-NLS-1$//$NON-NLS-2$
+ "') AND (tablekind = 'T' or tablekind = 'V')"; //$NON-NLS-1$
sql = "SELECT * from " + sysTable + " WHERE UPPER(databasename) = UPPER(?) AND (tablekind = 'T' or tablekind = 'V')"; //$NON-NLS-1$
}
// add the filter for table/views
if (!StringUtils.isEmpty(tableNamePattern)) {
sql = sql + " AND tablename LIKE '" + tableNamePattern + "'";//$NON-NLS-1$//$NON-NLS-2$
sql = sql + " AND tablename LIKE ?";//$NON-NLS-1$ //$NON-NLS-2$
}
if (types != null && types.length > 0) {
@@ -223,11 +223,18 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
}
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
stmt.setString(1, database);
// add the filter for table/views
if (!StringUtils.isEmpty(tableNamePattern)) {
stmt.setString(2, tableNamePattern);
}
rs = stmt.executeQuery();
while (rs.next()) {
String name = rs.getString("TableName").trim(); //$NON-NLS-1$
@@ -326,21 +333,33 @@ public class TeradataDataBaseMetadata extends FakeDatabaseMetaData {
if (!StringUtils.isEmpty(database)) {
sql = "HELP COLUMN \"" + database + "\".\"" + tableNamePattern + "\".* ";//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
if (dbMajorVersion > 12) {
sql = "SELECT * from DBC.COLUMNSV WHERE UPPER(databasename) = UPPER('" + database //$NON-NLS-1$
+ "') AND UPPER(tablename) = UPPER('" + tableNamePattern + "')" + " Order by tablename "; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
sql = "SELECT * from DBC.COLUMNSV WHERE UPPER(databasename) = UPPER(?) AND UPPER(tablename) = UPPER(?)" //$NON-NLS-1$
+ " Order by tablename "; //$NON-NLS-1$ //$NON-NLS-3$
}
} else {
sql = "HELP COLUMN \"" + tableNamePattern + "\".* ";//$NON-NLS-1$//$NON-NLS-2$
if (dbMajorVersion > 12) {
sql = "SELECT * from DBC.COLUMNSV WHERE UPPER(tablename) = UPPER('" + tableNamePattern + "')" + " Order by tablename "; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
sql = "SELECT * from DBC.COLUMNSV WHERE UPPER(tablename) = UPPER(?)" + " Order by tablename "; //$NON-NLS-1$//$NON-NLS-2$
// //$NON-NLS-3$
}
}
ResultSet rs = null;
Statement stmt = null;
PreparedStatement stmt = null;
List<String[]> list = new ArrayList<String[]>();
try {
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
stmt = connection.prepareStatement(sql);
if (!StringUtils.isEmpty(database)) {
if (dbMajorVersion > 12) {
stmt.setString(1, database);
stmt.setString(2, tableNamePattern);
}
} else {
if (dbMajorVersion > 12) {
stmt.setString(1, tableNamePattern);
}
}
rs = stmt.executeQuery();
while (rs.next()) {
String tableName = tableNamePattern;
String columnName = null;

View File

@@ -277,6 +277,10 @@ public class NetworkUtil {
if (wrapIpV6 && Inet6Address.class.isInstance(inetAddress)) {
String addr = inetAddress.getHostAddress();
if (!addr.startsWith("[") || !addr.endsWith("]")) {
int idx = addr.indexOf("%");
if (idx > 0) {
addr = addr.substring(0, idx);
}
addr = "[" + addr + "]";
}
return addr;

View File

@@ -0,0 +1,55 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.commons.utils.time;
import java.io.File;
import java.util.Properties;
import org.eclipse.core.runtime.Platform;
public class PropertiesCollectorUtil {
private static final String ROOT_NODE = "additional_packages_records"; // additional packages
private static final String PREF_ADDITIONAL_PACKAGES = "AdditionalPackages"; // preference node
private static final String ADDITONAL_PACKAGE_FILE = "additionalPackages";
public static String getAdditionalPackageRecording() {
File file = getRecordFile(ADDITONAL_PACKAGE_FILE);
Properties props = PropertiesFileUtil.read(file, true);
String records = props.getProperty(ROOT_NODE, "");
return records;
}
public static void storeAdditionalPackageRecording(String records) {
File file = getRecordFile(ADDITONAL_PACKAGE_FILE);
Properties props = PropertiesFileUtil.read(file, false);
props.setProperty(ROOT_NODE, records);
PropertiesFileUtil.store(file, props);
}
private static File getRecordFile(String fileName) {
String configurationLocation = Platform.getConfigurationLocation().getURL().getPath();
File file = new File(configurationLocation + "/data_collector/" + fileName);
return file;
}
public static String getAdditionalPackagePreferenceNode() {
return PREF_ADDITIONAL_PACKAGES;
}
}

View File

@@ -76,6 +76,8 @@ ExtendedTableMoveCommand.MoveLabel=Move up or down, one or more table entries
ExtendedTablePasteCommand.Paste.Label=Paste data from the internal clipoard
ExtendedTableRemoveCommand.Romve.Label=Remove table entries
ExtendedTableResetDBTypesCommand.ResetDBTypes.Label=Reset all DB Types to get the defaults
ExtendedTableCaseCommand.case.Label=Change selected DB columns to uppercase/lowercase
ExtendedTableQuoteCommand.Quote.Label=Quote selected DB columns
ImportPushButton.ImportButton.Tip=Replace all rows by import from xml file
ImportPushButtonForExtendedTable.ErrorMsg.Text=Error occurred
LabelledFileField.BrowseButton.Text=Browse...

View File

@@ -27,11 +27,13 @@ import org.talend.commons.ui.swt.advanced.dataeditor.button.MoveDownPushButtonFo
import org.talend.commons.ui.swt.advanced.dataeditor.button.MoveUpPushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.MoveUpPushButtonForExtendedTable;
import org.talend.commons.ui.swt.advanced.dataeditor.button.PastePushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.QuotePushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.RemovePushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.RemovePushButtonForExtendedTable;
import org.talend.commons.ui.swt.advanced.dataeditor.button.ResetDBTypesPushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.SaveAsGenericSchemaPushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.SelectContextVariablesPushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.CasePushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton;
import org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer;
@@ -67,7 +69,11 @@ public class ExtendedToolbarView extends AbstractExtendedToolbar {
protected ResetDBTypesPushButton resetDBTypesButton;
protected SelectContextVariablesPushButton selectContextVariablesButton;
protected CasePushButton caseButton;
protected QuotePushButton quoteButton;
/**
* DOC amaumont MatadataToolbarEditor constructor comment.
*
@@ -103,7 +109,11 @@ public class ExtendedToolbarView extends AbstractExtendedToolbar {
pasteButton = createPastePushButton();
addallButton = createAddAllPushButton();
caseButton = createCasePushButton();
quoteButton = createQuotePushButton();
exportButton = createExportPushButton();
importButton = createImportPushButton();
@@ -169,6 +179,14 @@ public class ExtendedToolbarView extends AbstractExtendedToolbar {
protected SelectContextVariablesPushButton createSelectContextVariablesPushButton() {
return null;
}
protected CasePushButton createCasePushButton() {
return null;
}
protected QuotePushButton createQuotePushButton() {
return null;
}
/**
* Getter for addButton.
@@ -327,6 +345,14 @@ public class ExtendedToolbarView extends AbstractExtendedToolbar {
if (getAddallButton() != null) {
list.add(getAddallButton());
}
if (getCaseButton() != null) {
list.add(getCaseButton());
}
if (getQuoteButton() != null) {
list.add(getQuoteButton());
}
return list;
}
@@ -348,6 +374,26 @@ public class ExtendedToolbarView extends AbstractExtendedToolbar {
public AddAllPushButton getAddallButton() {
return this.addallButton;
}
/**
* Getter for caseButton.
*
* @return the caseButton
*/
public CasePushButton getCaseButton() {
return this.caseButton;
}
/**
* Getter for quoteButton.
*
* @return the quoteButton
*/
public QuotePushButton getQuoteButton() {
return this.quoteButton;
}
}
//

View File

@@ -0,0 +1,48 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.commons.ui.swt.advanced.dataeditor.button;
import org.eclipse.gef.commands.Command;
import org.eclipse.swt.widgets.Composite;
import org.talend.commons.ui.runtime.i18n.Messages;
import org.talend.commons.ui.runtime.image.EImage;
import org.talend.commons.ui.runtime.image.ImageProvider;
import org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton;
import org.talend.commons.ui.swt.extended.table.AbstractExtendedControlViewer;
public abstract class CasePushButton extends ExtendedPushButton {
/**
* DOC CasePushButton constructor comment.
*
* @param parent
* @param extendedControlViewer
*/
public CasePushButton(Composite parent, AbstractExtendedControlViewer extendedControlViewer) {
super(parent, extendedControlViewer,
Messages.getString("CasePushButton.CaseButton.Tip"), ImageProvider.getImage(EImage.UPPERCASE_ICON)); //$NON-NLS-1$
}
protected abstract Command getCommandToExecute();
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton#getEnabledState()
*/
@Override
public boolean getEnabledState() {
return super.getEnabledState() && !getExtendedControlViewer().isReadOnly();
}
}

View File

@@ -0,0 +1,87 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.commons.ui.swt.advanced.dataeditor.button;
import java.util.Arrays;
import java.util.List;
import org.eclipse.gef.commands.Command;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.widgets.Composite;
import org.talend.commons.ui.runtime.i18n.Messages;
import org.talend.commons.ui.runtime.image.EImage;
import org.talend.commons.ui.runtime.image.ImageProvider;
import org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer;
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
public abstract class CasePushButtonForExtendedTable extends CasePushButton implements IExtendedTablePushButton {
private EnableStateListenerForTableButton enableStateHandler;
private boolean isUpperCase = true;
/**
* DOC CasePushButtonForExtendedTable constructor comment.
*
* @param parent
* @param extendedControlViewer
*/
public CasePushButtonForExtendedTable(Composite parent, AbstractExtendedTableViewer extendedTableViewer) {
super(parent, extendedTableViewer);
this.enableStateHandler = new EnableStateListenerForTableButton(this);
}
@Override
protected void afterCommandExecution(Command executedCommand) {
super.afterCommandExecution(executedCommand);
if (isUpperCase) {
this.getButton().setToolTipText( Messages.getString("CasePushButton.CaseButton.Tip"));
this.getButton().setImage(ImageProvider.getImage(EImage.LOWERCASE_ICON));
this.isUpperCase = false;
} else {
this.getButton().setToolTipText( Messages.getString("CasePushButton.CaseButton.Tip"));
this.getButton().setImage(ImageProvider.getImage(EImage.UPPERCASE_ICON));
this.isUpperCase = true;
}
}
@Override
protected Command getCommandToExecute() {
AbstractExtendedTableViewer extendedTableViewer = (AbstractExtendedTableViewer) extendedControlViewer;
ExtendedTableModel extendedTableModel = extendedTableViewer.getExtendedTableModel();
TableViewer tableViewer = extendedTableViewer.getTableViewerCreator().getTableViewer();
ISelection selection = tableViewer.getSelection();
StructuredSelection structuredSelection = (StructuredSelection) selection;
Object[] objects = structuredSelection.toArray();
int[] selectionIndices = extendedTableViewer.getTableViewerCreator().getTable().getSelectionIndices();
return getCommandToExecute(extendedTableModel, Arrays.asList(objects), selectionIndices, isUpperCase);
}
protected abstract Command getCommandToExecute(ExtendedTableModel extendedTable, List beansToUppercase, int[] selectionIndices, boolean isUpperCase);
/*
* (non-Javadoc)
*
* @see org.talend.core.ui.extended.button.IExtendedTablePushButton#getExtendedTableViewer()
*/
public AbstractExtendedTableViewer getExtendedTableViewer() {
return (AbstractExtendedTableViewer) getExtendedControlViewer();
}
@Override
public boolean getEnabledState() {
return super.getEnabledState() && this.enableStateHandler.getEnabledState();
}
}

View File

@@ -0,0 +1,57 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.commons.ui.swt.advanced.dataeditor.button;
import org.eclipse.swt.widgets.Composite;
import org.talend.commons.ui.runtime.i18n.Messages;
import org.talend.commons.ui.runtime.image.EImage;
import org.talend.commons.ui.runtime.image.ImageProvider;
import org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton;
import org.talend.commons.ui.swt.extended.table.AbstractExtendedControlViewer;
public abstract class QuotePushButton extends ExtendedPushButton {
private String dbmsId = null;
/**
* DOC QuotePushButton constructor comment.
*
* @param parent
* @param extendedControlViewer
*/
public QuotePushButton(Composite parent, AbstractExtendedControlViewer extendedControlViewer) {
super(parent, extendedControlViewer,
Messages.getString("QuotePushButton.QuoteButton.Tip"), ImageProvider.getImage(EImage.EDIT_ICON)); //$NON-NLS-1$
}
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton#getEnabledState()
*/
@Override
public boolean getEnabledState() {
return super.getEnabledState() && !getExtendedControlViewer().isReadOnly();
}
public String getDbmsId() {
return dbmsId;
}
public void setDbmsId(String dbmsId) {
this.dbmsId = dbmsId;
}
}

View File

@@ -0,0 +1,205 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.commons.ui.swt.advanced.dataeditor.button;
import java.util.Arrays;
import java.util.List;
import org.eclipse.gef.commands.Command;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.talend.commons.ui.runtime.i18n.Messages;
import org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer;
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
public abstract class QuotePushButtonForExtendedTable extends QuotePushButton implements IExtendedTablePushButton {
private String quote = null;
private boolean isAddingQuote = true;
private EnableStateListenerForTableButton enableStateHandler;
/**
* DOC SchemaTargetAddPushButton constructor comment.
*
* @param parent
* @param extendedControlViewer
*/
public QuotePushButtonForExtendedTable(Composite parent, AbstractExtendedTableViewer extendedTableViewer) {
super(parent, extendedTableViewer);
this.enableStateHandler = new EnableStateListenerForTableButton(this);
}
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton#beforeCommandExecution()
*/
@Override
protected void beforeCommandExecution() {
QuoteManipulateDialog dlg = new QuoteManipulateDialog(getButton().getShell());
if (dlg.open() == Window.OK) {
this.quote = dlg.getQuote();
this.isAddingQuote = dlg.isAddingQuote();
}
}
protected Command getCommandToExecute() {
if (quote == null) return null;
AbstractExtendedTableViewer extendedTableViewer = (AbstractExtendedTableViewer) extendedControlViewer;
ExtendedTableModel extendedTableModel = extendedTableViewer.getExtendedTableModel();
TableViewer tableViewer = extendedTableViewer.getTableViewerCreator().getTableViewer();
ISelection selection = tableViewer.getSelection();
StructuredSelection structuredSelection = (StructuredSelection) selection;
Object[] objects = structuredSelection.toArray();
int[] selectionIndices = extendedTableViewer.getTableViewerCreator().getTable().getSelectionIndices();
return getCommandToExecute(extendedTableModel, Arrays.asList(objects), selectionIndices, quote, isAddingQuote );
}
protected abstract Command getCommandToExecute(ExtendedTableModel extendedTable, List beansToUppercase, int[] selectionIndices, String quote, boolean isAddingQuote);
/*
* (non-Javadoc)
*
* @see org.talend.core.ui.extended.button.IExtendedTablePushButton#getExtendedTableViewer()
*/
public AbstractExtendedTableViewer getExtendedTableViewer() {
return (AbstractExtendedTableViewer) getExtendedControlViewer();
}
@Override
public boolean getEnabledState() {
return super.getEnabledState() && this.enableStateHandler.getEnabledState();
}
class QuoteManipulateDialog extends Dialog {
private Button addBtn;
private Button removeBtn;
private Text quoteTxt;
private Button okBtn;
boolean isAddingQuote = true;
String quote = "";
public QuoteManipulateDialog(Shell parentShel) {
super(parentShel);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
*/
protected void configureShell(Shell shell) {
super.configureShell(shell);
shell.setText(Messages.getString("QuoteManipulateDialog.title"));
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
*/
protected void createButtonsForButtonBar(Composite parent) {
// create OK and Cancel buttons by default
okBtn = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
okBtn.setEnabled(false);
}
/*
* (non-Javadoc) Method declared on Dialog.
*/
protected Control createDialogArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 4;
composite.setLayout(layout);
GridData layoutData = new GridData(GridData.FILL_BOTH);
layoutData.widthHint = 400;
composite.setLayoutData(layoutData);
addBtn = new Button(composite, SWT.RADIO);
addBtn.setSelection(true);
Label label = new Label(composite, SWT.WRAP);
label.setText(Messages.getString("QuoteManipulateDialog.addQuote")); //$NON-NLS-1$
removeBtn = new Button(composite, SWT.RADIO);
Label label1 = new Label(composite, SWT.WRAP);
label1.setText(Messages.getString("QuoteManipulateDialog.removeQuote")); //$NON-NLS-1$
quoteTxt = new Text(composite, SWT.SINGLE | SWT.BORDER);
layoutData = new GridData(GridData.FILL_HORIZONTAL);
layoutData.horizontalSpan = 4;
quoteTxt.setLayoutData(layoutData);
quoteTxt.setText("");
quoteTxt.setFocus();
addBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
isAddingQuote = true;
quoteTxt.setFocus();
quote = quoteTxt.getText();
}
});
removeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
isAddingQuote = false;
quoteTxt.setFocus();
quote = quoteTxt.getText();
}
});
quoteTxt.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
quote = quoteTxt.getText();
if ( quote != null && quote.length() > 0) {
okBtn.setEnabled(true);
} else {
okBtn.setEnabled(false);
}
}
});
return composite;
}
public boolean isAddingQuote() {
return this.isAddingQuote;
}
public String getQuote() {
return this.quote;
}
}
}

View File

@@ -0,0 +1,88 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.commons.ui.swt.advanced.dataeditor.commands;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.gef.commands.Command;
import org.talend.commons.ui.runtime.i18n.Messages;
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
public abstract class ExtendedTableCaseCommand extends Command implements IExtendedTableCommand {
private ExtendedTableModel extendedTable;
private List beansToCovertCase;
private int[] selectionIndices;
private boolean isUpperCase;
public static final String LABEL = Messages.getString("ExtendedTableCaseCommand.case.Label"); //$NON-NLS-1$
/**
* DOC ExtendedTableCaseCommand constructor comment.
*/
@SuppressWarnings("unchecked")//$NON-NLS-1$
public ExtendedTableCaseCommand(ExtendedTableModel extendedTable, List beansToCovertCase, int[] selectionIndices, boolean isUpperCase) {
super(LABEL);
this.extendedTable = extendedTable;
this.beansToCovertCase = new ArrayList(beansToCovertCase);
this.selectionIndices = selectionIndices;
this.isUpperCase = isUpperCase;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.commands.Command#execute()
*/
@Override
public void execute() {
convertCase(extendedTable, beansToCovertCase, selectionIndices, isUpperCase);
}
public abstract void convertCase(ExtendedTableModel extendedTable, List copiedObjectsList, int[] selectionIndices, boolean isUpperCase);
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.command.CommonCommand#canUndo()
*/
@Override
public boolean canUndo() {
return false;
}
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.command.CommonCommand#redo()
*/
@Override
public void redo() {
}
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.command.CommonCommand#undo()
*/
@Override
public void undo() {
}
}

View File

@@ -0,0 +1,90 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.commons.ui.swt.advanced.dataeditor.commands;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.gef.commands.Command;
import org.talend.commons.ui.runtime.i18n.Messages;
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
public abstract class ExtendedTableQuoteCommand extends Command implements IExtendedTableCommand {
private ExtendedTableModel extendedTable;
private List beansToQuote;
private int[] selectionIndices;
private String quote;
boolean isAddingQuote;
public static final String LABEL = Messages.getString("ExtendedTableQuoteCommand.Quote.Label"); //$NON-NLS-1$
/**
* DOC ExtendedTableQuoteCommand constructor comment.
*/
@SuppressWarnings("unchecked")//$NON-NLS-1$
public ExtendedTableQuoteCommand(ExtendedTableModel extendedTable, List beansToQuote, int[] selectionIndices, String quote, boolean isAddingQuote) {
super(LABEL);
this.extendedTable = extendedTable;
this.beansToQuote = new ArrayList(beansToQuote);
this.selectionIndices = selectionIndices;
this.quote = quote;
this.isAddingQuote = isAddingQuote;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.commands.Command#execute()
*/
@Override
public void execute() {
toQuote(extendedTable, beansToQuote, selectionIndices, quote, isAddingQuote);
}
public abstract void toQuote(ExtendedTableModel extendedTable, List copiedObjectsList, int[] selectionIndices, String quote, boolean isAddingQuote);
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.command.CommonCommand#canUndo()
*/
@Override
public boolean canUndo() {
return false;
}
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.command.CommonCommand#redo()
*/
@Override
public void redo() {
}
/*
* (non-Javadoc)
*
* @see org.talend.commons.ui.command.CommonCommand#undo()
*/
@Override
public void undo() {
}
}

View File

@@ -178,6 +178,23 @@ public class ExtendedTableModel<B> extends AbstractExtendedControlModel {
public void setUseEquals(boolean useEquals) {
beansList.setUseEquals(useEquals);
}
/**
*
* Replace bean.
*
* @param bean
* @param index can be null
*/
public void replace(B bean, Integer index) {
if (tableViewer != null && !tableViewer.getTable().isDisposed()) {
tableViewer.replace(bean, index);
tableViewer.refresh(bean, true, true);
}
this.beansList.replaceElement(index, bean);
}
/**
* DOC amaumont Comment method "remove".

View File

@@ -12,11 +12,14 @@
// ============================================================================
package org.talend.core.repository.model;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -623,8 +626,7 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
stream.close();
byte[] currentContent = item.getContent().getInnerContent();
if (!Arrays.equals(innerContent, currentContent)) {
if (!isSameStringContent(innerContent, currentContent)) {
item.getContent().setInnerContent(innerContent);
Project project = getRepositoryContext().getProject();
save(project, item);
@@ -641,6 +643,44 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
throw new PersistenceException(ioe);
}
}
protected boolean isSameStringContent(byte[] data1, byte[] data2) throws IOException {
boolean isSame = true;
BufferedReader br1 = null, br2 = null;
try {
br1 = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(data1), StandardCharsets.UTF_8.toString()));
br2 = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(data2), StandardCharsets.UTF_8.toString()));
String line1 = null, line2 = null;
while (isSame) {
line1 = br1.readLine();
line2 = br2.readLine();
if ((line1 == null && line2 == null)) {
break;
}
if (!StringUtils.equals(line1, line2)) {
isSame = false;
break;
}
}
} finally {
if (br1 != null) {
try {
br1.close();
} catch (IOException e) {
ExceptionHandler.process(e);
}
}
if (br2 != null) {
try {
br2.close();
} catch (IOException e) {
ExceptionHandler.process(e);
}
}
}
return isSame;
}
private void createSQLPattern(URL url, String sqlPatternLabel, String categoryName) throws PersistenceException {
if (url == null) {
@@ -693,8 +733,7 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
stream.close();
byte[] currentContent = item.getContent().getInnerContent();
if (!Arrays.equals(innerContent, currentContent)) {
if (!isSameStringContent(innerContent, currentContent)) {
item.getContent().setInnerContent(innerContent);
Project project = getRepositoryContext().getProject();
save(project, item);

View File

@@ -110,6 +110,7 @@ import org.talend.core.model.properties.Property;
import org.talend.core.model.properties.RoutineItem;
import org.talend.core.model.properties.SpagoBiServer;
import org.talend.core.model.properties.Status;
import org.talend.core.model.properties.TDQItem;
import org.talend.core.model.properties.User;
import org.talend.core.model.properties.impl.FolderItemImpl;
import org.talend.core.model.relationship.RelationshipItemBuilder;
@@ -123,6 +124,7 @@ import org.talend.core.model.repository.LockInfo;
import org.talend.core.model.repository.RepositoryContentManager;
import org.talend.core.model.repository.RepositoryObject;
import org.talend.core.model.repository.RepositoryViewObject;
import org.talend.core.model.routines.CodesJarInfo;
import org.talend.core.repository.CoreRepositoryPlugin;
import org.talend.core.repository.constants.Constant;
import org.talend.core.repository.constants.FileConstants;
@@ -410,7 +412,8 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
}
boolean isThrow = true;
if (tdqRepService != null && CoreRuntimePlugin.getInstance().isDataProfilePerspectiveSelected()) {
if (tdqRepService != null && (CoreRuntimePlugin.getInstance().isDataProfilePerspectiveSelected()
|| item instanceof TDQItem)) {
// change MessageBox to DeleteModelElementConfirmDialog
InputDialog inputDialog = tdqRepService.getInputDialog(item);
if (MessageDialog.OK == inputDialog.open()) {
@@ -1369,21 +1372,15 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
}
@Override
public List<IRepositoryViewObject> getAllInnerCodes(ERepositoryObjectType codesJarType, Property jarProperty)
throws PersistenceException {
return getAllInnerCodes(projectManager.getCurrentProject(), codesJarType, jarProperty);
}
@Override
public List<IRepositoryViewObject> getAllInnerCodes(Project project, ERepositoryObjectType codesJarType, Property jarProperty)
throws PersistenceException {
public List<IRepositoryViewObject> getAllInnerCodes(CodesJarInfo info) throws PersistenceException {
Project project = ProjectManager.getInstance().getProjectFromProjectTechLabel(info.getProjectTechName());
// empty folder won't be commit in git, create if not exist
IFolder folder = ResourceUtils.getProject(project).getFolder(ERepositoryObjectType.getFolderName(codesJarType))
.getFolder(jarProperty.getLabel());
IFolder folder = ResourceUtils.getProject(project).getFolder(ERepositoryObjectType.getFolderName(info.getType()))
.getFolder(info.getLabel());
if (!folder.exists()) {
ResourceUtils.createFolder(folder);
}
return repositoryFactoryFromProvider.getAll(project, codesJarType, false, false, folder);
return repositoryFactoryFromProvider.getAll(project, info.getType(), false, false, folder);
}
@Override

View File

@@ -523,10 +523,10 @@ public class CopyObjectAction {
if (isInnerCode) {
CodesJarInfo info = CodesJarResourceCache.getCodesJarByInnerCode(item);
if (info.getProperty() != null) {
if (info != null) {
IDesignerMavenService designerMavenService = IDesignerMavenService.get();
if (designerMavenService != null) {
designerMavenService.updateCodeJarMavenProject(info.getProperty(), false);
designerMavenService.updateCodeJarMavenProject(info, false);
}
}
}

View File

@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry exported="true" kind="lib" path="lib/resty-0.3.2.jar" />
<classpathentry exported="true" kind="lib" path="lib/delight-rhino-sandbox-0.0.15.jar"/>
<classpathentry exported="true" kind="lib" path="lib/rhino-1.7.13.jar"/>
<classpathentry exported="true" kind="lib" path="lib/resty-0.3.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/json_simple-1.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>

View File

@@ -129,5 +129,7 @@ Bundle-Activator: org.talend.core.runtime.CoreRuntimePlugin
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,
lib/resty-0.3.2.jar,
lib/json_simple-1.1.jar
lib/json_simple-1.1.jar,
lib/delight-rhino-sandbox-0.0.15.jar,
lib/rhino-1.7.13.jar
Eclipse-RegisterBuddy: org.talend.testutils

View File

@@ -12,7 +12,9 @@ bin.includes = META-INF/,\
lib/,\
talend_metadata_columns_schema.xsd,\
talend_targetschema_columns_schema.xsd,\
dist/
dist/,\
lib/delight-rhino-sandbox-0.0.15.jar,\
lib/rhino-1.7.13.jar
src.includes = META-INF/,\
mappingMetadataTypes.xml,\
mappings/,\

View File

@@ -12,17 +12,26 @@
<dbType type="BPCHAR" ignoreLen="true" ignorePre="true" />
<dbType type="BYTEA" ignoreLen="true" ignorePre="true" />
<dbType type="CHAR" defaultLength="50" ignorePre="true"/>
<dbType type="CHARACTER" defaultLength="50" ignorePre="true"/>
<dbType type="CID" ignoreLen="true" ignorePre="true" />
<dbType type="CIDR" ignoreLen="true" ignorePre="true" />
<dbType type="CIRCLE" ignoreLen="true" ignorePre="true" />
<dbType type="DATE" ignoreLen="true" ignorePre="true" />
<dbType type="FLOAT4" ignoreLen="true" ignorePre="true" />
<dbType type="REAL" ignoreLen="true" ignorePre="true" />
<dbType type="FLOAT8" ignoreLen="true" ignorePre="true" />
<dbType type="DOUBLE PRECISION" ignoreLen="true" ignorePre="true" />
<dbType type="INET" ignoreLen="true" ignorePre="true" />
<dbType type="INT2" ignoreLen="true" ignorePre="true" />
<dbType type="SMALLINT" ignoreLen="true" ignorePre="true" />
<dbType type="INT2VECTOR" ignoreLen="true" ignorePre="true" />
<dbType type="INT4" ignoreLen="true" ignorePre="true" />
<dbType type="INT8" ignoreLen="true" ignorePre="true" />
<dbType type="INTEGER" ignoreLen="true" ignorePre="true" />
<dbType type="CHARACTER VARYING" ignoreLen="true" ignorePre="true" />
<dbType type="BOOLEAN" ignoreLen="true" ignorePre="true" />
<dbType type="BIGINT" ignoreLen="true" ignorePre="true" />
<dbType type="BIT VARYING" ignoreLen="true" ignorePre="true" />
<dbType type="INTERVAL" ignorePre="true" />
<dbType type="LINE" ignoreLen="true" ignorePre="true" />
<dbType type="LSEG" ignoreLen="true" ignorePre="true" />
@@ -30,6 +39,7 @@
<dbType type="MONEY" ignoreLen="true" ignorePre="true" />
<dbType type="NAME" ignoreLen="true" ignorePre="true" />
<dbType type="NUMERIC" defaultLength="20" defaultPrecision="10"/>
<dbType type="DECIMAL" defaultLength="20" defaultPrecision="10"/>
<dbType type="OID" ignoreLen="true" ignorePre="true" />
<dbType type="OIDVECTOR" ignoreLen="true" ignorePre="true" />
<dbType type="PATH" ignoreLen="true" ignorePre="true" />
@@ -110,16 +120,19 @@
<talendToDbTypes><!-- Adviced mappings -->
<talendType type="id_List"/>
<talendType type="id_Boolean">
<dbType type="BOOL" default="true" />
<dbType type="BOOL" default="true" />
<dbType type="BOOLEAN" />
</talendType>
<talendType type="id_Byte">
</talendType>
<talendType type="id_byte[]">
<dbType type="BIT" default="true" />
<dbType type="VARBIT" />
<dbType type="VARBIT" />
<dbType type="BIT VARYING" />
</talendType>
<talendType type="id_Character">
<dbType type="CHAR" default="true" />
<dbType type="CHARACTER" />
<dbType type="BPCHAR" />
<dbType type="VARCHAR" />
<dbType type="TEXT" />
@@ -136,33 +149,47 @@
<dbType type="RELTIME" />
</talendType>
<talendType type="id_BigDecimal">
<dbType type="NUMERIC" default="true" />
<dbType type="NUMERIC" default="true" />
<dbType type="DECIMAL" />
<dbType type="FLOAT4" />
<dbType type="REAL" />
<dbType type="FLOAT8"/>
<dbType type="DOUBLE PRECISION"/>
</talendType>
<talendType type="id_Double">
<dbType type="FLOAT4" />
<dbType type="REAL" />
<dbType type="FLOAT8" default="true" />
<dbType type="NUMERIC" />
<dbType type="NUMERIC" />
<dbType type="DECIMAL" />
<dbType type="DOUBLE PRECISION"/>
</talendType>
<talendType type="id_Float">
<dbType type="FLOAT4" default="true" />
<dbType type="FLOAT8" />
<dbType type="NUMERIC" />
<dbType type="REAL" />
<dbType type="NUMERIC" />
<dbType type="DECIMAL" />
<dbType type="DOUBLE PRECISION"/>
</talendType>
<talendType type="id_Integer">
<dbType type="INT2" />
<dbType type="SMALLINT" />
<dbType type="INT4" default="true" />
<dbType type="SERIAL" />
<dbType type="INT8" />
<dbType type="BIGSERIAL" />
<dbType type="BIGINT" />
<dbType type="BIGSERIAL" />
<dbType type="INTEGER" />
</talendType>
<talendType type="id_Long">
<dbType type="INT2" />
<dbType type="INT4" />
<dbType type="SERIAL" />
<dbType type="INT8" default="true" />
<dbType type="BIGSERIAL" />
<dbType type="BIGINT" />
<dbType type="BIGSERIAL" />
<dbType type="SMALLINT" />
</talendType>
<talendType type="id_Object">
<dbType type="_POINT" />
@@ -209,18 +236,26 @@
<dbType type="_ABSTIME" />
<dbType type="_ACLITEM" />
<dbType type="_INT8" />
<dbType type="BIGINT" />
<dbType type="BIT VARYING" />
<dbType type="_VARBIT" />
<dbType type="_BIT" />
<dbType type="_BOOL" />
<dbType type="BOOLEAN" />
<dbType type="BOX" />
<dbType type="_BOX" />
<dbType type="_BYTEA" />
<dbType type="_VARCHAR" />
<dbType type="CHARACTER VARYING" />
<dbType type="CHARACTER" />
<dbType type="INTEGER" />
<dbType type="REAL" />
<dbType type="_BPCHAR" />
<dbType type="_CID" />
<dbType type="_CIDR" />
<dbType type="_CIRCLE" />
<dbType type="_DATE" />
<dbType type="DOUBLE PRECISION"/>
<dbType type="_FLOAT8" />
<dbType type="_INET" />
<dbType type="INT2VECTOR" />
@@ -236,6 +271,7 @@
<dbType type="NAME" />
<dbType type="_NAME" />
<dbType type="_NUMERIC" />
<dbType type="DECIMAL" />
<dbType type="_OID" />
<dbType type="OIDVECTOR" />
<dbType type="_OIDVECTOR" />
@@ -247,26 +283,44 @@
<dbType type="INT4" />
<dbType type="SERIAL" />
<dbType type="INT8" />
<dbType type="BIGSERIAL" />
<dbType type="BIGINT" />
<dbType type="BIGSERIAL" />
<dbType type="SMALLINT" />
</talendType>
<talendType type="id_String">
<dbType type="BPCHAR" />
<dbType type="VARCHAR" default="true" />
<dbType type="CHARACTER VARYING" />
<dbType type="TEXT" />
</talendType>
</talendToDbTypes>
<dbToTalendTypes>
<dbType type="INT2" >
<talendType type="id_Short" default="true" />
</dbType>
<dbType type="SMALLINT" >
<talendType type="id_Short" default="true" />
</dbType>
<dbType type="INT4" >
<talendType type="id_Integer" default="true" />
</dbType>
</dbType>
<dbType type="INTEGER" >
<talendType type="id_Integer" default="true" />
</dbType>
<dbType type="CHARACTER VARYING" >
<talendType type="id_String" default="true" />
</dbType>
<dbType type="BOOLEAN" >
<talendType type="id_Boolean" default="true" />
</dbType>
<dbType type="SERIAL" >
<talendType type="id_Integer" default="true" />
</dbType>
<dbType type="INT8" >
<talendType type="id_Long" default="true" />
</dbType>
<dbType type="BIGINT" >
<talendType type="id_Long" default="true" />
</dbType>
<dbType type="BIGSERIAL" >
<talendType type="id_Long" default="true" />
@@ -274,14 +328,26 @@
<dbType type="FLOAT4" >
<talendType type="id_Float" default="true" />
<talendType type="id_BigDecimal"/>
</dbType>
</dbType>
<dbType type="REAL" >
<talendType type="id_Float" default="true" />
<talendType type="id_BigDecimal"/>
</dbType>
<dbType type="FLOAT8" >
<talendType type="id_Double" default="true" />
<talendType type="id_BigDecimal"/>
</dbType>
<dbType type="DOUBLE PRECISION" >
<talendType type="id_Double" default="true" />
<talendType type="id_BigDecimal"/>
</dbType>
<dbType type="NUMERIC">
<talendType type="id_Double"/>
<talendType type="id_BigDecimal" default="true" />
</dbType>
<dbType type="DECIMAL">
<talendType type="id_Double"/>
<talendType type="id_BigDecimal" default="true" />
</dbType>
<dbType type="BOOL" >
<talendType type="id_Boolean" default="true" />
@@ -291,9 +357,15 @@
</dbType>
<dbType type="VARBIT" >
<talendType type="id_byte[]" default="true" />
</dbType>
</dbType>
<dbType type="BIT VARYING" >
<talendType type="id_byte[]" default="true" />
</dbType>
<dbType type="CHAR" >
<talendType type="id_String" default="true" />
</dbType>
<dbType type="CHARACTER" >
<talendType type="id_String" default="true" />
</dbType>
<dbType type="BPCHAR" >
<talendType type="id_String" default="true" />

View File

@@ -9,19 +9,61 @@
</parent>
<artifactId>org.talend.core.runtime</artifactId>
<packaging>eclipse-plugin</packaging>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.javadelight/delight-rhino-sandbox -->
<dependency>
<groupId>org.javadelight</groupId>
<artifactId>delight-rhino-sandbox</artifactId>
<version>0.0.15</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mozilla/rhino -->
<dependency>
<groupId>org.mozilla</groupId>
<artifactId>rhino</artifactId>
<version>1.7.13</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
</execution>
</executions>
</plugin>
</plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>generate-sources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/lib</outputDirectory>
<artifactItems>
<artifactItem>
<groupId>org.javadelight</groupId>
<artifactId>delight-rhino-sandbox</artifactId>
<version>0.0.15</version>
</artifactItem>
<artifactItem>
<groupId>org.mozilla</groupId>
<artifactId>rhino</artifactId>
<version>1.7.13</version>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -155,13 +155,6 @@ public interface ILibraryManagerService extends IService {
public boolean checkJarInstalledFromPlatform(String uriPath);
/**
* deploy jars from lib/java to local maven if any jar already exist in maven and need update , for jars that not
* exist in maven won't be deploy by this funciton , those jars should be deploy when it is needed Comment method
* "synToLocalMaven".
*/
public void synToLocalMaven();
public String getMavenUriFromIndex(String jarName);
public void setCustomMavenURI(String orignalURI, String customURI);

View File

@@ -138,6 +138,10 @@ public class PluginChecker {
public static final String HELP_PLUGIN_ID = "org.talend.help"; //$NON-NLS-1$
public static final String APACHE_CXF_PLUGIN_ID = "org.talend.libraries.apache.cxf"; //$NON-NLS-1$
public static final String SWTBOT_PLUGIN_ID = "org.eclipse.swtbot.eclipse.core"; //$NON-NLS-1$
/**
* Check if specific plug-in is loaded.
*
@@ -370,6 +374,10 @@ public class PluginChecker {
return isPluginLoaded(BD_ROUTINE_PLUGIN_ID);
}
public static boolean isSWTBotLoaded() {
return isPluginLoaded(SWTBOT_PLUGIN_ID);
}
public static String getBundlePath(String bundleName) {
String bundlePath = ""; //$NON-NLS-1$
Bundle refBundle = Platform.getBundle(bundleName);

View File

@@ -67,8 +67,8 @@ public enum EDatabase4DriverClassName {
// if change the order, it might break the audit for PSQL.
PSQL(EDatabaseTypeName.PSQL, "org.postgresql.Driver"), //$NON-NLS-1$
PLUSPSQL(EDatabaseTypeName.PLUSPSQL, "org.postgresql.Driver"), //$NON-NLS-1$
GREENPLUM(EDatabaseTypeName.GREENPLUM, "org.postgresql.Driver"), //$NON-NLS-1$
GREENPLUM(EDatabaseTypeName.GREENPLUM, "com.pivotal.jdbc.GreenplumDriver"), //$NON-NLS-1$
GREENPLUM_PSQL(EDatabaseTypeName.GREENPLUM, "org.postgresql.Driver"), //$NON-NLS-1$
SAS(EDatabaseTypeName.SAS, "com.sas.rio.MVADriver"), //$NON-NLS-1$
SAPHana(EDatabaseTypeName.SAPHana, "com.sap.db.jdbc.Driver"), //$NON-NLS-1$
SQLITE(EDatabaseTypeName.SQLITE, "org.sqlite.JDBC"), //$NON-NLS-1$

View File

@@ -114,7 +114,10 @@ public enum EDatabaseTypeName {
"ParAccel", "ParAccel", Boolean.TRUE, "PARACCEL", "PARACCEL", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
NETEZZA(
"Netezza", "Netezza", Boolean.FALSE, "NETEZZA", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
SAS("SAS", "SAS", Boolean.TRUE, "SAS", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
/**
* @deprecated
*/
SAS("SAS", "SAS (Deprecated)", Boolean.TRUE, "SAS", EDatabaseSchemaOrCatalogMapping.None, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// General JDBC not support schema defalut
GENERAL_JDBC(
"General JDBC", "General JDBC", Boolean.FALSE, "JDBC", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

View File

@@ -22,14 +22,14 @@ import org.talend.core.runtime.hd.hive.HiveMetadataHelper;
*/
public enum EImpalaDriver {
HIVE2("HIVE2", "HIVE2", "org.apache.hive.jdbc.HiveDriver"),
IMPALA40("IMPALA40", "IMPALA40", "com.cloudera.impala.jdbc4.Driver"),
IMPALA41("IMPALA41", "IMPALA41", "com.cloudera.impala.jdbc41.Driver");
HIVE2("HIVE2", "HIVE2", "org.apache.hive.jdbc.HiveDriver", "doSupportHive2"),
IMPALA("IMPALA", "IMPALA", "com.cloudera.impala.jdbc.Driver", "doSupportImpalaConnector");
EImpalaDriver(String displayName, String name, String driver) {
EImpalaDriver(String displayName, String name, String driver, String supportDriverMethodName) {
this.displayName = displayName;
this.name = name;
this.driver = driver;
this.supportDriverMethodName = supportDriverMethodName;
}
private String displayName;
@@ -38,6 +38,8 @@ public enum EImpalaDriver {
private String driver;
private String supportDriverMethodName;
public String getDisplayName() {
return displayName;
}
@@ -50,6 +52,10 @@ public enum EImpalaDriver {
return driver;
}
public String getSupportDriverMethodName() {
return supportDriverMethodName;
}
public static boolean isSupport(String distribution, String version, boolean byDisplay, String supportMethodName) {
return HiveMetadataHelper.doSupportMethod(distribution, version, byDisplay, supportMethodName);
}
@@ -57,7 +63,7 @@ public enum EImpalaDriver {
public static String[] getImpalaDriverDisplay(String distribution, String version, boolean byDisplay) {
List<String> list = new ArrayList<>(0);
for (EImpalaDriver driver : EImpalaDriver.values()) {
if (isSupport(distribution, version, byDisplay, "doSupportImpalaConnector")) {
if (isSupport(distribution, version, byDisplay, driver.getSupportDriverMethodName())) {
list.add(driver.getDisplayName());
}
}

View File

@@ -334,5 +334,19 @@ public class ConnParameterKeys {
public static final String CONN_PARA_KEY_SET_HADOOP_CONF = "CONN_PARA_KEY_SET_HADOOP_CONF";
public static final String CONN_PARA_KEY_HADOOP_CONF_SPECIFIC_JAR = "CONN_PARA_KEY_HADOOP_CONF_SPECIFIC_JAR";
/**Knox*/
public static final String CONN_PARA_KEY_SPARK_MODE="CONN_PARA_KEY_SPARK_MODE";
public static final String CONN_PARA_KEY_USE_KNOX="CONN_PARA_KEY_USE_KNOX";
public static final String CONN_PARA_KEY_KNOX_URL="CONN_PARA_KEY_KNOX_URL";
public static final String CONN_PARA_KEY_KNOX_USER = "CONN_PARA_KEY_KNOX_USER";
public static final String CONN_PARA_KEY_KNOX_PASSWORD="CONN_PARA_KEY_KNOX_PASSWORD";
public static final String CONN_PARA_KEY_KNOX_DIRECTORY="CONN_PARA_KEY_KNOX_DIRECTORY";
}

View File

@@ -114,6 +114,13 @@ public class DatabaseConnStrUtil {
&& EDatabaseVersion4Drivers.SYBASEIQ_16_SA.getVersionValue().equals(dbVersion)) {
connStr = EDatabaseConnTemplate.SYBASEASE_16_SA;
}
if (EDatabaseTypeName.GREENPLUM.getDisplayName().equals(dbType)) {
if (EDatabaseVersion4Drivers.GREENPLUM.getVersionValue().equals(dbVersion)) {
connStr = EDatabaseConnTemplate.GREENPLUM;
}else if(EDatabaseVersion4Drivers.GREENPLUM_PSQL.getVersionValue().equals(dbVersion)) {
connStr = EDatabaseConnTemplate.GREENPLUM_PSQL;
}
}
EDatabaseVersion4Drivers version = EDatabaseVersion4Drivers.indexOfByVersion(dbVersion);
if (connStr != null) {
String s = connStr.getUrlTemplate(version);
@@ -221,8 +228,10 @@ public class DatabaseConnStrUtil {
.get(ConnParameterKeys.IMPALA_AUTHENTICATION_PRINCIPLA));
}
String url = null;
if (template.startsWith(DbConnStrForHive.URL_HIVE_2_TEMPLATE)) {
url = getImpalaURLString(false, server, port, sidOrDatabase, impalaPrincipal);
String driver = dbConn.getParameters().get(ConnParameterKeys.IMPALA_DRIVER);
if (template.startsWith(DbConnStrForHive.URL_HIVE_2_TEMPLATE)
|| template.startsWith(DbConnStrForHive.URL_IMPALA_TEMPLATE)) {
url = getImpalaURLString(false, server, port, sidOrDatabase, impalaPrincipal, driver);
}
url = attachAdditionalHiveParameters(url, dbConn, false);
return url;
@@ -369,9 +378,13 @@ public class DatabaseConnStrUtil {
return s;
}
private static String getImpalaURLString(boolean supportContext, String server, String port, String sid, String Principal) {
String s = EDatabaseConnTemplate.IMPALA.getUrlTemplate(null);
String standardURlString = getImpalaURlString(s, supportContext, server, port, sid);
private static String getImpalaURLString(boolean supportContext, String server, String port, String sid, String Principal,
String driver) {
String template = EDatabaseConnTemplate.IMPALA.getUrlTemplate(null);
if (EDatabaseTypeName.IMPALA.getDbType().equals(driver)) {
template = EDatabaseConnTemplate.IMPALA_IMPALA_DRIVER.getUrlTemplate(null);
}
String standardURlString = getImpalaURlString(template, supportContext, server, port, sid);
String principalSuffix = "principal="; //$NON-NLS-1$
boolean hasPrinc = false;
String[] urlArray = standardURlString.split(SEMICOLON);

View File

@@ -30,6 +30,8 @@ public class DbConnStrForHive extends DbConnStr {
public static final String URL_HIVE_2_TEMPLATE = "jdbc:hive2://";//$NON-NLS-1$
public static final String URL_IMPALA_TEMPLATE = "jdbc:impala://";//$NON-NLS-1$
/**
* DOC Marvin DbConnStrForHive constructor comment.
*

View File

@@ -54,6 +54,11 @@ public enum EDatabaseConnTemplate {
"5432")), //$NON-NLS-1$
GREENPLUM(new DbConnStr(EDatabaseTypeName.GREENPLUM, //
"jdbc:pivotal:greenplum://<host>:<port>;;DatabaseName=<sid>;<property>", //$NON-NLS-1$
"5432")), //$NON-NLS-1$
GREENPLUM_PSQL(new DbConnStr(EDatabaseTypeName.GREENPLUM, //
"jdbc:postgresql://<host>:<port>/<sid>?<property>", //$NON-NLS-1$
"5432")), //$NON-NLS-1$
@@ -209,6 +214,9 @@ public enum EDatabaseConnTemplate {
IMPALA(new DbConnStr(EDatabaseTypeName.IMPALA, "jdbc:hive2://<host>:<port>/<sid>;auth=noSasl", //$NON-NLS-1$
"21050", null, null, "localhost", "default")), //$NON-NLS-1$
IMPALA_IMPALA_DRIVER(new DbConnStr(EDatabaseTypeName.IMPALA, "jdbc:impala://<host>:<port>/<sid>;auth=noSasl", //$NON-NLS-1$
"21050", null, null, "localhost", "default")), //$NON-NLS-1$
HBASE(new DbConnStr(EDatabaseTypeName.HBASE, "127.0.0.1", //$NON-NLS-1$
"2181")), //$NON-NLS-1$

View File

@@ -84,7 +84,11 @@ public enum EDatabaseVersion4Drivers {
MSSQL_2012(new DbVersion4Drivers(EDatabaseTypeName.MSSQL,
"Microsoft SQL Server 2012", "Microsoft SQL Server 2012", "jtds-1.3.1-patch-20190523.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
MSSQL_PROP(new DbVersion4Drivers(EDatabaseTypeName.MSSQL,
"Microsoft", "MSSQL_PROP", "mssql-jdbc.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"Microsoft", "MSSQL_PROP", //$NON-NLS-1$ //$NON-NLS-2$
new String[] { "mssql-jdbc.jar", "slf4j-api-1.7.25.jar", "slf4j-log4j12-1.7.25.jar", "adal4j-1.6.5.jar", //$NON-NLS-1$
"commons-lang3-3.10.jar", "commons-codec-1.14.jar", "gson-2.8.6.jar", "oauth2-oidc-sdk-6.5.jar",
"json-smart-2.4.7.jar", "nimbus-jose-jwt-8.11.jar", "javax.mail-1.6.2.jar", "log4j-1.2.17.jar",
"accessors-smart-2.4.7.jar", "asm-9.1.jar" })),
VERTICA_9(new DbVersion4Drivers(EDatabaseTypeName.VERTICA, "VERTICA 9.X", "VERTICA_9_0", "vertica-jdbc-9.3.1-0.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
VERTICA_7_1_X(new DbVersion4Drivers(EDatabaseTypeName.VERTICA, "VERTICA 7.1.X (Deprecated)", "VERTICA_7_1_X", "vertica-jdbc-7.1.2-0.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -99,8 +103,8 @@ public enum EDatabaseVersion4Drivers {
VERTICA_3(new DbVersion4Drivers(EDatabaseTypeName.VERTICA, "VERTICA 3 (Deprecated)", "VERTICA_3", "vertica_3.0_jdk_5.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// for bug 0017930
GREENPLUM(new DbVersion4Drivers(EDatabaseTypeName.GREENPLUM, "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$
GREENPLUM_PSQL(new DbVersion4Drivers(EDatabaseTypeName.GREENPLUM,"PostgreSQL", "POSTGRESQL", "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$
GREENPLUM(new DbVersion4Drivers(EDatabaseTypeName.GREENPLUM,"Greenplum", "GREENPLUM", "greenplum-5.1.4.000275.jar")), //$NON-NLS-1$
// PSQL_V10(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "v10", "V10", "postgresql-42.2.5.jar")),
PSQL_V9_X(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "v9 and later", "V9_X", "postgresql-42.2.14.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
PSQL_PRIOR_TO_V9(new DbVersion4Drivers(EDatabaseTypeName.PSQL, "Prior to v9", "PRIOR_TO_V9", "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

View File

@@ -26,11 +26,6 @@ public enum ECustomVersionGroup {
MAPRDB,
PIG,
PIG_HBASE,
PIG_HCATALOG,
MAP_REDUCE,
SPARK,

View File

@@ -18,12 +18,6 @@ public enum ECustomVersionType {
MAPRDB("Maprdb", ECustomVersionGroup.MAPRDB), //$NON-NLS-1$
PIG("Pig", ECustomVersionGroup.PIG), //$NON-NLS-1$
PIG_HBASE("Pig for HBase", ECustomVersionGroup.PIG_HBASE), //$NON-NLS-1$
PIG_HCATALOG("Pig for Hcatalog", ECustomVersionGroup.PIG_HCATALOG), //$NON-NLS-1$
MAP_REDUCE("Map Reduce", ECustomVersionGroup.MAP_REDUCE), //$NON-NLS-1$
SPARK("Spark", ECustomVersionGroup.SPARK), //$NON-NLS-1$

View File

@@ -483,7 +483,7 @@ public class HadoopCustomVersionDefineDialog extends TitleAreaDialog {
private boolean isSupportHadoop() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopService.class)) {
hadoopService = (IHadoopService) GlobalServiceRegister.getDefault().getService(IHadoopService.class);
hadoopService = GlobalServiceRegister.getDefault().getService(IHadoopService.class);
}
return hadoopService != null;
@@ -503,11 +503,7 @@ public class HadoopCustomVersionDefineDialog extends TitleAreaDialog {
private ECustomVersionType[] filterTypes(Object[] types) {
Object[] filteredTypes = ArrayUtils.removeElement(types, ECustomVersionType.ALL);
IDesignerCoreService designerCoreService = CoreRuntimePlugin.getInstance().getDesignerCoreService();
INode node = designerCoreService.getRefrenceNode("tPigLoad"); //$NON-NLS-1$
if (node == null) {
filteredTypes = ArrayUtils.removeElement(filteredTypes, ECustomVersionType.PIG);
}
node = designerCoreService.getRefrenceNode("tMRConfiguration", ComponentCategory.CATEGORY_4_MAPREDUCE.getName());//$NON-NLS-1$
INode node = designerCoreService.getRefrenceNode("tMRConfiguration", ComponentCategory.CATEGORY_4_MAPREDUCE.getName());//$NON-NLS-1$
if (node == null) {
filteredTypes = ArrayUtils.removeElement(filteredTypes, ECustomVersionType.MAP_REDUCE);
}

View File

@@ -425,7 +425,7 @@ public class HadoopVersionDialog extends TitleAreaDialog {
if (isFromExistVersion) {
IHadoopService hadoopService = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopService.class)) {
hadoopService = (IHadoopService) GlobalServiceRegister.getDefault().getService(IHadoopService.class);
hadoopService = GlobalServiceRegister.getDefault().getService(IHadoopService.class);
}
if (hadoopService != null) {
for (ECustomVersionGroup group : existVersionSelectionMap.keySet()) {
@@ -437,10 +437,7 @@ public class HadoopVersionDialog extends TitleAreaDialog {
for (ECustomVersionType type : types) {
if (type.getGroup() == group) {
Set<String> hadoopLibraries = new HashSet<String>();
if (ECustomVersionType.PIG == type || ECustomVersionType.PIG_HBASE == type
|| ECustomVersionType.PIG_HCATALOG == type) {
hadoopLibraries = getLibrariesForPig(type);
} else if (ECustomVersionType.MAP_REDUCE == type) {
if (ECustomVersionType.MAP_REDUCE == type) {
hadoopLibraries = getLibrariesForMapReduce(type);
} else if (ECustomVersionType.SPARK == type || ECustomVersionType.SPARK_STREAMING == type) {
hadoopLibraries = getLibrariesForSpark(type);
@@ -542,42 +539,6 @@ public class HadoopVersionDialog extends TitleAreaDialog {
return neededLibraries;
}
private Set<String> getLibrariesForPig(ECustomVersionType type) {
Set<String> neededLibraries = new HashSet<String>();
INode node = CoreRuntimePlugin.getInstance().getDesignerCoreService().getRefrenceNode("tPigLoad");//$NON-NLS-1$
IElementParameter elementParameter = node.getElementParameter("MAPREDUCE");//$NON-NLS-1$
if (elementParameter != null) {
elementParameter.setValue(true);
}
elementParameter = node.getElementParameter("DISTRIBUTION");//$NON-NLS-1$
if (elementParameter != null) {
elementParameter.setValue(distribution);
}
elementParameter = node.getElementParameter("PIG_VERSION");//$NON-NLS-1$
if (elementParameter != null) {
elementParameter.setValue(version);
}
elementParameter = node.getElementParameter("LOAD");//$NON-NLS-1$
if (elementParameter != null) {
if (ECustomVersionType.PIG_HBASE == type) {
elementParameter.setValue("HBASESTORAGE");//$NON-NLS-1$
} else if (ECustomVersionType.PIG_HCATALOG == type) {
elementParameter.setValue("HCATLOADER");//$NON-NLS-1$
}
}
List<ModuleNeeded> modulesNeeded = node.getModulesNeeded();
for (ModuleNeeded module : modulesNeeded) {
if (module.isRequired(node.getElementParameters())) {
neededLibraries.add(module.getModuleName());
}
}
return neededLibraries;
}
public Map<ECustomVersionType, Map<String, Object>> getTypeConfigurations() {
return this.typeConfigurations;
}

View File

@@ -57,6 +57,11 @@ public class ConnectionBean implements Cloneable {
private static final String TOKEN = "token"; //$NON-NLS-1$
private static final String URL = "url"; //$NON-NLS-1$
private static final String STORECREDENTIALS = "storeCredentials"; //$NON-NLS-1$
private String credentials = ""; //$NON-NLS-1$
/**
* DOC smallet ConnectionBean constructor comment.
*/
@@ -178,6 +183,9 @@ public class ConnectionBean implements Cloneable {
public String getPassword() {
try {
if (conDetails.has(PASSWORD)) {
if (isStoreCredentials() && credentials != null) {
return this.credentials;
}
return conDetails.getString(PASSWORD);
}
} catch (JSONException e) {
@@ -326,6 +334,7 @@ public class ConnectionBean implements Cloneable {
toReturn.setWorkSpace(st[i++]);
toReturn.setComplete(new Boolean(st[i++]));
toReturn.setToken(new Boolean(st[i++]));
toReturn.setStoreCredentials(new Boolean(st[i++]));
JSONObject dynamicJson = new JSONObject();
toReturn.getConDetails().put(DYNAMICFIELDS, dynamicJson);
while (i < st.length) {
@@ -408,4 +417,30 @@ public class ConnectionBean implements Cloneable {
return "";
}
public boolean isStoreCredentials() {
try {
if (conDetails.has(STORECREDENTIALS)) {
return (Boolean) conDetails.get(STORECREDENTIALS);
}
} catch (JSONException e) {
ExceptionHandler.process(e);
}
return false;
}
public void setStoreCredentials(boolean store) {
try {
conDetails.put(STORECREDENTIALS, store);
} catch (JSONException e) {
ExceptionHandler.process(e);
}
}
public String getCredentials() {
return this.credentials;
}
public void setCredentials(String credentials) {
this.credentials = credentials;
}
}

View File

@@ -27,8 +27,8 @@ import org.talend.core.model.process.IElement;
import org.talend.core.model.process.INode;
import org.talend.core.model.process.IProcess;
import org.talend.core.model.process.Problem;
import org.talend.core.model.properties.Property;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.routines.CodesJarInfo;
import org.talend.designer.codegen.PigTemplate;
/**
@@ -120,7 +120,7 @@ public interface ILibrariesService extends IService {
Set<ModuleNeeded> getAllCodesJarModuleNeededs();
Set<ModuleNeeded> getCodesJarModuleNeededs(Property property);
Set<ModuleNeeded> getCodesJarModuleNeededs(CodesJarInfo info);
List<ModuleNeeded> getModuleNeeded(String id, boolean isGroup);

View File

@@ -125,6 +125,10 @@ public interface IMetadataColumn {
public void setCustom(boolean custom);
public boolean isIgnoreCustomSort();
public void setIgnoreCustomSort(boolean ignoreCustomSort);
public void setCustomId(int customId); // only for custom columns to sort them
public int getCustomId(); // only for custom columns to sort them

View File

@@ -106,4 +106,6 @@ public interface ISAPConstant {
public static final String PROP_DB_USERNAME = "db.username";//$NON-NLS-1$
public static final String PROP_DB_PASSWORD = "db.password";//$NON-NLS-1$
}
public static final String PROP_DB_ADDITIONAL_PROPERTIES = "db.additionalProperties";//$NON-NLS-1$
}

View File

@@ -53,6 +53,8 @@ public class MetadataColumn implements IMetadataColumn, Cloneable {
private boolean custom = false;
private boolean ignoreCustomSort = false;
private boolean readOnly = false;
private int customId = 0;
@@ -574,6 +576,24 @@ public class MetadataColumn implements IMetadataColumn, Cloneable {
this.custom = custom;
}
/**
* Getter for ignoreCustomSort.
*
* @return the ignoreCustomSort
*/
public boolean isIgnoreCustomSort() {
return ignoreCustomSort;
}
/**
* Sets the ignoreCustomSort.
*
* @param ignoreCustomSort the ignoreCustomSort to set
*/
public void setIgnoreCustomSort(boolean ignoreCustomSort) {
this.ignoreCustomSort = ignoreCustomSort;
}
/**
* Getter for readOnly.
*

View File

@@ -360,7 +360,7 @@ public class MetadataTable implements IMetadataTable, Cloneable {
for (int i = 0; i < listColumns.size(); i++) {
IMetadataColumn column = listColumns.get(i);
if (column.isCustom()) {
if (column.isCustom() && !column.isIgnoreCustomSort()) {
customColumns.add(column);
}
}

View File

@@ -32,6 +32,8 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang.StringUtils;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -492,18 +494,55 @@ public final class MetadataTalendType {
}
}
private static String getSha1OfFile(File file) {
String sha1 = null;
FileInputStream fileInputStream = null;
try {
fileInputStream = new FileInputStream(file);
sha1 = DigestUtils.shaHex(fileInputStream);
} catch (Exception e) {
ExceptionHandler.process(e);
} finally {
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException e) {
e.printStackTrace(); // Just print the exception for debug.
}
}
}
return sha1;
}
public static void copyFile(File in, IFile out) throws CoreException, IOException {
FileInputStream fis = new FileInputStream(in);
if (out.exists()) {
out.setContents(fis, true, false, null);
} else {
out.create(fis, true, null);
}
fis.close();
}
public static void syncNewMappingFileToProject() throws SystemException {
try {
File sysMappingFiles = new File(MetadataTalendType.getSystemForderURLOfMappingsFile().getPath());
IFolder projectMappingFolder = ResourceUtils.getProject(ProjectManager.getInstance().getCurrentProject())
.getFolder(MetadataTalendType.PROJECT_MAPPING_FOLDER);
File projectMappingFiles = projectMappingFolder.getFullPath().toFile();
if (sysMappingFiles.list().length == new File(projectMappingFolder.getLocationURI()).list().length) {
File projectMappingFiles = new File(projectMappingFolder.getLocationURI());
if (!sysMappingFiles.exists() || !projectMappingFiles.exists()) {
return;
}
for (File sysMapping : sysMappingFiles.listFiles()) {
IFile projectMapping = projectMappingFolder.getFile(sysMapping.getName());
if (projectMapping.exists() && StringUtils.equals(sysMapping.getName(), "mapping_Greenplum.xml")) {
String sha1OfFile = DigestUtils.shaHex(projectMapping.getContents());
String shalOfOldSystem = "8431f19215dacb3caa126778ae695954552cce2a";
if (StringUtils.equals(sha1OfFile, shalOfOldSystem)) {
copyFile(sysMapping, projectMapping);
}
}
if (!projectMapping.exists()) {
FileInputStream fis = null;
try {

View File

@@ -25,8 +25,10 @@ import org.apache.avro.SchemaBuilder.FieldAssembler;
import org.apache.avro.SchemaBuilder.FieldBuilder;
import org.apache.avro.SchemaBuilder.PropBuilder;
import org.apache.avro.SchemaBuilder.RecordBuilder;
import org.apache.avro.SchemaParseException;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.eclipse.emf.common.util.EList;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.GlobalServiceRegister;
@@ -49,6 +51,10 @@ import orgomg.cwm.objectmodel.core.TaggedValue;
*/
public final class MetadataToolAvroHelper {
private static Logger LOGGER = Logger.getLogger(MetadataToolAvroHelper.class);
private static final String COLUMN = "Column";
private static final String TALEND_DB_COLUMN_NAME = "talend.field.dbColumnName";
/**
* @return An Avro schema with enriched properties from the incoming metadata table.
@@ -66,7 +72,7 @@ public final class MetadataToolAvroHelper {
dynamicPosition = i;
dynColumn = column;
} else {
fa = convertToAvro(fa, column);
fa = convertToAvro(fa, column, i);
}
i++;
}
@@ -137,7 +143,7 @@ public final class MetadataToolAvroHelper {
* Build a field into a schema using enriched properties from the incoming column.
*/
private static FieldAssembler<Schema> convertToAvro(FieldAssembler<Schema> fa,
org.talend.core.model.metadata.builder.connection.MetadataColumn in) {
org.talend.core.model.metadata.builder.connection.MetadataColumn in, int i) {
ICoreService coreService = (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
String label = in.getLabel();
if (label != null && coreService != null) {
@@ -237,7 +243,27 @@ public final class MetadataToolAvroHelper {
}
type = in.isNullable() ? AvroUtils.wrapAsNullable(type) : type;
return defaultValue == null ? fb.type(type).noDefault() : fb.type(type).withDefault(defaultValue);
FieldAssembler<Schema> returnResult = null;
try {
if (defaultValue == null) {
returnResult = fb.type(type).noDefault();
} else {
returnResult = fb.type(type).withDefault(defaultValue);
}
} catch (SchemaParseException e) {
// if validation not pass from avro ,then generate a new name like Column0 to pass the validation, but
// actually the display name of schema and the column name is using TALEND_DB_COLUMN_NAME
String genColumn = COLUMN + i;
FieldBuilder<Schema> fbNew = fa.name(genColumn);
copyColumnProperties(fbNew, in);
if (defaultValue == null) {
returnResult = fbNew.type(type).noDefault();
} else {
returnResult = fbNew.type(type).withDefault(defaultValue);
}
LOGGER.info(e.getMessage() + ", use " + genColumn + " instead");
}
return returnResult;
}
private static Schema getLogicalTypeSchema(org.talend.core.model.metadata.builder.connection.MetadataColumn column) {

View File

@@ -281,9 +281,7 @@ public final class MetadataToolHelper {
}
public static boolean isAllowSpecificCharacters() {
IEclipsePreferences coreUIPluginNode = new InstanceScope().getNode(ITalendCorePrefConstants.CoreUIPlugin_ID);
return coreUIPluginNode
.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
return CoreRuntimePlugin.getInstance().getProjectPreferenceManager().isAllowSpecificCharacters();
}
/**
@@ -614,6 +612,7 @@ public final class MetadataToolHelper {
target.getListColumns().remove(targetColumn);
newTargetColumn.setCustom(targetColumn.isCustom());
newTargetColumn.setCustomId(targetColumn.getCustomId());
newTargetColumn.setIgnoreCustomSort(targetColumn.isIgnoreCustomSort());
columnsTAdd.add(newTargetColumn);
}
}
@@ -773,6 +772,7 @@ public final class MetadataToolHelper {
target.getListColumns().remove(targetColumn);
newTargetColumn.setCustom(targetColumn.isCustom());
newTargetColumn.setCustomId(targetColumn.getCustomId());
newTargetColumn.setIgnoreCustomSort(targetColumn.isIgnoreCustomSort());
columnsTAdd.add(newTargetColumn);
}
}

View File

@@ -32,9 +32,7 @@ import org.talend.core.database.EDatabaseTypeName;
import org.talend.core.database.conn.ConnParameterKeys;
import org.talend.core.database.conn.template.EDatabaseConnTemplate;
import org.talend.core.database.conn.version.EDatabaseVersion4Drivers;
import org.talend.core.hadoop.IHadoopClusterService;
import org.talend.core.hadoop.repository.HadoopRepositoryUtil;
import org.talend.core.hadoop.version.custom.ECustomVersionGroup;
import org.talend.core.language.ECodeLanguage;
import org.talend.core.language.LanguageManager;
import org.talend.core.model.metadata.EMetadataEncoding;
@@ -443,6 +441,13 @@ public class RepositoryToComponentProperty {
} else {
return TalendQuoteUtils.addQuotes(connection.getValue(dbPassword, false));
}
} else if ("SAPHANA_PROPERTIES_STRING".equals(value)) { //$NON-NLS-1$
String dbParameters = TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_ADDITIONAL_PROPERTIES, connection);
if (isContextMode(connection, dbParameters)) {
return dbParameters;
} else {
return TalendQuoteUtils.addQuotes(dbParameters);
}
}
return null;
}
@@ -1071,7 +1076,10 @@ public class RepositoryToComponentProperty {
return dbVersionString;
} else if (EDatabaseTypeName.SYBASEASE.getDisplayName().equals(databaseType)) {
return dbVersionString;
} else {
} else if (EDatabaseTypeName.GREENPLUM.getDisplayName().equals(databaseType)) {
return dbVersionString;
}else {
String driverValue = EDatabaseVersion4Drivers.getDriversStr(databaseType, dbVersionString);
if (EDatabaseConnTemplate.ORACLE_OCI.getDBDisplayName().equals(databaseType)
|| EDatabaseConnTemplate.ORACLE_CUSTOM.getDBDisplayName().equals(databaseType)
@@ -1533,22 +1541,6 @@ public class RepositoryToComponentProperty {
}
if (value.equals("HADOOP_CUSTOM_JARS")) {
if (targetComponent != null && targetComponent.startsWith("tPig")) {
// for pig component
String clusterID = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CLUSTER_ID);
if (clusterID != null) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
IHadoopClusterService hadoopClusterService = GlobalServiceRegister.getDefault()
.getService(IHadoopClusterService.class);
Map<String, String> hadoopCustomLibraries = hadoopClusterService.getHadoopCustomLibraries(clusterID);
if (EDatabaseTypeName.HBASE.getDisplayName().equals(connection.getDatabaseType())) {
return hadoopCustomLibraries.get(ECustomVersionGroup.PIG_HBASE.getName()) == null ? ""
: hadoopCustomLibraries.get(ECustomVersionGroup.PIG_HBASE.getName());
}
}
}
}
return connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CUSTOM_JARS);
}

View File

@@ -146,7 +146,7 @@ public abstract class AbstractItemMigrationTask extends AbstractMigrationTask im
* this returns all type handled by this migration task even the extended type that could benefit from this
* migrations
* */
List<ERepositoryObjectType> getAllTypes() {
protected List<ERepositoryObjectType> getAllTypes() {
List<ERepositoryObjectType> declaredTypes = getTypes();
ArrayList<ERepositoryObjectType> allTypes = new ArrayList<ERepositoryObjectType>(declaredTypes.size());
allTypes.addAll(declaredTypes);

View File

@@ -124,6 +124,7 @@ public enum EParameterFieldType {
TACOKIT_BUTTON,
TACOKIT_SUGGESTABLE_TABLE,
TACOKIT_VALUE_SELECTION,
TACOKIT_TABLE,
TACOKIT_TEXT_AREA_SELECTION;
public String getName() {

View File

@@ -12,6 +12,7 @@
// ============================================================================
package org.talend.core.model.process;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -133,4 +134,8 @@ public interface IProcess extends IElement {
public String getComponentsType();
public INode getNodeByUniqueName(String uniqueName);
default List<? extends INode> getProcessNodes() {
return new ArrayList<INode>();
}
}

View File

@@ -67,6 +67,8 @@ public class JobInfo {
private boolean needUnloadProcessor;
private int includeESBFlag = 0;
public JobInfo(String jobId, String contextName, String version) {
this.jobId = jobId;
this.contextName = contextName;
@@ -572,4 +574,13 @@ public class JobInfo {
public boolean isNeedUnloadProcessor() {
return this.needUnloadProcessor;
}
public int getIncludeESBFlag() {
return includeESBFlag;
}
public void setIncludeESBFlag(int includeESBFlag) {
this.includeESBFlag = includeESBFlag;
}
}

View File

@@ -52,4 +52,12 @@ public interface IRepositoryPrefConstants {
public static final String ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS = "allow_specific_characters_for_schema_columns";
public static final String REF_PROJECT_BRANCH_SETTING = "ref_project_branch_setting";
public static final String ITEM_EXPORT_DEPENDENCIES = "item_export_dependencies";
public static final String ITEM_IMPORT_DEPENDENCIES = "item_import_dependencies";
public static final String ITEM_IMPORT_BRANCH_DEPENDENCIES = "item_import_from_branch_dependencies";
public static final String ITEM_DISABLE_SCREENSHOT = "item_disable_screenshot";
}

View File

@@ -12,9 +12,23 @@
// ============================================================================
package org.talend.core.model.routines;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.runtime.Assert;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.model.properties.Property;
import org.talend.core.model.properties.RoutinesJarItem;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.runtime.repository.item.ItemProductKeys;
import org.talend.cwm.helper.ResourceHelper;
import org.talend.designer.core.model.utils.emf.component.IMPORTType;
import org.talend.repository.ProjectManager;
import org.talend.repository.model.IProxyRepositoryService;
/**
* Could get most of codesjar's attribute in EMF model but some are lost when model is unloaded. Store those attributes
@@ -23,7 +37,7 @@ import org.talend.repository.ProjectManager;
public class CodesJarInfo {
private Property property;
private static final String EMPTY_DATE;
private String projectTechName;
@@ -35,24 +49,47 @@ public class CodesJarInfo {
private ERepositoryObjectType type;
private CodesJarInfo() {
private List<IMPORTType> imports;
private String modifiedDate;
static {
Calendar c = Calendar.getInstance();
c.setTimeInMillis(0);
EMPTY_DATE = ResourceHelper.dateFormat().format(c.getTime());
}
private CodesJarInfo() {
imports = new ArrayList<>();
}
public static CodesJarInfo create(Property property) {
Assert.isTrue(property.getItem() instanceof RoutinesJarItem);
CodesJarInfo info = new CodesJarInfo();
info.property = property;
info.projectTechName = ProjectManager.getInstance().getProject(property).getTechnicalLabel();
info.id = property.getId();
info.label = property.getLabel();
info.version = property.getVersion();
info.type = ERepositoryObjectType.getItemType(property.getItem());
if (((RoutinesJarItem) property.getItem()).getRoutinesJarType() != null) {
info.imports.addAll(((RoutinesJarItem) property.getItem()).getRoutinesJarType().getImports());
}
String modifiedDate = (String) property.getAdditionalProperties().get(ItemProductKeys.DATE.getModifiedKey());
info.modifiedDate = StringUtils.isNotBlank(modifiedDate) ? modifiedDate : EMPTY_DATE;
return info;
}
public Property getProperty() {
return property;
}
try {
IRepositoryViewObject obj = IProxyRepositoryService.get().getProxyRepositoryFactory().getLastVersion(id);
if (obj != null) {
return obj.getProperty();
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
return null;
}
public String getProjectTechName() {
return projectTechName;
@@ -74,6 +111,14 @@ public class CodesJarInfo {
return type;
}
public List<IMPORTType> getImports() {
return imports;
}
public String getModifiedDate() {
return modifiedDate;
}
public boolean isInCurrentMainProject() {
return projectTechName.equals(ProjectManager.getInstance().getCurrentProject().getTechnicalLabel());
}
@@ -82,36 +127,42 @@ public class CodesJarInfo {
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((projectTechName == null) ? 0 : projectTechName.hashCode());
result = prime * result + ((property == null) ? 0 : property.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((label == null) ? 0 : label.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((version == null) ? 0 : version.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
if (this == obj)
return true;
}
if (obj == null) {
if (obj == null)
return false;
}
if (getClass() != obj.getClass()) {
if (getClass() != obj.getClass())
return false;
}
CodesJarInfo other = (CodesJarInfo) obj;
if (projectTechName == null && other.projectTechName != null) {
return false;
} else if (!projectTechName.equals(other.projectTechName)) {
return false;
}
if (property == null && other.property != null) {
return false;
} else if (property != null && other.property != null) {
if (!property.getId().equals(other.property.getId()) || !property.getLabel().equals(other.property.getLabel())
|| !property.getVersion().equals(other.property.getVersion())) {
if (id == null) {
if (other.id != null)
return false;
}
}
} else if (!id.equals(other.id))
return false;
if (label == null) {
if (other.label != null)
return false;
} else if (!label.equals(other.label))
return false;
if (type == null) {
if (other.type != null)
return false;
} else if (!type.equals(other.type))
return false;
if (version == null) {
if (other.version != null)
return false;
} else if (!version.equals(other.version))
return false;
return true;
}

View File

@@ -21,14 +21,13 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.script.Bindings;
import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import org.apache.commons.lang.StringUtils;
import org.apache.oro.text.regex.MalformedPatternException;
import org.apache.oro.text.regex.PatternCompiler;
@@ -36,8 +35,7 @@ import org.apache.oro.text.regex.Perl5Compiler;
import org.apache.oro.text.regex.Perl5Matcher;
import org.apache.oro.text.regex.Perl5Substitution;
import org.apache.oro.text.regex.Util;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.core.runtime.Platform;
import org.talend.commons.utils.PasswordEncryptUtil;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.language.ECodeLanguage;
@@ -50,14 +48,16 @@ import org.talend.core.model.metadata.types.JavaTypesManager;
import org.talend.core.model.process.IContext;
import org.talend.core.model.process.IContextManager;
import org.talend.core.model.process.IContextParameter;
import org.talend.core.model.repository.IRepositoryPrefConstants;
import org.talend.core.prefs.ITalendCorePrefConstants;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.core.runtime.services.IGenericDBService;
import org.talend.core.utils.TalendQuoteUtils;
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
import org.talend.repository.model.RepositoryConstants;
import delight.rhinosandox.RhinoSandbox;
import delight.rhinosandox.RhinoSandboxes;
/**
* Utilities to work with IContextParamet objects. <br/>
*
@@ -84,6 +84,12 @@ public final class ContextParameterUtils {
private static final String NON_CONTEXT_PATTERN = "[^a-zA-Z0-9_]"; //$NON-NLS-1$
private static final RhinoSandbox SANDBOX = RhinoSandboxes.create();
private static final Map<String, Object> CTX_VARS_LAST = new HashMap<String, Object>();
private static ReadWriteLock CTX_VARS_LOCK = new ReentrantReadWriteLock();
/**
* Constructs a new ContextParameterUtils.
*/
@@ -206,10 +212,37 @@ public final class ContextParameterUtils {
}
}
private static ScriptEngine engine = new ScriptEngineManager().getEngineByName("JavaScript");
public static ScriptEngine getScriptEngine() {
return engine;
private static String preProcessScript(String script) {
String newCode = script;
CTX_VARS_LOCK.readLock().lock();
try {
Set<Entry<String, Object>> entries = CTX_VARS_LAST.entrySet();
for (Entry<String, Object> entry : entries) {
String val = entry.getValue().toString();
if (entry.getValue() instanceof String) {
val = "\"" + val.replace("\"", "\\\"") + "\"";
}
newCode = newCode.replace(JAVA_NEW_CONTEXT_PREFIX + entry.getKey(), val);
}
} finally {
CTX_VARS_LOCK.readLock().unlock();
}
return newCode;
}
public static boolean isValidLiteralValue(String value) {
String newCode = preProcessScript(value);
try {
SANDBOX.eval(null, newCode);
return true;
} catch (Exception e) {
// ignore
}
return false;
}
public static String convertContext2Literal4AnyVar(final String code, final IContext context) {
@@ -223,23 +256,22 @@ public final class ContextParameterUtils {
Object result = code;
if (engine == null) {
engine = new ScriptEngineManager().getEngineByName("JavaScript");
Map<String, Object> varMap = getVarMapForScriptEngine(context);
CTX_VARS_LOCK.writeLock().lock();
try {
CTX_VARS_LAST.clear();
CTX_VARS_LAST.putAll(varMap);
} finally {
CTX_VARS_LOCK.writeLock().unlock();
}
if (engine == null) {
throw new RuntimeException("can't find the script engine");
}
String newCode = preProcessScript(code);
Bindings binding = engine.getBindings(ScriptContext.ENGINE_SCOPE);
if (binding != null) {
binding.clear();
Map<String, Object> varMap = getVarMapForScriptEngine(context);
binding.put("context", varMap);
}
try {
String replacement = " ";
result = engine.eval(code.replace("\r\n", replacement).replace("\n", replacement).replace("\r", replacement));
result = SANDBOX.eval(null,
newCode.replace("\r\n", replacement).replace("\n", replacement).replace("\r", replacement));
} catch (Exception e) {
// ignore the exception
}
@@ -296,7 +328,7 @@ public final class ContextParameterUtils {
List<String> mvnValues = new ArrayList<>();
IGenericDBService dbService = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericDBService.class)) {
dbService = (IGenericDBService) GlobalServiceRegister.getDefault().getService(IGenericDBService.class);
dbService = GlobalServiceRegister.getDefault().getService(IGenericDBService.class);
}
for (String value : values) {
try {
@@ -617,8 +649,11 @@ public final class ContextParameterUtils {
}
private static boolean isAllowSpecificCharacters() {
IEclipsePreferences coreUIPluginNode = new InstanceScope().getNode(ITalendCorePrefConstants.CoreUIPlugin_ID);
return coreUIPluginNode.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
if (Platform.isRunning()) {
return CoreRuntimePlugin.getInstance().getProjectPreferenceManager().isAllowSpecificCharacters();
} else {
return false;
}
}
public static boolean isEmptyParameter(String source) {

View File

@@ -27,9 +27,6 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.script.ScriptEngine;
import javax.script.ScriptException;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.model.components.ComponentCategory;
import org.talend.core.model.components.IComponent;
@@ -418,6 +415,52 @@ public class NodeUtil {
return conns;
}
/**
* DOC
* <p>
* The method searches for the incoming node connections of type
* on a processing path and returns the first ones only
* </p>
*
* @param node
* @param type - node type to look for
* @return
*/
public static List<? extends IConnection> getFirstIncomingLineConnectionsOfType(INode node, String type) {
if (type == null)
return new ArrayList<IConnection>();
Set<String> uniqueNamesDone = new HashSet<String>();
List<? extends IConnection> allIncomingConnections = getFirstIncomingLineConnectionsOfType(node, uniqueNamesDone, type);
return allIncomingConnections;
}
private static List<? extends IConnection> getFirstIncomingLineConnectionsOfType(INode node, Set<String> uniqueNamesDone, String type) {
List<IConnection> conns = new ArrayList<IConnection>();
List<? extends IConnection> incomingConnections = node.getIncomingConnections();
if (incomingConnections != null) {
for (int i = 0; i < incomingConnections.size(); i++) {
IConnection connection = incomingConnections.get(i);
INode nextNode = connection.getSource();
if (!uniqueNamesDone.contains(nextNode.getUniqueName())) {
uniqueNamesDone.add(nextNode.getUniqueName());
if (type.equals((String)nextNode.getElementParameter("COMPONENT_NAME").getValue())) {
conns.add(connection);
} else {
conns.addAll(getFirstIncomingLineConnectionsOfType(nextNode, uniqueNamesDone, type)); // follow this way
}
}
}
}
return conns;
}
public static INode getFirstMergeNode(INode node) {
INode mergeNode = null;
for (IConnection connection : node.getOutgoingConnections()) {
@@ -1040,14 +1083,7 @@ public class NodeUtil {
}
private static boolean isValidLiteralValue(String value) {
ScriptEngine se = ContextParameterUtils.getScriptEngine();
if(se==null) return true;
try {
se.eval(value);
return true;
} catch (ScriptException e) {
return false;
}
return ContextParameterUtils.isValidLiteralValue(value);
}
private static String checkStringQuotationMarks(String str) {

View File

@@ -22,8 +22,6 @@ import org.ops4j.pax.url.mvn.MavenResolver;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.service.cm.ManagedService;
import org.osgi.util.tracker.ServiceTracker;
import org.osgi.util.tracker.ServiceTrackerCustomizer;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.utils.network.IProxySelectorProvider;
import org.talend.commons.utils.network.TalendProxySelector;
@@ -47,39 +45,6 @@ public class TalendMavenResolver {
private static MavenResolver mavenResolver = null;
/**
*
* DOC wchen TalendMavenResolver constructor comment.
*/
static {
// the tracker is use in case the service is modifed
final BundleContext context = CoreRuntimePlugin.getInstance().getBundle().getBundleContext();
ServiceTracker<org.ops4j.pax.url.mvn.MavenResolver, org.ops4j.pax.url.mvn.MavenResolver> serviceTracker = new ServiceTracker<org.ops4j.pax.url.mvn.MavenResolver, org.ops4j.pax.url.mvn.MavenResolver>(
context, org.ops4j.pax.url.mvn.MavenResolver.class,
new ServiceTrackerCustomizer<org.ops4j.pax.url.mvn.MavenResolver, org.ops4j.pax.url.mvn.MavenResolver>() {
@Override
public org.ops4j.pax.url.mvn.MavenResolver addingService(
ServiceReference<org.ops4j.pax.url.mvn.MavenResolver> reference) {
return context.getService(reference);
}
@Override
public void modifiedService(ServiceReference<org.ops4j.pax.url.mvn.MavenResolver> reference,
org.ops4j.pax.url.mvn.MavenResolver service) {
mavenResolver = null;
}
@Override
public void removedService(ServiceReference<org.ops4j.pax.url.mvn.MavenResolver> reference,
org.ops4j.pax.url.mvn.MavenResolver service) {
mavenResolver = null;
}
});
serviceTracker.open();
}
public static void updateMavenResolver(String resolverKey, Dictionary<String, String> props) throws Exception {
if (!needUpdate(resolverKey)) {
return;

View File

@@ -126,6 +126,9 @@ public abstract class AbstractPropertyValueEvaluator implements PropertyValueEva
}
if (GenericTypeUtils.isStringType(property)) {
if (property.isFlag(Property.Flags.ENCRYPT)) {
return TalendQuoteUtils.removeQuotes(stringValue);
}
return TalendQuoteUtils.removeQuotes(StringEscapeUtils.unescapeJava(stringValue));
}
return rawValue;

View File

@@ -46,6 +46,8 @@ public interface MavenConstants {
static final String EXCLUDE_DELETED_ITEMS = "EXCLUDE_DELETED_ITEMS";
static final String SKIP_LOOP_DEPENDENCY_CHECK = "SKIP_LOOP_DEPENDENCY_CHECK";
static final String SKIP_FOLDERS = "SKIP_FOLDERS";
/*

View File

@@ -80,4 +80,13 @@ public interface TalendProcessOptionConstants {
*/
public static final int MODULES_WITH_CODESJAR = 1 << 6;
/**
* flag for check if is ESB job
*/
public static final int ISESB_CHECKED = 1;
public static final int ISESB_CHILDREN_INCLUDE = 1 << 1;
public static final int ISESB_CURRENT_INCLUDE = 1 << 2;
}

View File

@@ -15,6 +15,7 @@ package org.talend.core.runtime.projectsetting;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.Assert;
@@ -27,6 +28,7 @@ import org.talend.commons.exception.PersistenceException;
import org.talend.commons.utils.workbench.resources.ResourceUtils;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.model.general.Project;
import org.talend.core.model.repository.IRepositoryPrefConstants;
import org.talend.designer.runprocess.IRunProcessService;
import org.talend.repository.ProjectManager;
import org.talend.repository.documentation.ERepositoryActionName;
@@ -195,6 +197,26 @@ public class ProjectPreferenceManager {
// return qulifierPreference.getBoolean(key, false);
return getPreferenceStore().getBoolean(key);
}
public boolean isAllowSpecificCharacters() {
String value = getValue(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS);
if (StringUtils.isNotEmpty(value)) {
return Boolean.valueOf(value);
}
return false; // Default value
}
public void setAllowSpecificCharacters(boolean isAllow) {
setValue(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, isAllow);
}
public boolean isDisableScreenshot() {
return getPreferenceStore().getBoolean(IRepositoryPrefConstants.ITEM_DISABLE_SCREENSHOT);
}
public void setDisableScreenshot(boolean isDisable) {
getPreferenceStore().setValue(IRepositoryPrefConstants.ITEM_DISABLE_SCREENSHOT, isDisable);
}
/**
* Save the configurations.

View File

@@ -14,17 +14,16 @@ package org.talend.core.runtime.services;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.IService;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.Property;
import org.talend.core.model.properties.RoutineItem;
import org.talend.core.model.routines.CodesJarInfo;
public interface IDesignerMavenService extends IService {
String getCodesJarPackageByInnerCode(RoutineItem innerCodeItem);
String getImportGAVPackageForCodesJar(String projectTechName, Item codesJarItem);
String getImportGAVPackageForCodesJar(CodesJarInfo info);
void updateCodeJarMavenProject(Property codeJarProperty, boolean needReSync) throws Exception;
void updateCodeJarMavenProject(CodesJarInfo info, boolean needReSync) throws Exception;
public static IDesignerMavenService get() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerMavenService.class)) {

View File

@@ -150,6 +150,8 @@ public interface IGenericWizardService extends IService {
*/
public ITreeContextualAction getDefaultAction(RepositoryNode node);
public ITreeContextualAction getGenericAction(String typeName, String location);
public void loadAdditionalJDBC();
public List<String> getAllAdditionalJDBCTypes();

View File

@@ -27,47 +27,12 @@ import org.talend.core.GlobalServiceRegister;
import org.talend.core.model.components.IComponentsFactory;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.core.service.IUpdateService;
import org.talend.utils.io.FilesUtils;
import org.talend.utils.string.DigestUtil;
public class SharedStudioUtils {
public static final String FILE_EXTRA_FEATURE_INDEX = "extra_feature.index"; //$NON-NLS-1$
public static final String SIGNATURE_FILE_NAME_SUFFIX = ".sig"; //$NON-NLS-1$
public static final String PROP_DEVMODE = "osgi.dev"; //$NON-NLS-1$
public static boolean updateExtraFeatureFile() {
File userConfigFolder = new File(Platform.getConfigurationLocation().getURL().getPath());
File studioConfigFolder = new File(Platform.getInstallLocation().getURL().getPath(), "configuration");//$NON-NLS-1$
if (!userConfigFolder.getAbsolutePath().equals(studioConfigFolder.getAbsolutePath())) {
File studioExtraFile = new File(studioConfigFolder, FILE_EXTRA_FEATURE_INDEX);
File studioExtraSignFile = new File(studioConfigFolder, FILE_EXTRA_FEATURE_INDEX + SIGNATURE_FILE_NAME_SUFFIX);
File userExtraFile = new File(userConfigFolder, FILE_EXTRA_FEATURE_INDEX);
File userExtraSignFile = new File(userConfigFolder, FILE_EXTRA_FEATURE_INDEX + SIGNATURE_FILE_NAME_SUFFIX);
boolean isNeedUpdate = false;
if (!studioExtraSignFile.exists() && userExtraSignFile.exists()) {
userExtraSignFile.delete();
if (userExtraFile.exists()) {
userExtraFile.delete();
}
return true;
} else if (studioExtraSignFile.exists()) {
isNeedUpdate = true;
}
if (isNeedUpdate) {
try {
FilesUtils.copyFile(studioExtraFile, userExtraFile);
FilesUtils.copyFile(studioExtraSignFile, userExtraSignFile);
} catch (IOException ex) {
ExceptionHandler.process(ex);
}
return true;
}
}
return false;
}
public static boolean isSharedStudioMode() {
if (isDevEnvironment()) {
return false;

View File

@@ -47,4 +47,6 @@ public interface ICoreUIService extends IService {
String getPreferenceValue(String key);
void loadComponentsFromProviders(ERepositoryObjectType type);
void resetDataCollectorData();
}

View File

@@ -147,4 +147,6 @@ public interface IJobletProviderService extends IService {
public void updateJobleModifiedRelated(Item item, String oldName, String newName);
public IProcess getJobletGEFProcessFromNode(INode node);
}

View File

@@ -39,10 +39,11 @@ public class CodesJarResourceCache {
List<Project> allProjects = new ArrayList<>();
allProjects.addAll(ProjectManager.getInstance().getAllReferencedProjects(true));
allProjects.add(ProjectManager.getInstance().getCurrentProject());
IProxyRepositoryFactory factory = IProxyRepositoryService.get().getProxyRepositoryFactory();
try {
for (Project project : allProjects) {
for (ERepositoryObjectType codesJarType : ERepositoryObjectType.getAllTypesOfCodesJar()) {
List<IRepositoryViewObject> objects = getProxyRepositoryFactory().getAllCodesJars(project, codesJarType);
List<IRepositoryViewObject> objects = factory.getAllCodesJars(project, codesJarType);
for (IRepositoryViewObject obj : objects) {
CACHE.add(CodesJarInfo.create(obj.getProperty()));
}
@@ -63,8 +64,7 @@ public class CodesJarResourceCache {
public static CodesJarInfo getCodesJarById(String id) {
synchronized (LOCK) {
Optional<CodesJarInfo> optional = CACHE.stream().filter(info -> info.getProperty().getId().equals(id))
.findFirst();
Optional<CodesJarInfo> optional = CACHE.stream().filter(info -> info.getId().equals(id)).findFirst();
if (optional.isPresent()) {
return optional.get();
}
@@ -75,13 +75,12 @@ public class CodesJarResourceCache {
public static CodesJarInfo getCodesJarByLabel(ERepositoryObjectType type, String projectTechName, String label) {
synchronized (LOCK) {
Optional<CodesJarInfo> optional = CACHE.stream().filter(
info -> ERepositoryObjectType.getItemType(info.getProperty().getItem()) == type
&& info.getProperty().getLabel().equals(label) && info.getProjectTechName().equals(projectTechName))
.findFirst();
Optional<CodesJarInfo> optional = CACHE.stream().filter(info -> info.getType() == type
&& info.getLabel().equals(label) && info.getProjectTechName().equals(projectTechName)).findFirst();
if (optional.isPresent()) {
return optional.get();
}
ExceptionHandler.process(new Exception("Codes jar [" + label + "] is not found!")); //$NON-NLS-1$ //$NON-NLS-2$
return null;
}
}
@@ -89,19 +88,23 @@ public class CodesJarResourceCache {
public static CodesJarInfo getCodesJarByInnerCode(RoutineItem routineItem) throws PersistenceException {
String codesJarName = RoutinesUtil.getCodesJarLabelByInnerCode(routineItem);
String projectTechName = ProjectManager.getInstance().getProject(routineItem).getTechnicalLabel();
return getAllCodesJars().stream()
.filter(info -> info.getProperty().getLabel().equals(codesJarName)
&& info.getProjectTechName().equals(projectTechName))
.findFirst().get();
Optional<CodesJarInfo> optional = getAllCodesJars().stream()
.filter(info -> info.getLabel().equals(codesJarName) && info.getProjectTechName().equals(projectTechName))
.findFirst();
if (optional.isPresent()) {
return optional.get();
}
ExceptionHandler.process(new Exception("Codes jar [" + routineItem.getProperty().getLabel() + "] is not found!")); //$NON-NLS-1$ //$NON-NLS-2$
return null;
}
public static void addToCache(Property newProperty) {
synchronized (LOCK) {
Iterator<CodesJarInfo> iterator = CACHE.iterator();
while (iterator.hasNext()) {
Property oldProperty = iterator.next().getProperty();
if (newProperty.getId().equals(oldProperty.getId()) && newProperty.getLabel().equals(oldProperty.getLabel())
&& newProperty.getVersion().equals(oldProperty.getVersion())) {
CodesJarInfo oldInfo = iterator.next();
if (newProperty.getId().equals(oldInfo.getId()) && newProperty.getLabel().equals(oldInfo.getLabel())
&& newProperty.getVersion().equals(oldInfo.getVersion())) {
iterator.remove();
}
}
@@ -113,10 +116,9 @@ public class CodesJarResourceCache {
synchronized (LOCK) {
Iterator<CodesJarInfo> iterator = CACHE.iterator();
while (iterator.hasNext()) {
Property oldProperty = iterator.next().getProperty();
if ((oldId == null || (oldId != null && oldId.equals(oldProperty.getId())))
&& oldLabel.equals(oldProperty.getLabel())
&& oldVersion.equals(oldProperty.getVersion())) {
CodesJarInfo oldInfo = iterator.next();
if ((oldId == null || (oldId != null && oldId.equals(oldInfo.getId()))) && oldLabel.equals(oldInfo.getLabel())
&& oldVersion.equals(oldInfo.getVersion())) {
iterator.remove();
}
}
@@ -128,22 +130,15 @@ public class CodesJarResourceCache {
synchronized (LOCK) {
Iterator<CodesJarInfo> iterator = CACHE.iterator();
while (iterator.hasNext()) {
Property oldProperty = iterator.next().getProperty();
if (oldProperty.getId().equals(property.getId()) && oldProperty.getLabel().equals(property.getLabel())
&& oldProperty.getVersion().equals(property.getVersion())) {
CodesJarInfo oldInfo = iterator.next();
if (oldInfo.getId().equals(property.getId()) && oldInfo.getLabel().equals(property.getLabel())
&& oldInfo.getVersion().equals(property.getVersion())) {
iterator.remove();
}
}
}
}
private static IProxyRepositoryFactory getProxyRepositoryFactory() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IProxyRepositoryService.class)) {
return GlobalServiceRegister.getDefault().getService(IProxyRepositoryService.class).getProxyRepositoryFactory();
}
return null;
}
public static void addCodesJarChangeListener() {
if (!isListenerAdded) {
synchronized (LOCK) {

View File

@@ -271,14 +271,10 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
protected void syncInnerCodeItems(boolean forceUpdate) throws SystemException {
IProxyRepositoryFactory factory = getRepositoryService().getProxyRepositoryFactory();
for (CodesJarInfo info : CodesJarResourceCache.getAllCodesJars()) {
Property property = info.getProperty();
String projectTechName = info.getProjectTechName();
Project project = ProjectManager.getInstance().getProjectFromProjectTechLabel(projectTechName);
ERepositoryObjectType codesJarType = ERepositoryObjectType.getItemType(property.getItem());
List<IRepositoryViewObject> innerCodesObjects = factory.getAllInnerCodes(project, codesJarType, property);
List<IRepositoryViewObject> innerCodesObjects = factory.getAllInnerCodes(info);
for (IRepositoryViewObject codesObj : innerCodesObjects) {
RoutineItem codeItem = (RoutineItem) codesObj.getProperty().getItem();
syncRoutine(codeItem, projectTechName, true, forceUpdate);
syncRoutine(codeItem, info.getProjectTechName(), true, forceUpdate);
}
}
}
@@ -295,11 +291,8 @@ public abstract class AbstractRoutineSynchronizer implements ITalendSynchronizer
return;
}
CodesJarInfo info = CodesJarResourceCache.getCodesJarByInnerCode(routineItem);
Property codesJarProperty = info.getProperty();
IFolder innerCodeFolder = ResourceUtils.getFolder(ResourceUtils.getProject(info.getProjectTechName()),
ERepositoryObjectType.getFolderName(ERepositoryObjectType.getItemType(codesJarProperty.getItem())) + "/"
+ codesJarProperty.getLabel(),
true);
ERepositoryObjectType.getFolderName(info.getType()) + "/" + info.getLabel(), true);
IFile innerCodeFile = innerCodeFolder
.getFile(routineItem.getProperty().getLabel() + "_" + routineItem.getProperty().getVersion() + ".item");
if (innerCodeFile.exists()) {

View File

@@ -196,6 +196,7 @@ public abstract class AbstractTalendFunctionParser extends AbstractFunctionParse
function.setName(funcName);
function.setDescription(des);
function.setParameters(Arrays.asList(paras));
function.setFullQualifiedName(fullName);
if (!category.equals(EMPTY_STRING)) {
function.setCategory(category);
}

View File

@@ -16,6 +16,7 @@ import java.util.ArrayList;
import java.util.List;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.utils.generation.JavaUtils;
import org.talend.core.runtime.i18n.Messages;
import org.talend.utils.json.JSONArray;
import org.talend.utils.json.JSONException;
@@ -45,6 +46,10 @@ public class Function implements Cloneable {
private boolean isUserDefined;
private boolean rountineJarDependencyMissing = true;
private String fullQualifiedName;
/**
* yzhang Function constructor comment.
*/
@@ -517,6 +522,40 @@ public class Function implements Cloneable {
this.className = className;
}
public String getFullQualifiedName() {
return fullQualifiedName;
}
public void setFullQualifiedName(String fullQualifiedName) {
this.fullQualifiedName = fullQualifiedName;
}
public String getRoutineJarName() {
String[] fqns = fullQualifiedName.split("\\.");
if (fqns.length > 1) {
return fqns[fqns.length - 2];
}
return null;
}
public boolean isRoutineJar() {
if (this.fullQualifiedName == null || this.fullQualifiedName.isEmpty()) {
return false;
}
return this.fullQualifiedName.contains("." + JavaUtils.JAVA_ROUTINESJAR_DIRECTORY + ".");
}
public boolean isRoutineJarDependencyMissing() {
if (!this.isRoutineJar()) {
return false;
}
return this.rountineJarDependencyMissing;
}
public void setRountineJarDependencyMissing(boolean rountineJarDependencyMissing) {
this.rountineJarDependencyMissing = rountineJarDependencyMissing;
}
@SuppressWarnings("unchecked")
public String toSerialized() throws JSONException {
JSONObject functionObj = new JSONObject();

View File

@@ -109,6 +109,11 @@ public class FunctionManager {
parser = new RoutineFunctionParser();
parser.parse();
talendTypes = parser.getList();
parser = new RoutineJarsFunctionParser();
parser.parse();
talendTypes.addAll(parser.getList());
}
@SuppressWarnings("unchecked")

View File

@@ -0,0 +1,276 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.rowgenerator.data;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.resources.IFolder;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.core.SourceType;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.commons.utils.generation.JavaUtils;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.model.general.Project;
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.IRepositoryObject;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.model.routines.CodesJarInfo;
import org.talend.core.runtime.maven.MavenConstants;
import org.talend.core.runtime.process.ITalendProcessJavaProject;
import org.talend.core.runtime.projectsetting.ProjectPreferenceManager;
import org.talend.core.utils.CodesJarResourceCache;
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
import org.talend.designer.core.model.utils.emf.talendfile.RoutinesParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.TalendFilePackage;
import org.talend.designer.core.model.utils.emf.talendfile.impl.ProcessTypeImpl;
import org.talend.designer.runprocess.IRunProcessService;
import org.talend.repository.ProjectManager;
import org.talend.repository.model.IProxyRepositoryService;
/**
* Created by bhe on Jun 24, 2021
*
*
*/
public class RoutineJarsFunctionParser extends AbstractTalendFunctionParser {
public static final String MAVEN_PLUGIN_ID = "org.talend.designer.maven";
private List<String> systems = new ArrayList<String>();
private final Set<CodesJarInfo> infos = new HashSet<CodesJarInfo>();
public RoutineJarsFunctionParser() {
super();
initProcessCodesJarInfo();
}
private void initProcessCodesJarInfo() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault()
.getService(IRunProcessService.class);
IRepositoryObject process = (IRepositoryObject) service.getActiveProcess();
if (process == null || process.getProperty() == null || process.getProperty().getItem() == null) {
return;
}
Item processItem = process.getProperty().getItem();
Set<CodesJarInfo> allSet = CodesJarResourceCache.getAllCodesJars();
Set<RoutinesParameterType> rps = new HashSet<RoutinesParameterType>();
if (processItem instanceof ProcessItem) {
ProcessType pt = ((ProcessItem) processItem).getProcess();
rps.addAll(pt.getParameters().getRoutinesParameter());
// if it is test process
int pidFeature = TalendFilePackage.PROCESS_TYPE_FEATURE_COUNT + 2;
int versionFeature = TalendFilePackage.PROCESS_TYPE_FEATURE_COUNT + 4;
ProcessTypeImpl pi = (ProcessTypeImpl) pt;
if (pi.eClass() != null && StringUtils.equals(pi.eClass().getName(), "TestContainer")) {
try {
Object pid = pi.eGet(pidFeature, true, false);
Object version = pi.eGet(versionFeature, true, false);
if (pid != null) {
IProxyRepositoryService svc = IProxyRepositoryService.get();
try {
List<IRepositoryViewObject> vos = svc.getProxyRepositoryFactory().getAllVersion(pid.toString());
for (IRepositoryViewObject vo : vos) {
if (StringUtils.equals(vo.getVersion(), String.valueOf(version))) {
Item parentProcessItem = vo.getProperty().getItem();
if (parentProcessItem instanceof ProcessItem) {
pt = ((ProcessItem) parentProcessItem).getProcess();
rps.addAll(pt.getParameters().getRoutinesParameter());
}
}
}
} catch (PersistenceException e) {
// ignore
}
}
} catch (Exception e) {
// ignore
}
}
} else if (processItem instanceof JobletProcessItem) {
ProcessType pt = ((JobletProcessItem) processItem).getJobletProcess();
rps.addAll(pt.getParameters().getRoutinesParameter());
}
if (!rps.isEmpty()) {
rps.forEach(rp -> {
for (CodesJarInfo info : allSet) {
if (StringUtils.equals(info.getId(), rp.getId())) {
infos.add(info);
}
}
});
}
}
}
@Override
@SuppressWarnings("restriction")
public void parse() {
typeMethods.clear();
try {
Set<CodesJarInfo> jarInfos = CodesJarResourceCache.getAllCodesJars();
jarInfos.forEach(e -> {
try {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault()
.getService(IRunProcessService.class);
ITalendProcessJavaProject talendProcessJavaProject = service.getTalendCodesJarJavaProject(e);
if (talendProcessJavaProject != null) {
IFolder srcFolder = talendProcessJavaProject.getSrcFolder();
IPackageFragmentRoot root = talendProcessJavaProject.getJavaProject()
.getPackageFragmentRoot(srcFolder);
final List<IJavaElement> elements = new ArrayList<IJavaElement>();
addEveryProjectElements(root, elements,
getGroupId() + "." + JavaUtils.JAVA_ROUTINESJAR_DIRECTORY + "." + e.getLabel().toLowerCase());
// for (IJavaElement element : elements) {
// see bug 8055,reversal the getLastName() method
for (int i = elements.size(); i > 0; i--) {
IJavaElement element = elements.get(i - 1);
if (element instanceof ICompilationUnit) {
ICompilationUnit compilationUnit = (ICompilationUnit) element;
IType[] types = compilationUnit.getAllTypes();
if (types.length > 0) {
// SourceType sourceType = (SourceType) types[0];
IMember sourceType = types[0];
if (sourceType != null) {
// processSourceType(sourceType, sourceType.getElementName(),
// sourceType.getFullyQualifiedName(),
// sourceType.getElementName(), false);
processSourceType(sourceType, sourceType.getElementName(),
types[0].getFullyQualifiedName(), sourceType.getElementName(), false);
}
}
}
}
}
}
} catch (Exception ex) {
ExceptionHandler.process(ex);
}
});
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
/*
* (non-Javadoc)
*
* @see
* org.talend.designer.rowgenerator.data.AbstractTalendFunctionParser#processSourceType(org.eclipse.jdt.internal
* .core.SourceType)
*/
@SuppressWarnings("restriction")
@Override
protected void processSourceType(IMember member, String className, String fullName, String funcName, boolean isSystem) {
try {
if (member instanceof SourceType) {
IMethod[] methods = ((SourceType) member).getMethods();
for (IMethod method : methods) {
super.processSourceType(method, className, fullName, method.getElementName(), systems.contains(className));
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
/*
* (non-Javadoc)
*
* @see org.talend.designer.rowgenerator.data.AbstractTalendFunctionParser#getPackageFragment()
*/
@Override
protected String getPackageFragment() {
return null;
}
@Override
protected ITalendProcessJavaProject getTalendCodeProject() {
return null;
}
@Override
protected Function parseJavaCommentToFunctions(String string, String className, String fullName, String funcName,
boolean isSystem) {
Function func = super.parseJavaCommentToFunctions(string, className, fullName, funcName, isSystem);
// set routine jars dependency missing or not
infos.forEach(info -> {
if (func.getRoutineJarName().equals(info.getLabel().toLowerCase())) {
func.setRountineJarDependencyMissing(false);
}
});
return func;
}
protected void addEveryProjectElements(IPackageFragmentRoot root, List<IJavaElement> elements, String packageFragment)
throws JavaModelException {
if (root == null || elements == null) {
return;
}
// system
IPackageFragment Pkg = root.getPackageFragment(packageFragment);
if (Pkg != null && Pkg.exists()) {
elements.addAll(Arrays.asList(Pkg.getChildren()));
}
ProjectManager projectManager = ProjectManager.getInstance();
// referenced project.
projectManager.retrieveReferencedProjects();
for (Project p : projectManager.getReferencedProjects()) {
IPackageFragment userPkg = root.getPackageFragment(packageFragment + "." + p.getLabel().toLowerCase()); //$NON-NLS-1$
if (userPkg != null && userPkg.exists()) {
elements.addAll(Arrays.asList(userPkg.getChildren()));
}
}
}
private static String getGroupId() {
Project p = ProjectManager.getInstance().getCurrentProject();
ProjectPreferenceManager preferenceManager = new ProjectPreferenceManager(p, MAVEN_PLUGIN_ID, false);
return preferenceManager.getValue(MavenConstants.PROJECT_GROUPID);
}
}

View File

@@ -192,7 +192,7 @@ public interface IRunProcessService extends IService {
@Deprecated
public void buildJavaProject();
public void buildCodesJavaProject(IProgressMonitor monitor);
public void buildCodesJavaProject(IProgressMonitor monitor, Set<CodesJarInfo> toUpdate);
/**
* @deprecated use {@link IRunProcessService#getTalendJobJavaProject(Property)} instead
@@ -258,6 +258,8 @@ public interface IRunProcessService extends IService {
public boolean isExcludeDeletedItems(Property property);
public boolean getMavenPrefOptionStatus(String prefName);
public static IRunProcessService get() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
return GlobalServiceRegister.getDefault().getService(IRunProcessService.class);

View File

@@ -186,7 +186,7 @@ public final class ProjectManager {
Set<String> resolvedProjectLabels, boolean force) {
if (p != null) {
String parentBranch = ProjectManager.getInstance().getMainProjectBranch(p);
if (parentBranch != null || force) {
if ((!p.isLocal() || parentBranch != null) || force) {
resolvedProjectLabels.add(p.getTechnicalLabel());
for (ProjectReference pr : new Project(p).getProjectReferenceList()) {
if (ProjectManager.validReferenceProject(p, pr)

View File

@@ -43,6 +43,7 @@ import org.talend.core.model.repository.Folder;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.model.repository.IRepositoryWorkUnitListener;
import org.talend.core.model.repository.LockInfo;
import org.talend.core.model.routines.CodesJarInfo;
import org.talend.repository.RepositoryWorkUnit;
/**
@@ -317,11 +318,7 @@ public interface IProxyRepositoryFactory {
public abstract List<IRepositoryViewObject> getAllCodesJars(Project project, ERepositoryObjectType type)
throws PersistenceException;
public abstract List<IRepositoryViewObject> getAllInnerCodes(ERepositoryObjectType codesJarType, Property jarProperty)
throws PersistenceException;
public abstract List<IRepositoryViewObject> getAllInnerCodes(Project project, ERepositoryObjectType codesJarType,
Property jarProperty) throws PersistenceException;
public abstract List<IRepositoryViewObject> getAllInnerCodes(CodesJarInfo info) throws PersistenceException;
public abstract List<String> getFolders(ERepositoryObjectType type) throws PersistenceException;

View File

@@ -12,6 +12,7 @@
// ============================================================================
package org.talend.repository.model;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.IService;
/**
@@ -20,4 +21,11 @@ import org.talend.core.IService;
public interface IProxyRepositoryService extends IService {
public IProxyRepositoryFactory getProxyRepositoryFactory();
public static IProxyRepositoryService get() {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IProxyRepositoryService.class)) {
return GlobalServiceRegister.getDefault().getService(IProxyRepositoryService.class);
}
return null;
}
}

View File

@@ -103,6 +103,8 @@ public class RepositoryConstants {
public static final String REPOSITORY_CLOUD_APAC_ID = "cloud_apac"; //$NON-NLS-1$
public static final String REPOSITORY_CLOUD_US_WEST_ID = "cloud_us_west"; //$NON-NLS-1$
public static final String REPOSITORY_CLOUD_AUS_ID = "cloud_aus"; //$NON-NLS-1$
public static final String REPOSITORY_CLOUD_CUSTOM_ID = "cloud_custom"; //$NON-NLS-1$

View File

@@ -36,6 +36,16 @@
id="org.talend.core.ui.token.RepositroyActionsTokenCollector"
name="actions">
</provider>
<provider
collector="org.talend.core.ui.token.AdditionalPackagesTokenCollector"
description="installed addtional package, old iems, amc"
id="org.talend.core.ui.token.AdditionalPackageTokenCollector"
name="addtional package">
</provider>
<provider
collector="org.talend.core.ui.token.AMCUsageTokenCollector"
id="AMCUsageTokenCollector">
</provider>
</extension>
<extension

View File

@@ -27,6 +27,7 @@ import org.talend.core.ui.component.ComponentPaletteUtilities;
import org.talend.core.ui.component.ComponentsFactoryProvider;
import org.talend.core.ui.services.IDesignerCoreUIService;
import org.talend.core.ui.services.IRulesProviderService;
import org.talend.core.ui.token.TokenCollectorFactory;
/**
* DOC ggu class global comment. Detailled comment
@@ -107,4 +108,9 @@ public class CoreUIService implements ICoreUIService {
designerCoreUIService.loadComponentsFromProviders(type);
}
}
@Override
public void resetDataCollectorData() {
TokenCollectorFactory.getFactory().reset();
}
}

View File

@@ -24,6 +24,8 @@ import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.talend.commons.ui.runtime.swt.tableviewer.TableViewerCreatorColumnNotModifiable;
import org.talend.commons.ui.runtime.swt.tableviewer.behavior.DefaultTableLabelProvider;
import org.talend.commons.ui.swt.advanced.dataeditor.button.CasePushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.QuotePushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.ResetDBTypesPushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton;
import org.talend.commons.ui.swt.tableviewer.TableViewerCreator;
@@ -88,6 +90,14 @@ public class CustomTableManager {
if (resetDBTypesButton != null) {
resetDBTypesButton.getButton().setEnabled(false);
}
CasePushButton caseButton = tableEditorView.getExtendedToolbar().getCaseButton();
if (caseButton != null) {
caseButton.getButton().setEnabled(false);
}
QuotePushButton quoteButton = tableEditorView.getExtendedToolbar().getQuoteButton();
if (quoteButton != null) {
quoteButton.getButton().setEnabled(false);
}
} else {
tableEditorView.getToolBar().getAddButton().getButton().addSelectionListener(new SelectionListener() {
@@ -170,6 +180,14 @@ public class CustomTableManager {
if (resetDBTypesButton != null) {
resetDBTypesButton.getButton().setEnabled(false);
}
CasePushButton caseButton = tableEditorView.getExtendedToolbar().getCaseButton();
if (caseButton != null) {
caseButton.getButton().setEnabled(false);
}
QuotePushButton quoteButton = tableEditorView.getExtendedToolbar().getQuoteButton();
if (quoteButton != null) {
quoteButton.getButton().setEnabled(false);
}
}
if (linkedTable != null) {
if (linkedTable.isReadOnly() && linkedTableEditorView != null) {

View File

@@ -43,6 +43,7 @@ import org.talend.commons.ui.command.CommandStackForComposite;
import org.talend.commons.ui.runtime.image.EImage;
import org.talend.commons.ui.runtime.image.ImageProvider;
import org.talend.commons.ui.swt.advanced.composite.ThreeCompositesSashForm;
import org.talend.commons.ui.swt.advanced.dataeditor.ExtendedToolbarView;
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
import org.talend.commons.ui.swt.tableviewer.IModifiedBeanListener;
import org.talend.commons.ui.swt.tableviewer.ModifiedBeanEvent;
@@ -67,6 +68,7 @@ import org.talend.core.model.utils.NodeUtil;
import org.talend.core.ui.CoreUIPlugin;
import org.talend.core.ui.i18n.Messages;
import org.talend.core.ui.metadata.editor.AbstractMetadataTableEditorView;
import org.talend.core.ui.metadata.editor.MetadataQuoteToolbarEditorView;
import org.talend.core.ui.metadata.editor.MetadataTableEditor;
import org.talend.core.ui.metadata.editor.MetadataTableEditorView;
import org.talend.core.utils.TalendQuoteUtils;
@@ -376,8 +378,19 @@ public class MetadataDialog extends Dialog {
} else {
metadataTableEditor = new MetadataTableEditor(outputMetaTable, titleOutput);
}
outputMetaView = new DialogMetadataTableEditorView(composite, SWT.NONE, metadataTableEditor, outputReadOnly, true,
true, false);
//enable dbcolumn manipulate feature only on Database output component
String nodeFamily = "", rootFamily = "";
if ( outputNode != null && outputNode.getComponent() != null ) {
nodeFamily = outputNode.getComponent().getOriginalFamilyName();
rootFamily = nodeFamily != null ? nodeFamily.split("/")[0] : "";
}
if (rootFamily.equals("Databases")) {
outputMetaView = new DialogMetadataDBOutputTableEditorView(composite, SWT.NONE, metadataTableEditor, outputReadOnly, true,
true, false);
} else {
outputMetaView = new DialogMetadataTableEditorView(composite, SWT.NONE, metadataTableEditor, outputReadOnly, true,
true, false);
}
outputMetaView.setMetadataTalendTypeFilter(NodeUtil.createMetadataTalendTypeFilter(outputNode));
outputMetaView.setIsRepository(isRepository(outputNode, outputMetaTable));
initializeMetadataTableView(outputMetaView, outputNode, outputMetaTable);
@@ -544,8 +557,21 @@ public class MetadataDialog extends Dialog {
} else {
metadataTableEditorForOutput = new MetadataTableEditor(outputMetaTable, titleOutput + " (Output)");
}
outputMetaView = new DialogMetadataTableEditorView(compositesSachForm.getRightComposite(), SWT.NONE,
metadataTableEditorForOutput, outputReadOnly, true, true, false);
//Enable dbcolumn manipulate feature only on Database output component
String nodeFamily = "", rootFamily = "";
if ( outputNode != null && outputNode.getComponent() != null ) {
nodeFamily = outputNode.getComponent().getOriginalFamilyName();
rootFamily = nodeFamily != null ? nodeFamily.split("/")[0] : "";
}
if (rootFamily.equals("Databases")) {
outputMetaView = new DialogMetadataDBOutputTableEditorView(compositesSachForm.getRightComposite(), SWT.NONE,
metadataTableEditorForOutput, outputReadOnly, true, true, false);
} else {
outputMetaView = new DialogMetadataTableEditorView(compositesSachForm.getRightComposite(), SWT.NONE,
metadataTableEditorForOutput, outputReadOnly, true, true, false);
}
outputMetaView.setMetadataTalendTypeFilter(NodeUtil.createMetadataTalendTypeFilter(outputNode));
outputMetaView.setIsRepository(isRepository(outputNode, outputMetaTable));
initializeMetadataTableView(outputMetaView, outputNode, outputMetaTable);
@@ -799,7 +825,22 @@ public class MetadataDialog extends Dialog {
newTableViewerCreator.setLazyLoad(TableViewerCreator.getRecommandLazyLoad());
}
}
class DialogMetadataDBOutputTableEditorView extends MetadataTableEditorView {
public DialogMetadataDBOutputTableEditorView(Composite parentComposite, int mainCompositeStyle,
ExtendedTableModel<IMetadataColumn> extendedTableModel, boolean readOnly, boolean toolbarVisible,
boolean labelVisible, boolean initGraphicsComponents) {
super(parentComposite, mainCompositeStyle, extendedTableModel, readOnly, toolbarVisible, labelVisible,
initGraphicsComponents);
}
@Override
protected ExtendedToolbarView initToolBar() {
return new MetadataQuoteToolbarEditorView(getMainComposite(), SWT.NONE, this.getExtendedTableViewer(), this.getCurrentDbms());
}
}
public static void setSingleAndStruct(boolean isSingle) {
isSingleAndStruct = isSingle;
}

View File

@@ -0,0 +1,65 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.core.ui.metadata.editor;
import java.util.List;
import org.eclipse.gef.commands.Command;
import org.eclipse.swt.widgets.Composite;
import org.talend.commons.ui.swt.advanced.dataeditor.button.QuotePushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.QuotePushButtonForExtendedTable;
import org.talend.commons.ui.swt.advanced.dataeditor.button.CasePushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.CasePushButtonForExtendedTable;
import org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer;
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
import org.talend.core.ui.metadata.extended.command.MetadataCaseCommand;
import org.talend.core.ui.metadata.extended.command.MetadataQuoteCommand;
public class MetadataQuoteToolbarEditorView extends MetadataToolbarEditorView {
public MetadataQuoteToolbarEditorView(Composite parent, int style, AbstractExtendedTableViewer extendedTableViewer) {
super(parent, style, extendedTableViewer);
}
public MetadataQuoteToolbarEditorView(Composite parent, int style, AbstractExtendedTableViewer extendedTableViewer, String dbmsId) {
super(parent, style, extendedTableViewer, dbmsId);
this.getQuoteButton().setDbmsId(dbmsId);
}
@Override
public CasePushButton createCasePushButton() {
return new CasePushButtonForExtendedTable(toolbar, extendedTableViewer) {
@Override
protected Command getCommandToExecute(ExtendedTableModel extendedTable, List beansToConvertCase, int[] selectionIndices, boolean isUpperCase) {
return new MetadataCaseCommand(extendedTable, beansToConvertCase, selectionIndices, isUpperCase);
}
};
}
@Override
protected QuotePushButton createQuotePushButton() {
return new QuotePushButtonForExtendedTable(toolbar, extendedTableViewer) {
@Override
protected Command getCommandToExecute(ExtendedTableModel extendedTable, List beansToQuote, int[] selectionIndices, String quote, boolean isAddingQuote) {
return new MetadataQuoteCommand(extendedTable, beansToQuote, selectionIndices, quote, isAddingQuote);
}
};
}
}

View File

@@ -0,0 +1,72 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.core.ui.metadata.extended.command;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Event;
import org.talend.commons.ui.swt.advanced.dataeditor.commands.ExtendedTableCaseCommand;
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
import org.talend.core.model.metadata.IMetadataColumn;
import org.talend.core.model.metadata.builder.ConvertionHelper;
import org.talend.core.model.metadata.builder.connection.MetadataColumn;
import org.talend.core.model.metadata.builder.connection.impl.ConnectionFactoryImpl;
import org.talend.core.ui.metadata.editor.MetadataTableEditor;
public class MetadataCaseCommand extends ExtendedTableCaseCommand {
/**
* DOC MetadataCaseCommand constructor comment.
*
* @param extendedTableModel
* @param beansToUppercase
* @param selectionIndices
* @param isUpperCase
*/
public MetadataCaseCommand(ExtendedTableModel extendedTable, List beansToUppercase, int[] selectionIndices, boolean isUpperCase) {
super(extendedTable, beansToUppercase, selectionIndices, isUpperCase);
}
@Override
public void convertCase(ExtendedTableModel extendedTable, List copiedObjectsList, int[] selectionIndices, boolean isUpperCase) {
int index = 0;
for (Object current : copiedObjectsList) {
//get refreshed element
current = extendedTable.getTableViewer().getElementAt(selectionIndices[index]);
if (current instanceof IMetadataColumn) {
IMetadataColumn copy = ((IMetadataColumn) current).clone();
copy.setUsefulColumn(true);
if (copy.getOriginalDbColumnName() != null && !StringUtils.isEmpty(copy.getOriginalDbColumnName())) {
copy.setOriginalDbColumnName(isUpperCase ? copy.getOriginalDbColumnName().toUpperCase() : copy.getOriginalDbColumnName().toLowerCase());
}
extendedTable.replace(copy, selectionIndices[index]);
}
// Add a new statement to fix the MetadataColumn type.
else if (current instanceof MetadataColumn) {
MetadataTableEditor tableEditor = (MetadataTableEditor) extendedTable;
MetadataColumn metadataColumn = (MetadataColumn) current;
MetadataColumn newColumnCopy = new ConnectionFactoryImpl().copy(metadataColumn,
isUpperCase ? StringUtils.upperCase(metadataColumn.getName()) : StringUtils.lowerCase(metadataColumn.getName()));
IMetadataColumn copy = (ConvertionHelper.convertToIMetaDataColumn(newColumnCopy)).clone();
extendedTable.replace(copy, selectionIndices[index]);
}
index++;
}
extendedTable.getTableViewer().getTable().select(selectionIndices);
extendedTable.getTableViewer().getTable().notifyListeners(SWT.Selection, new Event());
}
}

View File

@@ -0,0 +1,88 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.core.ui.metadata.extended.command;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Event;
import org.talend.commons.ui.swt.advanced.dataeditor.commands.ExtendedTableQuoteCommand;
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
import org.talend.core.model.metadata.IMetadataColumn;
import org.talend.core.model.metadata.builder.ConvertionHelper;
import org.talend.core.model.metadata.builder.connection.MetadataColumn;
import org.talend.core.model.metadata.builder.connection.impl.ConnectionFactoryImpl;
import org.talend.core.ui.metadata.editor.MetadataTableEditor;
public class MetadataQuoteCommand extends ExtendedTableQuoteCommand {
/**
* DOC MetadataQuoteCommand constructor comment.
*
* @param extendedTableModel
* @param beansToQuote
* @param selectionIndices
*/
public MetadataQuoteCommand(ExtendedTableModel extendedTable, List beansToQuote, int[] selectionIndices, String quote, boolean isAddingQuote) {
super(extendedTable, beansToQuote, selectionIndices, quote, isAddingQuote);
}
@Override
public void toQuote(ExtendedTableModel extendedTable, List copiedObjectsList, int[] selectionIndices, String quote, boolean isAddingQuote) {
int index = 0;
for (Object current : copiedObjectsList) {
//get refreshed element
current = extendedTable.getTableViewer().getElementAt(selectionIndices[index]);
if (current instanceof IMetadataColumn) {
IMetadataColumn copy = ((IMetadataColumn) current).clone();
copy.setUsefulColumn(true);
String oldDbColumnName = copy.getOriginalDbColumnName();
if (oldDbColumnName != null) {
String newDbColumnName = oldDbColumnName;
if (isAddingQuote) {
newDbColumnName = quote + newDbColumnName + quote;
} else {
newDbColumnName = StringUtils.removeStart(oldDbColumnName, quote);
newDbColumnName = StringUtils.removeEnd(newDbColumnName, quote);
}
copy.setOriginalDbColumnName(newDbColumnName);
extendedTable.replace(copy, selectionIndices[index]);
}
}
// Add a new statement to fix the MetadataColumn type.
else if (current instanceof MetadataColumn) {
MetadataTableEditor tableEditor = (MetadataTableEditor) extendedTable;
MetadataColumn metadataColumn = (MetadataColumn) current;
String oldName = metadataColumn.getName();
if (oldName != null) {
String newName = oldName;
if (isAddingQuote) {
newName = quote + oldName + quote;
} else {
newName = StringUtils.removeStart(oldName, quote);
newName = StringUtils.removeEnd(newName, quote);
}
MetadataColumn newColumnCopy = new ConnectionFactoryImpl().copy(metadataColumn, newName);
IMetadataColumn copy = (ConvertionHelper.convertToIMetaDataColumn(newColumnCopy)).clone();
extendedTable.replace(copy, selectionIndices[index]);
}
}
index++;
}
extendedTable.getTableViewer().getTable().select(selectionIndices);
extendedTable.getTableViewer().getTable().notifyListeners(SWT.Selection, new Event());
}
}

View File

@@ -12,17 +12,17 @@
// ============================================================================
package org.talend.core.ui.preference;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.talend.core.model.repository.IRepositoryPrefConstants;
import org.talend.core.ui.CoreUIPlugin;
public class SpecificSettingPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
public SpecificSettingPreferencePage() {
setPreferenceStore(CoreUIPlugin.getDefault().getPreferenceStore());
setDescription("Specific settings");
noDefaultAndApplyButton();
}
/*
@@ -32,8 +32,6 @@ public class SpecificSettingPreferencePage extends FieldEditorPreferencePage imp
*/
@Override
protected void createFieldEditors() {
addField(new BooleanFieldEditor(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS,
"Allow specific characters (UTF8,...) for columns of schemas", getFieldEditorParent()));
}

View File

@@ -14,7 +14,6 @@ package org.talend.core.ui.preference.metadata;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
import org.talend.core.model.repository.IRepositoryPrefConstants;
import org.talend.core.prefs.ITalendCorePrefConstants;
import org.talend.core.ui.CoreUIPlugin;
@@ -27,8 +26,6 @@ public class MetadataPreferenceInitializer extends AbstractPreferenceInitializer
public void initializeDefaultPreferences() {
IPreferenceStore store = CoreUIPlugin.getDefault().getPreferenceStore();
store.setDefault(ITalendCorePrefConstants.MAXIMUM_AMOUNT_OF_COLUMNS_FOR_XML, 500);
store.setDefault(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
}
}

View File

@@ -0,0 +1,58 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.core.ui.token;
import java.util.Properties;
import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.talend.commons.runtime.service.ICollectDataService;
import us.monoid.json.JSONObject;
public class AMCUsageTokenCollector extends AbstractTokenCollector {
@Override
public JSONObject collect() throws Exception {
Properties props = new Properties();
ICollectDataService instance = ICollectDataService.getInstance("amc");
if (instance != null) {
props = instance.getCollectedData();
} else {
IScopeContext[] contexts = new IScopeContext[] { InstanceScope.INSTANCE, ConfigurationScope.INSTANCE,
DefaultScope.INSTANCE };
String plugin = "org.talend.amc";
for (IScopeContext context : contexts) {
IEclipsePreferences amc = context.getNode(plugin);
if (amc != null) {
if (amc.getBoolean(ICollectDataService.AMC_FILE_TYPE_USED, false)) {
props.setProperty(ICollectDataService.AMC_PREVIEW_KEY, ICollectDataService.AMC_PREVIEW_FILEVALUE);
} else if (amc.getBoolean(ICollectDataService.AMC_DATABASE_TYPE_USED, false)) {
props.setProperty(ICollectDataService.AMC_PREVIEW_KEY, ICollectDataService.AMC_PREVIEW_DATABASEVALUE);
}
break;
}
}
}
JSONObject finalToken = new JSONObject();
finalToken.put(ICollectDataService.AMC_PREVIEW_KEY, "<Empty>");
for (Object key : props.keySet()) {
finalToken.put((String) key, props.get(key));
}
return finalToken;
}
}

View File

@@ -0,0 +1,40 @@
// ============================================================================
//
// Copyright (C) 2006-2021 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.core.ui.token;
import org.talend.commons.utils.time.PropertiesCollectorUtil;
import us.monoid.json.JSONObject;
public class AdditionalPackagesTokenCollector extends AbstractTokenCollector {
public AdditionalPackagesTokenCollector() {
// TODO Auto-generated constructor stub
}
@Override
public JSONObject collect() throws Exception {
String records = PropertiesCollectorUtil.getAdditionalPackageRecording();
JSONObject allRecords;
try {
allRecords = new JSONObject(records);
} catch (Exception e) {
// the value is not set, or is empty
allRecords = new JSONObject();
allRecords.put(PropertiesCollectorUtil.getAdditionalPackagePreferenceNode(), new JSONObject());
}
return allRecords;
}
}

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