use of org.talend.designer.core.model.utils.emf.talendfile.ConnectionType in project tdi-studio-se by Talend.
the class RenameFieldNameFortLineChart method searchSourceComponents.
// search all components that tLineChart linked directly or indirectly
private void searchSourceComponents(Item item) {
ProcessType processType = getProcessType(item);
for (Object o : processType.getConnection()) {
if (o instanceof ConnectionType) {
ConnectionType currentConnection = (ConnectionType) o;
String connectorName = currentConnection.getConnectorName();
if (listComponent.contains(currentConnection.getTarget())) {
String sourceComponentName = currentConnection.getSource();
if (!"ITERATE".equals(connectorName) && !"SUBJOB_OK".equals(connectorName) && !"SUBJOB_ERROR".equals(connectorName) && !"COMPONENT_OK".equals(connectorName) && !"COMPONENT_ERROR".equals(connectorName) && !"RUN_IF".equals(connectorName)) {
if (!listSourceComponent.contains(sourceComponentName)) {
listSourceComponent.add(sourceComponentName);
}
if (!listComponent.contains(sourceComponentName)) {
listComponent.add(sourceComponentName);
searchSourceComponents(item);
}
}
}
}
}
// end search
}
use of org.talend.designer.core.model.utils.emf.talendfile.ConnectionType in project tdi-studio-se by Talend.
the class RenameConnectionNameofSalesforceOutput method renameConnections.
private void renameConnections(Item item, ProcessType processType) throws PersistenceException {
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
boolean modified = false;
for (Object o : processType.getConnection()) {
ConnectionType currentConnection = (ConnectionType) o;
if ("FLOW".equals(currentConnection.getConnectorName())) {
//$NON-NLS-1$
String nodeUniqueName = currentConnection.getSource();
for (Object n : processType.getNode()) {
NodeType node = (NodeType) n;
if ("tSalesforceOutput".equals(node.getComponentName())) {
for (Object e : node.getElementParameter()) {
ElementParameterType p = (ElementParameterType) e;
if ("UNIQUE_NAME".equals(p.getName()) && nodeUniqueName.equals(p.getValue())) {
//$NON-NLS-1$
//$NON-NLS-1$
currentConnection.setConnectorName("MAIN");
modified = true;
}
}
}
}
}
}
if (modified) {
factory.save(item, true);
}
}
use of org.talend.designer.core.model.utils.emf.talendfile.ConnectionType in project tdi-studio-se by Talend.
the class RenameConnectionThenRunToOnSubjobOkTask method renameConnections.
/**
* yzhang Comment method "renameConnections".
*
* @param item
* @param processType
* @throws PersistenceException
*/
private void renameConnections(Item item, ProcessType processType) throws PersistenceException {
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
boolean modified = false;
for (Object o : processType.getConnection()) {
ConnectionType currentConnection = (ConnectionType) o;
if (currentConnection.getConnectorName().equals("THEN_RUN")) {
//$NON-NLS-1$
currentConnection.setConnectorName(EConnectionType.ON_SUBJOB_OK.getName());
currentConnection.setLabel(EConnectionType.ON_SUBJOB_OK.getDefaultLinkName());
currentConnection.setLineStyle(EConnectionType.ON_SUBJOB_OK.getId());
modified = true;
}
}
if (modified) {
factory.save(item, true);
}
}
use of org.talend.designer.core.model.utils.emf.talendfile.ConnectionType in project tdi-studio-se by Talend.
the class MoveStartsLinkFromPartitionerToDepartitioner method replaceConnections.
public boolean replaceConnections(Item item) throws PersistenceException {
ProcessType processType = getProcessType(item);
if (processType == null) {
return false;
}
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
boolean replaceDone = false;
boolean modified = false;
for (Object o : processType.getConnection()) {
ConnectionType currentConnection = (ConnectionType) o;
if (currentConnection.getConnectorName() != null && STARTS_CONNECTOR_NAME.equals(currentConnection.getConnectorName())) {
String source = currentConnection.getSource();
String target = currentConnection.getTarget();
NodeType recollectorNode = null;
NodeType departitionerNode = null;
NodeType partitionerNode = null;
for (Object obj : processType.getNode()) {
NodeType currentNode = (NodeType) obj;
if (currentNode.getComponentName().equals("tPartitioner") && source.equals(ComponentUtilities.getNodeUniqueName(currentNode))) {
partitionerNode = currentNode;
} else if (currentNode.getComponentName().equals("tRecollector") && target.equals(ComponentUtilities.getNodeUniqueName(currentNode))) {
recollectorNode = currentNode;
}
}
if (recollectorNode != null && partitionerNode != null) {
//know we need to migrate this one.
ElementParameterType linkedDepartitioner = ComponentUtilities.getNodeProperty(recollectorNode, "DEPART_COMPONENT");
currentConnection.setSource(linkedDepartitioner.getValue());
modified = true;
}
}
}
if (modified) {
factory.save(item, true);
replaceDone = true;
}
return replaceDone;
}
Aggregations