Compare commits

...

2 Commits

Author SHA1 Message Date
vyu-talend
175bad96cf fix(TDI-49458):bump talend_file_enhanced.jar (#8623) 2023-03-30 22:08:33 +08:00
Jane Ding
8d6f6a9453 fix(TUP-37227):Issue building when items names too long (#8621)
* fix(TUP-37227):Issue building when items names too long (#8412)

* fix(TUP-37227):Issue building when items names too long
https://jira.talendforge.org/browse/TUP-37227

* fix(TUP-37227):Issue building when items names too long
https://jira.talendforge.org/browse/TUP-37227

* fix(TUP-37227):Issue building when items names too long
https://jira.talendforge.org/browse/TUP-37227

* fix(TUP-37227):Issue building when items names too long
https://jira.talendforge.org/browse/TUP-37227

* fix(TUP-38185):job run fail if joblet use db connection from other
joblet
https://jira.talendforge.org/browse/TUP-38185

* fix(TUP-38185):job run fail if joblet use db connection from other
joblet
https://jira.talendforge.org/browse/TUP-38185

* fix(TUP-38185):job run fail if joblet use db connection from other
joblet
https://jira.talendforge.org/browse/TUP-38185

* fix(TUP-38185):job run fail if joblet use db connection from other
joblet
https://jira.talendforge.org/browse/TUP-38185

* fix(TUP-38185):job run fail if joblet use db connection from other
joblet
https://jira.talendforge.org/browse/TUP-38185

* fix(TUP-38185):job run fail if joblet use db connection from other
joblet
https://jira.talendforge.org/browse/TUP-38185

* fix(TUP-38185):job run fail if joblet use db connection from other
joblet
https://jira.talendforge.org/browse/TUP-38185

* fix(TUP-38185):job run fail if joblet use db connection from other
joblet
https://jira.talendforge.org/browse/TUP-38185

* fix(TUP-38185):job run fail if joblet use db connection from other
joblet
https://jira.talendforge.org/browse/TUP-38185
2023-03-30 18:15:18 +08:00
25 changed files with 261 additions and 34 deletions

View File

@@ -149,7 +149,7 @@
<IMPORTS>
<IMPORT
NAME="Talen File Enhanced"
MODULE="talend_file_enhanced-1.2.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.2" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.2.jar"
MODULE="talend_file_enhanced-1.3.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.3" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.3.jar"
REQUIRED="true"
/>
</IMPORTS>

View File

@@ -149,7 +149,7 @@
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Talen File Enhanced"
MODULE="talend_file_enhanced-1.2.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.2" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.2.jar" REQUIRED="true" />
MODULE="talend_file_enhanced-1.3.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.3" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.3.jar" REQUIRED="true" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -213,7 +213,7 @@
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Talen File Enhanced"
MODULE="talend_file_enhanced-1.2.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.2" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.2.jar" REQUIRED="true" />
MODULE="talend_file_enhanced-1.3.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.3" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.3.jar" REQUIRED="true" />
<IMPORT NAME="Talend_CSV" MODULE="talendcsv.jar" MVN="mvn:org.talend.libraries/talendcsv/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.csv/lib/talendcsv.jar"
REQUIRED="true" />
</IMPORTS>

View File

@@ -131,7 +131,7 @@
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Talend File Enhanced" MODULE="talend_file_enhanced-1.2.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.2" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.2.jar" REQUIRED="true" />
<IMPORT NAME="Talend File Enhanced" MODULE="talend_file_enhanced-1.3.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.3" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.3.jar" REQUIRED="true" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -118,7 +118,7 @@
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Talen File Enhanced"
MODULE="talend_file_enhanced-1.2.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.2" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.2.jar" REQUIRED="true" />
MODULE="talend_file_enhanced-1.3.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.3" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.3.jar" REQUIRED="true" />
<IMPORT NAME="Talend_CSV" MODULE="talendcsv.jar" MVN="mvn:org.talend.libraries/talendcsv/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.csv/lib/talendcsv.jar" REQUIRED="true" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -81,7 +81,7 @@
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Talen File Enhanced" MODULE="talend_file_enhanced-1.2.jar" REQUIRED="true" />
<IMPORT NAME="Talen File Enhanced" MODULE="talend_file_enhanced-1.3.jar" REQUIRED="true" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -39,7 +39,7 @@
String skipEmptyRows = "true"; //("true").equals(ElementParameterParser.getValue(node, "__SKIP_EMPTY_ROWS__"));
boolean trimAll = ("true").equals(ElementParameterParser.getValue(node,"__TRIMALL__"));
String encoding = ElementParameterParser.getValue(node,"__ENCODING__");
//need to process rows longger than 100,000 characters, the property SafetySwitch(in talend_file_enhanced-1.2.jar) should be sent to false.(the default is true)
//need to process rows longger than 100,000 characters, the property SafetySwitch(in talend_file_enhanced-1.3.jar) should be sent to false.(the default is true)
//that means if check the option(true), the logic value of bSafetySwitch should be changed to false (negate the property)
boolean bSafetySwitch = !(("true").equals(ElementParameterParser.getValue(node, "__PROCESS_LONG_ROW__")));
String advancedSeparatorStr = ElementParameterParser.getValue(node, "__ADVANCED_SEPARATOR__");

View File

@@ -128,7 +128,7 @@
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Talen File Enhanced" MODULE="talend_file_enhanced-1.2.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.2" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.2.jar" REQUIRED="true" />
<IMPORT NAME="Talen File Enhanced" MODULE="talend_file_enhanced-1.3.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.3" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.3.jar" REQUIRED="true" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -69,7 +69,7 @@
String dieOnErrorStr = ElementParameterParser.getValue(node, "__DIE_ON_ERROR__");
boolean dieOnError = (dieOnErrorStr!=null&&!("").equals(dieOnErrorStr))?("true").equals(dieOnErrorStr):false;
//need to process rows longger than 100 000 characters, the property SafetySwitch(in talend_file_enhanced-1.2.jar) should be sent to false.(the default is true)
//need to process rows longger than 100 000 characters, the property SafetySwitch(in talend_file_enhanced-1.3.jar) should be sent to false.(the default is true)
//that means if check the option(true), the logic value of bSafetySwitch should be changed to false (XOR with 'true')
boolean bSafetySwitch = (("true").equals(ElementParameterParser.getValue(node, "__PROCESS_LONG_ROW__")) ^ true);
String advancedSeparatorStr = ElementParameterParser.getValue(node, "__ADVANCED_SEPARATOR__");

View File

@@ -258,7 +258,7 @@
<IMPORTS>
<IMPORT
NAME="Talen File Enhanced"
MODULE="talend_file_enhanced-1.2.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.2" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.2.jar"
MODULE="talend_file_enhanced-1.3.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.3" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.3.jar"
REQUIRED="true"
/>
</IMPORTS>

View File

@@ -175,7 +175,7 @@
<IMPORTS>
<IMPORT
NAME="Talen File Enhanced"
MODULE="talend_file_enhanced-1.2.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.2" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.2.jar"
MODULE="talend_file_enhanced-1.3.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.3" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.3.jar"
REQUIRED="true"
/>
</IMPORTS>

View File

@@ -79,7 +79,7 @@
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Talen File Enhanced" MODULE="talend_file_enhanced-1.2.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.2" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.2.jar" REQUIRED="true" />
<IMPORT NAME="Talen File Enhanced" MODULE="talend_file_enhanced-1.3.jar" MVN="mvn:org.talend.components.lib/talend_file_enhanced/1.3" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_file_enhanced-1.3.jar" REQUIRED="true" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -381,6 +381,9 @@ public enum EParameterName {
REPAINT("REPAINT"), //$NON-NLS-1$
// for joblet short unique name
SHORT_UNIQUE_NAME("SHORT_UNIQUE_NAME"), //$NON-NLS-1$
// for automap algorithms
LEVENSHTEIN("LEVENSHTEIN"), //$NON-NLS-1$
JACCARD("JACCARD"), //$NON-NLS-1$

View File

@@ -727,7 +727,7 @@ public class ConnectionCreateAction extends SelectionAction {
listArgs.add(meta.getTableName());
}
} else {
listArgs.add(node.getUniqueName());
listArgs.add(node.getUniqueName(false));
}
String baseName = node.getConnectionName();

View File

@@ -99,6 +99,7 @@ import org.talend.core.model.repository.ExternalNodesFactory;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.model.utils.ContextParameterUtils;
import org.talend.core.model.utils.NodeUtil;
import org.talend.core.model.utils.TalendPropertiesUtil;
import org.talend.core.model.utils.TalendTextUtils;
import org.talend.core.prefs.ITalendCorePrefConstants;
import org.talend.core.repository.model.ProxyRepositoryFactory;
@@ -608,6 +609,23 @@ public class Node extends Element implements IGraphicalNode {
}
setPropertyValue(EParameterName.UNIQUE_NAME.getName(), uniqueName2);
IElementParameter shortUniqueNameParam = getElementParameter(EParameterName.SHORT_UNIQUE_NAME.getName());
if (shortUniqueNameParam != null) {
// Only for SHORT_UNIQUE_NAME element parameter exist.
// Joblet SHORT_UNIQUE_NAME init in AbstractJobletComponent.createElementParameters(INode)
String shortUniqueName = "";
if (shortUniqueNameParam.getValue() != null && !"".equals(shortUniqueNameParam.getValue())) {
shortUniqueName = (String) shortUniqueNameParam.getValue();
}
if (!reloadingComponent && shortUniqueName != null
&& (shortUniqueNameParam.getValue() == null || "".equals(shortUniqueNameParam.getValue()))) {
shortUniqueName = ((Process) getProcess()).generateUniqueNodeName(this, true);
((Process) getProcess()).addUniqueNodeName(shortUniqueName);
}
setPropertyValue(EParameterName.SHORT_UNIQUE_NAME.getName(), shortUniqueName);
}
/*
* for implements [TESB-10335], need to replace "__NODE_UNIQUE_NAME__" to node unique name in expression.
*/
@@ -876,17 +894,28 @@ public class Node extends Element implements IGraphicalNode {
*/
@Override
public String getUniqueName() {
return getUniqueName(TalendPropertiesUtil.isEnabledUseShortJobletName());
}
public String getUniqueName(boolean enableShortName) {
String uniqueName = null;
IElementParameter param = getElementParameter(EParameterName.UNIQUE_NAME.getName());
if (param != null) {
uniqueName = (String) param.getValue();
}
if (enableShortName) {
IElementParameter parameter = getElementParameter(EParameterName.SHORT_UNIQUE_NAME.getName());
if (parameter != null) {
uniqueName = (String) parameter.getValue();
}
}
return uniqueName;
}
// can only be set with the properties
private void setUniqueName(String uniqueName) {
((Process) getProcess()).removeUniqueNodeName(getUniqueName());
((Process) getProcess()).removeUniqueNodeName(getUniqueName(false));
((Process) getProcess()).addUniqueNodeName(uniqueName);
}
@@ -2074,7 +2103,7 @@ public class Node extends Element implements IGraphicalNode {
externalNode.setIncomingConnections(inputs);
externalNode.setOutgoingConnections(outputs);
externalNode.setElementParameters(getElementParameters());
externalNode.setUniqueName(getUniqueName());
externalNode.setUniqueName(getUniqueName(false));
externalNode.setSubProcessStart(isSubProcessStart());
externalNode.setProcess(getProcess());
externalNode.setComponent(getComponent());

View File

@@ -124,6 +124,7 @@ import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.model.routines.RoutinesUtil;
import org.talend.core.model.update.IUpdateManager;
import org.talend.core.model.utils.NodeUtil;
import org.talend.core.model.utils.TalendPropertiesUtil;
import org.talend.core.model.utils.TalendTextUtils;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.repository.utils.ConvertJobsUtil;
@@ -745,6 +746,10 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
String uniqueName = nodeContainer.getNode().getUniqueName();
removeUniqueNodeName(uniqueName);
if (nodeContainer instanceof AbstractJobletContainer) {
// remove SHORT_UNIQUE_NAME and UNIQUE_NAME for joblet
String name = nodeContainer.getNode().getUniqueName(false);
removeUniqueNodeName(name);
// use readedContainers to record the containers alreay be read, in case of falling into dead loop
Set<NodeContainer> readedContainers = new HashSet<NodeContainer>();
removeUniqueNodeNamesInJoblet((AbstractJobletContainer) nodeContainer, readedContainers);
@@ -1153,7 +1158,8 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
|| param.getFieldType().equals(EParameterFieldType.PROPERTY_TYPE)
|| param.getFieldType().equals(EParameterFieldType.VALIDATION_RULE_TYPE)
|| param.getFieldType().equals(EParameterFieldType.UNIFIED_COMPONENTS)
|| param.getName().equals(EParameterName.UPDATE_COMPONENTS.getName())) {
|| param.getName().equals(EParameterName.UPDATE_COMPONENTS.getName())
|| param.getName().equals(EParameterName.SHORT_UNIQUE_NAME.getName())) {
return;
}
if (param.getParentParameter() != null) {
@@ -1284,6 +1290,19 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
} else if (param.getFieldType().equals(EParameterFieldType.PASSWORD) && value instanceof String) {
pType.setRawValue((String) value);
} else if (param.getFieldType().equals(EParameterFieldType.COMPONENT_LIST) && value != null) {
String componentValue = value.toString();
if (TalendPropertiesUtil.isEnabledUseShortJobletName() && (param.getElement() instanceof INode)) {
INode node = (INode) param.getElement();
String completeValue = DesignerUtilities.getNodeInJobletCompleteUniqueName(node, componentValue);
// possible blank when joblet node removed from process
componentValue = completeValue;
if (StringUtils.isBlank(completeValue) && param.isContextMode()
&& !DesignerUtilities.validateJobletShortName(value.toString())) {
componentValue = value.toString();
}
}
pType.setValue(componentValue);
} else {
if (value == null) {
pType.setValue(""); //$NON-NLS-1$
@@ -1820,10 +1839,11 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
for (Connection element : connList) {
connec = element;
cType = fileFact.createConnectionType();
cType.setSource(node.getUniqueName());
cType.setSource(node.getUniqueName(false));
INode jTarget = connec.getTarget();
String targetUniqueName = jTarget.getUniqueName();
if (jTarget instanceof Node) {
targetUniqueName = ((Node) jTarget).getUniqueName(false);
Node jn = (Node) jTarget.getJobletNode();
if (jn != null) {
targetUniqueName = jn.getUniqueName();
@@ -2195,6 +2215,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
loadNotes(processType);
loadSubjobs(processType);
checkNodeComponentListElementParameters();
initExternalComponents();
initJobletComponents();
setActivate(true);
@@ -2230,6 +2251,32 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
}
public void checkNodeComponentListElementParameters() {
if (!TalendPropertiesUtil.isEnabledUseShortJobletName()) {
return;
}
// load short unique name value for component list value
for (INode node : getGraphicalNodes()) {
for (IElementParameter param : node.getElementParameters()) {
loadComponentListShortNameValue(node, param);
Collection<IElementParameter> childrenParameter = param.getChildParameters().values();
for (IElementParameter childParameter : childrenParameter) {
loadComponentListShortNameValue(node, childParameter);
}
}
}
}
private void loadComponentListShortNameValue(INode node, IElementParameter param) {
if (param != null && EParameterFieldType.COMPONENT_LIST == param.getFieldType()) {
String originalValue = param.getValue().toString();
String shortUniqueName = DesignerUtilities.getNodeInJobletShortUniqueName(node, originalValue);
if (StringUtils.isNotBlank(shortUniqueName)) {
param.setValue(shortUniqueName);
}
}
}
@SuppressWarnings("unchecked")
private void checkNodeTableParameters() {
for (INode node : getGraphicalNodes()) {
@@ -2543,7 +2590,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
loadElementParameters(nc, listParamType);
if (nodesHashtable.containsKey(nc.getUniqueName())) {
if (nodesHashtable.containsKey(nc.getUniqueName(false))) {
// if the uniquename is already in the list, there must be a problem with the job.
// simply don't load the component
return null;
@@ -2586,7 +2633,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
NodeContainer nodeContainer = loadNodeContainer(nc, isJunitContainer);
addNodeContainer(nodeContainer);
nodesHashtable.put(nc.getUniqueName(), nc);
nodesHashtable.put(nc.getUniqueName(false), nc);
updateAllMappingTypes();
nc.setNeedLoadLib(false);
if (nc.isJoblet()) {
@@ -3455,12 +3502,18 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
public String generateUniqueNodeName(INode node) {
return generateUniqueNodeName(node, false);
}
public String generateUniqueNodeName(INode node, boolean useShortName) {
IComponent component = node.getComponent();
if (node instanceof Node) {
component = ((Node) node).getDelegateComponent();
}
String baseName = component.getOriginalName();
if (EComponentType.GENERIC.equals(component.getComponentType())) {
if (useShortName) {
baseName = component.getShortName();
} else if (EComponentType.GENERIC.equals(component.getComponentType())) {
baseName = component.getDisplayName();
}
return UniqueNodeNameGenerator.generateUniqueNodeName(baseName, uniqueNodeNameList);

View File

@@ -31,6 +31,7 @@ import org.talend.core.ui.metadata.dialog.CustomTableManager;
import org.talend.core.ui.metadata.dialog.MetadataDialog;
import org.talend.core.ui.metadata.editor.MetadataTableEditor;
import org.talend.core.ui.metadata.editor.MetadataTableEditorView;
import org.talend.designer.core.model.components.EParameterName;
import org.talend.designer.core.ui.editor.connections.Connection;
import org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController;
import org.talend.designer.core.ui.views.properties.MultipleThreadDynamicComposite;
@@ -78,8 +79,10 @@ public class MainConnectionComposite extends MultipleThreadDynamicComposite {
// Composite compositeEditorView = new Composite(composite, SWT.BORDER);
// compositeEditorView.setLayoutData(data);
String elementName = (String) ((Connection) elem).getSource()
.getElementParameter(EParameterName.UNIQUE_NAME.getName()).getValue();
metadataTableEditor = new MetadataTableEditor(outputMetaTable, "Schema from " //$NON-NLS-1$
+ ((Connection) elem).getSource().getElementName() + " output "); //$NON-NLS-1$
+ elementName + " output "); //$NON-NLS-1$
metadataTableEditorView = new MetadataTableEditorView(composite, SWT.NONE, metadataTableEditor, true, false,
true, false);
MetadataDialog.initializeMetadataTableView(metadataTableEditorView, ((Connection) elem).getSource(),

View File

@@ -18,6 +18,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CommandStack;
import org.eclipse.jface.fieldassist.DecoratedField;
@@ -48,6 +49,7 @@ import org.talend.core.model.process.IElement;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.INode;
import org.talend.core.model.process.IProcess2;
import org.talend.core.model.utils.TalendPropertiesUtil;
import org.talend.core.runtime.services.IGenericService;
import org.talend.core.ui.IJobletProviderService;
import org.talend.core.ui.process.IGraphicalNode;
@@ -57,6 +59,7 @@ import org.talend.designer.core.ui.AbstractMultiPageTalendEditor;
import org.talend.designer.core.ui.editor.AbstractTalendEditor;
import org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand;
import org.talend.designer.core.ui.editor.nodes.Node;
import org.talend.designer.core.utils.DesignerUtilities;
/**
* DOC nrousseau class global comment. Detailled comment <br/>
@@ -305,19 +308,23 @@ public class ComponentListController extends AbstractElementPropertySectionContr
if (node.getJobletNode() != null) {
node = node.getJobletNode();
}
final String uniqueName = node.getUniqueName();
String uniqueName = node.getUniqueName();
if (uniqueName.equals(currentNode.getUniqueName())) {
continue;
}
String displayName = (String) node.getElementParameter("LABEL").getValue(); //$NON-NLS-1$
String displayUniqueName = getDisplayUniqueName(node, uniqueName);
if (displayName == null) {
displayName = uniqueName;
displayName = displayUniqueName;
}
if (displayName.indexOf("__UNIQUE_NAME__") != -1) { //$NON-NLS-1$
displayName = displayName.replaceAll("__UNIQUE_NAME__", uniqueName); //$NON-NLS-1$
displayName = displayName.replaceAll("__UNIQUE_NAME__", displayUniqueName); //$NON-NLS-1$
}
if (!displayName.equals(uniqueName)) {
displayName = uniqueName + " - " + displayName; //$NON-NLS-1$
if (!uniqueName.equals(displayUniqueName) && displayName.indexOf(uniqueName) != -1) {
displayName = displayName.replaceAll(uniqueName, displayUniqueName);
}
if (!displayName.equals(displayUniqueName)) {
displayName = displayUniqueName + " - " + displayName; //$NON-NLS-1$
}
componentUniqueNames.add(uniqueName);
componentDisplayNames.add(displayName);
@@ -361,6 +368,13 @@ public class ComponentListController extends AbstractElementPropertySectionContr
}
}
private static String getDisplayUniqueName(INode node, String uniqueName) {
if (TalendPropertiesUtil.isEnabledUseShortJobletName()) {
return DesignerUtilities.getNodeInJobletCompleteUniqueName(node, uniqueName);
}
return uniqueName;
}
SelectionListener listenerSelection = new SelectionAdapter() {
@Override
@@ -391,9 +405,18 @@ public class ComponentListController extends AbstractElementPropertySectionContr
}
if (param.isContextMode()) {
String paramValue = (String) value;
if (elem instanceof INode) {
INode currentNode = (INode) elem;
String completeValue = getDisplayUniqueName(currentNode, paramValue);
if (StringUtils.isNotBlank(completeValue)
|| StringUtils.isBlank(completeValue) && DesignerUtilities.validateJobletShortName(paramValue)) {
paramValue = completeValue;
}
}
combo.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_YELLOW));
combo.setEnabled(false);
combo.setText((String) value);
combo.setText(paramValue);
} else {
combo.setItems(curComponentNameList);
if (numValue == -1) {

View File

@@ -512,7 +512,7 @@ public class SubjobContainer extends Element implements ISubjobContainer {
String subjobStartUniqueName = (String) getPropertyValue(EParameterName.UNIQUE_NAME.getName());
if (process != null && (List<Node>) process.getGraphicalNodes() != null) {
for (Node node : (List<Node>) process.getGraphicalNodes()) {
if (node.getUniqueName() != null && node.getUniqueName().equals(subjobStartUniqueName)) {
if (node.getUniqueName(false) != null && node.getUniqueName(false).equals(subjobStartUniqueName)) {
return node;
}
}
@@ -521,7 +521,7 @@ public class SubjobContainer extends Element implements ISubjobContainer {
}
public void setSubjobStartNode(Node node) {
setPropertyValue(EParameterName.UNIQUE_NAME.getName(), node.getUniqueName());
setPropertyValue(EParameterName.UNIQUE_NAME.getName(), node.getUniqueName(false));
if (node.getComponent().getName().equals("tPrejob") || node.getComponent().getName().equals("tPostjob")) { //$NON-NLS-1$ //$NON-NLS-2$
setPropertyValue(EParameterName.SHOW_SUBJOB_TITLE.getName(), Boolean.TRUE);

View File

@@ -17,6 +17,7 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.collections.BidiMap;
import org.apache.commons.lang.StringUtils;
import org.eclipse.emf.common.ui.celleditor.ExtendedComboBoxCellEditor;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CommandStack;
@@ -56,6 +57,7 @@ import org.talend.core.model.process.Element;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.IProcess2;
import org.talend.core.model.properties.ConnectionItem;
import org.talend.core.model.utils.TalendPropertiesUtil;
import org.talend.core.ui.CoreUIPlugin;
import org.talend.core.ui.process.IGEFProcess;
import org.talend.core.ui.properties.tab.IDynamicProperty;
@@ -472,12 +474,28 @@ public class AdvancedContextComposite extends ScrolledComposite implements IDyna
@Override
public Object get(IElementParameter bean) {
final Object value = bean.getValue();
Object value = bean.getValue();
if (EParameterFieldType.COMPONENT_LIST == bean.getFieldType()
&& TalendPropertiesUtil.isEnabledUseShortJobletName()) {
String completeValue = DesignerUtilities.getNodeInJobletCompleteUniqueName(node, value.toString());
if (StringUtils.isNotBlank(completeValue)
|| StringUtils.isBlank(completeValue)
&& DesignerUtilities.validateJobletShortName(value.toString())) {
value = completeValue;
}
}
return value == null ? "" : String.valueOf(value); //$NON-NLS-1$
}
@Override
public void set(IElementParameter bean, Object value) {
if (EParameterFieldType.COMPONENT_LIST == bean.getFieldType()
&& TalendPropertiesUtil.isEnabledUseShortJobletName()) {
String shortValue = DesignerUtilities.getNodeInJobletShortUniqueName(node, value.toString());
if (StringUtils.isNotBlank(shortValue)) {
value = shortValue;
}
}
if (value != null && !value.equals(bean.getValue())) {
executeCommand(new PropertyChangeCommand(node, bean.getName(), value));
getTableViewerCreator().refresh();

View File

@@ -553,7 +553,7 @@ public class ComponentSettingsView extends ViewPart implements IComponentSetting
Node node = (Node) elem;
label = node.getLabel();
String uniqueName = node.getUniqueName();
String uniqueName = node.getUniqueName(false);
if (!label.equals(uniqueName)) {
label = label + "(" + uniqueName + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}

View File

@@ -14,7 +14,10 @@ package org.talend.designer.core.utils;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang.StringUtils;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -23,6 +26,8 @@ import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.PlatformUI;
import org.talend.commons.CommonsPlugin;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.CorePlugin;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.PluginChecker;
@@ -264,4 +269,97 @@ public class DesignerUtilities {
}
return null;
}
/**
* Get the complete unique name for the node in joblet by short unique name.
*
* e.g. jc_1_tDBConnection_1 =>testjoblet_1_tDBConnection_1
*
* @param node
* @param shortUniqueName
* @return
*/
public static String getNodeInJobletCompleteUniqueName(INode node, String shortUniqueName) {
if (StringUtils.isBlank(shortUniqueName) || !validateJobletShortName(shortUniqueName)) {
return shortUniqueName;
}
String graphicalName = "";
StringBuffer graphNameBuffer = new StringBuffer();
boolean findOut = findGraphicNodeInJoblet(node.getProcess(), shortUniqueName, graphNameBuffer, true);
if (findOut) {
graphicalName = graphNameBuffer.toString();
} else {
if (CommonsPlugin.isDebugMode()) {
ExceptionHandler.process(new Exception("Can't find out " + shortUniqueName + " in " + node.getProcess()
+ " for node " + node.getElementParameter(EParameterName.UNIQUE_NAME.getName())));
}
}
return graphicalName;
}
public static boolean validateJobletShortName(String shortUniqueName) {
if (StringUtils.isBlank(shortUniqueName)) {
return false;
}
Matcher matcher = Pattern.compile("jc[0-9]+_[0-9]").matcher(shortUniqueName);
return matcher.find();
}
/**
* Get the complete unique name for the node in joblet by short unique name.
*
* e.g. testjoblet_1_tDBConnection_1 => jc_1_tDBConnection_1
*
* @param node
* @param shortUniqueName
* @return
*/
public static String getNodeInJobletShortUniqueName(INode node, String completeUniqueName) {
if (StringUtils.isBlank(completeUniqueName)) {
return completeUniqueName;
}
String graphicalName = "";
StringBuffer graphNameBuffer = new StringBuffer();
boolean findOut = findGraphicNodeInJoblet(node.getProcess(), completeUniqueName, graphNameBuffer, false);
if (findOut) {
graphicalName = graphNameBuffer.toString();
} else {
if (CommonsPlugin.isDebugMode()) {
ExceptionHandler.process(new Exception("Can't find out " + completeUniqueName + " in " + node.getProcess()
+ " for node " + node.getElementParameter(EParameterName.UNIQUE_NAME.getName())));
}
}
return graphicalName;
}
private static boolean findGraphicNodeInJoblet(IProcess process, String uniqueName, StringBuffer graphNameBuffer,
boolean matchShortName) {
List<? extends INode> nodes = process.getGraphicalNodes();
for (INode iNode : nodes) {
Node graphNode = (Node) iNode;
String graphNodeName = graphNode.getUniqueName(matchShortName);
if (isJobletComponent(graphNode) && uniqueName.startsWith(graphNodeName)) {
if (graphNodeName.equals(uniqueName)) {
graphNameBuffer.append(graphNode.getUniqueName(!matchShortName));
return true;
}
String nonJobletName = uniqueName.replaceFirst(graphNodeName + "_", "");
graphNameBuffer.append(graphNode.getUniqueName(!matchShortName)).append("_");
boolean findOut = findGraphicNodeInJoblet(graphNode.getComponent().getProcess(), nonJobletName, graphNameBuffer,
matchShortName);
if (findOut) {
return true;
}
}
if (graphNodeName.equals(uniqueName)) {
graphNameBuffer.append(uniqueName);
return true;
}
}
return false;
}
public static boolean isJobletComponent(INode node) {
return node.getComponent().getComponentType() == EComponentType.JOBLET;
}
}

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="lib/talend_file_enhanced-1.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/talend_file_enhanced-1.3.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>

View File

@@ -4,7 +4,7 @@ Bundle-Name: Custom
Bundle-SymbolicName: org.talend.libraries.custom;singleton:=true
Bundle-Version: 7.3.1.qualifier
Bundle-ClassPath: .,
lib/talend_file_enhanced-1.2.jar
lib/talend_file_enhanced-1.3.jar
Export-Package: org.talend.fileprocess,
org.talend.fileprocess.delimited
Bundle-ActivationPolicy: lazy

View File

@@ -61,7 +61,7 @@
<artifactItem>
<groupId>org.talend.components.lib</groupId>
<artifactId>talend_file_enhanced</artifactId>
<version>1.2</version>
<version>1.3</version>
</artifactItem>
</artifactItems>
</configuration>