use of org.talend.designer.core.ui.editor.cmd.JobletConnectionReconnectCommand in project tdi-studio-se by Talend.
the class JobletContainer method refreshJobletConnections.
private void refreshJobletConnections() {
Iterator<IConnection> inIterator = inputs.iterator();
while (inIterator.hasNext()) {
IConnection conn = inIterator.next();
if (isCollapsed()) {
((Connection) conn).reconnect(conn.getSource(), this.node, conn.getLineStyle());
} else {
out: for (NodeContainer nodeContainer : this.nodeContainers) {
Node connNode = nodeContainer.getNode();
IElementParameter elePa = this.node.getElementParameter(connNode.getJoblet_unique_name());
if (elePa != null) {
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
IElementParameter elechild = null;
String uniqueName = null;
boolean isTri = service.isTriggerNode(connNode);
if (service != null && isTri) {
elechild = elePa.getChildParameters().get("COMPONENT_LIST");
uniqueName = conn.getMetaName();
} else {
elechild = elePa.getChildParameters().get("CONNECTION");
uniqueName = conn.getUniqueName();
}
if (elechild != null && elechild.getValue().equals(uniqueName)) {
List<? extends INodeConnector> connList = new JobletUtil().createConnectors(connNode, this.getProcess());
// modify///////////////////////////////////////////////////////////////////////////////////////////////////////
List<INodeConnector> inodeConnList = new ArrayList<INodeConnector>();
inodeConnList.addAll(connList);
inodeConnList.addAll(connNode.getListConnector());
connNode.setListConnector(inodeConnList);
// connNode.getListConnector().addAll(connList);
IMetadataTable iTable = this.node.getMetadataTable(connNode.getUniqueName());
if (iTable != null && !connNode.getMetadataList().contains(iTable)) {
// connNode.getMetadataList().add(iTable);
}
JobletConnectionReconnectCommand reConnectCommand = new JobletConnectionReconnectCommand(conn);
reConnectCommand.setNewTarget(connNode);
reConnectCommand.execute();
break;
} else if (getFlowInput(inputs).size() == 1 && !isTri && new JobletUtil().isJobletInput(connNode, this.getProcess())) {
for (IConnection flowConn : getFlowInput(inputs)) {
if (!flowConn.getUniqueName().equals(conn.getUniqueName())) {
continue out;
}
}
JobletConnectionReconnectCommand reConnectCommand = new JobletConnectionReconnectCommand(conn);
reConnectCommand.setNewTarget(connNode);
reConnectCommand.execute();
break;
}
}
}
}
}
Iterator<IConnection> outIterator = outputs.iterator();
while (outIterator.hasNext()) {
IConnection conn = outIterator.next();
if (isCollapsed()) {
((Connection) conn).reconnect(this.node, conn.getTarget(), conn.getLineStyle());
} else {
for (NodeContainer nodeContainer : this.nodeContainers) {
Node connNode = nodeContainer.getNode();
if (conn.getConnectorName().equals(connNode.getJoblet_unique_name())) {
List<? extends INodeConnector> connList = new JobletUtil().createConnectors(connNode, this.getProcess());
List<INodeConnector> inodeConnList = new ArrayList<INodeConnector>();
inodeConnList.addAll(connList);
inodeConnList.addAll(connNode.getListConnector());
connNode.setListConnector(inodeConnList);
// connNode.setListConnector(connList);
IMetadataTable iTable = this.node.getMetadataTable(connNode.getUniqueName());
if (iTable != null && !connNode.getMetadataList().contains(iTable)) {
// connNode.getMetadataList().add(iTable);
}
JobletConnectionReconnectCommand reConnectCommand = new JobletConnectionReconnectCommand(conn);
reConnectCommand.setNewSource(connNode);
reConnectCommand.execute();
// return;
}
}
}
}
if (!isCollapsed()) {
for (NodeContainer nodeContainer : this.nodeContainers) {
Node connNode = nodeContainer.getNode();
IProcess jobletProcess = this.getNode().getComponent().getProcess();
List<? extends INode> jobletNodes = jobletProcess.getGraphicalNodes();
for (INode n : jobletNodes) {
if (connNode.getJoblet_unique_name().equals(n.getUniqueName())) {
connNode.setDummy(n.isDummy());
// connNode.setActivate(n.isActivate());
}
}
}
}
}
Aggregations