Compare commits

...

49 Commits

Author SHA1 Message Date
zyuan-talend
3293b8f359 feat(TUP-26268): fix the NPE. (#4379) 2021-06-16 18:04:51 +08:00
hcyi
7527dda149 fix(TUP-31238):Library sync with JFrog/Nexus on studio startup doesn'… (#4376)
…t use proxy.
2021-06-11 17:38:28 +08:00
Zhiwei Xue
ddf653b4ea fix(TUP-31759):fix codes install issues on CI (#4372) 2021-06-11 15:26:46 +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
154 changed files with 2697 additions and 11420 deletions

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

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

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

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

@@ -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.2.jar", "nimbus-jose-jwt-8.11.jar", "javax.mail-1.6.2.jar", "log4j-1.2.17.jar",
"accessors-smart-1.1.jar", "asm-5.0.3.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$

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

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

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

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

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

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

@@ -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,7 +197,19 @@ 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);
}
/**
* Save the configurations.
*/

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

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

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

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

@@ -42,6 +42,10 @@
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

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

@@ -25,8 +25,10 @@ import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
@@ -78,8 +80,6 @@ import org.talend.core.language.LanguageManager;
import org.talend.core.model.components.ComponentCategory;
import org.talend.core.model.components.EComponentType;
import org.talend.core.model.components.IComponent;
import org.talend.core.model.components.IComponentsFactory;
import org.talend.core.model.components.IComponentsService;
import org.talend.core.model.context.ContextUtils;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.general.Project;
@@ -98,10 +98,8 @@ import org.talend.core.model.process.JobInfo;
import org.talend.core.model.process.ProcessUtils;
import org.talend.core.model.process.ReplaceNodesInProcessProvider;
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.properties.Property;
import org.talend.core.model.relationship.Relation;
import org.talend.core.model.relationship.RelationshipItemBuilder;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryObject;
@@ -114,6 +112,7 @@ import org.talend.core.model.routines.RoutinesUtil;
import org.talend.core.model.utils.JavaResourcesHelper;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.core.runtime.maven.MavenConstants;
import org.talend.core.runtime.process.ITalendProcessJavaProject;
import org.talend.core.runtime.process.LastGenerationInfo;
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
@@ -192,7 +191,7 @@ public class ProcessorUtilities {
private static final Set<ModuleNeeded> retrievedJarsForCurrentBuild = new HashSet<ModuleNeeded>();
private static final Set<String> esbJobs = new HashSet<String>();
private static final Map<String, Integer> esbJobs = new HashMap<String, Integer>();
private static boolean isDebug = false;
@@ -439,6 +438,81 @@ public class ProcessorUtilities {
return false;
}
public static boolean checkProcessLoopDependencies(IProcess mainProcess, String id, String version,
LinkedList<String> pathlink, Map<String, String> idToLatestVersion) {
if (ItemCacheManager.LATEST_VERSION.contains(version)) {
if (idToLatestVersion.get(id) == null) {
ProcessItem processItem = ItemCacheManager.getProcessItem(id);
version = processItem.getProperty().getVersion();
idToLatestVersion.put(id, version);
} else {
version = idToLatestVersion.get(id);
}
}
String pathNode = id + "-" + version;
if (pathlink.contains(pathNode)) {
return true;
}
pathlink.add(pathNode);
boolean hasLoop = false;
List<? extends INode> processNodes = mainProcess.getProcessNodes();
for (INode node : processNodes) {
if (!node.isActivate()) {
continue;
}
IElementParameter processIdParam = node.getElementParameter("PROCESS_TYPE_PROCESS");
if (processIdParam != null && StringUtils.isNotBlank((String) processIdParam.getValue())) {
String jobIds = (String) processIdParam.getValue();
String subNodeversion = (String) node.getElementParameter("PROCESS_TYPE_VERSION").getValue();
for (String jobId : jobIds.split(ProcessorUtilities.COMMA)) {
if (StringUtils.isBlank(jobId)) {
continue;
}
ProcessItem processItem = ItemCacheManager.getProcessItem(jobId, subNodeversion);
if (processItem != null) {
IDesignerCoreService service = CorePlugin.getDefault().getDesignerCoreService();
IProcess subProcess = service.getProcessFromProcessItem(processItem);
if (subProcess != null) {
hasLoop = checkProcessLoopDependencies(subProcess, jobId, subNodeversion, pathlink,
idToLatestVersion);
}
}
if (hasLoop) {
break;
}
}
} else {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IJobletProviderService.class)) {
IJobletProviderService jobletService = GlobalServiceRegister.getDefault()
.getService(IJobletProviderService.class);
if (jobletService != null) {
IProcess jobletProcess = jobletService.getJobletGEFProcessFromNode(node);
if (jobletProcess != null) {
String jobletId = jobletProcess.getId();
IElementParameter projectTecNameParam = jobletProcess.getElementParameter("PROJECT_TECHNICAL_NAME");
if (projectTecNameParam != null && StringUtils.isNotBlank((String) projectTecNameParam.getValue())) {
jobletId = projectTecNameParam.getValue() + ":" + jobletId;
}
hasLoop = checkProcessLoopDependencies(jobletProcess, jobletId, jobletProcess.getVersion(), pathlink,
idToLatestVersion);
}
}
}
}
if (hasLoop) {
break;
}
}
if (!hasLoop) {
pathlink.removeLast();
}
return hasLoop;
}
private static IProcessor generateCode(IProcessor processor2, JobInfo jobInfo, String selectedContextName,
boolean statistics, boolean trace, boolean needContext, int option, IProgressMonitor progressMonitor)
throws ProcessorException {
@@ -538,11 +612,12 @@ public class ProcessorUtilities {
jobInfo.setProcessor(processor);
if (isMainJob && selectedProcessItem != null) {
Relation mainRelation = new Relation();
mainRelation.setId(jobInfo.getJobId());
mainRelation.setVersion(jobInfo.getJobVersion());
mainRelation.setType(RelationshipItemBuilder.JOB_RELATION);
hasLoopDependency = checkLoopDependencies(mainRelation, new HashMap<String, String>());
if (!IRunProcessService.get().getMavenPrefOptionStatus(MavenConstants.SKIP_LOOP_DEPENDENCY_CHECK)) {
Property property = selectedProcessItem.getProperty();
String jobId = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel() + ":" + property.getId();
hasLoopDependency = checkProcessLoopDependencies(currentProcess, jobId, property.getVersion(),
new LinkedList<String>(), new HashMap<String, String>());
}
// clean the previous code in case it has deleted subjob
cleanSourceFolder(progressMonitor, currentProcess, processor);
}
@@ -645,233 +720,6 @@ public class ProcessorUtilities {
return processor;
}
public static boolean checkLoopDependencies(Relation mainJobInfo, Map<String, String> idToLastestVersionMap)
throws ProcessorException {
List<Relation> itemsJobRelatedTo = getItemsRelation(mainJobInfo, idToLastestVersionMap);
List<Relation> relationChecked = new ArrayList<>();
relationChecked.add(mainJobInfo);
return checkLoopDependencies(mainJobInfo, mainJobInfo, itemsJobRelatedTo, relationChecked, idToLastestVersionMap);
}
private static boolean checkLoopDependencies(Relation mainRelation, Relation currentRelation,
List<Relation> itemsJobRelatedTo,
List<Relation> relationChecked, Map<String, String> idToLastestVersionMap) throws ProcessorException {
boolean hasDependency = false;
for (Relation relation : itemsJobRelatedTo) {
try {
// means the tRunjob deactivate, or one of the specific version tRunjon deactivate, skip
Map<String, Set<String>> actTrunjobHM = getActivateTRunjobMap(currentRelation.getId(),
currentRelation.getVersion());
if (actTrunjobHM.get(relation.getId()) == null
|| !actTrunjobHM.get(relation.getId()).contains(relation.getVersion())) {
continue;
}
} catch (Exception e) {
throw new ProcessorException(e);
}
hasDependency = relation.getId().equals(mainRelation.getId())
&& relation.getVersion().equals(mainRelation.getVersion());
if (!hasDependency) {
List<Relation> itemsChildJob = getItemsRelation(relation, idToLastestVersionMap);
if (!relationChecked.contains(relation)) {
relationChecked.add(relation);
hasDependency = checkLoopDependencies(mainRelation, relation, itemsChildJob, relationChecked,
idToLastestVersionMap);
}
if (!hasDependency) {
for (Relation childRelation : itemsChildJob) {
try {
// means the tRunjob deactivate, or one of the specific version tRunjon deactivate, skip
Map<String, Set<String>> activateTRunjobMap = getActivateTRunjobMap(relation.getId(),
relation.getVersion());
if (activateTRunjobMap.get(childRelation.getId()) == null
|| !activateTRunjobMap.get(childRelation.getId()).contains(childRelation.getVersion())) {
continue;
}
} catch (Exception e) {
throw new ProcessorException(e);
}
hasDependency = checkLoopDependencies(childRelation, idToLastestVersionMap);
if (hasDependency) {
break;
}
}
}
}
if (hasDependency) {
break;
}
}
return hasDependency;
}
private static Map<String, Set<String>> getActivateTRunjobMap(String id, String version) throws PersistenceException {
Map<String, Set<String>> actTrunjobHM = new HashMap<String, Set<String>>();
ProcessType processType = null;
try {
IRepositoryViewObject currentJobObject = ProxyRepositoryFactory.getInstance().getSpecificVersion(id, version, true);
if (currentJobObject != null) {
Item item = currentJobObject.getProperty().getItem();
if (item instanceof ProcessItem) {
processType = ((ProcessItem) item).getProcess();
} else if (item instanceof JobletProcessItem) {
processType = ((JobletProcessItem) item).getJobletProcess();
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
if (processType != null) {
List<Project> allProjects = new ArrayList<Project>();
allProjects.add(ProjectManager.getInstance().getCurrentProject());
allProjects.addAll(ProjectManager.getInstance().getAllReferencedProjects());
List<String> jobletsComponentsList = new ArrayList<String>();
IComponentsFactory componentsFactory = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsService.class)) {
IComponentsService compService = GlobalServiceRegister.getDefault()
.getService(IComponentsService.class);
if (compService != null) {
componentsFactory = compService.getComponentsFactory();
for (IComponent component : componentsFactory.readComponents()) {
if (component.getComponentType() == EComponentType.JOBLET) {
jobletsComponentsList.add(component.getName());
}
}
}
}
String jobletPaletteType = null;
String frameWork = processType.getFramework();
if (StringUtils.isBlank(frameWork)) {
jobletPaletteType = ComponentCategory.CATEGORY_4_DI.getName();
} else if (frameWork.equals(HadoopConstants.FRAMEWORK_SPARK)) {
jobletPaletteType = ComponentCategory.CATEGORY_4_SPARK.getName();
} else if (frameWork.equals(HadoopConstants.FRAMEWORK_SPARK_STREAMING)) {
jobletPaletteType = ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName();
}
for (Object nodeObject : processType.getNode()) {
NodeType node = (NodeType) nodeObject;
// not tRunjob && not joblet then continue
if (!node.getComponentName().equals("tRunJob") && !jobletsComponentsList.contains(node.getComponentName())) { // $NON-NLS-1$
continue;
}
boolean nodeActivate = true;
String processIds = null;
String processVersion = null;
for (Object elementParam : node.getElementParameter()) {
ElementParameterType elemParamType = (ElementParameterType) elementParam;
if ("PROCESS:PROCESS_TYPE_PROCESS".equals(elemParamType.getName())) { // $NON-NLS-1$
processIds = elemParamType.getValue();
if (StringUtils.isNotBlank(processIds)) {
for (String jobId : processIds.split(ProcessorUtilities.COMMA)) {
if (actTrunjobHM.get(jobId) == null) {
actTrunjobHM.put(jobId, new HashSet<String>());
}
}
}
} else if ("PROCESS:PROCESS_TYPE_VERSION".equals(elemParamType.getName()) // $NON-NLS-1$
|| "PROCESS_TYPE_VERSION".equals(elemParamType.getName())) { // $NON-NLS-1$
processVersion = elemParamType.getValue();
} else if ("ACTIVATE".equals(elemParamType.getName())) { // $NON-NLS-1$
nodeActivate = Boolean.parseBoolean(elemParamType.getValue());
}
}
if (nodeActivate) {
if (StringUtils.isNotBlank(processIds)) {
for (String jobId : processIds.split(ProcessorUtilities.COMMA)) {
String actualVersion = processVersion;
if (RelationshipItemBuilder.LATEST_VERSION.equals(processVersion)) {
for (Project project : allProjects) {
IRepositoryViewObject lastVersion = null;
lastVersion = ProxyRepositoryFactory.getInstance().getLastVersion(project, jobId);
if (lastVersion != null) {
actualVersion = lastVersion.getVersion();
break;
}
}
}
if (actTrunjobHM.get(jobId) != null) {
actTrunjobHM.get(jobId).add(actualVersion);
}
}
} else if (componentsFactory != null && jobletPaletteType != null) {
// for joblet
IComponent cc = componentsFactory.get(node.getComponentName(), jobletPaletteType);
if (GlobalServiceRegister.getDefault().isServiceRegistered(IJobletProviderService.class)) {
IJobletProviderService jobletService = GlobalServiceRegister.getDefault()
.getService(IJobletProviderService.class);
Property property = jobletService.getJobletComponentItem(cc);
if (property != null && StringUtils.isNotBlank(property.getId())) {
String jobletId = property.getId();
if (actTrunjobHM.get(jobletId) == null) {
actTrunjobHM.put(jobletId, new HashSet<String>());
}
String actualVersion = processVersion;
if (RelationshipItemBuilder.LATEST_VERSION.equals(processVersion)) {
for (Project project : allProjects) {
IRepositoryViewObject lastVersion = null;
lastVersion = ProxyRepositoryFactory.getInstance().getLastVersion(project, jobletId);
if (lastVersion != null) {
actualVersion = lastVersion.getVersion();
break;
}
}
}
actTrunjobHM.get(jobletId).add(actualVersion);
}
}
}
}
}
}
return actTrunjobHM;
}
private static List<Relation> getItemsRelation(Relation mainJobInfo, Map<String, String> idToLastestVersionMap) throws ProcessorException {
List<Relation> itemsJobRelatedTo = new ArrayList<Relation>();
try {
List<Project> allProjects = new ArrayList<Project>();
allProjects.add(ProjectManager.getInstance().getCurrentProject());
allProjects.addAll(ProjectManager.getInstance().getAllReferencedProjects());
RelationshipItemBuilder instance = RelationshipItemBuilder.getInstance();
if (instance != null) {
itemsJobRelatedTo.addAll(instance.getItemsChildRelatedTo(mainJobInfo.getId(), mainJobInfo.getVersion(),
mainJobInfo.getType(), RelationshipItemBuilder.JOB_RELATION));
itemsJobRelatedTo.addAll(instance.getItemsChildRelatedTo(mainJobInfo.getId(), mainJobInfo.getVersion(),
mainJobInfo.getType(), RelationshipItemBuilder.JOBLET_RELATION));
for (Relation relation : itemsJobRelatedTo) {
if (relation.getVersion().equals(RelationshipItemBuilder.LATEST_VERSION)) {
if (idToLastestVersionMap.containsKey(relation.getId())) {
relation.setVersion(idToLastestVersionMap.get(relation.getId()));
} else {
for (Project project : allProjects) {
IRepositoryViewObject lastVersion =
ProxyRepositoryFactory.getInstance().getLastVersion(project, relation.getId());
if (lastVersion != null) {
relation.setVersion(lastVersion.getVersion());
idToLastestVersionMap.put(relation.getId(), relation.getVersion());
break;
}
}
}
}
}
}
} catch (PersistenceException e) {
throw new ProcessorException(e);
}
return itemsJobRelatedTo;
}
private static void setNeededResources(final Map<String, Object> argumentsMap, JobInfo jobInfo) {
argumentsMap.put(TalendProcessArgumentConstant.ARG_NEED_XMLMAPPINGS,
@@ -1265,11 +1113,11 @@ public class ProcessorUtilities {
}
if (isMainJob && selectedProcessItem != null) {
Relation mainRelation = new Relation();
mainRelation.setId(jobInfo.getJobId());
mainRelation.setVersion(jobInfo.getJobVersion());
mainRelation.setType(RelationshipItemBuilder.JOB_RELATION);
hasLoopDependency = checkLoopDependencies(mainRelation, new HashMap<String, String>());
if (!IRunProcessService.get().getMavenPrefOptionStatus(MavenConstants.SKIP_LOOP_DEPENDENCY_CHECK)) {
Property property = selectedProcessItem.getProperty();
hasLoopDependency = checkProcessLoopDependencies(currentProcess, property.getId(), property.getVersion(),
new LinkedList<String>(), new HashMap<String, String>());
}
// clean the previous code in case it has deleted subjob
cleanSourceFolder(progressMonitor, currentProcess, processor);
}
@@ -1800,13 +1648,16 @@ public class ProcessorUtilities {
}
}
}
if (isEsbComponentName(componentName)) {
addEsbJob(jobInfo);
}
}
}
}
private static void recordESBIncludingFlag(JobInfo jobInfo, int esbIncludingOption) {
int includeESBFlag = jobInfo.getIncludeESBFlag();
includeESBFlag |= esbIncludingOption;
jobInfo.setIncludeESBFlag(includeESBFlag);
}
static void setGenerationInfoWithChildrenJob(INode node, JobInfo jobInfo, final JobInfo subJobInfo) {
final LastGenerationInfo generationInfo = LastGenerationInfo.getInstance();
@@ -1915,6 +1766,13 @@ public class ProcessorUtilities {
static boolean hasLoopDependency = false;
private static void resetBuildFlagsAndCaches() {
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
}
/**
* This function will generate the code of the process and all of this sub process.
*
@@ -1929,15 +1787,10 @@ public class ProcessorUtilities {
if (monitors == null) {
monitor = new NullProgressMonitor();
}
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
JobInfo jobInfo = new JobInfo(processName, contextName, version);
IProcessor process = generateCode(jobInfo, contextName, statistics, trace, true, GENERATE_ALL_CHILDS, monitor);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return process;
}
@@ -1957,14 +1810,9 @@ public class ProcessorUtilities {
}
JobInfo jobInfo = new JobInfo(processId, contextName, version);
jobInfo.setApplyContextToChildren(applyContextToChildren);
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor process = generateCode(jobInfo, contextName, statistics, trace, true, GENERATE_ALL_CHILDS, monitor);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return process;
}
@@ -1979,14 +1827,9 @@ public class ProcessorUtilities {
}
JobInfo jobInfo = new JobInfo(process, contextName);
jobInfo.setApplyContextToChildren(applyContextToChildren);
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor result = generateCode(jobInfo, contextName, statistics, trace, true, GENERATE_ALL_CHILDS, monitor);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return result;
}
@@ -2001,15 +1844,10 @@ public class ProcessorUtilities {
}
JobInfo jobInfo = new JobInfo(process, contextName, version);
jobInfo.setApplyContextToChildren(applyContextToChildren);
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor result =
generateCode(jobInfo, contextName, statistics, trace, needContext, GENERATE_ALL_CHILDS, monitor);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return result;
}
@@ -2033,14 +1871,9 @@ public class ProcessorUtilities {
ProcessUtils.isOptionChecked(argumentsMap, TalendProcessArgumentConstant.ARG_NEED_CONTEXT);
int option = ProcessUtils.getOptionValue(argumentsMap, TalendProcessArgumentConstant.ARG_GENERATE_OPTION, 0);
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor result = generateCode(jobInfo, contextName, statistics, trace, needContext, option, monitor);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return result;
}
@@ -2058,28 +1891,18 @@ public class ProcessorUtilities {
JobInfo jobInfo = new JobInfo(process, contextName, version);
jobInfo.setContext(context);
jobInfo.setApplyContextToChildren(applyContextToChildren);
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
result = generateCode(jobInfo, contextName, statistics, trace, true, GENERATE_ALL_CHILDS, monitor);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
}
return result;
}
public static IProcessor generateCode(ProcessItem process, String contextName, boolean statistics, boolean trace)
throws ProcessorException {
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor returnValue = generateCode(process, contextName, statistics, trace, false);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return returnValue;
}
@@ -2107,29 +1930,19 @@ public class ProcessorUtilities {
jobInfo = new JobInfo(process, context);
}
jobInfo.setApplyContextToChildren(applyToChildren);
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor genCode = generateCode(jobInfo, context.getName(), statistics, trace, contextProperties,
GENERATE_ALL_CHILDS, new NullProgressMonitor());
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return genCode;
}
public static IProcessor generateCode(IProcess process, IContext context, boolean statistics, boolean trace,
boolean properties) throws ProcessorException {
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor returnValue =
generateCode(process, context, statistics, trace, properties, new NullProgressMonitor());
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return returnValue;
}
@@ -2157,15 +1970,10 @@ public class ProcessorUtilities {
} else {
jobInfo = new JobInfo(process, context);
}
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor genCode = generateCode(jobInfo, context.getName(), statistics, trace, properties,
GENERATE_ALL_CHILDS, progressMonitor);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return genCode;
}
@@ -2208,15 +2016,10 @@ public class ProcessorUtilities {
+ (jobInfo.getJobName() != null ? jobInfo.getJobName() : jobInfo.getJobId());
TimeMeasure.begin(timeMeasureGenerateCodesId);
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor genCode = generateCode(processor, jobInfo, context.getName(), statistics, trace, properties,
GENERATE_ALL_CHILDS, progressMonitor);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
TimeMeasure.end(timeMeasureGenerateCodesId);
// if active before, not disable and active still.
@@ -2239,15 +2042,10 @@ public class ProcessorUtilities {
}
// achen modify to fix 0006107
JobInfo jobInfo = new JobInfo(process, context);
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor genCode = generateCode(jobInfo, context.getName(), statistics, trace, properties, option,
new NullProgressMonitor());
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return genCode;
}
@@ -2262,14 +2060,9 @@ public class ProcessorUtilities {
}
JobInfo jobInfo = new JobInfo(process, contextName);
jobInfo.setApplyContextToChildren(applyContextToChildren);
jobList.clear();
esbJobs.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
IProcessor result = generateCode(jobInfo, contextName, statistics, trace, true, option, monitor);
jobList.clear();
hasLoopDependency = false;
mainJobInfo = null;
resetBuildFlagsAndCaches();
return result;
}
@@ -2611,6 +2404,8 @@ public class ProcessorUtilities {
} else if (frameWork.equals(HadoopConstants.FRAMEWORK_SPARK_STREAMING)) {
jobletPaletteType = ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName();
}
boolean hasChildrenIncludeESB = false;
for (NodeType node : nodes) {
boolean activate = true;
// check if node is active at least.
@@ -2625,8 +2420,8 @@ public class ProcessorUtilities {
continue;
}
if (isEsbComponentName(node.getComponentName())) {
addEsbJob(parentJobInfo);
if (!firstChildOnly && isEsbComponentName(node.getComponentName())) {
recordESBIncludingFlag(parentJobInfo, TalendProcessOptionConstants.ISESB_CURRENT_INCLUDE);
}
boolean isCTalendJob = "cTalendJob".equalsIgnoreCase(node.getComponentName());
@@ -2655,6 +2450,18 @@ public class ProcessorUtilities {
jobInfo.setFatherJobInfo(parentJobInfo);
if (!firstChildOnly) {
getAllJobInfo(processItem.getProcess(), jobInfo, jobInfos, firstChildOnly, includeJoblet);
if (jobInfo.getIncludeESBFlag() >= 2) {
hasChildrenIncludeESB = true;
}
}
} else {
Optional<JobInfo> infoOptional = jobInfos.stream().filter(info -> info.equals(jobInfo))
.findFirst();
if (infoOptional.isPresent()) {
JobInfo matchJobInfo = infoOptional.get();
if (matchJobInfo.getIncludeESBFlag() >= 2) {
hasChildrenIncludeESB = true;
}
}
}
}
@@ -2706,6 +2513,16 @@ public class ProcessorUtilities {
}
}
}
// checked done set the esb including option
if (!firstChildOnly) {
recordESBIncludingFlag(parentJobInfo, TalendProcessOptionConstants.ISESB_CHECKED);
if (hasChildrenIncludeESB) {
recordESBIncludingFlag(parentJobInfo, TalendProcessOptionConstants.ISESB_CHILDREN_INCLUDE);
}
esbJobs.put(esbJobKey(parentJobInfo.getJobId(), parentJobInfo.getJobVersion()), parentJobInfo.getIncludeESBFlag());
}
return jobInfos;
}
@@ -2922,9 +2739,21 @@ public class ProcessorUtilities {
}
public static boolean isEsbJob(IProcess process, boolean checkCurrentProcess) {
// get includeESBFlag from cache
if (process instanceof IProcess2) {
Property property = ((IProcess2) process).getProperty();
String esbJobKey = esbJobKey(property.getId(), property.getVersion());
if (esbJobs.get(esbJobKey) != null) {
Integer esbOptions = esbJobs.get(esbJobKey);
if (BitwiseOptionUtils.containOption(esbOptions, TalendProcessOptionConstants.ISESB_CHECKED)) {
return checkCurrentProcess
? BitwiseOptionUtils.containOption(esbOptions, TalendProcessOptionConstants.ISESB_CURRENT_INCLUDE)
: esbOptions > 2;
}
}
}
if (process instanceof IProcess2) {
if (checkCurrentProcess) {
for (INode n : process.getGraphicalNodes()) {
if (isEsbComponentName(n.getComponent().getName())) {
@@ -2950,17 +2779,6 @@ public class ProcessorUtilities {
return false;
}
private static void addEsbJob(JobInfo jobInfo) {
if (esbJobs.contains(esbJobKey(jobInfo.getJobId(), jobInfo.getJobVersion()))) {
return;
}
esbJobs.add(esbJobKey(jobInfo.getJobId(), jobInfo.getJobVersion()));
if (jobInfo.getFatherJobInfo() != null) {
addEsbJob(jobInfo.getFatherJobInfo());
}
}
private static String esbJobKey(String processId, String version) {
return processId + "_" + version;
}

View File

@@ -26,7 +26,6 @@
<classpathentry exported="true" kind="lib" path="lib/maven-model-builder-3.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/maven-repository-metadata-3.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/plexus-interpolation-1.19.jar"/>
<classpathentry exported="true" kind="lib" path="lib/plexus-utils-3.0.17.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>

View File

@@ -16,7 +16,6 @@ Bundle-ClassPath: .,
lib/maven-model-builder-3.2.1.jar,
lib/maven-repository-metadata-3.2.1.jar,
lib/plexus-interpolation-1.19.jar,
lib/plexus-utils-3.0.17.jar,
lib/commons-codec.jar,
lib/httpclient.jar,
lib/httpcore.jar,

View File

@@ -40,6 +40,12 @@
<version>${project.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.talend.studio</groupId>
<artifactId>studio-log4j-dependencies-tos</artifactId>
<version>${project.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.talend.studio</groupId>
<artifactId>studio-maven-repository-build</artifactId>

View File

@@ -21,6 +21,16 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
<version>3.3.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
</dependency>
</dependencies>
<build>
<plugins>

View File

@@ -50,6 +50,22 @@
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
</dependency>
</dependencies>
<build>

View File

@@ -13,7 +13,7 @@
<!-- Dependency versions -->
<features-maven-plugin.version>2.2.9</features-maven-plugin.version>
<maven-install-plugin.version>2.5.1</maven-install-plugin.version>
<plexus-utils.version>2.1</plexus-utils.version>
<plexus-utils.version>3.0.24</plexus-utils.version>
</properties>
<dependencies>

View File

@@ -29,7 +29,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>1.1</version>
<version>3.0.24</version>
</dependency>
</dependencies>
<build>

View File

@@ -45,6 +45,12 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<exclusions>
<exclusion>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
@@ -66,6 +72,10 @@
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>

View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>studio-maven-repository-tos</artifactId>
<version>7.3.1-PATCH</version>
<relativePath>../</relativePath>
</parent>
<artifactId>studio-log4j-dependencies-tos</artifactId>
<packaging>pom</packaging>
<dependencies>
<!--add log4j dependency https://jira.talendforge.org/browse/TUP-31403 -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.12.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.12.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.12.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>2.12.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeScope>runtime</includeScope>
<outputDirectory>${basedir}/../tmp/repository</outputDirectory>
<useRepositoryLayout>true</useRepositoryLayout>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -16,6 +16,7 @@
<module>tacokit/pom.xml</module>
<module>tcompv1/pom.xml</module>
<module>surefire/pom.xml</module>
<module>log4j/pom.xml</module>
<module>zip/pom.xml</module>
</modules>
<properties>

View File

@@ -10,7 +10,7 @@
<artifactId>studio-tacokit-dependencies</artifactId>
<packaging>pom</packaging>
<properties>
<tacokit.components.version>1.20.0</tacokit.components.version>
<tacokit.components.version>1.22.0</tacokit.components.version>
</properties>
<repositories>
<repository>

View File

@@ -11,8 +11,8 @@
<packaging>pom</packaging>
<properties>
<tcomp.version>1.32.0</tcomp.version>
<slf4j.version>1.7.25</slf4j.version>
<tcomp.version>1.33.1</tcomp.version>
<slf4j.version>1.7.28</slf4j.version>
</properties>
<repositories>

View File

@@ -33,7 +33,7 @@
<artifactItem>
<groupId>org.talend.studio</groupId>
<artifactId>studio-maven-repository</artifactId>
<version>7.2.1.v20190226</version>
<version>7.3.1.v20210520</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${project.basedir}/../repository</outputDirectory>

View File

@@ -15,4 +15,5 @@ MavenProjectSettingPage.filterExampleMessage=Filter examples:\nlabel=myJob
MavenProjectSettingPage.refModuleText=Set reference project modules in profile
MavenProjectSettingPage.excludeDeletedItems=Exclude deleted items
MavenProjectSettingPage.syncAllPomsWarning=Click the Force full re-synchronize poms button to apply the new settings.
MavenProjectSettingPage.skipFolders=Skip folders
MavenProjectSettingPage.skipFolders=Skip folders
BuildProjectSettingPage.allowRecursiveJobs=Allow recursive jobs (Not recommended)

View File

@@ -12,15 +12,50 @@
// ============================================================================
package org.talend.designer.maven.ui.setting.project.page;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.talend.core.runtime.maven.MavenConstants;
import org.talend.core.runtime.projectsetting.EmptyProjectSettingPage;
import org.talend.designer.maven.DesignerMavenPlugin;
import org.talend.designer.maven.ui.i18n.Messages;
/**
* DOC ggu class global comment. Detailled comment
*/
public class BuildProjectSettingPage extends EmptyProjectSettingPage {
private IPreferenceStore preferenceStore;
private Button allowRecursiveJobsCheckbox;
public BuildProjectSettingPage() {
super();
}
@Override
protected String getPreferenceName() {
return DesignerMavenPlugin.PLUGIN_ID;
}
@Override
protected void createFieldEditors() {
Composite parent = getFieldEditorParent();
parent.setLayout(new GridLayout());
preferenceStore = getPreferenceStore();
allowRecursiveJobsCheckbox = new Button(parent, SWT.CHECK);
allowRecursiveJobsCheckbox.setText(Messages.getString("BuildProjectSettingPage.allowRecursiveJobs")); //$NON-NLS-1$
allowRecursiveJobsCheckbox.setSelection(!preferenceStore.getBoolean(MavenConstants.SKIP_LOOP_DEPENDENCY_CHECK));
}
@Override
public boolean performOk() {
boolean performOk = super.performOk();
if (preferenceStore != null) {
preferenceStore.setValue(MavenConstants.SKIP_LOOP_DEPENDENCY_CHECK, !allowRecursiveJobsCheckbox.getSelection());
}
return performOk;
}
}

View File

@@ -891,16 +891,31 @@ public class AggregatorPomsHelper {
} else {
model.getModules().addAll(collectRefProjectModules(null));
}
boolean isCIMode = false;
if (IRunProcessService.get() != null) {
isCIMode = IRunProcessService.get().isCIMode();
}
createRootPom(model, true, monitor);
installRootPom(true);
monitor.worked(1);
if (monitor.isCanceled()) {
return;
}
// codes pom
monitor.subTask("Synchronize code poms"); //$NON-NLS-1$
updateCodeProjects(monitor, true, true);
if (isCIMode) {
System.setProperty("ignore.ci.mode", Boolean.TRUE.toString());
updateCodeProjects(monitor, true, true);
System.setProperty("ignore.ci.mode", Boolean.FALSE.toString());
} else {
updateCodeProjects(monitor, true, true);
}
CodesJarM2CacheManager.updateCodesJarProject(monitor, true, true, true);
monitor.worked(1);
if (monitor.isCanceled()) {
return;
@@ -956,6 +971,15 @@ public class AggregatorPomsHelper {
if (monitor.isCanceled()) {
return;
}
if (isCIMode) {
for (ERepositoryObjectType codeType : ERepositoryObjectType.getAllTypesOfCodes()) {
ITalendProcessJavaProject codeProject = getCodesProject(codeType);
if (codeProject != null) {
updateCodeProjectPom(monitor, codeType, codeProject.getProjectPom());
}
}
}
monitor.done();
}

View File

@@ -30,6 +30,7 @@ import org.talend.core.model.properties.Property;
import org.talend.core.runtime.projectsetting.IProjectSettingTemplateConstants;
import org.talend.designer.maven.template.MavenTemplateManager;
import org.talend.designer.maven.utils.PomUtil;
import org.talend.designer.runprocess.IRunProcessService;
/**
* DOC ggu class global comment. Detailled comment
@@ -101,7 +102,11 @@ public abstract class AbstractMavenCodesTemplatePom extends AbstractMavenGeneral
existedDependencies = new ArrayList<Dependency>();
model.setDependencies(existedDependencies);
}
boolean isCIMode = false;
if (IRunProcessService.get() != null) {
isCIMode = IRunProcessService.get().isCIMode();
}
boolean ignoreCIMode = Boolean.getBoolean("ignore.ci.mode");
for (ModuleNeeded module : needModules) {
Dependency dependency = null;
// TDI-37032 add dependency only if jar available in maven
@@ -116,7 +121,10 @@ public abstract class AbstractMavenCodesTemplatePom extends AbstractMavenGeneral
} else {
isDeployed = true;
}
if (ignoreModuleInstallationStatus() || isDeployed) {
if (!isDeployed && ignoreCIMode) {
continue;
}
if (isCIMode || ignoreModuleInstallationStatus() || isDeployed) {
dependency = PomUtil.createModuleDependency(module.getMavenUri());
if (module.isExcluded())
dependency.setScope("provided");

View File

@@ -659,7 +659,7 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
// current job
Property currentJobProperty = processor.getProperty();
jobCoordinate.add(getJobCoordinate(currentJobProperty));
// children jobs without test cases
Set<JobInfo> childrenJobInfo = processor.getBuildChildrenJobs().stream().filter(j -> !j.isTestContainer())
.collect(Collectors.toSet());
@@ -669,16 +669,15 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
// talend libraries and codes
List<Dependency> dependencies = new ArrayList<>();
// codes
List<Dependency> codeDependencies = new ArrayList<>();
// codes
addCodesDependencies(codeDependencies);
// codesjar
codeDependencies.addAll(getCodesJarDependenciesFromChildren());
dependencies.addAll(codeDependencies);
// codes dependencies (optional)
ERepositoryObjectType.getAllTypesOfCodes().forEach(t -> dependencies.addAll(PomUtil.getCodesDependencies(t)));
dependencies.addAll(codeDependencies);
// libraries of talend/3rd party
Set<Dependency> parentJobDependencies = processor
.getNeededModules(

View File

@@ -315,6 +315,12 @@ public class PomIdsHelper {
return manager.getBoolean(MavenConstants.EXCLUDE_DELETED_ITEMS);
}
public static boolean getMavenPrefOptionStatus(String prefName) {
String projectTechName = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel();
ProjectPreferenceManager manager = getPreferenceManager(projectTechName);
return manager.getBoolean(prefName);
}
private static String getGroupId(String projectTechName, String baseName, Property property) {
if (projectTechName == null) {
projectTechName = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel();
@@ -393,6 +399,7 @@ public class PomIdsHelper {
if (PluginChecker.isTIS()) {
preferenceStore.setValue(MavenConstants.EXCLUDE_DELETED_ITEMS, true);
}
preferenceStore.setValue(MavenConstants.SKIP_LOOP_DEPENDENCY_CHECK, true);
}
preferenceManager.save();
preferenceManagers.put(projectTechName, preferenceManager);

View File

@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="lib/axis2-adb-codegen-1.6.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/XmlSchema-1.4.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/axis2-metadata-1.6.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/axis2-java2wsdl-1.6.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/axis2-codegen-1.6.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/woden-api-1.0M9.jar"/>
<classpathentry exported="true" kind="lib" path="lib/axiom-api-1.2.13.jar"/>
<classpathentry exported="true" kind="lib" path="lib/axiom-impl-1.2.13.jar"/>
@@ -11,7 +16,6 @@
<classpathentry exported="true" kind="lib" path="lib/httpcore-4.0.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/neethi-3.0.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/wstx-asl-3.2.9.jar"/>
<classpathentry exported="true" kind="lib" path="lib/xmlschema-core-2.0.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="class"/>

View File

@@ -14,6 +14,7 @@ Bundle-ClassPath: lib/activation-1.1.jar,
lib/axiom-api-1.2.13.jar,
lib/axiom-impl-1.2.13.jar,
lib/axis2-adb-1.6.2.jar,
lib/axis2-adb-codegen-1.6.2.jar,
lib/axis2-kernel-1.6.2.jar,
lib/axis2-transport-http-1.6.2.jar,
lib/axis2-transport-local-1.6.2.jar,
@@ -22,8 +23,11 @@ Bundle-ClassPath: lib/activation-1.1.jar,
lib/mail-1.4.jar,
lib/neethi-3.0.1.jar,
lib/wstx-asl-3.2.9.jar,
lib/xmlschema-core-2.0.1.jar,
lib/woden-api-1.0M9.jar,
lib/axis2-codegen-1.6.2.jar,
lib/axis2-java2wsdl-1.6.2.jar,
lib/axis2-metadata-1.6.2.jar,
lib/XmlSchema-1.4.7.jar,
.
Export-Package: com.ctc.wstx.api,
com.ctc.wstx.cfg,
@@ -129,6 +133,7 @@ Export-Package: com.ctc.wstx.api,
org.apache.axis2.i18n,
org.apache.axis2.java.security,
org.apache.axis2.jaxrs,
org.apache.axis2.jaxws.description,
org.apache.axis2.jsr181,
org.apache.axis2.modules,
org.apache.axis2.namespace,
@@ -167,9 +172,10 @@ Export-Package: com.ctc.wstx.api,
org.apache.ws.commons.schema,
org.apache.ws.commons.schema.constants,
org.apache.ws.commons.schema.extensions,
org.apache.ws.commons.schema.internal,
org.apache.ws.commons.schema.resolver,
org.apache.ws.commons.schema.utils,
org.apache.ws.java2wsdl,
org.apache.ws.java2wsdl.utils,
org.codehaus.stax2,
org.codehaus.stax2.evt,
org.codehaus.stax2.io,

View File

@@ -1,12 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.libraries.apache.axis2</artifactId>
<packaging>eclipse-plugin</packaging>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1-PATCH</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.libraries.apache.axis2</artifactId>
<packaging>eclipse-plugin</packaging>
<properties>
<axis2.version>1.6.2</axis2.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-codegen</artifactId>
<version>${axis2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-metadata</artifactId>
<version>${axis2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-java2wsdl</artifactId>
<version>${axis2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb-codegen</artifactId>
<version>${axis2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.schema</groupId>
<artifactId>XmlSchema</artifactId>
<version>1.4.7</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<configuration>
<dependency-resolution>
<optionalDependencies>ignore</optionalDependencies>
</dependency-resolution>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<excludeTypes>pom</excludeTypes>
<excludeTransitive>true</excludeTransitive>
<outputDirectory>${project.basedir}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -2,28 +2,28 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="lib" path="lib/jakarta.activation-1.2.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-wsdl-3.3.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-wsdl-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jakarta.activation-api-1.2.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/woodstox-core-6.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jakarta.annotation-api-1.3.5.jar"/>
<classpathentry exported="true" kind="lib" path="lib/stax2-api-4.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/neethi-3.1.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jakarta.ws.rs-api-2.1.6.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-core-3.3.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-bindings-xml-3.3.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-jaxrs-3.3.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-rs-client-3.3.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-transports-http-3.3.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-bindings-soap-3.3.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-databinding-jaxb-3.3.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-features-clustering-3.3.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-jaxws-3.3.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-simple-3.3.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-security-3.3.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-security-saml-3.3.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-addr-3.3.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-policy-3.3.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-security-3.3.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-core-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-bindings-xml-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-jaxrs-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-rs-client-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-transports-http-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-bindings-soap-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-databinding-jaxb-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-features-clustering-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-jaxws-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-frontend-simple-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-security-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-security-saml-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-addr-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-policy-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cxf-rt-ws-security-3.3.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/javax.ws.rs-api-2.0-m10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jakarta.xml.bind-api-2.3.3.jar"/>
<classpathentry exported="true" kind="lib" path="lib/xmlschema-core-2.2.5.jar"/>

View File

@@ -8,22 +8,22 @@ Bundle-ClassPath: .,
lib/neethi-3.1.1.jar,
lib/stax2-api-4.2.1.jar,
lib/javax.activation-1.2.0.jar,
lib/cxf-core-3.3.7.jar,
lib/cxf-rt-bindings-xml-3.3.7.jar,
lib/cxf-rt-frontend-jaxrs-3.3.7.jar,
lib/cxf-rt-rs-client-3.3.7.jar,
lib/cxf-rt-transports-http-3.3.7.jar,
lib/cxf-rt-wsdl-3.3.7.jar,
lib/cxf-rt-bindings-soap-3.3.7.jar,
lib/cxf-rt-databinding-jaxb-3.3.7.jar,
lib/cxf-rt-features-clustering-3.3.7.jar,
lib/cxf-rt-frontend-jaxws-3.3.7.jar,
lib/cxf-rt-frontend-simple-3.3.7.jar,
lib/cxf-rt-security-3.3.7.jar,
lib/cxf-rt-security-saml-3.3.7.jar,
lib/cxf-rt-ws-addr-3.3.7.jar,
lib/cxf-rt-ws-policy-3.3.7.jar,
lib/cxf-rt-ws-security-3.3.7.jar,
lib/cxf-core-3.3.10.jar,
lib/cxf-rt-bindings-xml-3.3.10.jar,
lib/cxf-rt-frontend-jaxrs-3.3.10.jar,
lib/cxf-rt-rs-client-3.3.10.jar,
lib/cxf-rt-transports-http-3.3.10.jar,
lib/cxf-rt-wsdl-3.3.10.jar,
lib/cxf-rt-bindings-soap-3.3.10.jar,
lib/cxf-rt-databinding-jaxb-3.3.10.jar,
lib/cxf-rt-features-clustering-3.3.10.jar,
lib/cxf-rt-frontend-jaxws-3.3.10.jar,
lib/cxf-rt-frontend-simple-3.3.10.jar,
lib/cxf-rt-security-3.3.10.jar,
lib/cxf-rt-security-saml-3.3.10.jar,
lib/cxf-rt-ws-addr-3.3.10.jar,
lib/cxf-rt-ws-policy-3.3.10.jar,
lib/cxf-rt-ws-security-3.3.10.jar,
lib/jakarta.ws.rs-api-2.1.6.jar,
lib/jakarta.annotation-api-1.3.5.jar,
lib/woodstox-core-6.2.1.jar,

View File

@@ -21,82 +21,82 @@
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-core</artifactId>
<version>3.3.7</version>
<version>3.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-bindings-xml</artifactId>
<version>3.3.7</version>
<version>3.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>3.3.7</version>
<version>3.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
<version>3.3.7</version>
<version>3.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>3.3.7</version>
<version>3.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-wsdl</artifactId>
<version>3.3.7</version>
<version>3.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-bindings-soap</artifactId>
<version>3.3.7</version>
<version>3.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-databinding-jaxb</artifactId>
<version>3.3.7</version>
<version>3.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-features-clustering</artifactId>
<version>3.3.7</version>
<version>3.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.3.7</version>
<version>3.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-simple</artifactId>
<version>3.3.7</version>
<version>3.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-security</artifactId>
<version>3.3.7</version>
<version>3.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-security-saml</artifactId>
<version>3.3.7</version>
<version>3.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-addr</artifactId>
<version>3.3.7</version>
<version>3.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-policy</artifactId>
<version>3.3.7</version>
<version>3.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>3.3.7</version>
<version>3.3.10</version>
</dependency>
<dependency>
<groupId>com.sun.activation</groupId>

View File

@@ -11,7 +11,7 @@
<classpathentry exported="true" kind="lib" path="lib/lucene-memory-4.10.4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/lucene-misc-4.10.4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/lucene-queries-4.10.4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/lucene-queryparser-4.10.4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/lucene-queryparser-5.5.5.jar"/>
<classpathentry exported="true" kind="lib" path="lib/lucene-sandbox-4.10.4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/lucene-spatial-4.10.4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/lucene-suggest-4.10.4.jar"/>

View File

@@ -92,32 +92,32 @@ Export-Package: org.apache.lucene;version="4.10.4",
org.apache.lucene.queries.function.docvalues;version="4.10.4",
org.apache.lucene.queries.function.valuesource;version="4.10.4",
org.apache.lucene.queries.mlt;version="4.10.4",
org.apache.lucene.queryparser.analyzing;version="4.10.4",
org.apache.lucene.queryparser.classic;version="4.10.4",
org.apache.lucene.queryparser.complexPhrase;version="4.10.4",
org.apache.lucene.queryparser.ext;version="4.10.4",
org.apache.lucene.queryparser.flexible.core;version="4.10.4",
org.apache.lucene.queryparser.flexible.core.builders;version="4.10.4",
org.apache.lucene.queryparser.flexible.core.config;version="4.10.4",
org.apache.lucene.queryparser.flexible.core.messages;version="4.10.4",
org.apache.lucene.queryparser.flexible.core.nodes;version="4.10.4",
org.apache.lucene.queryparser.flexible.core.parser;version="4.10.4",
org.apache.lucene.queryparser.flexible.core.processors;version="4.10.4",
org.apache.lucene.queryparser.flexible.core.util;version="4.10.4",
org.apache.lucene.queryparser.flexible.messages;version="4.10.4",
org.apache.lucene.queryparser.flexible.precedence;version="4.10.4",
org.apache.lucene.queryparser.flexible.precedence.processors;version="4.10.4",
org.apache.lucene.queryparser.flexible.standard;version="4.10.4",
org.apache.lucene.queryparser.flexible.standard.builders;version="4.10.4",
org.apache.lucene.queryparser.flexible.standard.config;version="4.10.4",
org.apache.lucene.queryparser.flexible.standard.nodes;version="4.10.4",
org.apache.lucene.queryparser.flexible.standard.parser;version="4.10.4",
org.apache.lucene.queryparser.flexible.standard.processors;version="4.10.4",
org.apache.lucene.queryparser.simple;version="4.10.4",
org.apache.lucene.queryparser.surround.parser;version="4.10.4",
org.apache.lucene.queryparser.surround.query;version="4.10.4",
org.apache.lucene.queryparser.xml;version="4.10.4",
org.apache.lucene.queryparser.xml.builders;version="4.10.4",
org.apache.lucene.queryparser.analyzing;version="5.5.5",
org.apache.lucene.queryparser.classic;version="5.5.5",
org.apache.lucene.queryparser.complexPhrase;version="5.5.5",
org.apache.lucene.queryparser.ext;version="5.5.5",
org.apache.lucene.queryparser.flexible.core;version="5.5.5",
org.apache.lucene.queryparser.flexible.core.builders;version="5.5.5",
org.apache.lucene.queryparser.flexible.core.config;version="5.5.5",
org.apache.lucene.queryparser.flexible.core.messages;version="5.5.5",
org.apache.lucene.queryparser.flexible.core.nodes;version="5.5.5",
org.apache.lucene.queryparser.flexible.core.parser;version="5.5.5",
org.apache.lucene.queryparser.flexible.core.processors;version="5.5.5",
org.apache.lucene.queryparser.flexible.core.util;version="5.5.5",
org.apache.lucene.queryparser.flexible.messages;version="5.5.5",
org.apache.lucene.queryparser.flexible.precedence;version="5.5.5",
org.apache.lucene.queryparser.flexible.precedence.processors;version="5.5.5",
org.apache.lucene.queryparser.flexible.standard;version="5.5.5",
org.apache.lucene.queryparser.flexible.standard.builders;version="5.5.5",
org.apache.lucene.queryparser.flexible.standard.config;version="5.5.5",
org.apache.lucene.queryparser.flexible.standard.nodes;version="5.5.5",
org.apache.lucene.queryparser.flexible.standard.parser;version="5.5.5",
org.apache.lucene.queryparser.flexible.standard.processors;version="5.5.5",
org.apache.lucene.queryparser.simple;version="5.5.5",
org.apache.lucene.queryparser.surround.parser;version="5.5.5",
org.apache.lucene.queryparser.surround.query;version="5.5.5",
org.apache.lucene.queryparser.xml;version="5.5.5",
org.apache.lucene.queryparser.xml.builders;version="5.5.5",
org.apache.lucene.sandbox.queries;version="4.10.4",
org.apache.lucene.sandbox.queries.regex;version="4.10.4",
org.apache.lucene.search;version="4.10.4",
@@ -163,7 +163,7 @@ Bundle-ClassPath: .,
lib/lucene-memory-4.10.4.jar,
lib/lucene-misc-4.10.4.jar,
lib/lucene-queries-4.10.4.jar,
lib/lucene-queryparser-4.10.4.jar,
lib/lucene-queryparser-5.5.5.jar,
lib/lucene-sandbox-4.10.4.jar,
lib/lucene-spatial-4.10.4.jar,
lib/lucene-suggest-4.10.4.jar

View File

@@ -9,7 +9,7 @@ bin.includes = META-INF/,\
lib/lucene-memory-4.10.4.jar,\
lib/lucene-misc-4.10.4.jar,\
lib/lucene-queries-4.10.4.jar,\
lib/lucene-queryparser-4.10.4.jar,\
lib/lucene-queryparser-5.5.5.jar,\
lib/lucene-sandbox-4.10.4.jar,\
lib/lucene-spatial-4.10.4.jar,\
lib/lucene-suggest-4.10.4.jar

View File

@@ -9,4 +9,31 @@
</parent>
<artifactId>org.talend.libraries.apache.lucene4</artifactId>
<packaging>eclipse-plugin</packaging>
<dependencies>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queryparser</artifactId>
<version>5.5.5</version>
</dependency>
</dependencies>
<build>
<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-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -69,6 +69,7 @@ import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.general.ModuleNeeded.ELibraryInstallStatus;
import org.talend.core.model.general.Project;
import org.talend.core.model.process.IProcess;
import org.talend.core.model.process.ProcessUtils;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.JobletProcessItem;
import org.talend.core.model.properties.ProcessItem;
@@ -540,9 +541,9 @@ public class ModulesNeededProvider {
Property property = findRoutinesPropery(infor.getId(), infor.getName(), routines, type);
if (property != null) {
if (((RoutineItem) property.getItem()).isBuiltIn()) {
systemRoutines.add(infor.getId());
systemRoutines.add(property.getId());
} else {
userRoutines.add(infor.getId());
userRoutines.add(property.getId());
}
}
}

View File

@@ -15,6 +15,8 @@ package org.talend.librariesmanager.nexus;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
@@ -22,14 +24,17 @@ import java.util.List;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.Header;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.fluent.Request;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicHeader;
import org.apache.http.params.CoreConnectionPNames;
import org.apache.http.util.EntityUtils;
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.IProgressMonitor;
import org.talend.commons.CommonsPlugin;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.utils.network.IProxySelectorProvider;
@@ -53,6 +58,8 @@ import net.sf.json.JSONObject;
*/
public class ArtifacoryRepositoryHandler extends AbstractArtifactRepositoryHandler {
private static Logger LOGGER = Logger.getLogger(ArtifacoryRepositoryHandler.class);
private String SEARCH_SERVICE = "api/search/gavc?"; //$NON-NLS-1$
private static final String SEARCH_NAME = "api/search/artifact?";
@@ -194,18 +201,9 @@ public class ArtifacoryRepositoryHandler extends AbstractArtifactRepositoryHandl
}
query = query + "v=" + versionToSearch;//$NON-NLS-1$
}
searchUrl = searchUrl + query;
Request request = Request.Get(searchUrl);
String userPass = serverBean.getUserName() + ":" + serverBean.getPassword(); //$NON-NLS-1$
String basicAuth = "Basic " + new String(new Base64().encode(userPass.getBytes())); //$NON-NLS-1$
Header authority = new BasicHeader("Authorization", basicAuth); //$NON-NLS-1$
request.addHeader(authority);
Header resultDetailHeader = new BasicHeader("X-Result-Detail", "info"); //$NON-NLS-1$ //$NON-NLS-2$
request.addHeader(resultDetailHeader);
List<MavenArtifact> resultList = new ArrayList<MavenArtifact>();
HttpResponse response = request.execute().returnResponse();
String content = EntityUtils.toString(response.getEntity());
searchUrl = searchUrl + query;
String content = doRequest(searchUrl);//
if (content.isEmpty()) {
return resultList;
}
@@ -302,19 +300,9 @@ public class ArtifacoryRepositoryHandler extends AbstractArtifactRepositoryHandl
}
q += "repos=" + repositoryId;//$NON-NLS-1$
}
searchUrl = searchUrl + q;
Request request = Request.Get(searchUrl);
String userPass = serverBean.getUserName() + ":" + serverBean.getPassword(); //$NON-NLS-1$
String basicAuth = "Basic " + new String(new Base64().encode(userPass.getBytes())); //$NON-NLS-1$
Header authority = new BasicHeader("Authorization", basicAuth); //$NON-NLS-1$
request.addHeader(authority);
Header resultDetailHeader = new BasicHeader("X-Result-Detail", "info"); //$NON-NLS-1$ //$NON-NLS-2$
request.addHeader(resultDetailHeader);
List<MavenArtifact> resultList = new ArrayList<MavenArtifact>();
HttpResponse response = request.execute().returnResponse();
String content = EntityUtils.toString(response.getEntity());
searchUrl = searchUrl + q;
String content = doRequest(searchUrl);//
if (content.isEmpty()) {
return resultList;
}
@@ -493,4 +481,34 @@ public class ArtifacoryRepositoryHandler extends AbstractArtifactRepositoryHandl
return doSearch(query, SEARCH_NAME, true, fromSnapshot);
}
public String doRequest(final String url) throws URISyntaxException, Exception {
final StringBuffer sb = new StringBuffer();
new HttpClientTransport(url, serverBean.getUserName(), serverBean.getPassword()) {
@Override
protected HttpResponse execute(IProgressMonitor monitor, DefaultHttpClient httpClient, URI targetURI)
throws Exception {
HttpGet httpGet = new HttpGet(targetURI);
String userName = serverBean.getUserName();
if (StringUtils.isNotBlank(userName) && !Boolean.getBoolean("talend.studio.search.nexus3.disableBasicAuth")) {
String auth = userName + ":" + serverBean.getPassword();
String authHeader = "Basic " + new String(Base64.encodeBase64(auth.getBytes(StandardCharsets.UTF_8)));
httpGet.setHeader(HttpHeaders.AUTHORIZATION, authHeader);
Header resultDetailHeader = new BasicHeader("X-Result-Detail", "info"); //$NON-NLS-1$ //$NON-NLS-2$
httpGet.addHeader(resultDetailHeader);
httpClient.setCredentialsProvider(null);
}
HttpResponse response = httpClient.execute(httpGet);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
sb.append(EntityUtils.toString(response.getEntity()));
} else {
LOGGER.info("Try to search " + url + " failed!");
throw new Exception(response.toString());
}
return response;
}
}.doRequest(null, new URI(url));
return sb.toString();
}
}

