Compare commits
33 Commits
onimych/TD
...
bhe/bugfix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e7b7fb5ba | ||
|
|
68b84b1590 | ||
|
|
be546937be | ||
|
|
a3359f65c5 | ||
|
|
8b3798a5cd | ||
|
|
ff6e1466ef | ||
|
|
7c23b55695 | ||
|
|
908016db95 | ||
|
|
b66a48d0e8 | ||
|
|
4263d6c113 | ||
|
|
568b699a66 | ||
|
|
c4939b8d17 | ||
|
|
cf37143e88 | ||
|
|
5025e1313e | ||
|
|
b4ff690dd4 | ||
|
|
8178c0ed6c | ||
|
|
e411bf27e9 | ||
|
|
bac868243d | ||
|
|
11759c0e39 | ||
|
|
4c5f8d2c6a | ||
|
|
6377917727 | ||
|
|
6470a49143 | ||
|
|
c4ed60ffe4 | ||
|
|
0a495661ec | ||
|
|
ac55c8a332 | ||
|
|
94137658bd | ||
|
|
fabaf19e9b | ||
|
|
5ab9f488ac | ||
|
|
ebd37ef57a | ||
|
|
890f446373 | ||
|
|
af6a19aed6 | ||
|
|
13ae1d14f3 | ||
|
|
3332b8a299 |
@@ -21,6 +21,7 @@ import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
@@ -38,6 +39,8 @@ public class ExceptionMessageDialog extends MessageDialog {
|
||||
|
||||
private String exceptionString = null;
|
||||
|
||||
private int[] diabledButtonIndex = new int[] {};
|
||||
|
||||
public ExceptionMessageDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage,
|
||||
int dialogImageType, String[] dialogButtonLabels, int defaultIndex, Throwable ex) {
|
||||
super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex);
|
||||
@@ -147,4 +150,21 @@ public class ExceptionMessageDialog extends MessageDialog {
|
||||
this.exceptionString = exceptionString;
|
||||
}
|
||||
|
||||
public void setDisabledButtons(int[] index) {
|
||||
this.diabledButtonIndex = index;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createButtonsForButtonBar(Composite parent) {
|
||||
super.createButtonsForButtonBar(parent);
|
||||
if (diabledButtonIndex == null) {
|
||||
return;
|
||||
}
|
||||
for (int index : diabledButtonIndex) {
|
||||
Button button = super.getButton(index);
|
||||
button.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2020 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.utils.database;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* created by qiongli on 2013-11-13 Detailled comment
|
||||
*
|
||||
*/
|
||||
public class Sybase16SADatabaseMetaData extends SybaseDatabaseMetaData {
|
||||
|
||||
private static Logger log = Logger.getLogger(Sybase16SADatabaseMetaData.class);
|
||||
|
||||
/**
|
||||
* DOC qiongli SybaseIQDatabaseMetaData constructor comment.
|
||||
*
|
||||
* @param connection
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Sybase16SADatabaseMetaData(Connection connection) throws SQLException {
|
||||
super(connection);
|
||||
}
|
||||
|
||||
public ResultSet getCatalogs(String login, String database) throws SQLException {
|
||||
List<String[]> list = new ArrayList<String[]>();
|
||||
|
||||
List<String> catList = new ArrayList<String>();
|
||||
if (!StringUtils.isEmpty(database)) {
|
||||
catList.add(database);
|
||||
}
|
||||
|
||||
for (String catalogName : catList) {
|
||||
String sql = createSqlByLoginAndCatalog(login, catalogName);
|
||||
ResultSet rs = null;
|
||||
Statement stmt = null;
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
rs = stmt.executeQuery(sql);
|
||||
|
||||
while (rs.next()) {
|
||||
int temp = rs.getInt(1);
|
||||
if (temp > 0) {
|
||||
String[] r = new String[] { catalogName };
|
||||
list.add(r);
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
log.error(e);
|
||||
} finally {
|
||||
try {
|
||||
if (rs != null) {
|
||||
rs.close();
|
||||
}
|
||||
if (stmt != null) {
|
||||
stmt.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SybaseResultSet tableResultSet = new SybaseResultSet();
|
||||
tableResultSet.setMetadata(new String[] { "TABLE_CAT" }); //$NON-NLS-1$
|
||||
tableResultSet.setData(list);
|
||||
return tableResultSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)
|
||||
throws SQLException {
|
||||
return super.getColumns(null, schemaPattern, tableNamePattern, columnNamePattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException {
|
||||
return super.getPrimaryKeys(null, schema, table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types)
|
||||
throws SQLException {
|
||||
return super.getTables(null, schemaPattern, tableNamePattern, types);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* get a sql query by login name and catalog name.
|
||||
*
|
||||
* @param loginName
|
||||
* @param catalogName
|
||||
* @return
|
||||
*/
|
||||
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
|
||||
+ "')";
|
||||
return sql;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -225,7 +225,7 @@ public abstract class ExtendedPushButton implements IExtendedPushButton {
|
||||
if (extendedControlModel == null) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
return !extendedControlModel.isReadonly();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,5 +94,9 @@ public abstract class AbstractExtendedControlModel {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isReadonly() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -398,4 +398,9 @@ public class ExtendedTableModel<B> extends AbstractExtendedControlModel {
|
||||
this.tableViewer = tableViewer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReadonly() {
|
||||
return super.isReadonly();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -874,6 +874,9 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
}
|
||||
|
||||
this.repositoryFactoryFromProvider.deleteObjectPhysical(project, object, version, fromEmptyRecycleBin);
|
||||
if (isFullLogonFinished()) {
|
||||
fireRepositoryPropertyChange(ERepositoryActionName.AFTER_DELETE.getName(), null, object);
|
||||
}
|
||||
// i18n
|
||||
// log.info("Physical deletion [" + objToDelete + "] by " + getRepositoryContext().getUser() + ".");
|
||||
String str[] = new String[] { object.toString(), getRepositoryContext().getUser().toString() };
|
||||
|
||||
@@ -12,10 +12,14 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.repository.model.dnd;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.components.IComponentsService;
|
||||
import org.talend.core.model.properties.ConnectionItem;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.SalesforceSchemaConnectionItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
@@ -28,6 +32,8 @@ import org.talend.repository.model.RepositoryNode;
|
||||
*/
|
||||
public class SalesforceComponentDndFilter extends DefaultRepositoryComponentDndFilter {
|
||||
|
||||
public static final String SALSEFORCE = "salesforce"; //$NON-NLS-1$
|
||||
|
||||
public static final String COMPONENT_T_SALSEFORCE_CONNECTION = "tSalesforceConnection"; //$NON-NLS-1$
|
||||
|
||||
public static final String COMPONENT_T_SALSEFORCE_WAVE_BULK_EXEC = "tSalesforceWaveBulkExec"; //$NON-NLS-1$
|
||||
@@ -98,7 +104,16 @@ public class SalesforceComponentDndFilter extends DefaultRepositoryComponentDndF
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (item instanceof ConnectionItem && SALSEFORCE.equalsIgnoreCase(((ConnectionItem) item).getTypeName())) {
|
||||
// Special for Javajet components: tSalesforceEinsteinBulkExec/tSalesforceEinsteinOutputBulkExec
|
||||
IComponentsService service = GlobalServiceRegister.getDefault().getService(IComponentsService.class);
|
||||
Collection<IComponent> componentAll = service.getComponentsFactory().readComponents();
|
||||
for (IComponent component : componentAll) {
|
||||
if (component.getName().startsWith("tSalesforceEinstein") && !components.contains(component)) { //$NON-NLS-1$
|
||||
components.add(component);
|
||||
}
|
||||
}
|
||||
}
|
||||
return components;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,8 @@ public enum EDatabaseTypeName {
|
||||
"IBM DB2 ZOS", "IBM DB2 ZOS", Boolean.TRUE, "IBM_DB2", "DB2", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.Schema), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
SYBASEASE(
|
||||
"SybaseASE", "Sybase (ASE and IQ)", Boolean.TRUE, "SYBASE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
SYBASEASE_SA(
|
||||
"SybaseASE", "SQL Anywhere", Boolean.TRUE, "SYBASE", EDatabaseSchemaOrCatalogMapping.Sid, EDatabaseSchemaOrCatalogMapping.None), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
// this Sybase IQ not used.
|
||||
SYBASEIQ(
|
||||
|
||||
@@ -114,7 +114,7 @@ public enum EDatabaseVersion4Drivers {
|
||||
"db2jcc_license_cisuz.jar" })), //$NON-NLS-1$
|
||||
SYBASEASE(new DbVersion4Drivers(EDatabaseTypeName.SYBASEASE, "Sybase 12/15", "SYBSEIQ_12_15", "jconn3.jar")), //$NON-NLS-1$
|
||||
SYBASEIQ_16(new DbVersion4Drivers(EDatabaseTypeName.SYBASEASE, "Sybase 16", "SYBSEIQ_16", "jconn4.jar")), //$NON-NLS-1$
|
||||
SYBASEIQ_16_SA(new DbVersion4Drivers(EDatabaseTypeName.SYBASEASE, "Sybase 16 (SQL Anywhere)", "SYBSEIQ_16_SA", "sajdbc4.jar")),
|
||||
SYBASEIQ_16_SA(new DbVersion4Drivers(EDatabaseTypeName.SYBASEASE, "Sybase 16 (SQL Anywhere)", "SYBSEIQ_16_SA", "sajdbc4-17.0.0.jar")),
|
||||
SYBASEIQ(new DbVersion4Drivers(EDatabaseTypeName.SYBASEIQ, "jconn3.jar")), //$NON-NLS-1$
|
||||
|
||||
// for bug 0013127
|
||||
@@ -166,9 +166,9 @@ public enum EDatabaseVersion4Drivers {
|
||||
REDSHIFT(new DbVersion4Drivers(EDatabaseTypeName.REDSHIFT, "redshift", "REDSHIFT", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"redshift-jdbc42-no-awssdk-1.2.37.1061.jar")), //$NON-NLS-1$
|
||||
REDSHIFT_SSO(new DbVersion4Drivers(EDatabaseTypeName.REDSHIFT_SSO, "redshift sso", "REDSHIFT_SSO", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
new String[] { "redshift-jdbc42-no-awssdk-1.2.37.1061.jar", "aws-java-sdk-1.11.406.jar", "jackson-core-2.9.9.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"jackson-databind-2.9.9.jar", "jackson-annotations-2.9.0.jar", "httpcore-4.4.9.jar", "httpclient-4.5.5.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
|
||||
"joda-time-2.8.1.jar", "commons-logging-1.1.3.jar", "commons-codec-1.6.jar" })), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
new String[] { "redshift-jdbc42-no-awssdk-1.2.37.1061.jar", "aws-java-sdk-1.11.729.jar", "jackson-core-2.10.1.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"jackson-databind-2.10.1.jar", "jackson-annotations-2.10.1.jar", "httpcore-4.4.11.jar", "httpclient-4.5.9.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
|
||||
"joda-time-2.8.1.jar", "commons-logging-1.2.jar", "commons-codec-1.11.jar" })), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
AMAZON_AURORA(new DbVersion4Drivers(EDatabaseTypeName.AMAZON_AURORA, "mysql-connector-java-5.1.30-bin.jar")); //$NON-NLS-1$
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ import org.talend.core.model.repository.DragAndDropManager;
|
||||
import org.talend.core.model.update.UpdatesConstants;
|
||||
import org.talend.core.model.utils.IDragAndDropServiceHandler;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.runtime.services.IGenericWizardService;
|
||||
import org.talend.core.service.IMetadataManagmentService;
|
||||
import org.talend.core.service.IMetadataManagmentUiService;
|
||||
import org.talend.core.utils.KeywordsValidator;
|
||||
@@ -155,12 +156,12 @@ public class RepositoryToComponentProperty {
|
||||
return getEDIFACTSchemaValue((EDIFACTConnection) connection, value);
|
||||
}
|
||||
|
||||
for (IDragAndDropServiceHandler handler : DragAndDropManager.getHandlers()) {
|
||||
if (handler.canHandle(connection)) {
|
||||
return handler.getComponentValue(connection, value, table, targetComponent, contextMap);
|
||||
}
|
||||
// Special for Javajet components: tSalesforceEinsteinBulkExec/tSalesforceEinsteinOutputBulkExec
|
||||
if (targetComponent != null && targetComponent.startsWith("tSalesforceEinstein")) { //$NON-NLS-1$
|
||||
return getSpecialGenericValue(connection, value, table, targetComponent, contextMap);
|
||||
}
|
||||
return null;
|
||||
|
||||
return getHandlerComponentValue(connection, value, table, targetComponent, contextMap);
|
||||
|
||||
}
|
||||
|
||||
@@ -213,8 +214,7 @@ public class RepositoryToComponentProperty {
|
||||
return;
|
||||
}
|
||||
SAPFunctionUnit unit = null;
|
||||
for (int i = 0; i < conn.getFuntions().size(); i++) {
|
||||
SAPFunctionUnit tmp = conn.getFuntions().get(i);
|
||||
for (SAPFunctionUnit tmp : conn.getFuntions()) {
|
||||
if (tmp.getLabel().equals(functionLabel)) {
|
||||
unit = tmp;
|
||||
break;
|
||||
@@ -230,9 +230,8 @@ public class RepositoryToComponentProperty {
|
||||
if (isInput) {
|
||||
mergeColumn(table, table.getChildren(), value2);
|
||||
} else {
|
||||
for (int i = 0; i < table.getChildren().size(); i++) {
|
||||
for (SAPFunctionParameter column : table.getChildren()) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
SAPFunctionParameter column = table.getChildren().get(i);
|
||||
// this part maybe no use , didn't find OUTPUT_PARAMS in sap component
|
||||
map.put("SAP_PARAMETER_TYPE", column.getType().replace('.', '_')); //$NON-NLS-1$
|
||||
map.put("SAP_TABLE_NAME", TalendQuoteUtils.addQuotes("")); //$NON-NLS-1$
|
||||
@@ -298,8 +297,8 @@ public class RepositoryToComponentProperty {
|
||||
if (conn == null) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < conn.getFuntions().size(); i++) {
|
||||
unit = conn.getFuntions().get(i);
|
||||
for (SAPFunctionUnit element : conn.getFuntions()) {
|
||||
unit = element;
|
||||
if (unit.getLabel().equals(functionLabel)) {
|
||||
break;
|
||||
}
|
||||
@@ -626,6 +625,50 @@ public class RepositoryToComponentProperty {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Object getSpecialGenericValue(Connection connection, String value, IMetadataTable table,
|
||||
String targetComponent,
|
||||
Map<Object, Object> contextMap) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
|
||||
IGenericWizardService wizardService = GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
|
||||
if (wizardService != null && wizardService.isGenericConnection(connection)) {
|
||||
if (value != null) {
|
||||
if ("ENDPOINT".equals(value)) { //$NON-NLS-1$
|
||||
value = "connection.endpoint"; //$NON-NLS-1$
|
||||
} else if ("USER_NAME".equals(value)) { //$NON-NLS-1$
|
||||
value = "connection.userPassword.userId"; //$NON-NLS-1$
|
||||
} else if ("PASSWORD".equals(value)) { //$NON-NLS-1$
|
||||
// salesforce javajet component:pwd = pwd + token
|
||||
value = "connection.userPassword.password"; //$NON-NLS-1$
|
||||
Object password = getHandlerComponentValue(connection, value, table, targetComponent, contextMap);
|
||||
String skValue = "connection.userPassword.securityKey"; //$NON-NLS-1$
|
||||
Object securityKey = getHandlerComponentValue(connection, skValue, table, targetComponent, contextMap);
|
||||
if (securityKey != null) {
|
||||
if (isContextMode(connection, String.valueOf(password))) {
|
||||
return String.valueOf(password) + "+" + String.valueOf(securityKey); //$NON-NLS-1$
|
||||
} else {
|
||||
return TalendQuoteUtils.addQuotes(TalendQuoteUtils.removeQuotesIfExist(String.valueOf(password))
|
||||
+ TalendQuoteUtils.removeQuotesIfExist(String.valueOf(securityKey)));
|
||||
}
|
||||
}
|
||||
return password;
|
||||
}
|
||||
return getHandlerComponentValue(connection, value, table, targetComponent, contextMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Object getHandlerComponentValue(Connection connection, String value, IMetadataTable table,
|
||||
String targetComponent, Map<Object, Object> contextMap) {
|
||||
for (IDragAndDropServiceHandler handler : DragAndDropManager.getHandlers()) {
|
||||
if (handler.canHandle(connection)) {
|
||||
return handler.getComponentValue(connection, value, table, targetComponent, contextMap);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static SalesforceModuleUnit getSaleforceModuleUnitByTable(IMetadataTable table,
|
||||
EList<SalesforceModuleUnit> moduleList) {
|
||||
for (SalesforceModuleUnit unit : moduleList) {
|
||||
@@ -746,9 +789,9 @@ public class RepositoryToComponentProperty {
|
||||
|
||||
public static List<Map<String, String>> getOutputWSDLValue(EList list) {
|
||||
List<Map<String, String>> newList = new ArrayList<Map<String, String>>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
for (Object element : list) {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
WSDLParameter node = (WSDLParameter) list.get(i);
|
||||
WSDLParameter node = (WSDLParameter) element;
|
||||
map.put("EXPRESSION", node.getExpression());
|
||||
map.put("COLUMN", node.getColumn());
|
||||
map.put("SOURCE", node.getSource());
|
||||
@@ -1003,8 +1046,9 @@ public class RepositoryToComponentProperty {
|
||||
} else {
|
||||
String version = connection.getDbVersionString();
|
||||
if (EDatabaseVersion4Drivers.ORACLE_18.name().equals(version)) {
|
||||
if (StringUtils.equals(CDCTypeMode.LOG_MODE.getName(), connection.getCdcTypeMode()))
|
||||
if (StringUtils.equals(CDCTypeMode.LOG_MODE.getName(), connection.getCdcTypeMode())) {
|
||||
return CDCTypeMode.LOG_UNSUPPORTED_MODE.getName();
|
||||
}
|
||||
}
|
||||
return connection.getCdcTypeMode();
|
||||
}
|
||||
@@ -1493,7 +1537,7 @@ public class RepositoryToComponentProperty {
|
||||
String clusterID = connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CLUSTER_ID);
|
||||
if (clusterID != null) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
|
||||
IHadoopClusterService hadoopClusterService = (IHadoopClusterService) GlobalServiceRegister.getDefault()
|
||||
IHadoopClusterService hadoopClusterService = GlobalServiceRegister.getDefault()
|
||||
.getService(IHadoopClusterService.class);
|
||||
Map<String, String> hadoopCustomLibraries = hadoopClusterService.getHadoopCustomLibraries(clusterID);
|
||||
|
||||
@@ -1746,7 +1790,7 @@ public class RepositoryToComponentProperty {
|
||||
private static boolean isContextMode(Connection connection, String value) {
|
||||
IMetadataManagmentUiService mmService = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IMetadataManagmentUiService.class)) {
|
||||
mmService = (IMetadataManagmentUiService) GlobalServiceRegister.getDefault()
|
||||
mmService = GlobalServiceRegister.getDefault()
|
||||
.getService(IMetadataManagmentUiService.class);
|
||||
}
|
||||
if (mmService != null) {
|
||||
@@ -2033,7 +2077,7 @@ public class RepositoryToComponentProperty {
|
||||
Path p = new Path(connection.getXmlFilePath());
|
||||
if ((p.toPortableString()).endsWith("xsd")) { //$NON-NLS-1$
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IMetadataManagmentUiService.class)) {
|
||||
IMetadataManagmentUiService mmUIService = (IMetadataManagmentUiService) GlobalServiceRegister.getDefault()
|
||||
IMetadataManagmentUiService mmUIService = GlobalServiceRegister.getDefault()
|
||||
.getService(IMetadataManagmentUiService.class);
|
||||
String newPath = mmUIService.getAndOpenXSDFileDialog(p);
|
||||
if (newPath != null) {
|
||||
@@ -2153,9 +2197,9 @@ public class RepositoryToComponentProperty {
|
||||
|
||||
public static List<Map<String, String>> getOutputXmlValue(EList list) {
|
||||
List<Map<String, String>> newList = new ArrayList<Map<String, String>>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
for (Object element : list) {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
XMLFileNode node = (XMLFileNode) list.get(i);
|
||||
XMLFileNode node = (XMLFileNode) element;
|
||||
String defaultValue = node.getDefaultValue();
|
||||
if (defaultValue == null) {
|
||||
defaultValue = ""; //$NON-NLS-1$
|
||||
@@ -2399,7 +2443,7 @@ public class RepositoryToComponentProperty {
|
||||
|
||||
} else {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IMetadataManagmentService.class)) {
|
||||
IMetadataManagmentService mmService = (IMetadataManagmentService) GlobalServiceRegister.getDefault()
|
||||
IMetadataManagmentService mmService = GlobalServiceRegister.getDefault()
|
||||
.getService(IMetadataManagmentService.class);
|
||||
IMetadataTable convert = mmService.convertMetadataTable(repTable);
|
||||
String uinqueTableName = node.getProcess()
|
||||
@@ -2654,8 +2698,7 @@ public class RepositoryToComponentProperty {
|
||||
boolean foundColumn = false;
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("QUERY", null); //$NON-NLS-1$
|
||||
for (int i = 0; i < schemaTargets.size(); i++) {
|
||||
SchemaTarget sch = schemaTargets.get(i);
|
||||
for (SchemaTarget sch : schemaTargets) {
|
||||
if (col.getLabel().equals(sch.getTagName())) {
|
||||
// map.put("SCHEMA_COLUMN", sch.getTagName());
|
||||
foundColumn = true;
|
||||
@@ -2664,8 +2707,7 @@ public class RepositoryToComponentProperty {
|
||||
}
|
||||
if (!foundColumn && colRenameMap != null && !colRenameMap.isEmpty()) {
|
||||
Set<String> newNameSet = colRenameMap.keySet();
|
||||
for (int i = 0; i < schemaTargets.size(); i++) {
|
||||
SchemaTarget sch = schemaTargets.get(i);
|
||||
for (SchemaTarget sch : schemaTargets) {
|
||||
if (newNameSet.contains(sch.getTagName())) {
|
||||
String oldColLabel = colRenameMap.get(sch.getTagName());
|
||||
if (col.getLabel().equals(oldColLabel)) {
|
||||
@@ -2724,8 +2766,7 @@ public class RepositoryToComponentProperty {
|
||||
for (IMetadataColumn col : metadataTable.getListColumns()) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("QUERY", null); //$NON-NLS-1$
|
||||
for (int i = 0; i < conceptTargets.size(); i++) {
|
||||
ConceptTarget cpt = conceptTargets.get(i);
|
||||
for (ConceptTarget cpt : conceptTargets) {
|
||||
if (col.getLabel().equals(cpt.getTargetName())) {
|
||||
// map.put("SCHEMA_COLUMN", sch.getTagName());
|
||||
map.put("QUERY", TalendQuoteUtils.addQuotes(cpt.getRelativeLoopExpression())); //$NON-NLS-1$
|
||||
|
||||
@@ -1109,10 +1109,43 @@ public abstract class RepositoryUpdateManager {
|
||||
}
|
||||
}
|
||||
|
||||
if (foundCompProperties && GlobalServiceRegister.getDefault().isServiceRegistered(IGenericDBService.class)) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericDBService.class)) {
|
||||
IGenericDBService service = GlobalServiceRegister.getDefault().getService(IGenericDBService.class);
|
||||
service.updateCompPropertiesForContextMode(dbConnectionItem.getConnection(), oldToNewHM);
|
||||
factory.save(dbConnectionItem);
|
||||
// if not found, search from generic metadata
|
||||
if (!foundCompProperties) {
|
||||
List<ERepositoryObjectType> repoTypeList = service.getAllGenericMetadataDBRepositoryType();
|
||||
for (ERepositoryObjectType type : repoTypeList) {
|
||||
List<IRepositoryViewObject> repositoryObjects = factory.getAll(type);
|
||||
for (IRepositoryViewObject object : repositoryObjects) {
|
||||
Item item = object.getProperty().getItem();
|
||||
if (item instanceof ConnectionItem) {
|
||||
Connection conn = ((ConnectionItem) item).getConnection();
|
||||
if (conn.isContextMode()) {
|
||||
ContextItem contextItem = ContextUtils.getContextItemById2(conn.getContextId());
|
||||
if (contextItem == null) {
|
||||
continue;
|
||||
}
|
||||
if (citem == contextItem) {
|
||||
String compProperties = conn.getCompProperties();
|
||||
if (StringUtils.isNotBlank(compProperties)) {
|
||||
foundCompProperties = true;
|
||||
dbConnectionItem = (ConnectionItem) item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (foundCompProperties) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (foundCompProperties) {
|
||||
service.updateCompPropertiesForContextMode(dbConnectionItem.getConnection(), oldToNewHM);
|
||||
factory.save(dbConnectionItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@ 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.talend.commons.utils.PasswordEncryptUtil;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.language.ECodeLanguage;
|
||||
@@ -48,6 +50,8 @@ 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.services.IGenericDBService;
|
||||
import org.talend.core.utils.TalendQuoteUtils;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
|
||||
@@ -595,8 +599,12 @@ public final class ContextParameterUtils {
|
||||
if (ContextUtils.isJavaKeyWords(name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Pattern regex = Pattern.compile(RepositoryConstants.CONTEXT_AND_VARIABLE_PATTERN, Pattern.UNICODE_CHARACTER_CLASS);
|
||||
Pattern regex = null;
|
||||
if (isAllowSpecificCharacters()) {
|
||||
regex = Pattern.compile(RepositoryConstants.CONTEXT_AND_VARIABLE_PATTERN, Pattern.UNICODE_CHARACTER_CLASS);
|
||||
} else {
|
||||
regex = Pattern.compile(RepositoryConstants.COLUMN_NAME_PATTERN, Pattern.UNICODE_CHARACTER_CLASS);
|
||||
}
|
||||
Matcher regexMatcher = regex.matcher(name);
|
||||
|
||||
return regexMatcher.matches();
|
||||
@@ -604,6 +612,11 @@ public final class ContextParameterUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean isAllowSpecificCharacters() {
|
||||
IEclipsePreferences coreUIPluginNode = new InstanceScope().getNode(ITalendCorePrefConstants.CoreUIPlugin_ID);
|
||||
return coreUIPluginNode.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
|
||||
}
|
||||
|
||||
public static boolean isEmptyParameter(String source) {
|
||||
return source.equals(StringUtils.EMPTY);
|
||||
}
|
||||
|
||||
@@ -66,4 +66,6 @@ public interface IGenericDBService extends IService{
|
||||
|
||||
public void updateCompPropertiesForContextMode(Connection connection, Map<String, String> contextVarMap);
|
||||
|
||||
public List<ERepositoryObjectType> getAllGenericMetadataDBRepositoryType();
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.ui;
|
||||
|
||||
import org.talend.core.IService;
|
||||
|
||||
/**
|
||||
* @author hwang
|
||||
*
|
||||
*/
|
||||
public interface IInstalledPatchService extends IService {
|
||||
|
||||
public String getLatestInstalledVersion(boolean isBar);
|
||||
|
||||
}
|
||||
@@ -281,6 +281,17 @@ public final class TalendQuoteUtils {
|
||||
return text;
|
||||
}
|
||||
|
||||
public static boolean isEnclosed(String text) {
|
||||
if (text == null) {
|
||||
return false;
|
||||
}
|
||||
text = text.trim();
|
||||
if (text.length() < 2) {
|
||||
return false;
|
||||
}
|
||||
return text.startsWith(QUOTATION_MARK) && text.endsWith(QUOTATION_MARK);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* ggu Comment method "addQuotesForSQLString".
|
||||
|
||||
@@ -30,6 +30,7 @@ public enum ERepositoryActionName {
|
||||
|
||||
DELETE_TO_RECYCLE_BIN("delete to recycle bin"), //$NON-NLS-1$
|
||||
DELETE_FOREVER("delete forever"), //$NON-NLS-1$
|
||||
AFTER_DELETE("after delete"), //$NON-NLS-1$
|
||||
|
||||
// these actions bellow are only for jobs and joblet actually, need to review.
|
||||
|
||||
|
||||
@@ -219,4 +219,13 @@ public class MetadataTableEditor extends ExtendedTableModel<IMetadataColumn> {
|
||||
|
||||
return metadataColumn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReadonly() {
|
||||
if (this.metadataTable != null) {
|
||||
return this.metadataTable.isReadOnly();
|
||||
}
|
||||
return super.isReadonly();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,12 @@ package org.talend.core.ui.preference.collector;
|
||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
import org.talend.core.prefs.ITalendCorePrefConstants;
|
||||
@@ -28,6 +34,7 @@ import org.talend.core.ui.token.TokenCollectorFactory;
|
||||
public class TalendDataCollectorPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
|
||||
|
||||
public TalendDataCollectorPreferencePage() {
|
||||
super(GRID);
|
||||
setPreferenceStore(CoreUIPlugin.getDefault().getPreferenceStore());
|
||||
setDescription(Messages.getString("TalendDataCollectorPreferencePage_Description")); //$NON-NLS-1$
|
||||
}
|
||||
@@ -41,6 +48,30 @@ public class TalendDataCollectorPreferencePage extends FieldEditorPreferencePage
|
||||
protected void createFieldEditors() {
|
||||
addField(new BooleanFieldEditor(ITalendCorePrefConstants.DATA_COLLECTOR_ENABLED,
|
||||
Messages.getString("TalendDataCollectorPreferencePage_EnableCapture"), getFieldEditorParent())); //$NON-NLS-1$
|
||||
if (Boolean.getBoolean("talend.DataCollector.visibleSendButton")) {//$NON-NLS-1$
|
||||
createSendDataButton(getFieldEditorParent());
|
||||
}
|
||||
}
|
||||
|
||||
private static void createSendDataButton(Composite parent) {
|
||||
GridData gd = new GridData();
|
||||
gd.horizontalSpan = 1;
|
||||
Button button = new Button(parent, SWT.PUSH | SWT.LEFT);
|
||||
button.setFont(parent.getFont());
|
||||
button.setLayoutData(gd);
|
||||
button.setText("Send Data"); //$NON-NLS-1$
|
||||
button.addSelectionListener(new SelectionListener() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
TokenCollectorFactory.getFactory().processWithoutWait();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.ui.token;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
@@ -49,7 +50,11 @@ public class DefaultTokenCollector extends AbstractTokenCollector {
|
||||
public static String calcUniqueId() {
|
||||
return TokenGenerator.generateMachineToken((src) -> StudioEncryption.getStudioEncryption(StudioEncryption.EncryptionKeyName.SYSTEM).encrypt(src));
|
||||
}
|
||||
|
||||
|
||||
public static String hashUniqueId() {
|
||||
return TokenGenerator.generateMachineToken((src) -> DigestUtils.sha256Hex(src));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@@ -61,7 +66,7 @@ public class DefaultTokenCollector extends AbstractTokenCollector {
|
||||
// version
|
||||
tokenStudioObject.put(VERSION.getKey(), VersionUtils.getInternalVersion());
|
||||
// uniqueId
|
||||
tokenStudioObject.put(UNIQUE_ID.getKey(), calcUniqueId());
|
||||
tokenStudioObject.put(UNIQUE_ID.getKey(), hashUniqueId());
|
||||
|
||||
// typeStudio
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IBrandingService.class)) {
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.Priority;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
@@ -197,6 +198,19 @@ public final class TokenCollectorFactory {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void processWithoutWait() {
|
||||
try {
|
||||
log.log(Level.INFO, "Start to collect data");
|
||||
priorCollect();
|
||||
log.log(Level.INFO, "End of collect data");
|
||||
log.log(Level.INFO, "Start to send data");
|
||||
send();
|
||||
log.log(Level.INFO, "End of send data");
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void send() {
|
||||
send(false);
|
||||
}
|
||||
|
||||
@@ -477,6 +477,10 @@ public class TalendTextUtils {
|
||||
return TalendQuoteUtils.removeQuotes(text, quotation);
|
||||
}
|
||||
|
||||
public static boolean isEnclosed(String text) {
|
||||
return TalendQuoteUtils.isEnclosed(text);
|
||||
}
|
||||
|
||||
public static String getStringConnect() {
|
||||
return TalendQuoteUtils.getStringConnect();
|
||||
}
|
||||
|
||||
@@ -77,5 +77,5 @@ public interface ICoreTisService extends IService {
|
||||
Map<String, String> getDropBundleInfo() throws IOException;
|
||||
|
||||
Set<String> getComponentBlackList();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>3.0.24</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<artifactId>studio-tacokit-dependencies</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<tacokit.components.version>1.8.0-SNAPSHOT</tacokit.components.version>
|
||||
<tacokit.components.version>1.10.0-SNAPSHOT</tacokit.components.version>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
||||
@@ -27,6 +27,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Properties;
|
||||
import java.util.Scanner;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -535,7 +536,7 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
"${talend.job.bat.addition}" },
|
||||
new String[] { jvmArgsStr.toString().trim(), getWindowsClasspath(), jobClass,
|
||||
windowsScriptAdditionValue.toString() });
|
||||
|
||||
batContent = normalizeSpaces(batContent);
|
||||
String shContent = MavenTemplateManager.getProjectSettingValue(IProjectSettingPreferenceConstants.TEMPLATE_SH,
|
||||
templateParameters);
|
||||
shContent = StringUtils
|
||||
@@ -544,7 +545,7 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
"${talend.job.sh.addition}" },
|
||||
new String[] { jvmArgsStr.toString().trim(), getUnixClasspath(), jobClass,
|
||||
unixScriptAdditionValue.toString() });
|
||||
|
||||
shContent = normalizeSpaces(shContent);
|
||||
String psContent = MavenTemplateManager.getProjectSettingValue(IProjectSettingPreferenceConstants.TEMPLATE_PS,
|
||||
templateParameters);
|
||||
psContent = StringUtils
|
||||
@@ -553,7 +554,7 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
"${talend.job.class}", "${talend.job.bat.addition}" },
|
||||
new String[] { jvmArgsStrPs1.toString().trim(), getWindowsClasspathForPs1(), jobClass,
|
||||
windowsScriptAdditionValue.toString() });
|
||||
|
||||
psContent = normalizeSpaces(psContent);
|
||||
String jobInfoContent = MavenTemplateManager
|
||||
.getProjectSettingValue(IProjectSettingPreferenceConstants.TEMPLATE_JOB_INFO, templateParameters);
|
||||
String projectTechName = ProjectManager.getInstance().getProject(property).getTechnicalLabel();
|
||||
@@ -649,12 +650,13 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
ERepositoryObjectType.getAllTypesOfCodes().forEach(t -> dependencies.addAll(PomUtil.getCodesDependencies(t)));
|
||||
|
||||
// libraries of talend/3rd party
|
||||
dependencies.addAll(convertToDistinctedJobDependencies(currentJobProperty.getId(), currentJobProperty.getVersion(),
|
||||
processor.getNeededModules(TalendProcessOptionConstants.MODULES_EXCLUDE_SHADED)));
|
||||
dependencies.addAll(processor.getNeededModules(TalendProcessOptionConstants.MODULES_EXCLUDE_SHADED).stream()
|
||||
.filter(m -> !m.isExcluded()).map(m -> createDenpendency(m, false)).collect(Collectors.toSet()));
|
||||
|
||||
// missing modules from the job generation of children
|
||||
childrenJobInfo.forEach(j -> dependencies.addAll(convertToDistinctedJobDependencies(j.getJobId(), j.getJobVersion(),
|
||||
LastGenerationInfo.getInstance().getModulesNeededPerJob(j.getJobId(), j.getJobVersion()))));
|
||||
childrenJobInfo.forEach(j -> dependencies
|
||||
.addAll(LastGenerationInfo.getInstance().getModulesNeededPerJob(j.getJobId(), j.getJobVersion()).stream()
|
||||
.filter(m -> !m.isExcluded()).map(m -> createDenpendency(m, false)).collect(Collectors.toSet())));
|
||||
|
||||
Set<ModuleNeeded> modules = new HashSet<>();
|
||||
// testcase modules from current job (optional)
|
||||
@@ -733,6 +735,8 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
|
||||
// remove duplicate job dependencies and only keep the latest one
|
||||
// keep high priority dependencies if set by tLibraryLoad
|
||||
// FIXME not used now since tacokit component use specific dependency version. so we must include all job dependencies.
|
||||
// but problem will remain for CI when need to download jars from nexus, maven will only resolve one of them.
|
||||
private Set<Dependency> convertToDistinctedJobDependencies(String jobId, String jobVersion, Set<ModuleNeeded> neededModules) {
|
||||
Set<Dependency> highPriorityDependencies = LastGenerationInfo.getInstance()
|
||||
.getHighPriorityModuleNeededPerJob(jobId, jobVersion).stream().map(m -> createDenpendency(m, false))
|
||||
@@ -931,4 +935,22 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
|
||||
}
|
||||
|
||||
// https://jira.talendforge.org/browse/TUP-27053
|
||||
public static String normalizeSpaces(String src) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
try (Scanner scanner = new Scanner(src)) {
|
||||
while (scanner.hasNextLine()) {
|
||||
String line = scanner.nextLine();
|
||||
line = StringUtils.normalizeSpace(line.trim());
|
||||
if (!line.isEmpty()) {
|
||||
sb.append(line);
|
||||
}
|
||||
sb.append('\n');
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -57,12 +57,32 @@ public class JDBCUtil {
|
||||
throw new RuntimeException("Null value in non-Nullable column");
|
||||
}
|
||||
|
||||
/**
|
||||
* getDate can be called with the resultSet having either a java.sql.Timestamp or a java.sql.Date
|
||||
* the double try implementation is not something im proud of, but having two methods would require
|
||||
* a huge refactoring that in the end is the same as doing that
|
||||
* @param rs
|
||||
* @param index
|
||||
* @return java.util.Date converted from java.sql.Timestamp/Date
|
||||
* @throws java.sql.SQLException
|
||||
*/
|
||||
public static Date getDate(ResultSet rs, int index) throws java.sql.SQLException {
|
||||
if(rs.getTimestamp(index) != null) {
|
||||
return new Date(rs.getTimestamp(index).getTime());
|
||||
Date result = null;
|
||||
try {
|
||||
if(rs.getTimestamp(index) != null) {
|
||||
result = new Date(rs.getTimestamp(index).getTime());
|
||||
return result;
|
||||
}
|
||||
} catch (java.sql.SQLException e) {
|
||||
}
|
||||
|
||||
return null;
|
||||
try {
|
||||
if(rs.getDate(index) != null) {
|
||||
result = new Date(rs.getDate(index).getTime());
|
||||
return result;
|
||||
}
|
||||
} catch (java.sql.SQLException e) {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//decrease the get method call number
|
||||
|
||||
@@ -54,8 +54,6 @@ public class ArtifacoryRepositoryHandler extends AbstractArtifactRepositoryHandl
|
||||
|
||||
private String SEARCH_SERVICE = "api/search/gavc?"; //$NON-NLS-1$
|
||||
|
||||
private String SEARCH_RESULT_PREFIX = "api/storage/";//$NON-NLS-1$
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@@ -218,13 +216,11 @@ public class ArtifacoryRepositoryHandler extends AbstractArtifactRepositoryHandl
|
||||
throw new Exception(resultStr);
|
||||
}
|
||||
if (resultArray != null) {
|
||||
String resultUrl = serverUrl + SEARCH_RESULT_PREFIX;
|
||||
for (int i = 0; i < resultArray.size(); i++) {
|
||||
JSONObject jsonObject = resultArray.getJSONObject(i);
|
||||
String lastUpdated = jsonObject.getString("lastUpdated"); //$NON-NLS-1$
|
||||
String uri = jsonObject.getString("uri"); //$NON-NLS-1$
|
||||
uri = uri.substring(resultUrl.length(), uri.length());
|
||||
String[] split = uri.split("/"); //$NON-NLS-1$
|
||||
String artifactPath = jsonObject.getString("path"); //$NON-NLS-1$
|
||||
String[] split = artifactPath.split("/"); //$NON-NLS-1$
|
||||
if (split.length > 4) {
|
||||
String fileName = split[split.length - 1];
|
||||
if (!fileName.endsWith("pom")) { //$NON-NLS-1$
|
||||
|
||||
@@ -439,8 +439,8 @@ SelectorTableForm.selectAllTables=Select All
|
||||
SelectorTableForm.selectNoneTables=Select None
|
||||
ShadowProcessHelper.logError.previewIsNull01=\nThe ShadowProcess use to extract data or metadata on a File don't run.
|
||||
ShadowProcessHelper.logError.previewIsNull02=\nConfigurationElementsFor("org.talend.repository.filepreview_provider").length \=\= 0 ??
|
||||
ShowAddedContextdialog.Messages=Should add the following context parameters to the jobs or not?
|
||||
ShowAddedContextdialog.Title=Added context
|
||||
ShowAddedContextdialog.dialogMessages=Add the following context parameters to Jobs using this connection?
|
||||
ShowAddedContextdialog.dialogTitle=Add context parameters
|
||||
ShowAddedContextdialog.Variables=Variables
|
||||
StoppablePreviewLoader.inforLabelText.previewInterrupted=Preview interrupted
|
||||
TableWizard.windowTitle=Schema
|
||||
|
||||
@@ -49,7 +49,7 @@ import org.talend.repository.UpdateRepositoryUtils;
|
||||
*/
|
||||
public class ShowAddedContextdialog extends SelectionDialog {
|
||||
|
||||
private static final String TITILE = Messages.getString("ShowAddedContextdialog.Title"); //$NON-NLS-1$
|
||||
private static final String TITILE = Messages.getString("ShowAddedContextdialog.dialogTitle"); //$NON-NLS-1$
|
||||
|
||||
private final List<AddedContextBean> addedVarBeans = new ArrayList<AddedContextBean>();
|
||||
|
||||
@@ -71,7 +71,7 @@ public class ShowAddedContextdialog extends SelectionDialog {
|
||||
setBlockOnOpen(true);
|
||||
// setDefaultImage(ImageProvider.getImage(ECoreImage.CONTEXT_ICON));
|
||||
setTitle(TITILE);
|
||||
setMessage(Messages.getString("ShowAddedContextdialog.Messages")); //$NON-NLS-1$
|
||||
setMessage(Messages.getString("ShowAddedContextdialog.dialogMessages")); //$NON-NLS-1$
|
||||
setHelpAvailable(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ import org.talend.commons.utils.workbench.extensions.IExtensionPointLimiter;
|
||||
import org.talend.core.database.EDatabase4DriverClassName;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.database.conn.template.EDatabaseConnTemplate;
|
||||
import org.talend.core.database.conn.version.EDatabaseVersion4Drivers;
|
||||
import org.talend.core.model.metadata.IMetadataConnection;
|
||||
import org.talend.core.model.metadata.IMetadataTable;
|
||||
import org.talend.core.model.metadata.builder.ConvertionHelper;
|
||||
@@ -334,12 +335,16 @@ public class ExtractMetaDataFromDataBase {
|
||||
return connectionStatus;
|
||||
}
|
||||
}
|
||||
if (EDatabaseTypeName.SYBASEASE == EDatabaseTypeName.getTypeFromDisplayName(dbType)) {
|
||||
boolean exsitedSybaseDB = checkSybaseDB(connection, sidOrDatabase);
|
||||
if (!exsitedSybaseDB) {
|
||||
connectionStatus.setMessageException(
|
||||
Messages.getString("ExtractMetaDataFromDataBase.DatabaseNoPresent", sidOrDatabase)); //$NON-NLS-1$
|
||||
return connectionStatus;
|
||||
String property = System.getProperty("disableCheckSybase16");//$NON-NLS-1$
|
||||
Boolean disableCheckSybase16 = StringUtils.isEmpty(property) ? false : Boolean.valueOf(property);
|
||||
if (!disableCheckSybase16) {
|
||||
if (StringUtils.equals(EDatabaseVersion4Drivers.SYBASEIQ_16.getVersionValue(), dbVersionString)) {
|
||||
boolean exsitedSybaseDB = checkSybaseDB(connection, sidOrDatabase);
|
||||
if (!exsitedSybaseDB) {
|
||||
connectionStatus.setMessageException(
|
||||
Messages.getString("ExtractMetaDataFromDataBase.DatabaseNoPresent", sidOrDatabase)); //$NON-NLS-1$
|
||||
return connectionStatus;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ import org.talend.commons.utils.database.EXASOLDatabaseMetaData;
|
||||
import org.talend.commons.utils.database.JtdsDatabaseMetadata;
|
||||
import org.talend.commons.utils.database.SAPHanaDataBaseMetadata;
|
||||
import org.talend.commons.utils.database.SASDataBaseMetadata;
|
||||
import org.talend.commons.utils.database.Sybase16SADatabaseMetaData;
|
||||
import org.talend.commons.utils.database.SybaseDatabaseMetaData;
|
||||
import org.talend.commons.utils.database.SybaseIQDatabaseMetaData;
|
||||
import org.talend.commons.utils.database.TeradataDataBaseMetadata;
|
||||
@@ -79,6 +80,7 @@ import org.talend.core.utils.TalendQuoteUtils;
|
||||
import org.talend.designer.core.IDesignerCoreService;
|
||||
import org.talend.metadata.managment.connection.manager.HiveConnectionManager;
|
||||
import org.talend.metadata.managment.hive.EmbeddedHiveDataBaseMetadata;
|
||||
import org.talend.metadata.managment.utils.MetadataConnectionUtils;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.utils.exceptions.MissingDriverException;
|
||||
import org.talend.utils.sql.ConnectionUtils;
|
||||
@@ -275,7 +277,10 @@ public class ExtractMetaDataUtils {
|
||||
if (dbMetaData != null
|
||||
&& EDatabaseTypeName.SYBASEIQ.getDisplayName().equals(dbMetaData.getDatabaseProductName())) {
|
||||
dbMetaData = createSybaseIQFakeDatabaseMetaData(conn);
|
||||
} else {
|
||||
} else if(dbMetaData != null
|
||||
&& EDatabaseTypeName.SYBASEASE_SA.getDisplayName().equals(dbMetaData.getDatabaseProductName())) {
|
||||
dbMetaData = createSybase16SAFakeDatabaseMetaData(conn);
|
||||
}else {
|
||||
dbMetaData = createSybaseFakeDatabaseMetaData(conn);
|
||||
}
|
||||
} else if (EDatabaseTypeName.HIVE.getDisplayName().equals(dbType) && isHiveEmbeddedConn(conn)) {
|
||||
@@ -426,6 +431,11 @@ public class ExtractMetaDataUtils {
|
||||
SybaseDatabaseMetaData dmd = new SybaseDatabaseMetaData(conn);
|
||||
return dmd;
|
||||
}
|
||||
|
||||
private DatabaseMetaData createSybase16SAFakeDatabaseMetaData(Connection conn) throws SQLException {
|
||||
SybaseDatabaseMetaData dmd = new Sybase16SADatabaseMetaData(conn);
|
||||
return dmd;
|
||||
}
|
||||
|
||||
private DatabaseMetaData createSybaseIQFakeDatabaseMetaData(Connection conn) throws SQLException {
|
||||
SybaseIQDatabaseMetaData dmd = new SybaseIQDatabaseMetaData(conn);
|
||||
|
||||
@@ -37,11 +37,13 @@ import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.data.list.ListUtils;
|
||||
import org.talend.commons.utils.database.AS400DatabaseMetaData;
|
||||
import org.talend.commons.utils.database.DB2ForZosDataBaseMetadata;
|
||||
import org.talend.commons.utils.database.Sybase16SADatabaseMetaData;
|
||||
import org.talend.commons.utils.database.SybaseDatabaseMetaData;
|
||||
import org.talend.commons.utils.database.TeradataDataBaseMetadata;
|
||||
import org.talend.core.ICoreService;
|
||||
import org.talend.core.database.EDatabase4DriverClassName;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.database.conn.version.EDatabaseVersion4Drivers;
|
||||
import org.talend.core.model.metadata.IMetadataConnection;
|
||||
import org.talend.core.model.metadata.MappingTypeRetriever;
|
||||
import org.talend.core.model.metadata.MetadataTalendType;
|
||||
@@ -252,7 +254,7 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
IMetadataConnection metaConnection, List<String> schemaFilter) {
|
||||
List<Schema> returnSchemas = new ArrayList<Schema>();
|
||||
if (dbJDBCMetadata == null || (dbConn != null && ConnectionHelper.getCatalogs(dbConn).size() > 0)
|
||||
|| ConnectionUtils.isSybase(dbJDBCMetadata)) {
|
||||
|| ConnectionUtils.isSybase(dbJDBCMetadata)) {
|
||||
return null;
|
||||
}
|
||||
ResultSet schemas = null;
|
||||
@@ -443,8 +445,14 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
return catalogList;
|
||||
}
|
||||
ResultSet catalogNames = null;
|
||||
if (dbJDBCMetadata instanceof SybaseDatabaseMetaData) {
|
||||
// Whether in context mode or not, metaConnection can get the correct username always
|
||||
|
||||
if (dbJDBCMetadata instanceof Sybase16SADatabaseMetaData) {
|
||||
String username = metaConnection == null ? dbConn.getUsername() : metaConnection.getUsername();
|
||||
String database = metaConnection == null ? dbConn.getSID() : metaConnection.getDatabase();
|
||||
catalogNames = ((Sybase16SADatabaseMetaData) dbJDBCMetadata).getCatalogs(username, database);
|
||||
} else if (dbJDBCMetadata instanceof SybaseDatabaseMetaData) {
|
||||
// Whether in context mode or not, metaConnection can get the correct username
|
||||
// always
|
||||
String username = metaConnection == null ? dbConn.getUsername() : metaConnection.getUsername();
|
||||
catalogNames = ((SybaseDatabaseMetaData) dbJDBCMetadata).getCatalogs(username);
|
||||
} else {
|
||||
|
||||
@@ -576,6 +576,16 @@ public class MetadataConnectionUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isSybase16SA(IMetadataConnection connectionMetadata) throws SQLException {
|
||||
boolean isSybase16SA = false;
|
||||
if(connectionMetadata!=null) {
|
||||
String dbVersionString = connectionMetadata.getDbVersionString();
|
||||
isSybase16SA = StringUtils.equals(EDatabaseVersion4Drivers.SYBASEIQ_16_SA.getVersionValue(),
|
||||
dbVersionString);
|
||||
}
|
||||
return isSybase16SA;
|
||||
}
|
||||
|
||||
public static boolean isSAPHana(DatabaseMetaData connectionMetadata) throws SQLException {
|
||||
if (connectionMetadata.getDriverName() != null && connectionMetadata.getDatabaseProductName() != null) {
|
||||
if ("HDB".equalsIgnoreCase(connectionMetadata.getDatabaseProductName().trim())) { //$NON-NLS-1$
|
||||
|
||||
@@ -92,6 +92,7 @@ import org.talend.core.prefs.IDEInternalPreferences;
|
||||
import org.talend.core.prefs.ITalendCorePrefConstants;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.ui.CoreUIPlugin;
|
||||
import org.talend.core.ui.IInstalledPatchService;
|
||||
import org.talend.core.ui.branding.IBrandingConfiguration;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
import org.talend.core.ui.perspective.RestoreAllRegisteredPerspectivesProvider;
|
||||
@@ -184,7 +185,18 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
|
||||
} catch (PersistenceException e) {
|
||||
localProvider = true;
|
||||
}
|
||||
|
||||
String buildIdField = " (" + VersionUtils.getVersion() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IInstalledPatchService.class)) {
|
||||
IInstalledPatchService pachService = (IInstalledPatchService) GlobalServiceRegister
|
||||
.getDefault().getService(IInstalledPatchService.class);
|
||||
if (pachService != null) {
|
||||
String patchVersion = pachService.getLatestInstalledVersion(true);
|
||||
if(patchVersion != null) {
|
||||
buildIdField = " (" + patchVersion + ")"; //$NON-NLS-1$ //$NON-NLS-2$;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (TalendPropertiesUtil.isHideBuildNumber()) {
|
||||
buildIdField = ""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ public class DynamicContentProvider extends IntroProvider {
|
||||
if (activeDataCollector && version != null && edition != null) {
|
||||
// uuid
|
||||
DefaultTokenCollector dtc = new DefaultTokenCollector();
|
||||
url.append("?version=").append(sb.toString()).append("&uid=").append(dtc.calcUniqueId()).append("&edition=") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
url.append("?version=").append(sb.toString()).append("&uid=").append(dtc.hashUniqueId()).append("&edition=") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
.append(edition);
|
||||
} else if (!activeDataCollector && version != null && edition != null) {
|
||||
url.append("?version=").append(sb.toString()).append("&edition=").append(edition); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
@@ -252,7 +252,7 @@ public class RegisterManagement {
|
||||
String version = VersionUtils.getVersion();
|
||||
|
||||
// UNIQUE_ID
|
||||
String uniqueId = DefaultTokenCollector.calcUniqueId();
|
||||
String uniqueId = DefaultTokenCollector.hashUniqueId();
|
||||
|
||||
RegisterUserPortTypeProxy proxy = new RegisterUserPortTypeProxy();
|
||||
proxy.setEndpoint("https://www.talend.com/TalendRegisterWS/registerws.php"); //$NON-NLS-1$
|
||||
@@ -464,7 +464,7 @@ public class RegisterManagement {
|
||||
URL registURL = null;
|
||||
try {
|
||||
// UNIQUE_ID
|
||||
String uniqueId = DefaultTokenCollector.calcUniqueId();
|
||||
String uniqueId = DefaultTokenCollector.hashUniqueId();
|
||||
uniqueId = uniqueId.replace("#", "%23");
|
||||
uniqueId = uniqueId.replace("$", "%24");
|
||||
uniqueId = uniqueId.replace("%", "%25");
|
||||
|
||||
@@ -616,6 +616,7 @@ public class ImportExportHandlersManager {
|
||||
itemRecord.getProperty().setId(id);
|
||||
try {
|
||||
changeIdManager.mapOldId2NewId(oldId, id);
|
||||
ChangeIdManager.oldANDNewIdMap.put(oldId, id);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
@@ -1008,6 +1009,8 @@ public class ImportExportHandlersManager {
|
||||
TimeMeasure.display = false;
|
||||
TimeMeasure.displaySteps = false;
|
||||
TimeMeasure.measureActive = false;
|
||||
|
||||
ChangeIdManager.oldANDNewIdMap.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -808,7 +808,7 @@ public class ImportBasicHandler extends AbstractImportExecutableHandler {
|
||||
tmpItem.getProperty().setAuthor(null);
|
||||
}
|
||||
}
|
||||
|
||||
path = changePathByNewID(path, tmpItem);
|
||||
beforeCreatingItem(selectedImportItem);
|
||||
|
||||
final RepositoryObjectCache repObjectcache = ImportCacheHelper.getInstance().getRepObjectcache();
|
||||
@@ -996,6 +996,10 @@ public class ImportBasicHandler extends AbstractImportExecutableHandler {
|
||||
protected void beforeCreatingItem(ImportItem selectedImportItem) {
|
||||
// noting to do specially.
|
||||
}
|
||||
|
||||
protected IPath changePathByNewID(IPath path, Item item) {
|
||||
return path;
|
||||
}
|
||||
|
||||
protected void afterCreatedItem(ResourcesManager resManager, ImportItem selectedImportItem) throws Exception {
|
||||
|
||||
|
||||
@@ -71,6 +71,8 @@ public class ChangeIdManager {
|
||||
private Map<String, Collection<String>> refIds2ItemIdsMap = new HashMap<String, Collection<String>>();
|
||||
|
||||
private Map<String, String> oldId2NewIdMap = new HashMap<String, String>();
|
||||
|
||||
public static Map<String, String> oldANDNewIdMap = new HashMap<String, String>();
|
||||
|
||||
private Set<String> idsNeed2CheckRefs = new HashSet<String>();
|
||||
|
||||
|
||||
@@ -1346,11 +1346,17 @@ public class LocalRepositoryFactory extends AbstractEMFRepositoryFactory impleme
|
||||
|
||||
// Getting the folder :
|
||||
try {
|
||||
IFolder folder = ResourceUtils.getFolder(fsProject, completePath, true);
|
||||
IFolder folder = null;
|
||||
try {
|
||||
folder = ResourceUtils.getFolder(fsProject, completePath, true);
|
||||
} catch (PersistenceException e) {
|
||||
}
|
||||
// changed by hqzhang for TDI-20600, FolderHelper.deleteFolder will fire the DeletedFolderListener in
|
||||
// ProjectRepoAbstractContentProvider class to refresh the node, if don't delete resource first, the deleted
|
||||
// foler display in repository view
|
||||
deleteResource(folder);
|
||||
if (folder != null && folder.exists()) {
|
||||
deleteResource(folder);
|
||||
}
|
||||
} finally {
|
||||
// even if the folder do not exist anymore, clean the list on the project
|
||||
getFolderHelper(project.getEmfProject()).deleteFolder(completePath);
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<version>1.2.17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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">
|
||||
<!--
|
||||
Copyright (C) 2010 Talend Inc. - www.talend.com
|
||||
<!--
|
||||
Copyright (C) 2010 Talend Inc. - www.talend.com
|
||||
-->
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -40,7 +40,7 @@
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<version>1.2.17</version>
|
||||
<type>bundle</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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">
|
||||
<!--
|
||||
Copyright (C) 2010 Talend Inc. - www.talend.com
|
||||
<!--
|
||||
Copyright (C) 2010 Talend Inc. - www.talend.com
|
||||
-->
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -40,7 +40,7 @@
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<version>1.2.17</version>
|
||||
<type>bundle</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -73,21 +73,6 @@ public class VersionUtilsTest {
|
||||
assertEquals(talendVersion, VersionUtils.getMojoVersion("ci.builder.version"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPluginVersion__MojoProperties() throws Exception {
|
||||
String talendVersion = VersionUtils.getTalendVersion();
|
||||
assertEquals(talendVersion + "-SNAPSHOT", VersionUtils.getMojoVersion("ci.builder.version"));
|
||||
if (mojo_properties.exists()) {
|
||||
mojo_properties.delete();
|
||||
}
|
||||
mojo_properties.createNewFile();
|
||||
setPropertiesValue(mojo_properties, "ci.builder.version", talendVersion + "-patch1");
|
||||
assertEquals(talendVersion + "-patch1", VersionUtils.getMojoVersion("ci.builder.version"));
|
||||
|
||||
setPropertiesValue(mojo_properties, "ci.builder.version", "6.0.0");
|
||||
assertEquals(talendVersion + "-SNAPSHOT", VersionUtils.getMojoVersion("ci.builder.version"));
|
||||
}
|
||||
|
||||
private void setPropertiesValue(File propertiesFile, String key, String value) throws Exception {
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty(key, value);
|
||||
|
||||
@@ -12,11 +12,16 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.model.utils;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.talend.core.model.context.JobContext;
|
||||
@@ -25,6 +30,8 @@ import org.talend.core.model.context.JobContextParameter;
|
||||
import org.talend.core.model.metadata.types.JavaTypesManager;
|
||||
import org.talend.core.model.process.IContext;
|
||||
import org.talend.core.model.process.IContextParameter;
|
||||
import org.talend.core.model.repository.IRepositoryPrefConstants;
|
||||
import org.talend.core.prefs.ITalendCorePrefConstants;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.TalendFileFactory;
|
||||
@@ -97,6 +104,8 @@ public class ContextParameterUtilsTest {
|
||||
|
||||
@Test
|
||||
public void testGetVariableFromCode4String() {
|
||||
IEclipsePreferences coreUIPluginNode = new InstanceScope().getNode(ITalendCorePrefConstants.CoreUIPlugin_ID);
|
||||
coreUIPluginNode.putBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, true);
|
||||
Assert.assertNull(ContextParameterUtils.getVariableFromCode(""));
|
||||
Assert.assertNull(ContextParameterUtils.getVariableFromCode("abc"));
|
||||
Assert.assertNull(ContextParameterUtils.getVariableFromCode("123"));
|
||||
@@ -116,10 +125,21 @@ public class ContextParameterUtilsTest {
|
||||
Assert.assertEquals("Podgląd", ContextParameterUtils.getVariableFromCode("context.Podgląd"));
|
||||
Assert.assertEquals("Română", ContextParameterUtils.getVariableFromCode("context.Română"));
|
||||
Assert.assertEquals("русский", ContextParameterUtils.getVariableFromCode("context.русский"));
|
||||
|
||||
coreUIPluginNode.putBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
|
||||
Assert.assertNull(ContextParameterUtils.getVariableFromCode("context.汉语"));
|
||||
Assert.assertNull(ContextParameterUtils.getVariableFromCode("context.日本語"));
|
||||
Assert.assertNull(ContextParameterUtils.getVariableFromCode("context.Ελληνική"));
|
||||
Assert.assertNull(ContextParameterUtils.getVariableFromCode("context.Français"));
|
||||
Assert.assertNull(ContextParameterUtils.getVariableFromCode("context.Podgląd"));
|
||||
Assert.assertNull(ContextParameterUtils.getVariableFromCode("context.Română"));
|
||||
Assert.assertNull(ContextParameterUtils.getVariableFromCode("context.русский"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetVariableFromCode4Context() {
|
||||
IEclipsePreferences coreUIPluginNode = new InstanceScope().getNode(ITalendCorePrefConstants.CoreUIPlugin_ID);
|
||||
coreUIPluginNode.putBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, true);
|
||||
String var = ContextParameterUtils.getVariableFromCode("context.abc");
|
||||
Assert.assertEquals("abc", var);
|
||||
|
||||
@@ -254,6 +274,16 @@ public class ContextParameterUtilsTest {
|
||||
|
||||
var = ContextParameterUtils.getVariableFromCode("context.русский-123");
|
||||
Assert.assertEquals("русский", var);
|
||||
|
||||
coreUIPluginNode.putBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
|
||||
Assert.assertNull(ContextParameterUtils.getVariableFromCode("context.マイSQL"));
|
||||
Assert.assertNull(ContextParameterUtils.getVariableFromCode("context.汉语"));
|
||||
Assert.assertNull(ContextParameterUtils.getVariableFromCode("context.Ελληνική"));
|
||||
Assert.assertNull(ContextParameterUtils.getVariableFromCode("context.Română_123"));
|
||||
Assert.assertNull(ContextParameterUtils.getVariableFromCode("context.русский"));
|
||||
Assert.assertNull(ContextParameterUtils.getVariableFromCode("context.マイSQL"));
|
||||
Assert.assertNull(ContextParameterUtils.getVariableFromCode("context.Podgląd"));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -281,6 +311,8 @@ public class ContextParameterUtilsTest {
|
||||
|
||||
@Test
|
||||
public void testIsValidParameterName() {
|
||||
IEclipsePreferences coreUIPluginNode = new InstanceScope().getNode(ITalendCorePrefConstants.CoreUIPlugin_ID);
|
||||
coreUIPluginNode.putBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, true);
|
||||
assertTrue(ContextParameterUtils.isValidParameterName("abc"));
|
||||
assertTrue(ContextParameterUtils.isValidParameterName("abc123"));
|
||||
assertTrue(ContextParameterUtils.isValidParameterName("abc_123"));
|
||||
@@ -290,6 +322,22 @@ public class ContextParameterUtilsTest {
|
||||
assertFalse(ContextParameterUtils.isValidParameterName("abc%de"));
|
||||
assertFalse(ContextParameterUtils.isValidParameterName("a*&^e"));
|
||||
assertFalse(ContextParameterUtils.isValidParameterName("123abc"));
|
||||
assertTrue(ContextParameterUtils.isValidParameterName("中文"));
|
||||
assertTrue(ContextParameterUtils.isValidParameterName("日本語"));
|
||||
assertTrue(ContextParameterUtils.isValidParameterName("Ελληνική"));
|
||||
assertTrue(ContextParameterUtils.isValidParameterName("Français"));
|
||||
assertTrue(ContextParameterUtils.isValidParameterName("Podgląd"));
|
||||
assertTrue(ContextParameterUtils.isValidParameterName("Română"));
|
||||
assertTrue(ContextParameterUtils.isValidParameterName("русский"));
|
||||
|
||||
coreUIPluginNode.putBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
|
||||
assertFalse(ContextParameterUtils.isValidParameterName("中文"));
|
||||
assertFalse(ContextParameterUtils.isValidParameterName("日本語"));
|
||||
assertFalse(ContextParameterUtils.isValidParameterName("Ελληνική"));
|
||||
assertFalse(ContextParameterUtils.isValidParameterName("Français"));
|
||||
assertFalse(ContextParameterUtils.isValidParameterName("Podgląd"));
|
||||
assertFalse(ContextParameterUtils.isValidParameterName("Română"));
|
||||
assertFalse(ContextParameterUtils.isValidParameterName("русский"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2020 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.designer.maven.tools.creator;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/*
|
||||
* Created by bhe on May 9, 2020
|
||||
*/
|
||||
public class CreateMavenJobPomTest {
|
||||
|
||||
@Test
|
||||
public void testNormalizeSpaces() throws Exception {
|
||||
String inputSh = "#!/bin/sh\n" + "cd `dirname $0`\n" + "ROOT_PATH=`pwd`\n"
|
||||
+ "java -Dtalend.component.manager.m2.repository=$ROOT_PATH/../lib -cp .:$ROOT_PATH:$ROOT_PATH/../lib/routines.jar:$ROOT_PATH/../lib/log4j-slf4j-impl-2.12.1.jar:$ROOT_PATH/../lib/log4j-api-2.12.1.jar:$ROOT_PATH/../lib/log4j-core-2.12.1.jar:$ROOT_PATH/../lib/antlr-runtime-3.5.2.jar:$ROOT_PATH/../lib/org.talend.dataquality.parser.jar:$ROOT_PATH/../lib/crypto-utils.jar:$ROOT_PATH/../lib/talend_file_enhanced_20070724.jar:$ROOT_PATH/../lib/slf4j-api-1.7.25.jar:$ROOT_PATH/../lib/dom4j-2.1.1.jar:$ROOT_PATH/nojvmparam_0_1.jar: local_project.nojvmparam_0_1.noJVMparam --context=Default \"$@\"\n";
|
||||
String expectSh = "#!/bin/sh\n" + "cd `dirname $0`\n" + "ROOT_PATH=`pwd`\n"
|
||||
+ "java -Dtalend.component.manager.m2.repository=$ROOT_PATH/../lib -cp .:$ROOT_PATH:$ROOT_PATH/../lib/routines.jar:$ROOT_PATH/../lib/log4j-slf4j-impl-2.12.1.jar:$ROOT_PATH/../lib/log4j-api-2.12.1.jar:$ROOT_PATH/../lib/log4j-core-2.12.1.jar:$ROOT_PATH/../lib/antlr-runtime-3.5.2.jar:$ROOT_PATH/../lib/org.talend.dataquality.parser.jar:$ROOT_PATH/../lib/crypto-utils.jar:$ROOT_PATH/../lib/talend_file_enhanced_20070724.jar:$ROOT_PATH/../lib/slf4j-api-1.7.25.jar:$ROOT_PATH/../lib/dom4j-2.1.1.jar:$ROOT_PATH/nojvmparam_0_1.jar: local_project.nojvmparam_0_1.noJVMparam --context=Default \"$@\"\n";
|
||||
|
||||
String inputBat = "%~d0\n" + "cd %~dp0\n"
|
||||
+ "java -Dtalend.component.manager.m2.repository=\"%cd%/../lib\" -cp .;../lib/routines.jar;../lib/log4j-slf4j-impl-2.12.1.jar;../lib/log4j-api-2.12.1.jar;../lib/log4j-core-2.12.1.jar;../lib/antlr-runtime-3.5.2.jar;../lib/org.talend.dataquality.parser.jar;../lib/crypto-utils.jar;../lib/talend_file_enhanced_20070724.jar;../lib/slf4j-api-1.7.25.jar;../lib/dom4j-2.1.1.jar;nojvmparam_0_1.jar; local_project.nojvmparam_0_1.noJVMparam --context=Default %*\n";
|
||||
String expectBat = "%~d0\n" + "cd %~dp0\n"
|
||||
+ "java -Dtalend.component.manager.m2.repository=\"%cd%/../lib\" -cp .;../lib/routines.jar;../lib/log4j-slf4j-impl-2.12.1.jar;../lib/log4j-api-2.12.1.jar;../lib/log4j-core-2.12.1.jar;../lib/antlr-runtime-3.5.2.jar;../lib/org.talend.dataquality.parser.jar;../lib/crypto-utils.jar;../lib/talend_file_enhanced_20070724.jar;../lib/slf4j-api-1.7.25.jar;../lib/dom4j-2.1.1.jar;nojvmparam_0_1.jar; local_project.nojvmparam_0_1.noJVMparam --context=Default %*\n";
|
||||
|
||||
String actualSh = CreateMavenJobPom.normalizeSpaces(inputSh);
|
||||
assertEquals(expectSh, actualSh);
|
||||
|
||||
String actualBat = CreateMavenJobPom.normalizeSpaces(inputBat);
|
||||
assertEquals(expectBat, actualBat);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user