Compare commits

...

8 Commits

Author SHA1 Message Date
Chao MENG
47ab3623d1 fix(TUP-35616): Problems on the \ processing on the password field after TUP-32821 (#5320)
* fix(TUP-35616): Problems on the \ processing on the password field after
TUP-32821
https://jira.talendforge.org/browse/TUP-35616

* Update ElementParameterParser.java

* fix(TUP-35616): Problems on the \ processing on the password field after
TUP-32821
https://jira.talendforge.org/browse/TUP-35616

* fix(TUP-35616): Problems on the \ processing on the password field after
TUP-32821
https://jira.talendforge.org/browse/TUP-35616

* fix(TUP-35616): Problems on the \ processing on the password field after
TUP-32821
https://jira.talendforge.org/browse/TUP-35616
2022-05-19 19:25:20 +08:00
hcyi
777c742a2a fix(TUP-35607):should no prompt for analysis when DB connection have context group with Multiple db set (#5311)
* fix(TUP-35607):should no prompt for analysis when DB connection have
context group with Multiple db set

* fix(TUP-35607):should no prompt for analysis when DB connection have
context group with Multiple db set

* fix(TUP-35607):should no prompt for analysis when DB connection have
context group with Multiple db set
2022-05-19 17:39:10 +08:00
Jane Ding
b3725df710 fix(TUP-33119):SuggestionValues.Item label is received at runtime (#5304)
instead of id when used inside table
https://jira.talendforge.org/browse/TUP-33119
2022-05-17 17:44:20 +08:00
Jane Ding
5e51256323 Revert "fix(TUP-33119):SuggestionValues.Item label is received at runtime (#5139)" (#5301) (#5302)
This reverts commit 9d2f2d25ae.
2022-05-16 16:07:37 +08:00
Emmanuel GALLOIS
f4a0029d79 feat(TDI-47911): bump component-runtime to 1.44.3 (#5274) (#5300) 2022-05-13 10:06:20 +02:00
Liu Xinquan
4a3effc565 Revert "chore(TDQ-20339) improve mvn path: org.talend.libraries.jfreechart (#5283)" (#5299)
This reverts commit ed91d67ccc.
2022-05-13 11:51:43 +08:00
bhe-talendbj
84232ab92f fix(TUP-35541): replace log4j-1.x (#5293) 2022-05-13 10:34:07 +08:00
Jane Ding
ee04ccc6ef fix(TUP-35538):failed to run job when studio is Chinese on R04 (#5295) (#5296)
* fix(TUP-35538):failed to run job when studio is Chinese on R04
https://jira.talendforge.org/browse/TUP-35538

* fix(TUP-35538):failed to run job when studio is Chinese on R04
https://jira.talendforge.org/browse/TUP-35538
2022-05-13 10:33:11 +08:00
15 changed files with 138 additions and 64 deletions

View File

@@ -46,7 +46,7 @@ public interface ITaCoKitService {
boolean isTaCoKitType(Object repoType);
Map<String, String> getParameterSuggestionValues(Object parameter, int rowNumber);
boolean isValueSelectionParameter(Object parameter);
public static ITaCoKitService getInstance() {
BundleContext bc = FrameworkUtil.getBundle(ITaCoKitService.class).getBundleContext();

View File

@@ -69,9 +69,9 @@ public enum EDatabaseVersion4Drivers {
INFORMIX(new DbVersion4Drivers(EDatabaseTypeName.INFORMIX, "ifxjdbc.jar")), //$NON-NLS-1$
SAS_9_1(new DbVersion4Drivers(EDatabaseTypeName.SAS, "SAS 9.1", "SAS_9.1", new String[] { "sas.core.jar", //$NON-NLS-1$
"sas.intrnet.javatools.jar", "sas.svc.connection.jar", "org.apache.log4j_1.2.15.v201012070815.jar" })), //$NON-NLS-1$ //$NON-NLS-2$
"sas.intrnet.javatools.jar", "sas.svc.connection.jar", "reload4j-1.2.19.jar" })), //$NON-NLS-1$ //$NON-NLS-2$
SAS_9_2(new DbVersion4Drivers(EDatabaseTypeName.SAS,
"SAS 9.2", "SAS_9.2", new String[] { "sas.core.jar", "sas.security.sspi.jar", "sas.svc.connection.jar", "org.apache.log4j_1.2.15.v201012070815.jar" })), //$NON-NLS-1$ //$NON-NLS-2$
"SAS 9.2", "SAS_9.2", new String[] { "sas.core.jar", "sas.security.sspi.jar", "sas.svc.connection.jar", "reload4j-1.2.19.jar" })), //$NON-NLS-1$ //$NON-NLS-2$
SAPHana(new DbVersion4Drivers(EDatabaseTypeName.SAPHana, "HDB 1.0", "HDB_1_0", "ngdbc.jar")), //$NON-NLS-1$
// MYSQL, add for 9594
MYSQL_8(new DbVersion4Drivers(EDatabaseTypeName.MYSQL, "MySQL 8", "MYSQL_8", "mysql-connector-java-8.0.18.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -84,7 +84,7 @@ public enum EDatabaseVersion4Drivers {
MSSQL_PROP(new DbVersion4Drivers(EDatabaseTypeName.MSSQL,
"Microsoft", "MSSQL_PROP", //$NON-NLS-1$ //$NON-NLS-2$
new String[] { "mssql-jdbc.jar", "slf4j-api-1.7.29.jar", "slf4j-log4j12-1.7.29.jar", "msal4j-1.11.0.jar", //$NON-NLS-1$
"oauth2-oidc-sdk-9.7.jar", "log4j-1.2.17.jar", "jackson-core-2.13.2.jar",
"oauth2-oidc-sdk-9.7.jar", "reload4j-1.2.19.jar", "jackson-core-2.13.2.jar",
"jackson-databind-2.13.2.2.jar", "jackson-annotations-2.13.2.jar", "jcip-annotations-1.0-1.jar",
"json-smart-2.4.7.jar", "nimbus-jose-jwt-9.9.3.jar", "accessors-smart-2.4.7.jar", "asm-9.1.jar",
"content-type-2.1.jar", "lang-tag-1.5.jar" })),

View File

@@ -17,7 +17,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.text.StringEscapeUtils;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.util.EcoreUtil;
@@ -128,7 +127,7 @@ public final class ElementParameterParser {
if (canEncryptValue(value)) {
try {
String removeQuotes = TalendQuoteUtils.removeQuotes(value);
removeQuotes = StringEscapeUtils.unescapeJava(removeQuotes);
removeQuotes = TalendQuoteUtils.checkSlashAndRemoveQuotation(removeQuotes);
return TalendQuoteUtils.addQuotes(PasswordEncryptUtil.encryptPasswordHex(removeQuotes),
TalendQuoteUtils.QUOTATION_MARK);
} catch (Exception e) {

View File

@@ -1,6 +1,6 @@
AbstractBrandingService_job_license_header_content=// ============================================================================\n//\n// \u7248\u6743\u6240\u6709 (c) 2005-2010, Talend Inc.\n//\n\u6B64\u6E90\u4EE3\u7801\u5DF2\u7531_{0} \u81EA\u52A8\u751F\u6210\n// / JobDesigner (CodeGenerator \u7248\u672C {1})\n// \u60A8\u53EF\u4EE5\u8BBF\u95EE www.talend.com \u4E86\u89E3 Talend \u4EA7\u54C1\u7684\u66F4\u591A\u4FE1\u606F\u3002\n// \u60A8\u53EF\u4EE5\u6839\u636E GNU LGPL \u8BB8\u53EF\u8BC1\u6761\u6B3E\u5206\u53D1\u6B64\u4EE3\u7801\n// http://www.gnu.org/licenses/lgpl.html)\u3002\n//\n// ============================================================================
AbstractBrandingService.routines_license_header_content2014=\u7248\u6743\u6240\u6709 (c) 2006-2014, Talend Inc.\n//\n\u6B64\u6E90\u4EE3\u7801\u5DF2\u7531_{0} \u81EA\u52A8\u751F\u6210\n// CodeGenerator \u7248\u672C {1}\n// \u60A8\u53EF\u4EE5\u8BBF\u95EE www.talend.com \u4E86\u89E3 Talend \u4EA7\u54C1\u7684\u66F4\u591A\u4FE1\u606F\u3002\n// \u60A8\u53EF\u4EE5\u6839\u636E GNU LGPL \u8BB8\u53EF\u8BC1\u6761\u6B3E\u5206\u53D1\u6B64\u4EE3\u7801\n// http://www.gnu.org/licenses/lgpl.html)\u3002
AbstractBrandingService.routines_license_header_content2014=\u7248\u6743\u6240\u6709 (c) 2006-2014, Talend Inc.\n//\u6B64\u6E90\u4EE3\u7801\u5DF2\u7531_{0} \u81EA\u52A8\u751F\u6210\n// CodeGenerator \u7248\u672C {1}\n// \u60A8\u53EF\u4EE5\u8BBF\u95EE www.talend.com \u4E86\u89E3 Talend \u4EA7\u54C1\u7684\u66F4\u591A\u4FE1\u606F\u3002\n// \u60A8\u53EF\u4EE5\u6839\u636E GNU LGPL \u8BB8\u53EF\u8BC1\u6761\u6B3E\u5206\u53D1\u6B64\u4EE3\u7801\n// http://www.gnu.org/licenses/lgpl.html)\u3002
AbstractComponentsProvider.folderNotExist=\u6587\u4EF6\u5939 {0} \u4E0D\u5B58\u5728\u3002
AbstractItemMigrationTask.taskFailed=\u8FC1\u79FB\u4EFB\u52A1 {0} \u5728\u8FC1\u79FB\u9879\u76EE {1} \u65F6\u5931\u8D25
AdvancedSocketFactory.failedInitial=\u9519\u8BEF\uFF1A\u65E0\u6CD5\u521D\u59CB\u5316\uFF1A

View File

@@ -44,6 +44,8 @@ public interface IMetadataManagmentUiService extends IService {
public IContext promptConfirmLauch(Shell shell, List<IContext> contexts);
public boolean promptConfirmLauch(Shell shell, IContext context);
public boolean isPromptNeeded(List<IContext> contexts);
}

View File

@@ -1,5 +1,5 @@
AbstractBrandingService_job_license_header_content=// ============================================================================\n//\n// \u7248\u6743\u6240\u6709 (c) 2005-2011\uFF0CTalend Inc.\n//\n\u6B64\u6E90\u4EE3\u7801\u5DF2\u7531_{0} \u81EA\u52A8\u751F\u6210\n// / JobDesigner (CodeGenerator \u7248\u672C {1})\n// \u60A8\u53EF\u4EE5\u8BBF\u95EE www.talend.com \u4E86\u89E3 Talend \u4EA7\u54C1\u7684\u66F4\u591A\u4FE1\u606F\u3002\n// \u60A8\u53EF\u4EE5\u6839\u636E GNU LGPL \u8BB8\u53EF\u8BC1\u6761\u6B3E\u5206\u53D1\u6B64\u4EE3\u7801\n// http://www.gnu.org/licenses/lgpl.html)\u3002\n//\n// ============================================================================
AbstractBrandingService.routines_license_header_content=\u7248\u6743\u6240\u6709 (c) 2005-2011\uFF0CTalend Inc.\n//\n\u6B64\u6E90\u4EE3\u7801\u5DF2\u7531_{0} \u81EA\u52A8\u751F\u6210\n// CodeGenerator \u7248\u672C {1}\n// \u60A8\u53EF\u4EE5\u8BBF\u95EE www.talend.com \u4E86\u89E3 Talend \u4EA7\u54C1\u7684\u66F4\u591A\u4FE1\u606F\u3002\n// \u60A8\u53EF\u4EE5\u6839\u636E GNU LGPL \u8BB8\u53EF\u8BC1\u6761\u6B3E\u5206\u53D1\u6B64\u4EE3\u7801\n// http://www.gnu.org/licenses/lgpl.html)\u3002
AbstractBrandingService.routines_license_header_content=\u7248\u6743\u6240\u6709 (c) 2005-2011\uFF0CTalend Inc.\n//\u6B64\u6E90\u4EE3\u7801\u5DF2\u7531_{0} \u81EA\u52A8\u751F\u6210\n// CodeGenerator \u7248\u672C {1}\n// \u60A8\u53EF\u4EE5\u8BBF\u95EE www.talend.com \u4E86\u89E3 Talend \u4EA7\u54C1\u7684\u66F4\u591A\u4FE1\u606F\u3002\n// \u60A8\u53EF\u4EE5\u6839\u636E GNU LGPL \u8BB8\u53EF\u8BC1\u6761\u6B3E\u5206\u53D1\u6B64\u4EE3\u7801\n// http://www.gnu.org/licenses/lgpl.html)\u3002
AbstractComponentsProvider.folderNotExist=\u6587\u4EF6\u5939 {0} \u4E0D\u5B58\u5728\u3002
AbstractItemMigrationTask.taskFailed=\u8FC1\u79FB\u4EFB\u52A1 {0} \u5728\u8FC1\u79FB\u9879\u76EE {1} \u65F6\u5931\u8D25
AdvancedSocketFactory.failedInitial=\u9519\u8BEF\uFF1A\u65E0\u6CD5\u521D\u59CB\u5316:

View File

@@ -13,18 +13,17 @@
<tcomp.version>${component-runtime.version}</tcomp.version>
<cxf.version>3.5.1</cxf.version>
<geronimo.version>1.0.2</geronimo.version>
<jackson.version>2.12.1</jackson.version>
<jcache.version>1.0.5</jcache.version>
<jcache_spec.version>1.0-alpha-1</jcache_spec.version>
<johnzon.version>1.2.16</johnzon.version>
<meecrowave.version>1.2.13</meecrowave.version>
<microprofile.version>1.2.1</microprofile.version>
<owb.version>2.0.26</owb.version>
<slf4j.version>1.7.32</slf4j.version>
<tomcat.version>9.0.59</tomcat.version>
<slf4j.version>1.7.33</slf4j.version>
<tomcat.version>9.0.62</tomcat.version>
<xbean.version>4.20</xbean.version>
<reload4j.version>1.2.19</reload4j.version>
<log4j2.version>2.17.1</log4j2.version>
<log4j2.version>2.17.2</log4j2.version>
<tycho.buildtimestamp.format>${timestamp}</tycho.buildtimestamp.format>
</properties>
<repositories>

View File

@@ -11,7 +11,7 @@
<packaging>pom</packaging>
<properties>
<tcomp.version>1.43.1</tcomp.version>
<tcomp.version>1.44.3</tcomp.version>
<slf4j.version>1.7.32</slf4j.version>
<reload4j.version>1.2.19</reload4j.version>
</properties>

View File

@@ -6,14 +6,14 @@
context="plugin:org.talend.libraries.jfreechart"
language="java"
message="Needed for jfreechart plugin"
name="jcommon-1.0.15.jar" mvn_uri="mvn:jfree/jcommon/1.0.15"
name="jcommon-1.0.15.jar" mvn_uri="mvn:org.talend.libraries/jcommon-1.0.15/6.0.0"
required="true">
</libraryNeeded>
<libraryNeeded
context="plugin:org.talend.libraries.jfreechart"
language="java"
message="Needed for jfreechart plugin"
name="jfreechart-1.0.12.jar" mvn_uri="mvn:jfree/jfreechart/1.0.12"
name="jfreechart-1.0.12.jar" mvn_uri="mvn:org.talend.libraries/jfreechart-1.0.12/6.0.0"
required="true">
</libraryNeeded>
<libraryNeeded

View File

@@ -86,6 +86,11 @@ public class MetadataManagmentUiService implements IMetadataManagmentUiService {
return ConnectionContextHelper.promptConfirmLauch(shell, contexts);
}
@Override
public boolean promptConfirmLauch(Shell shell, IContext context) {
return ConnectionContextHelper.promptConfirmLauch(shell, context);
}
@Override
public boolean isPromptNeeded(List<IContext> contexts) {
return ConnectionContextHelper.isPromptNeeded(contexts);

View File

@@ -92,6 +92,12 @@ public class PromptDialog extends SelectionDialog {
private Composite child;
public PromptDialog(Shell parentShell, IContext context) {
super(parentShell);
initDialog(context, canCancel, Messages.getString("ContextSetsSelectionDialog.Messages")); //$NON-NLS-1$
initSets();
}
public PromptDialog(Shell parentShell, ContextItem contextItem) {
super(parentShell);
initDialog(contextItem, canCancel, Messages.getString("ContextSetsSelectionDialog.Messages")); //$NON-NLS-1$
@@ -140,6 +146,8 @@ public class PromptDialog extends SelectionDialog {
}
contextSetsList.add(name);
}
} else if (source instanceof IContext) {
currentContext = (IContext) source;
}
}
}
@@ -200,21 +208,21 @@ public class PromptDialog extends SelectionDialog {
}
}
private Control createSelectionArea(Composite parent) {
Composite inner = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout();
gridLayout.marginHeight = 0;
inner.setLayout(gridLayout);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.minimumWidth = 220;
gridData.minimumHeight = 100;
inner.setLayoutData(gridData);
private void createSelectionArea(Composite parent) {
if (source != null && (source instanceof ContextItem || source instanceof List)) {
Composite inner = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout();
gridLayout.marginHeight = 0;
inner.setLayout(gridLayout);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.minimumWidth = 220;
gridData.minimumHeight = 100;
inner.setLayoutData(gridData);
contextCombo = new LabelledCombo(inner, Messages.getString("PromptDialog.context.environments.name"), null, //$NON-NLS-1$
contextSetsList, true);
contextCombo.setText(defalutContext + DEFAULT_FLAG);
return inner;
contextCombo = new LabelledCombo(inner, Messages.getString("PromptDialog.context.environments.name"), null, //$NON-NLS-1$
contextSetsList, true);
contextCombo.setText(defalutContext + DEFAULT_FLAG);
}
}
private void createContextArea(IContext currentContext, Composite parent) {
@@ -436,21 +444,23 @@ public class PromptDialog extends SelectionDialog {
}
protected void addFieldsListeners() {
contextCombo.addModifyListener(new ModifyListener() {
if (contextCombo != null) {
contextCombo.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
selectedContext = contextCombo.getItem(contextCombo.getSelectionIndex());
contextComp.dispose();
contextComp = new Composite(child, SWT.NONE);
contextComp.setLayout(new GridLayout(1, false));
contextComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
createContextArea(getCloneContext(), contextComp);
child.layout();
child.getParent().layout();
contextComp.layout();
}
});
@Override
public void modifyText(final ModifyEvent e) {
selectedContext = contextCombo.getItem(contextCombo.getSelectionIndex());
contextComp.dispose();
contextComp = new Composite(child, SWT.NONE);
contextComp.setLayout(new GridLayout(1, false));
contextComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
createContextArea(getCloneContext(), contextComp);
child.layout();
child.getParent().layout();
contextComp.layout();
}
});
}
}
@Override
@@ -485,7 +495,11 @@ public class PromptDialog extends SelectionDialog {
Point dialogSize = new Point(X_POSITION, Math.min((height * nbParams) + Y_POSITION, 400));
setSize(newShell, dialogSize);
newShell.setText(Messages.getString("PromptDialog.choose.title")); //$NON-NLS-1$
if (source != null && source instanceof IContext) {
newShell.setText(Messages.getString("PromptDialog.title", currentContext.getName())); //$NON-NLS-1$
} else {
newShell.setText(Messages.getString("PromptDialog.choose.title")); //$NON-NLS-1$
}
}
public IContext getCloneContext() {

View File

@@ -2225,4 +2225,38 @@ public final class ConnectionContextHelper {
}
return continueLaunch;
}
public static boolean promptConfirmLauch(Shell shell, IContext context) {
boolean continueLaunch = true;
int nbValues = 0;
Assert.isNotNull(context);
// Prompt for context values ?
for (IContextParameter parameter : context.getContextParameterList()) {
if (parameter.isPromptNeeded()) {
nbValues++;
}
}
if (nbValues > 0) {
IContext contextCopy = context.clone();
PromptDialog promptDialog = new PromptDialog(shell, contextCopy);
if (promptDialog.open() == PromptDialog.OK) {
for (IContextParameter param : context.getContextParameterList()) {
boolean found = false;
IContextParameter paramCopy = null;
for (int i = 0; i < contextCopy.getContextParameterList().size() & !found; i++) {
paramCopy = contextCopy.getContextParameterList().get(i);
if (param.getName().equals(paramCopy.getName())) {
// param.setValueList(paramCopy.getValueList());
param.setInternalValue(paramCopy.getValue());
found = true;
}
}
}
} else {
continueLaunch = false;
}
}
return continueLaunch;
}
}

View File

@@ -1,5 +1,5 @@
AbstractBrandingService_job_license_header_content=// ============================================================================\n//\n// \u7248\u6743\u6240\u6709 (c) 2005-2010, Talend Inc.\n//\n\u6B64\u6E90\u4EE3\u7801\u5DF2\u7531_{0} \u81EA\u52A8\u751F\u6210\n// / JobDesigner (CodeGenerator \u7248\u672C {1})\n// \u60A8\u53EF\u4EE5\u8BBF\u95EE www.talend.com \u4E86\u89E3 Talend \u4EA7\u54C1\u7684\u66F4\u591A\u4FE1\u606F\u3002\n// \u60A8\u53EF\u4EE5\u6839\u636E GNU LGPL \u8BB8\u53EF\u8BC1\u6761\u6B3E\u5206\u53D1\u6B64\u4EE3\u7801\n// http://www.gnu.org/licenses/lgpl.html)\u3002\n//\n// ============================================================================
AbstractBrandingService.routines_license_header_content=\u7248\u6743\u6240\u6709 (c) 2005-2010, Talend Inc.\n//\n\u6B64\u6E90\u4EE3\u7801\u5DF2\u7531_{0} \u81EA\u52A8\u751F\u6210\n// CodeGenerator \u7248\u672C {1}\n// \u60A8\u53EF\u4EE5\u8BBF\u95EE www.talend.com \u4E86\u89E3 Talend \u4EA7\u54C1\u7684\u66F4\u591A\u4FE1\u606F\u3002\n// \u60A8\u53EF\u4EE5\u6839\u636E GNU LGPL \u8BB8\u53EF\u8BC1\u6761\u6B3E\u5206\u53D1\u6B64\u4EE3\u7801\n// http://www.gnu.org/licenses/lgpl.html)\u3002
AbstractBrandingService.routines_license_header_content=\u7248\u6743\u6240\u6709 (c) 2005-2010, Talend Inc.\n//\u6B64\u6E90\u4EE3\u7801\u5DF2\u7531_{0} \u81EA\u52A8\u751F\u6210\n// CodeGenerator \u7248\u672C {1}\n// \u60A8\u53EF\u4EE5\u8BBF\u95EE www.talend.com \u4E86\u89E3 Talend \u4EA7\u54C1\u7684\u66F4\u591A\u4FE1\u606F\u3002\n// \u60A8\u53EF\u4EE5\u6839\u636E GNU LGPL \u8BB8\u53EF\u8BC1\u6761\u6B3E\u5206\u53D1\u6B64\u4EE3\u7801\n// http://www.gnu.org/licenses/lgpl.html)\u3002
AbstractComponentsProvider.folderNotExist=\u6587\u4EF6\u5939 {0} \u4E0D\u5B58\u5728\u3002
AbstractItemMigrationTask.taskFailed=\u8FC1\u79FB\u4EFB\u52A1 {0} \u5728\u8FC1\u79FB\u9879\u76EE {1} \u65F6\u5931\u8D25
AdvancedSocketFactory.failedInitial=\u9519\u8BEF\uFF1A\u65E0\u6CD5\u521D\u59CB\u5316\uFF1A

View File

@@ -37,6 +37,7 @@ import org.apache.log4j.Logger;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.talend.commons.exception.CommonExceptionHandler;
import org.talend.commons.exception.ExceptionHandler;
@@ -1420,6 +1421,10 @@ public class MetadataConnectionUtils {
}
public static Connection prepareConection(Connection connection) {
return prepareConection(connection, false);
}
public static Connection prepareConection(Connection connection, boolean isDefaultContext) {
// TDQ-19889 msjian: check whether context confirmation needed popup,
// Enabling the prompt to context variables
if (!Platform.isRunning() || !connection.isContextMode()) {
@@ -1438,14 +1443,26 @@ public class MetadataConnectionUtils {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IMetadataManagmentUiService.class)) {
IMetadataManagmentUiService mmUIService = GlobalServiceRegister.getDefault()
.getService(IMetadataManagmentUiService.class);
promptConfirmLauch = mmUIService.promptConfirmLauch(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
copyConnection , contextItem);
Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
if (isDefaultContext) {
promptConfirmLauch = mmUIService.promptConfirmLauch(shell, jobContext);
} else {
promptConfirmLauch = mmUIService.promptConfirmLauch(shell, copyConnection, contextItem);
}
}
if (!promptConfirmLauch) {
return null;
} else {
if (isDefaultContext) {
// save the input prompt context values to cache
for (IContextParameter param : jobContext.getContextParameterList()) {
JavaSqlFactory.savePromptConVars2Cache(connection, param);
}
// set the input values to connection
JavaSqlFactory.setPromptContextValues(copyConnection);
}
}
}
JavaSqlFactory.haveSetPromptContextVars = true;
return copyConnection;
}

View File

@@ -87,46 +87,50 @@ public class ElementParameterParserTest {
elementParametersWithChildrens.add(parameter);
when(node.getElementParametersWithChildrens()).thenReturn(elementParametersWithChildrens);
// "ab"
// input: "ab"
String val = "\"ab\"";
when(parameter.getValue()).thenReturn(val);
assertEquals("ab",
decryptPassword(ElementParameterParser.getEncryptedValue(node, paramName)));
// "a\"b"
// input: "a\"b"
val = "\"a\\\"b\"";
when(parameter.getValue()).thenReturn(val);
assertEquals("a\"b",
decryptPassword(ElementParameterParser.getEncryptedValue(node, paramName)));
// "a\\b"
// input: "a\\b" (keep the studio behavior)
val = "\"a\\\\b\"";
when(parameter.getValue()).thenReturn(val);
assertEquals("a\\b",
decryptPassword(ElementParameterParser.getEncryptedValue(node, paramName)));
// "a\\\\b"
val = "\"a\\\\\\\\b\"";
when(parameter.getValue()).thenReturn(val);
assertEquals("a\\\\b",
decryptPassword(ElementParameterParser.getEncryptedValue(node, paramName)));
// "test"+context.mypassword + "a"
// input: "a\\\\b" (keep the studio behavior)
val = "\"a\\\\\\\\b\"";
when(parameter.getValue()).thenReturn(val);
assertEquals("a\\\\\\\\b",
decryptPassword(ElementParameterParser.getEncryptedValue(node, paramName)));
// input: "test"+context.mypassword + "a"
val = "\"test\"+context.mypassword + \"a\"";
when(parameter.getValue()).thenReturn(val);
assertEquals(val,
ElementParameterParser.getEncryptedValue(node, paramName));
// "a" + "b"
// input: "a" + "b"
val = "\"a\" + \"b\"";
when(parameter.getValue()).thenReturn(val);
assertEquals(val, ElementParameterParser.getEncryptedValue(node, paramName));
// "\\123456/"
// input: "\\123456/" (keep the studio behavior)
val = "\"\\\\123456/\"";
when(parameter.getValue()).thenReturn(val);
assertEquals("\\123456/",
assertEquals("\\\\123456/",
decryptPassword(ElementParameterParser.getEncryptedValue(node, paramName)));
// "\123456/"
// input: "\123456/" (keep the studio behavior)
val = "\"\\123456/\"";
final String exp = "\123456/";
final String exp = "\\123456/";
when(parameter.getValue()).thenReturn(val);
assertEquals(exp,
decryptPassword(ElementParameterParser.getEncryptedValue(node, paramName)));
// input: "\,\n123\"" (keep the studio behavior)
val = "\"\\,\\n123\\\"\"";
when(parameter.getValue()).thenReturn(val);
assertEquals("\\,\\n123\"", decryptPassword(ElementParameterParser.getEncryptedValue(node, paramName)));
}
@Test
@@ -148,8 +152,8 @@ public class ElementParameterParserTest {
// "c":"d"
// }
// "{\r\n\"a\":\"b\",\r\n\"c\":\"d\"\r\n}"
String val = "\"{\\r\\n\\\"a\\\":\\\"b\\\",\\r\\n\\\"c\\\":\\\"d\\\"\\r\\n}\"";
// "{\r\n\"a\":\"b\",\r\n\"c\":\"d\"\r\n}" (keep the studio behavior)
String val = "\"{\r\n\\\"a\\\":\\\"b\\\",\r\n\\\"c\\\":\\\"d\\\"\r\n}\"";
when(parameter.getValue()).thenReturn(val);
assertEquals("{\r\n\"a\":\"b\",\r\n\"c\":\"d\"\r\n}",
decryptPassword(ElementParameterParser.getEncryptedValue(node, paramName)));