use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.
the class ProblemsAnalyser method checkProblems.
public List<Problem> checkProblems(ExternalDbMapData externalData) {
problems.clear();
if (externalData != null) {
List<IConnection> incomingConnections = new ArrayList<IConnection>(this.mapperManager.getComponent().getIncomingConnections());
List<IConnection> outgoingConnections = new ArrayList<IConnection>(this.mapperManager.getComponent().getOutgoingConnections());
ExternalDataConverter converter = new ExternalDataConverter(mapperManager);
MapperMain mapperMain = mapperManager.getComponent().getMapperMain();
List<IOConnection> inputsIOConnections = mapperMain.createIOConnections(incomingConnections);
ArrayList<InputTable> inputTables = converter.prepareInputTables(inputsIOConnections, externalData);
List<IOConnection> outputsIOConnections = mapperMain.createIOConnections(outgoingConnections);
ArrayList<OutputTable> outputTables = converter.prepareOutputTables(outputsIOConnections, this.mapperManager.getComponent().getMetadataList(), externalData);
List<? super AbstractInOutTable> tablesWriteMode = new ArrayList<AbstractInOutTable>();
tablesWriteMode.addAll(inputTables);
tablesWriteMode.addAll(outputTables);
List<? extends AbstractInOutTable> tablesReadMode = (List<? extends AbstractInOutTable>) tablesWriteMode;
ProblemsManager problemsManager = new ProblemsManager(mapperManager);
ArrayList<Problem> problemsLocal = new ArrayList<Problem>();
for (AbstractInOutTable table : tablesReadMode) {
List<IColumnEntry> columnEntries = table.getColumnEntries();
problemsManager.checkProblemsForAllEntries(columnEntries);
for (IColumnEntry entry : columnEntries) {
List<Problem> problemsOfEntry = entry.getProblems();
if (problemsOfEntry != null) {
problemsLocal.addAll(problemsOfEntry);
}
}
}
problems.addAll(problemsLocal);
}
return getProblems();
}
use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.
the class ClearTraceAction method run.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
//
final TraceConnectionsManager traceConnectionsManager = new TraceConnectionsManager(process);
traceConnectionsManager.init();
Set<IConnection> doneConnections = new HashSet<IConnection>();
IConnection connection = null;
for (Iterator<? extends INode> i = process.getGraphicalNodes().iterator(); connection == null && i.hasNext(); ) {
INode psNode = i.next();
if (psNode instanceof Node) {
Node node = (Node) psNode;
//$NON-NLS-1$
node.getNodeProgressBar().updateState("UPDATE_STATUS", new Double(0));
node.setErrorFlag(false);
node.setCompareFlag(false);
node.setErrorInfo(null);
//$NON-NLS-1$
node.getNodeError().updateState("UPDATE_STATUS", false);
//$NON-NLS-1$
node.setErrorInfoChange("ERRORINFO", false);
}
for (IConnection connec : psNode.getOutgoingConnections()) {
if (!doneConnections.contains(connec)) {
connec.setTraceData(null);
doneConnections.add(connec);
}
// get the related shadow connections
IConnection[] shadowconns = traceConnectionsManager.getShadowConnenctions(connec.getUniqueName());
if (shadowconns != null) {
for (IConnection sc : shadowconns) {
if (!doneConnections.contains(sc)) {
sc.setTraceData(null);
doneConnections.add(sc);
}
}
}
}
// currently, only for joblet when expanded.
IConnection[] nonShadowDataConnections = traceConnectionsManager.getNonShadowDataConnections(psNode);
if (nonShadowDataConnections != null) {
for (IConnection conn : nonShadowDataConnections) {
if (!doneConnections.contains(conn)) {
conn.setTraceData(null);
doneConnections.add(conn);
}
}
}
}
}
use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.
the class ConnectionCreateCommandTest method executeSimpleInputToSimpleOutput1.
/**
* simple input to simple output with no metadata and schema auto propagate.
*/
private ConnectionCreateCommand executeSimpleInputToSimpleOutput1() {
IProcess2 process = getFakeProcess();
Node simpleInputNode = NodeTestCreator.createSimpleInputNode(process);
// simple tests only since it's simply using the class ConnectionManager which already have JUnits.
List<Object> args = new ArrayList<Object>();
args.add(simpleInputNode.getUniqueName());
//$NON-NLS-1$
args.add("connectionName");
simpleInputNode.getMetadataList().clear();
IMetadataTable table = createSimpleMetadata1();
table.setTableName(simpleInputNode.getUniqueName());
table.setLabel(simpleInputNode.getUniqueName());
//$NON-NLS-1$
table.setAttachedConnector("FLOW");
simpleInputNode.getMetadataList().add(table);
// set null, the command should take the schema from the component directly
args.add(null);
//$NON-NLS-1$
ConnectionCreateCommand ccc = new ConnectionCreateCommand(simpleInputNode, "FLOW", args);
ConnectionCreateCommand.setCreatingConnection(true);
Node simpleOutputNode = NodeTestCreator.createSimpleOutputNode(process);
ccc.setTarget(simpleOutputNode);
ccc.execute();
assertEquals(simpleInputNode.getOutgoingConnections().size(), 1);
assertEquals(simpleOutputNode.getIncomingConnections().size(), 1);
assertEquals(simpleOutputNode.getMetadataList().size(), 1);
IMetadataTable outputMetadata = simpleOutputNode.getMetadataList().get(0);
// metadata should have been propagated automatically
assertMetadataIsSame(table, outputMetadata);
IConnection connection = simpleInputNode.getOutgoingConnections().get(0);
assertEquals(simpleOutputNode.getIncomingConnections().get(0), connection);
assertEquals(connection.getSource(), simpleInputNode);
assertEquals(connection.getTarget(), simpleOutputNode);
assertEquals(connection.getMetaName(), simpleInputNode.getUniqueName());
//$NON-NLS-1$
assertEquals(connection.getConnectorName(), "FLOW");
//$NON-NLS-1$
INodeConnector inputConnector = simpleInputNode.getConnectorFromName("FLOW");
//$NON-NLS-1$
INodeConnector outputConnector = simpleOutputNode.getConnectorFromName("FLOW");
assertEquals(inputConnector.getCurLinkNbOutput(), 1);
assertEquals(outputConnector.getCurLinkNbInput(), 1);
return ccc;
}
use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.
the class ChangeOutputConnectionOrderCommandTest method test.
@Test
public void test() {
tSAPBapiComponent = ComponentsFactoryProvider.getInstance().get("tSAPBapi", ComponentCategory.CATEGORY_4_DI.getName());
tLogRowComponent = ComponentsFactoryProvider.getInstance().get("tLogRow", ComponentCategory.CATEGORY_4_DI.getName());
Property property1 = PropertiesFactory.eINSTANCE.createProperty();
//$NON-NLS-1$
property1.setId("property1");
//$NON-NLS-1$
property1.setVersion("0.1");
//$NON-NLS-1$
property1.setLabel("test1");
Process process = new Process(property1);
Node tSAPBapi_1 = new Node(tSAPBapiComponent, process);
tSAPBapi_1.getMetadataList().add(createMetadataTable("row_IV_KOKRS_1"));
tSAPBapi_1.getMetadataList().add(createMetadataTable("row_ES_RETURN_1"));
tSAPBapi_1.getMetadataList().add(createMetadataTable("row_ET_COSTELEMGRP_HIER_1"));
tSAPBapi_1.getMetadataList().add(createMetadataTable("row_SINGLE_PARAM_1"));
Node tLogRow_1 = new Node(tLogRowComponent, process);
Connection conn1 = new Connection(tSAPBapi_1, tLogRow_1, EConnectionType.FLOW_MAIN, EConnectionType.FLOW_MAIN.getName(), "tSAPBapi_1", "row_ES_RETURN_1", "row_ES_RETURN_1", false);
Connection conn2 = new Connection(tSAPBapi_1, tLogRow_1, EConnectionType.FLOW_MAIN, EConnectionType.FLOW_MAIN.getName(), "tSAPBapi_1", "row_ET_COSTELEMGRP_HIER_1", "row_ET_COSTELEMGRP_HIER_1", false);
Connection conn3 = new Connection(tSAPBapi_1, tLogRow_1, EConnectionType.FLOW_MAIN, EConnectionType.FLOW_MAIN.getName(), "tSAPBapi_1", "row_SINGLE_PARAM_1", "row_SINGLE_PARAM_1", false);
List<IConnection> reoderConnection = new ArrayList<IConnection>();
reoderConnection.add(conn2);
reoderConnection.add(conn3);
reoderConnection.add(conn1);
ChangeOutputConnectionOrderCommand command = new ChangeOutputConnectionOrderCommand(tSAPBapi_1, reoderConnection);
command.execute();
Assert.assertEquals(conn1.getConnectionLabel().getLabelText(), "row_ES_RETURN_1 (Main order:3)");
Assert.assertEquals(conn2.getConnectionLabel().getLabelText(), "row_ET_COSTELEMGRP_HIER_1 (Main order:1)");
Assert.assertEquals(conn3.getConnectionLabel().getLabelText(), "row_SINGLE_PARAM_1 (Main order:2)");
command.undo();
Assert.assertEquals(conn1.getConnectionLabel().getLabelText(), "row_ES_RETURN_1 (Main order:1)");
Assert.assertEquals(conn2.getConnectionLabel().getLabelText(), "row_ET_COSTELEMGRP_HIER_1 (Main order:2)");
Assert.assertEquals(conn3.getConnectionLabel().getLabelText(), "row_SINGLE_PARAM_1 (Main order:3)");
}
use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.
the class ConnectionCreateCommandTest method executeSimpleInputToSimpleOutput3.
/**
* simple input to simple output with no metadata and without schema auto propagate.
*/
private ConnectionCreateCommand executeSimpleInputToSimpleOutput3() {
IProcess2 process = getFakeProcess();
Node simpleInputNode = NodeTestCreator.createSimpleInputNode(process);
// simple tests only since it's simply using the class ConnectionManager which already have JUnits.
List<Object> args = new ArrayList<Object>();
args.add(simpleInputNode.getUniqueName());
//$NON-NLS-1$
args.add("connectionName");
simpleInputNode.getMetadataList().clear();
IMetadataTable table = createSimpleMetadata1();
table.setTableName(simpleInputNode.getUniqueName());
table.setLabel(simpleInputNode.getUniqueName());
//$NON-NLS-1$
table.setAttachedConnector("FLOW");
simpleInputNode.getMetadataList().add(table);
// set null, the command should take the schema from the component directly
args.add(null);
//$NON-NLS-1$
ConnectionCreateCommand ccc = new ConnectionCreateCommand(simpleInputNode, "FLOW", args);
ConnectionCreateCommand.setCreatingConnection(true);
Node simpleOutputNode = NodeTestCreator.createSimpleOutputNodeNoPropagate(process);
ccc.setTarget(simpleOutputNode);
ccc.execute();
assertEquals(simpleInputNode.getOutgoingConnections().size(), 1);
assertEquals(simpleOutputNode.getIncomingConnections().size(), 1);
assertEquals(simpleOutputNode.getMetadataList().size(), 1);
IMetadataTable outputMetadata = simpleOutputNode.getMetadataList().get(0);
// no propagation
assertEquals(outputMetadata.getListColumns().size(), 0);
IConnection connection = simpleInputNode.getOutgoingConnections().get(0);
assertEquals(simpleOutputNode.getIncomingConnections().get(0), connection);
assertEquals(connection.getSource(), simpleInputNode);
assertEquals(connection.getTarget(), simpleOutputNode);
assertEquals(connection.getMetaName(), simpleInputNode.getUniqueName());
//$NON-NLS-1$
assertEquals(connection.getConnectorName(), "FLOW");
//$NON-NLS-1$
INodeConnector inputConnector = simpleInputNode.getConnectorFromName("FLOW");
//$NON-NLS-1$
INodeConnector outputConnector = simpleOutputNode.getConnectorFromName("FLOW");
assertEquals(inputConnector.getCurLinkNbOutput(), 1);
assertEquals(outputConnector.getCurLinkNbInput(), 1);
return ccc;
}
Aggregations