View File

@@ -150,28 +150,32 @@ public class ShareLibrariesUtil {
*/
public static void seachArtifacts(IProgressMonitor monitor, IRepositoryArtifactHandler artifactHandler,
Map<String, List<MavenArtifact>> snapshotArtifactMap, Map<String, List<MavenArtifact>> releaseArtifactMap,
Set<String> snapshotGroupIdSet, Set<String> releaseGroupIdSet) throws Exception {
Set<String> snapshotGroupIdSet, Set<String> releaseGroupIdSet) {
if (artifactHandler != null) {
checkCancel(monitor);
List<MavenArtifact> searchResults = new ArrayList<MavenArtifact>();
for (String groupId : releaseGroupIdSet) {
searchResults = artifactHandler.search(groupId, null, null, true, false);
if (searchResults != null) {
for (MavenArtifact result : searchResults) {
checkCancel(monitor);
ShareLibrariesUtil.putArtifactToMap(result, releaseArtifactMap, false);
try {
checkCancel(monitor);
List<MavenArtifact> searchResults = new ArrayList<MavenArtifact>();
for (String groupId : releaseGroupIdSet) {
searchResults = artifactHandler.search(groupId, null, null, true, false);
if (searchResults != null) {
for (MavenArtifact result : searchResults) {
checkCancel(monitor);
ShareLibrariesUtil.putArtifactToMap(result, releaseArtifactMap, false);
}
}
}
}
checkCancel(monitor);
for (String groupId : snapshotGroupIdSet) {
searchResults = artifactHandler.search(groupId, null, null, false, true);
if (searchResults != null) {
for (MavenArtifact result : searchResults) {
checkCancel(monitor);
ShareLibrariesUtil.putArtifactToMap(result, snapshotArtifactMap, true);
checkCancel(monitor);
for (String groupId : snapshotGroupIdSet) {
searchResults = artifactHandler.search(groupId, null, null, false, true);
if (searchResults != null) {
for (MavenArtifact result : searchResults) {
checkCancel(monitor);
ShareLibrariesUtil.putArtifactToMap(result, snapshotArtifactMap, true);
}
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
}

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;
@@ -89,6 +91,14 @@ public class CustomTableManagerOnlyForGenericSchema {
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.getExtendedToolbar().getAddButton().getButton().addSelectionListener(new SelectionListener() {
@@ -169,6 +179,14 @@ public class CustomTableManagerOnlyForGenericSchema {
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()) {

View File

@@ -139,6 +139,7 @@ public final class OtherConnectionContextUtils {
DbSchema,
DbUsername,
DbPassword,
DbParameters,
}
/*
@@ -611,6 +612,10 @@ public final class OtherConnectionContextUtils {
conn.getValue(TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_PASSWORD, conn), false),
JavaTypesManager.PASSWORD);
break;
case DbParameters:
ConnectionContextHelper.createParameters(varList, paramName,
TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_ADDITIONAL_PROPERTIES, conn));
break;
default:
}
}
@@ -722,6 +727,10 @@ public final class OtherConnectionContextUtils {
TaggedValueHelper.setTaggedValue(sapConn, ISAPConstant.PROP_DB_PASSWORD,
ContextParameterUtils.getNewScriptCode(sapBasicVarName, LANGUAGE));
break;
case DbParameters:
TaggedValueHelper.setTaggedValue(sapConn, ISAPConstant.PROP_DB_ADDITIONAL_PROPERTIES,
ContextParameterUtils.getNewScriptCode(sapBasicVarName, LANGUAGE));
break;
default:
}
}
@@ -768,11 +777,14 @@ public final class OtherConnectionContextUtils {
TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_USERNAME, conn)));
String dbPassword = TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType,
conn.getValue(TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_PASSWORD, conn), false)));
String dbParameters = TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType,
TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_ADDITIONAL_PROPERTIES, conn)));
TaggedValueHelper.setTaggedValue(conn, ISAPConstant.PROP_DB_HOST, dbHost);
TaggedValueHelper.setTaggedValue(conn, ISAPConstant.PROP_DB_PORT, dbPort);
TaggedValueHelper.setTaggedValue(conn, ISAPConstant.PROP_DB_SCHEMA, dbSchema);
TaggedValueHelper.setTaggedValue(conn, ISAPConstant.PROP_DB_USERNAME, dbUsername);
TaggedValueHelper.setTaggedValue(conn, ISAPConstant.PROP_DB_PASSWORD, conn.getValue(dbPassword, true));
TaggedValueHelper.setTaggedValue(conn, ISAPConstant.PROP_DB_ADDITIONAL_PROPERTIES, dbParameters);
}
public static SAPConnection cloneOriginalValueSAPConnection(SAPConnection fileConn, ContextType contextType) {
@@ -813,11 +825,14 @@ public final class OtherConnectionContextUtils {
TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_USERNAME, fileConn));
String dbPassword = ConnectionContextHelper.getOriginalValue(contextType,
fileConn.getValue(TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_PASSWORD, fileConn), false));
String dbParameters = ConnectionContextHelper.getOriginalValue(contextType,
TaggedValueHelper.getValueString(ISAPConstant.PROP_DB_ADDITIONAL_PROPERTIES, fileConn));
TaggedValueHelper.setTaggedValue(cloneConn, ISAPConstant.PROP_DB_HOST, dbHost);
TaggedValueHelper.setTaggedValue(cloneConn, ISAPConstant.PROP_DB_PORT, dbPort);
TaggedValueHelper.setTaggedValue(cloneConn, ISAPConstant.PROP_DB_SCHEMA, dbSchema);
TaggedValueHelper.setTaggedValue(cloneConn, ISAPConstant.PROP_DB_USERNAME, dbUsername);
TaggedValueHelper.setTaggedValue(cloneConn, ISAPConstant.PROP_DB_PASSWORD, dbPassword);
TaggedValueHelper.setTaggedValue(cloneConn, ISAPConstant.PROP_DB_ADDITIONAL_PROPERTIES, dbParameters);
ConnectionContextHelper.cloneConnectionProperties(fileConn, cloneConn);

View File

@@ -7,7 +7,6 @@ Require-Bundle: org.eclipse.ui,
org.apache.commons.logging,
org.apache.commons.collections,
org.apache.commons.lang,
org.apache.axis,
org.talend.libraries.mdm;resolution:=optional,
org.talend.common.ui.runtime,
org.talend.core.runtime,
@@ -17,7 +16,8 @@ Require-Bundle: org.eclipse.ui,
org.apache.log4j,
javax.xml.rpc,
org.eclipse.xsd,
javax.xml.ws
javax.xml.ws,
org.talend.libraries.apache.axis2
Bundle-ActivationPolicy: lazy
Eclipse-RegisterBuddy: org.talend.testutils
Export-Package: metadata.managment.i18n,

View File

@@ -14,6 +14,7 @@ package org.talend.core.model.metadata.builder.database;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
@@ -387,12 +388,12 @@ public class ExtractMetaDataFromDataBase {
private static boolean checkSybaseDB(Connection connection, String database) {
ExtractMetaDataUtils extractMeta = ExtractMetaDataUtils.getInstance();
if (extractMeta != null) {
Statement stmt = null;
PreparedStatement stmt = null;
ResultSet resultSet = null;
try {
stmt = connection.createStatement();
stmt = connection.prepareStatement("sp_helpdb " + database);
extractMeta.setQueryStatementTimeout(stmt);
resultSet = stmt.executeQuery("sp_helpdb " + database);
resultSet = stmt.executeQuery();
return true;
} catch (SQLException e) {
ExceptionHandler.process(e);
@@ -705,25 +706,23 @@ public class ExtractMetaDataFromDataBase {
tableComment = tablesSet.getString(GetTable.REMARKS.name());
}
if (StringUtils.isBlank(tableComment)) {
String selectRemarkOnTable = getSelectRemarkOnTable(tableName);
if (selectRemarkOnTable != null && connection != null) {
tableComment = executeGetCommentStatement(selectRemarkOnTable, connection);
if (connection != null) {
tableComment = executeGetCommentStatement(connection, tableName);
}
}
return tableComment;
}
private static String getSelectRemarkOnTable(String tableName) {
return "SELECT TABLE_COMMENT FROM information_schema.TABLES WHERE TABLE_NAME='" + tableName + "'"; //$NON-NLS-1$ //$NON-NLS-2$
}
private static String executeGetCommentStatement(Connection connection, String tableName) {
String sql = "SELECT TABLE_COMMENT FROM information_schema.TABLES WHERE TABLE_NAME=?";
private static String executeGetCommentStatement(String queryStmt, Connection connection) {
String comment = null;
Statement statement = null;
PreparedStatement statement = null;
ResultSet resultSet = null;
try {
statement = connection.createStatement();
statement.execute(queryStmt);
statement = connection.prepareStatement(sql);
statement.setString(1, tableName);
statement.execute();
// get the results
resultSet = statement.getResultSet();

View File

@@ -15,6 +15,7 @@ package org.talend.core.model.metadata.builder.database.manager;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.Driver;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
@@ -1067,9 +1068,9 @@ public class ExtractManager {
try {
if (!tableInfoParameters.isUsedName()) {
if (tableInfoParameters.getSqlFiter() != null && !"".equals(tableInfoParameters.getSqlFiter())) { //$NON-NLS-1$
Statement stmt = extractMeta.getConn().createStatement();
PreparedStatement stmt = extractMeta.getConn().prepareStatement(tableInfoParameters.getSqlFiter());
extractMeta.setQueryStatementTimeout(stmt);
ResultSet rsTables = stmt.executeQuery(tableInfoParameters.getSqlFiter());
ResultSet rsTables = stmt.executeQuery();
itemTablesName = ExtractMetaDataFromDataBase.getTableNamesFromQuery(rsTables, extractMeta.getConn());
rsTables.close();
stmt.close();

View File

@@ -14,9 +14,9 @@ package org.talend.core.model.metadata.builder.database.manager.dbs;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
@@ -68,15 +68,17 @@ public class IBMDB2ExtractManager extends ExtractManager {
@Override
public String getTableNameBySynonyms(Connection conn, String tableName) {
Statement sta = null;
PreparedStatement sta = null;
ResultSet resultSet = null;
try {
if (conn != null && conn.getMetaData().getDatabaseProductName().startsWith(DATABASE_PRODUCT_NAME)) {
String sql = "SELECT NAME,BASE_NAME FROM SYSIBM.SYSTABLES where TYPE='A' and name ='" + tableName + "'";
sta = conn.createStatement();
String sql = "SELECT NAME,BASE_NAME FROM SYSIBM.SYSTABLES where TYPE='A' and name =?";
sta = conn.prepareStatement(sql);
sta.setString(1, tableName);
ExtractMetaDataUtils.getInstance().setQueryStatementTimeout(sta);
resultSet = sta.executeQuery(sql);
resultSet = sta.executeQuery();
while (resultSet.next()) {
String baseName = resultSet.getString("base_name").trim();
return baseName;
@@ -113,15 +115,16 @@ public class IBMDB2ExtractManager extends ExtractManager {
ExtractMetaDataUtils extractMeta = ExtractMetaDataUtils.getInstance();
// need to retrieve columns of synonym by useing sql rather than get them from jdbc metadata
String synSQL = "SELECT a.*\n" + "FROM SYSCAT.COLUMNS a\n" + "LEFT OUTER JOIN SYSIBM.SYSTABLES b\n"
+ "ON a.TABNAME = b.NAME\n" + "AND a.TABSCHEMA = b.CREATOR\n" + "where a.TABNAME =" + "\'" + tableName
+ "\'\n";
+ "ON a.TABNAME = b.NAME\n" + "AND a.TABSCHEMA = b.CREATOR\n" + "where a.TABNAME =?\n";
if (!("").equals(metadataConnection.getSchema())) {
synSQL += "AND b.CREATOR =\'" + metadataConnection.getSchema() + "\'";
}
synSQL += "ORDER BY a.COLNO";
Statement sta = extractMeta.getConn().createStatement();
PreparedStatement sta = extractMeta.getConn().prepareStatement(synSQL);
sta.setString(1, tableName);
extractMeta.setQueryStatementTimeout(sta);
ResultSet columns = sta.executeQuery(synSQL);
ResultSet columns = sta.executeQuery();
String typeName = null;
int index = 0;
List<String> columnLabels = new ArrayList<String>();

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