use of org.talend.designer.mapper.external.data.ExternalMapperData in project tdi-studio-se by Talend.
the class ProblemsAnalyserTest method createMapperComponent.
private MapperComponent createMapperComponent() {
IComponent tMysqlComponent = ComponentsFactoryProvider.getInstance().get("tMysqlInput", ComponentCategory.CATEGORY_4_DI.getName());
IComponent tMapComponent = ComponentsFactoryProvider.getInstance().get("tMap", 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 tMysqlInput_1 = new Node(tMysqlComponent, process);
IMetadataTable tMysqlInput_1_table = tMysqlInput_1.getMetadataTable("tMysqlInput_1");
createMetadataColumns(tMysqlInput_1_table, 2);
Node tMysqlInput_2 = new Node(tMysqlComponent, process);
IMetadataTable tMysqlInput_2_table = tMysqlInput_2.getMetadataTable("tMysqlInput_2");
createMetadataColumns(tMysqlInput_2_table, 2);
Node tMap_1 = new Node(tMapComponent, process);
Connection row1 = new Connection(tMysqlInput_1, tMap_1, EConnectionType.FLOW_MAIN, EConnectionType.FLOW_MAIN.getName(), "tMysqlInput_1", "row1", "row1", false);
Connection row2 = new Connection(tMysqlInput_2, tMap_1, EConnectionType.FLOW_REF, EConnectionType.FLOW_MAIN.getName(), "tMysqlInput_1", "row2", "row2", false);
tMap_1.getExternalNode().initialize();
MapperComponent mapperComponent = (MapperComponent) tMap_1.getExternalNode();
ExternalMapperData externalData = (ExternalMapperData) mapperComponent.getExternalData();
ExternalMapperTable externalTable = prepareExternalData(tMysqlInput_1_table);
externalTable.setName(row1.getName());
externalData.getInputTables().add(externalTable);
externalTable = prepareExternalData(tMysqlInput_2_table);
externalTable.setName(row2.getName());
externalData.getInputTables().add(externalTable);
return mapperComponent;
}
use of org.talend.designer.mapper.external.data.ExternalMapperData in project tdi-studio-se by Talend.
the class MapperHelper method isGeneratedAsVirtualComponent.
/**
*
* DOC YeXiaowei Comment method "isGeneratedAsVirtualComponent".
*
* @param mapperNode
* @return
*/
public static boolean isGeneratedAsVirtualComponent(final INode mapperNode) {
if (isMapperOnBigDataProcess(mapperNode.getComponent().getPaletteType())) {
return false;
}
boolean hasPersistentSortedLookup = false;
List<IConnection> incomingConnections = (List<IConnection>) mapperNode.getIncomingConnections();
ExternalMapperData internalExternalData = (ExternalMapperData) mapperNode.getExternalNode().getExternalData();
if (internalExternalData != null && incomingConnections.size() > 0) {
List<ExternalMapperTable> inputTables = internalExternalData.getInputTables();
int sizeInputTables = inputTables.size();
HashMap<String, IConnection> hNameToConnection = new HashMap<String, IConnection>();
for (IConnection connection : incomingConnections) {
hNameToConnection.put(connection.getName(), connection);
}
for (int iInputTable = 1; iInputTable < sizeInputTables; iInputTable++) {
// T_TM_M_241
ExternalMapperTable inputTable = inputTables.get(iInputTable);
String tableName = inputTable.getName();
IConnection connection = hNameToConnection.get(tableName);
if (connection == null) {
continue;
}
if (inputTable != null) {
// T_TM_M_245
List<ExternalMapperTableEntry> metadataTableEntries = inputTable.getMetadataTableEntries();
if (metadataTableEntries == null) {
continue;
}
if (inputTable.isPersistent() && !"ALL_ROWS".equals(inputTable.getMatchingMode()) && !"DYNAMIC".equals(inputTable.getLookupMode())) {
//$NON-NLS-1$ //$NON-NLS-2$
hasPersistentSortedLookup = true;
}
}
// T_TM_M_245
}
// T_TM_M_241
}
return hasPersistentSortedLookup;
}
Aggregations