use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.
the class OracleGenerationManagerTest method setUp.
@Before
public void setUp() throws Exception {
dbMapComponent = new DbMapComponent();
List<IConnection> incomingConnections = new ArrayList<IConnection>();
conn = mock(IConnection.class);
incomingConnections.add(conn);
dbMapComponent.setIncomingConnections(incomingConnections);
oracleManager = new OracleGenerationManager();
}
use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.
the class PostgresGenerationManagerTest method init.
private void init(String schema, String main_table, String lookup_table) {
List<IConnection> incomingConnections = new ArrayList<IConnection>();
String[] mainTableEntities = new String[] { "id", "name", "classNum" };
String[] lookupEndtities = new String[] { "id", "score" };
incomingConnections.add(mockConnection(schema, main_table, mainTableEntities));
incomingConnections.add(mockConnection(schema, lookup_table, lookupEndtities));
component.setIncomingConnections(incomingConnections);
ExternalDbMapData externalData = new ExternalDbMapData();
List<ExternalDbMapTable> inputs = new ArrayList<ExternalDbMapTable>();
List<ExternalDbMapTable> outputs = new ArrayList<ExternalDbMapTable>();
// main table
ExternalDbMapTable inputTable = new ExternalDbMapTable();
inputTable.setTableName(schema + "." + main_table);
List<ExternalDbMapEntry> entities = getMetadataEntities(mainTableEntities, new String[3]);
inputTable.setMetadataTableEntries(entities);
inputs.add(inputTable);
// lookup table
inputTable = new ExternalDbMapTable();
inputTable.setTableName(schema + "." + lookup_table);
entities = getMetadataEntities(lookupEndtities, new String[2]);
inputTable.setMetadataTableEntries(entities);
inputs.add(inputTable);
// output
ExternalDbMapTable outputTable = new ExternalDbMapTable();
outputTable.setName("grade");
List<ExternalDbMapEntry> conditions = new ArrayList<ExternalDbMapEntry>();
conditions.add(new ExternalDbMapEntry(schema + "." + main_table + ".id =3"));
outputTable.setCustomWhereConditionsEntries(conditions);
String[] names = new String[] { "id", "name", "classNum", "score" };
String[] expressions = new String[] { schema + "." + main_table + ".id", schema + "." + main_table + ".name", schema + "." + main_table + ".classNum", schema + "." + lookup_table + ".score" };
outputTable.setMetadataTableEntries(getMetadataEntities(names, expressions));
outputs.add(outputTable);
externalData.setInputTables(inputs);
externalData.setOutputTables(outputs);
component.setExternalData(externalData);
List<IMetadataTable> metadataList = new ArrayList<IMetadataTable>();
MetadataTable metadataTable = getMetadataTable(names);
metadataTable.setLabel("grade");
metadataList.add(metadataTable);
component.setMetadataList(metadataList);
Process process = mock(Process.class);
when(process.getContextManager()).thenReturn(new JobContextManager());
component.setProcess(process);
}
use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.
the class ComponentSettingsView method isAvoidRecoveryByConditions.
/**
* Need to add recovery category or not by some conditions for current connection
*
* @param elem
*/
private boolean isAvoidRecoveryByConditions(IElement elem) {
if (elem instanceof IConnection) {
INode source = ((IConnection) elem).getSource();
List<? extends IConnection> conns = source.getIncomingConnections();
for (IConnection conn : conns) {
Object propertyValue = conn.getPropertyValue(Connection.LINESTYLE_PROP);
if (propertyValue.equals(EConnectionType.ON_COMPONENT_OK) || propertyValue.equals(EConnectionType.ON_COMPONENT_ERROR) || propertyValue.equals(EConnectionType.RUN_IF) || propertyValue.equals(EConnectionType.ON_SUBJOB_ERROR) || propertyValue.equals(EConnectionType.PARALLELIZE)) {
return true;
} else {
if (isAvoidRecoveryByConditions(conn)) {
return true;
}
}
}
}
return false;
}
use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.
the class MultiUIManager method autoMap.
/**
*
* DOC wzhang Comment method "autoMap". for multiSchema.
*/
public void autoMap() {
List<FOXTreeNode> treeData = foxManager.getTreeData(foxManager.getCurrentSchema());
if (treeData == null || treeData.size() < 1) {
return;
}
FOXTreeNode root = treeData.get(0);
List<FOXTreeNode> mappableNodes = new ArrayList<FOXTreeNode>();
getMappableNode((Element) root, mappableNodes);
IConnection connection = foxUI.getConnection();
if (connection != null) {
IMetadataTable metadataTable = connection.getMetadataTable();
if (metadataTable != null) {
List<IMetadataColumn> schemaData = metadataTable.getListColumns();
for (FOXTreeNode node : mappableNodes) {
for (IMetadataColumn column : schemaData) {
if (node.getLabel().equals(column.getLabel())) {
node.setTable(metadataTable);
node.setColumn(column);
node.setDefaultValue(null);
node.setRow(foxManager.getCurrentSchema());
break;
}
}
}
}
}
this.foxUI.refreshXMLViewer(root);
this.foxUI.redrawLinkers();
}
use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.
the class FOXManager method getOriginalNodes.
/**
*
* DOC wzhang Comment method "getOriginalNodes".
*
* @return
*/
protected List<FOXTreeNode> getOriginalNodes() {
List<FOXTreeNode> tmpTreeData = new ArrayList<FOXTreeNode>();
List<? extends IConnection> incomingConnections = NodeUtil.getIncomingConnections(this.getFoxComponent(), IConnectionCategory.FLOW);
if (incomingConnections.size() > 0) {
for (IConnection conn : incomingConnections) {
String uniqueName = conn.getUniqueName();
List<FOXTreeNode> list = contents.get(uniqueName);
tmpTreeData.addAll(list);
}
}
return tmpTreeData;
}
Aggregations